[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[E-devel] e_modules net and wlan fixes



Hi,

attached you will find two patches. One will fix the net module (change
of the calculation base, because the unit of ci->max is packets not
bytes) and one the wlan module (emitting of the label activation
signal).

By,
Thomas


-- 
Stark, Thomas <thomas@st4rk.de>
--- e-cvs/e_modules/net/e_mod_main.c	2006-09-22 23:09:00.000000000 +0200
+++ e/e_modules/net/e_mod_main.c	2006-11-17 14:39:29.000000000 +0100
@@ -12,6 +12,8 @@
   Ecore_Timer *check_timer;
   unsigned long old_in;
   unsigned long old_out;
+  unsigned long old_pkg_in;
+  unsigned long old_pkg_out;
 };
 
 struct _Net
@@ -474,9 +476,12 @@
   char buf[256];
   unsigned long in = 0;
   unsigned long out = 0;
+  unsigned long pin = 0;
+  unsigned long pout = 0;
   unsigned long dummy = 0;
   int found;
   long bytes_in, bytes_out;
+  long pkg_in, pkg_out;
   char in_str[100];
   char out_str[100];
   double i, o;
@@ -498,8 +503,8 @@
 	  buf[i] = ' ';
 
       if (sscanf (buf, "%s %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu "
-		  "%lu %lu %lu %lu\n", dev, &in, &dummy, &dummy,
-		  &dummy, &dummy, &dummy, &dummy, &dummy, &out, &dummy,
+		  "%lu %lu %lu %lu\n", dev, &in, &pin, &dummy,
+		  &dummy, &dummy, &dummy, &dummy, &dummy, &out, &pout,
 		  &dummy, &dummy, &dummy, &dummy, &dummy, &dummy) < 17)
 	continue;
       if (!ci->device)
@@ -519,14 +524,23 @@
   bytes_out = out - inst->old_out;
   bytes_in = bytes_in / ci->poll_time;
   bytes_out = bytes_out / ci->poll_time;
+  pkg_in = pin - inst->old_pkg_in;
+  pkg_out = pout - inst->old_pkg_out;
 
   if (bytes_in < 0)
     bytes_in = 0;
   if (bytes_out < 0)
     bytes_out = 0;
 
+  if (pkg_in < 0)
+    pkg_in = 0;
+  if (pkg_out < 0)
+    pkg_out = 0;
+
   inst->old_in = in;
   inst->old_out = out;
+  inst->old_pkg_in = pin;
+  inst->old_pkg_out = pout;
 
   edje_object_part_text_set (inst->net_obj, "net_label", ci->device);
 
@@ -562,12 +576,12 @@
     }
 
   i = 0.0;
-  if (bytes_in != 0.0)
-    i = ((double) bytes_in / (double) ci->max);
+  if (pkg_in != 0.0)
+    i = ((double) pkg_in / (double) ci->max);
 
   o = 0.0;
-  if (bytes_out != 0.0)
-    o = ((double) bytes_out / (double) ci->max);
+  if (pkg_out != 0.0)
+    o = ((double) pkg_out / (double) ci->max);
 
   if (i < 0.0)
     i = 0.0;
--- e-cvs/e_modules/wlan/e_mod_main.c	2006-09-22 23:09:02.000000000 +0200
+++ e/e_modules/wlan/e_mod_main.c	2006-11-18 15:22:18.000000000 +0100
@@ -480,14 +480,15 @@
   _wlan_update_level (inst, level_send);
   
    snprintf(omsg,sizeof(omsg),"Qual: %d%%", wlan_link);
-   
-   edje_object_signal_emit(inst->wlan_obj, "label_active", "");
    edje_object_part_text_set(inst->wlan_obj, "qual_label", omsg);
 
    snprintf(omsg,sizeof(omsg),"Lvl: %d%%", wlan_level);
    edje_object_part_text_set(inst->wlan_obj, "level_label", omsg);
 
-  return 1;
+   if (ci->always_text)
+     edje_object_signal_emit(inst->wlan_obj, "label_active", "");
+
+   return 1;
 }
 
 static void