Enlightenment CVS committal

Author  : devilhorns
Project : e_modules
Module  : net

Dir     : e_modules/net


Modified Files:
        e_mod_main.c 


Log Message:
Fixes for net module. Displays Tx and Rx correctly now.

===================================================================
RCS file: /cvsroot/enlightenment/e_modules/net/e_mod_main.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- e_mod_main.c        1 Mar 2006 16:25:08 -0000       1.13
+++ e_mod_main.c        6 Mar 2006 09:59:46 -0000       1.14
@@ -554,17 +554,41 @@
    char in_str[100];
    char out_str[100];
    
-   if (nf->conf->show_text) 
+   if (!nf->conf->show_text) 
      {
-       snprintf(in_str, sizeof(in_str), "Rx: %d B", in_use);
-       snprintf(out_str, sizeof(out_str), "Tx: %d B", out_use);
-       edje_object_part_text_set(nf->ttxt_obj, "tx-text", out_str);
-       edje_object_part_text_set(nf->rtxt_obj, "rx-text", in_str);
+       edje_object_part_text_set(nf->ttxt_obj, "tx-text", "");
+       edje_object_part_text_set(nf->rtxt_obj, "rx-text", "");         
      }
     else 
      {
-       edje_object_part_text_set(nf->ttxt_obj, "tx-text", "");
-       edje_object_part_text_set(nf->rtxt_obj, "rx-text", ""); 
+       if (bytes_in > 1048576) 
+         {
+            bytes_in = bytes_in / 1048576;
+            snprintf(in_str, sizeof(in_str), "Rx: %d Mb", bytes_in);
+         }
+       else if (bytes_in > 1024 && bytes_in < 1048576) 
+         {
+            bytes_in = bytes_in / 1024; 
+            snprintf(in_str, sizeof(in_str), "Rx: %d Kb", bytes_in);
+         }
+       else
+         snprintf(in_str, sizeof(in_str), "Rx: %d B", bytes_in);            
+       
+       if (bytes_out > 1048576) 
+         {
+            bytes_out = bytes_out / 1048576;
+            snprintf(out_str, sizeof(out_str), "Tx: %d Mb", bytes_out);
+         }
+       else if (bytes_out > 1024 && bytes_out < 1048576) 
+         {
+            bytes_out = bytes_out / 1024; 
+            snprintf(out_str, sizeof(out_str), "Tx: %d Kb", bytes_out);
+         }
+       else
+         snprintf(out_str, sizeof(out_str), "Tx: %d B", bytes_out);         
+
+       edje_object_part_text_set(nf->ttxt_obj, "tx-text", out_str);
+       edje_object_part_text_set(nf->rtxt_obj, "rx-text", in_str);
      }
    
    if (nf->conf->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