Michael Jennings wrote:
On Wednesday, 18 April 2007, at 15:26:01 (-0500),
Richard Kolkovich wrote:

This patch disables the display of the 'Swap' label if your machine
does not have any swap.

We need unified/context diffs please.  diff -u

Michael


d0h.  Attached.

--

Richard Kolkovich
[EMAIL PROTECTED]


Index: e_mod_main.c
===================================================================
RCS file: /var/cvs/e/e_modules/mem/e_mod_main.c,v
retrieving revision 1.43
diff -u -r1.43 e_mod_main.c
--- e_mod_main.c        30 Mar 2007 20:30:34 -0000      1.43
+++ e_mod_main.c        18 Apr 2007 23:33:57 -0000
@@ -437,8 +437,10 @@
     {
       snprintf (real_str, sizeof (real_str), "Real: %d/%d MB", (real / 1024),
                (total_real / 1024));
-      snprintf (swap_str, sizeof (swap_str), "Swap: %d/%d MB", (swap / 1024),
-               (total_swap / 1024));
+      if ( total_swap ) { 
+          snprintf (swap_str, sizeof (swap_str), "Swap: %d/%d MB", (swap / 
1024),
+            (total_swap / 1024));
+      }
     }
   else
     {
@@ -446,19 +448,27 @@
 
       tr = (((double) real / (double) total_real) * 100);
       snprintf (real_str, sizeof (real_str), "Real: %1.2f%%", tr);
-      tr = (((double) swap / (double) total_swap) * 100);
-      snprintf (swap_str, sizeof (swap_str), "Swap: %1.2f%%", tr);
+      if ( total_swap ) { 
+          tr = (((double) swap / (double) total_swap) * 100);
+          snprintf (swap_str, sizeof (swap_str), "Swap: %1.2f%%", tr);
+      }
     }
   edje_object_part_text_set (inst->mem_obj, "real_label", real_str);
-  edje_object_part_text_set (inst->mem_obj, "swap_label", swap_str);
+  if ( total_swap ) { 
+      edje_object_part_text_set (inst->mem_obj, "swap_label", swap_str);
+  } else {
+      edje_object_part_text_set (inst->mem_obj, "swap_label", "");
+  }
 
   double tr = ((double) real / (double) total_real);
   msg.val = tr;
   edje_object_message_send (inst->mem_obj, EDJE_MESSAGE_FLOAT, 1, &msg);
 
-  double ts = ((double) swap / (double) total_swap);
-  msg.val = ts;
-  edje_object_message_send (inst->mem_obj, EDJE_MESSAGE_FLOAT, 2, &msg);
+  if ( total_swap ) { 
+      double ts = ((double) swap / (double) total_swap);
+      msg.val = ts;
+      edje_object_message_send (inst->mem_obj, EDJE_MESSAGE_FLOAT, 2, &msg);
+  }
 
   return 1;
 }
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to