Enlightenment CVS committal

Author  : devilhorns
Project : e_modules
Module  : net

Dir     : e_modules/net/src


Modified Files:
        e_mod_config.c e_mod_config.h e_mod_configure.c e_mod_net.c 


Log Message:
Added option to always show text on the icon.
Added option to launch an app on double-click.

===================================================================
RCS file: /cvs/e/e_modules/net/src/e_mod_config.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- e_mod_config.c      12 Feb 2007 21:23:07 -0000      1.4
+++ e_mod_config.c      14 Feb 2007 08:23:45 -0000      1.5
@@ -18,7 +18,9 @@
    ci = E_NEW(Config_Item, 1);
    ci->id = evas_stringshare_add(id);
    ci->device = evas_stringshare_add("eth0");
+   ci->app = evas_stringshare_add("");
    ci->limit = 0;
+   ci->show_text = 1;
    cfg->items = evas_list_append(cfg->items, ci);
    return ci;
 }
@@ -74,6 +76,11 @@
        if (strcmp(inst->gcc->id, id)) continue;
        if (!inst->timer)
          inst->timer = ecore_timer_add(0.5, _cb_poll, inst);
+       if (!ci->show_text)
+         edje_object_signal_emit(inst->o_net, "e,state,text,hide", "");
+       else
+         edje_object_signal_emit(inst->o_net, "e,state,text,show", "");
+         
        break;
      }
 }
===================================================================
RCS file: /cvs/e/e_modules/net/src/e_mod_config.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- e_mod_config.h      12 Feb 2007 21:23:07 -0000      1.4
+++ e_mod_config.h      14 Feb 2007 08:23:45 -0000      1.5
@@ -17,7 +17,8 @@
 {
    const char *id;
    const char *device;
-   int limit;
+   const char *app;
+   int limit, show_text;
 };
 
 EAPI Config_Item *_config_item_get(const char *id);
===================================================================
RCS file: /cvs/e/e_modules/net/src/e_mod_configure.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- e_mod_configure.c   12 Feb 2007 21:23:07 -0000      1.4
+++ e_mod_configure.c   14 Feb 2007 08:23:45 -0000      1.5
@@ -6,7 +6,8 @@
 struct _E_Config_Dialog_Data 
 {
    char *device;
-   int limit;
+   char *app;
+   int limit, show_text;
    
    Ecore_List *devs;
    int num;
@@ -71,10 +72,16 @@
    char *tmp;
    int i = 0;
    
+   cfdata->device = NULL;
    if (ci->device) 
      cfdata->device = strdup(ci->device);
-   else
-     cfdata->device = NULL;
+   
+   cfdata->app = NULL;
+   if (ci->app)
+     cfdata->app = strdup(ci->app);
+
+   cfdata->show_text = ci->show_text;
+   cfdata->limit = ci->limit;
    
    cfdata->devs = _config_devices_get();
    if (!cfdata->devs) return;
@@ -88,7 +95,6 @@
          }
        i++;
      }
-   cfdata->limit = ci->limit;
 }
 
 static Evas_Object *
@@ -100,13 +106,23 @@
    int i = 0;
    
    o = e_widget_list_add(evas, 0, 0);
+   
+   of = e_widget_framelist_add(evas, _("General Settings"), 0);
+   ob = e_widget_check_add(evas, _("Show Text"), &(cfdata->show_text));
+   e_widget_framelist_object_append(of, ob);
+   ob = e_widget_label_add(evas, _("Launch Application On Double-Click"));
+   e_widget_framelist_object_append(of, ob);
+   ob = e_widget_entry_add(evas, &(cfdata->app));
+   e_widget_framelist_object_append(of, ob);
+   e_widget_list_object_append(o, of, 1, 1, 0.5);
+   
    of = e_widget_framelist_add(evas, _("Activity Notification Level"), 0);
    rg = e_widget_radio_group_new(&(cfdata->limit));
-   ob = e_widget_radio_add(evas, "High (MB)", 1048575, rg);
+   ob = e_widget_radio_add(evas, _("High (MB)"), 1048575, rg);
    e_widget_framelist_object_append(of, ob);
