Enlightenment CVS committal

Author  : devilhorns
Project : e_modules
Module  : net

Dir     : e_modules/net


Modified Files:
        e_mod_config.c e_mod_main.c 


Log Message:
More accurate text updates.

===================================================================
RCS file: /cvs/e/e_modules/net/e_mod_config.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- e_mod_config.c      23 May 2006 22:07:37 -0000      1.11
+++ e_mod_config.c      24 May 2006 20:02:51 -0000      1.12
@@ -140,11 +140,8 @@
    tmp = ecore_list_goto_index(cfdata->devs, cfdata->dev_num);
    if (tmp != NULL)
      {
-        if (strcmp(tmp, ci->device))
-          {
-            evas_stringshare_del(ci->device);
-             ci->device = evas_stringshare_add(strdup(tmp));
-          }
+       evas_stringshare_del(ci->device);
+       ci->device = evas_stringshare_add(tmp);
      }
 
    ci->poll_time = cfdata->poll_time;
===================================================================
RCS file: /cvs/e/e_modules/net/e_mod_main.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -3 -r1.26 -r1.27
--- e_mod_main.c        23 May 2006 22:07:37 -0000      1.26
+++ e_mod_main.c        24 May 2006 20:02:51 -0000      1.27
@@ -63,7 +63,8 @@
    
    inst = E_NEW(Instance, 1);
    ci = _net_config_item_get(id);
-   if (!ci->id) ci->id = evas_stringshare_add(id);
+   if (!ci->id) 
+     ci->id = evas_stringshare_add(id);
    
    net = _net_new(gc->evas);
    net->inst = inst;
@@ -156,7 +157,7 @@
                               e_util_zone_current_get(e_manager_current_get()),
                               x + ev->output.x, y + ev->output.y, 1, 1, 
E_MENU_POP_DIRECTION_DOWN, ev->timestamp);
         evas_event_feed_mouse_up(inst->gcc->gadcon->evas, ev->button, 
EVAS_BUTTON_NONE, ev->timestamp, NULL);
-     }
+     }   
 }
 
 static void
@@ -199,7 +200,6 @@
        
        if (!strcmp(inst->gcc->id, ci->id)) 
          {
-            _net_cb_check(inst);
             if (inst->check_timer)
               ecore_timer_interval_set(inst->check_timer, 
(double)ci->poll_time);
             else
@@ -226,7 +226,7 @@
    ci = E_NEW(Config_Item, 1);
    ci->id = evas_stringshare_add(id);
    ci->device = evas_stringshare_add("eth0");
-   ci->poll_time = 1;
+   ci->poll_time = 1.0;
    ci->max = 1500;
    net_config->items = evas_list_append(net_config->items, ci);
    return ci;
@@ -273,7 +273,7 @@
        ci = E_NEW(Config_Item, 1);
        ci->id = evas_stringshare_add("0");
        ci->device = evas_stringshare_add("eth0");
-       ci->poll_time = 1;
+       ci->poll_time = 1.0;
        ci->max = 1500;
        net_config->items = evas_list_append(net_config->items, ci);
      }
@@ -379,7 +379,7 @@
 _net_update_rx(Instance *inst, int value) 
 {
    Edje_Message_Int_Set *val;
-
+   
    val = malloc(sizeof(Edje_Message_Int_Set) + (1 * sizeof(int)));
    val->count = 1;
    val->val[0] = value;
@@ -437,7 +437,6 @@
    long bytes_out;
    double in_use = 0.0;
    double out_use = 0.0;
-   Edje_Message_Float msg;
    char in_str[100];
    char out_str[100];
    
@@ -462,7 +461,9 @@
                    "%lu %lu %lu %lu\n", dev, &in, &dummy, &dummy,
                    &dummy, &dummy, &dummy, &dummy, &dummy, &out, &dummy, 
&dummy, &dummy, &dummy, &dummy, &dummy, &dummy) < 17)
            continue;
-        if (!strcmp(dev, strdup(ci->device)))
+       if (!ci->device)
+         continue;
+        if (!strcmp(dev, ci->device))
           {
              found = 1;
              break;
@@ -483,24 +484,21 @@
         if (bytes_out < 0)
            bytes_out = 0;
 
-        in_use = (int)((bytes_in * 100L) / max_in);
-        out_use = (int)((bytes_out * 100L) / max_out);
+        in_use = ((bytes_in * 100L) / max_in);
+        out_use = ((bytes_out * 100L) / max_out);
      }
    else
      {
-        in_use = 0;
-        out_use = 0;
+        in_use = 0.0;
+        out_use = 0.0;
      }
 
    old_in = in;
    old_out = out;
       
-   if ((bytes_in < 0) || (bytes_out < 0))
-     {
-        edje_object_part_text_set(inst->net_obj, "tx_label", "Tx: 0 B");
-        edje_object_part_text_set(inst->net_obj, "rx_label", "Rx: 0 B");
-     }
-   else
+   if (bytes_in <= 0)
+     edje_object_part_text_set(inst->net_obj, "rx_label", "Rx: 0 B");
+   else 
      {
         if (bytes_in > 1048576)
           {
@@ -513,8 +511,15 @@
              snprintf(in_str, sizeof(in_str), "Rx: %d Kb", bytes_in);
           }
         else
-           snprintf(in_str, sizeof(in_str), "Rx: %d B", bytes_in);
-
+         snprintf(in_str, sizeof(in_str), "Rx: %d B", bytes_in);
+       
+        edje_object_part_text_set(inst->net_obj, "rx_label", in_str);  
+     }
+   
+   if (bytes_out <= 0) 
+     edje_object_part_text_set(inst->net_obj, "tx_label", "Tx: 0 B");
+   else 
+     {
         if (bytes_out > 1048576)
           {
              bytes_out = bytes_out / 1048576;
@@ -526,22 +531,22 @@
              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(inst->net_obj, "tx_label", out_str);
-        edje_object_part_text_set(inst->net_obj, "rx_label", in_str);
+         snprintf(out_str, sizeof(out_str), "Tx: %d B", bytes_out);
+       
+        edje_object_part_text_set(inst->net_obj, "tx_label", out_str); 
      }
 
    int x, y, w, h;
    double i, o;
    evas_object_geometry_get(inst->net_obj, &x, &y, &w, &h);
-   if (in_use > 100)
-     in_use = 100;
-   if (out_use > 100)
-     out_use = 100;
    i = ((double)in_use * ((double)w / (double)100));
    o = ((double)out_use * ((double)w / (double)100));
-
+   
+   if (i < 0)
+     i = 0.0;
+   if (o < 0)
+     o = 0.0;
+   
    if ((i > 0) && (i < 1))
      i = 10.0;
    if ((o > 0) && (o < 1))




-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to