Enlightenment CVS committal

Author  : devilhorns
Project : e_modules
Module  : net

Dir     : e_modules/net


Modified Files:
        e_mod_main.h e_mod_main.c e_mod_config.c 


Log Message:
Fixes for graphing negative values and changing devices

===================================================================
RCS file: /cvsroot/enlightenment/e_modules/net/e_mod_main.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- e_mod_main.h        9 Mar 2006 11:39:09 -0000       1.6
+++ e_mod_main.h        12 Mar 2006 18:45:41 -0000      1.7
@@ -59,4 +59,6 @@
 EAPI int   e_modapi_about    (E_Module *m);
 EAPI int   e_modapi_config   (E_Module *m);
 
+void      _net_face_graph_clear(Net_Face *nf);
+
 #endif
===================================================================
RCS file: /cvsroot/enlightenment/e_modules/net/e_mod_main.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- e_mod_main.c        9 Mar 2006 11:39:09 -0000       1.15
+++ e_mod_main.c        12 Mar 2006 18:45:42 -0000      1.16
@@ -18,7 +18,6 @@
 static void      _net_face_cb_menu_configure(void *data, E_Menu *mn, 
E_Menu_Item *mi);
 static int       _net_face_update_values(void *data);
 static void      _net_face_graph_values(Net_Face *nf, int tx_val, int rx_val);
-static void      _net_face_graph_clear(Net_Face *nf);
 
 static int net_count;
 
@@ -536,12 +535,17 @@
    
    if (!found) 
      return 1;
-   
+      
    if (old_in && old_out) 
      {
        bytes_in = in - old_in;
        bytes_out = out - old_out;
        
+       if (bytes_in < 0)
+         bytes_in = 0;
+       if (bytes_out < 0)
+         bytes_out = 0;
+       
        in_use = (int)((bytes_in * 100L) / max_in);
        out_use = (int)((bytes_out * 100L) / max_out);
      }
@@ -563,6 +567,11 @@
        edje_object_part_text_set(nf->ttxt_obj, "tx-text", "");
        edje_object_part_text_set(nf->rtxt_obj, "rx-text", "");         
      }
+   else if ((bytes_in < 0) || (bytes_out < 0))
+     {
+       edje_object_part_text_set(nf->ttxt_obj, "tx-text", "Tx: 0 B");
+       edje_object_part_text_set(nf->rtxt_obj, "rx-text", "Rx: 0 B");  
+     }
     else 
      {
        if (bytes_in > 1048576) 
@@ -652,7 +661,7 @@
      }      
 }
 
-static void 
+void 
 _net_face_graph_clear(Net_Face *nf) 
 {
    Evas_List *l;
===================================================================
RCS file: /cvsroot/enlightenment/e_modules/net/e_mod_config.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- e_mod_config.c      9 Mar 2006 11:39:09 -0000       1.8
+++ e_mod_config.c      12 Mar 2006 18:45:42 -0000      1.9
@@ -149,8 +149,15 @@
 
    nf = cfd->data;
    tmp = ecore_list_goto_index(cfdata->devs, cfdata->dev_num);
-   if (tmp != NULL)
-     nf->conf->device = (char *)evas_stringshare_add(strdup(tmp));
+   if (tmp != NULL) 
+     {
+       if (strcmp(tmp, nf->conf->device)) 
+         {
+            _net_face_graph_clear(nf);
+            nf->conf->device = (char *)evas_stringshare_add(strdup(tmp));
+         }
+     }
+   
    nf->conf->check_interval = cfdata->check_interval;
    nf->conf->show_text = cfdata->show_text;
    nf->conf->show_graph = cfdata->show_graph;




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to