-   ob = e_widget_radio_add(evas, "Middle (KB)", 1023, rg);
+   ob = e_widget_radio_add(evas, _("Middle (KB)"), 1023, rg);
    e_widget_framelist_object_append(of, ob);
-   ob = e_widget_radio_add(evas, "Low (B)", 0, rg);
+   ob = e_widget_radio_add(evas, _("Low (B)"), 0, rg);
    e_widget_framelist_object_append(of, ob);
    e_widget_list_object_append(o, of, 1, 1, 0.5);
 
@@ -140,7 +156,12 @@
        ci->device = evas_stringshare_add(tmp);
      }
    ci->limit = cfdata->limit;
+   ci->show_text = cfdata->show_text;
 
+   if (ci->app) evas_stringshare_del(ci->app);
+   if (cfdata->app != NULL)
+     ci->app = evas_stringshare_add(cfdata->app);
+   
    e_config_save_queue();
    _config_updated(ci->id);
    return 1;
===================================================================
RCS file: /cvs/e/e_modules/net/src/e_mod_net.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- e_mod_net.c 13 Feb 2007 08:37:13 -0000      1.7
+++ e_mod_net.c 14 Feb 2007 08:23:45 -0000      1.8
@@ -59,24 +59,32 @@
    else
      edje_object_signal_emit(inst->o_net, "e,state,send,active", "e");
 
-   if (!inst->popup) return 1;
-
    if (bin > 1048576)
-     snprintf(tmp, sizeof(tmp), "Rx: %ld Mb", (bin / 1048576));
+     snprintf(tmp, sizeof(tmp), "%ld Mb", (bin / 1048576));
    else if ((bin > 1024) && (bin < 1048576))
-     snprintf(tmp, sizeof(tmp), "Rx: %ld Kb", (bin / 1024));
+     snprintf(tmp, sizeof(tmp), "%ld Kb", (bin / 1024));
    else
-     snprintf(tmp, sizeof(tmp), "Rx: %ld B", bin);
-   edje_object_part_text_set(inst->popup->o_bg, "e.text.recv", tmp);
-
+     snprintf(tmp, sizeof(tmp), "%ld B", bin);
+   edje_object_part_text_set(inst->o_net, "e.text.recv", tmp);
+   if (inst->popup) 
+     {
+       snprintf(buf, sizeof(buf), "Rx: %s", tmp);
+       edje_object_part_text_set(inst->popup->o_bg, "e.text.recv", buf);
+     }
+   
    if (bout > 1048576)
-     snprintf(tmp, sizeof(tmp), "Tx: %ld Mb", (bout / 1048576));
+     snprintf(tmp, sizeof(tmp), "%ld Mb", (bout / 1048576));
    else if ((bout > 1024) && (bout < 1048576))
-     snprintf(tmp, sizeof(tmp), "Tx: %ld Kb", (bout / 1024));
+     snprintf(tmp, sizeof(tmp), "%ld Kb", (bout / 1024));
    else
-     snprintf(tmp, sizeof(tmp), "Tx: %ld B", bout);
-   edje_object_part_text_set(inst->popup->o_bg, "e.text.send", tmp);
-
+     snprintf(tmp, sizeof(tmp), "%ld B", bout);
+   edje_object_part_text_set(inst->o_net, "e.text.send", tmp);
+   if (inst->popup) 
+     {
+       snprintf(buf, sizeof(buf), "Tx: %s", tmp);
+       edje_object_part_text_set(inst->popup->o_bg, "e.text.send", buf);
+     }
+   
    return 1;
 }
 
@@ -84,11 +92,22 @@
 _cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event) 
 {
    Instance *inst;
+   Config_Item *ci;
+   Ecore_Exe *x;
    Evas_Event_Mouse_Down *ev;
    
    inst = data;
    ev = event;
-   if ((ev->button == 1) && (!cfg->menu))
+   ci = _config_item_get(inst->gcc->id);
+   if ((ev->button == 1) && (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)) 
+     {
+       if (ci->app != NULL) 
+         {
+            x = ecore_exe_run(ci->app, NULL);
+            if (x) ecore_exe_free(x);
+         }
+     }
+   else if ((ev->button == 1) && (!cfg->menu))
      {
        if (inst->popup_locked) 
          inst->popup_locked=0;



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to