Re: [E-devel] [PATCH] patch for 'mem' module
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.c30 Mar 2007 20:30:34 - 1.43 +++ e_mod_main.c18 Apr 2007 23:33:57 - @@ -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
Re: [E-devel] [PATCH] patch for 'mem' module
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 -- Michael Jennings (a.k.a. KainX) http://www.kainx.org/ <[EMAIL PROTECTED]> n + 1, Inc., http://www.nplus1.net/ Author, Eterm (www.eterm.org) --- "Normal is in the eye of the beholder."-- Whoopi Goldberg - 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
[E-devel] [PATCH] patch for 'mem' module
This patch disables the display of the 'Swap' label if your machine does not have any swap. -- 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 -r1.43 e_mod_main.c 440,441c440,443 < 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)); > } 449,450c451,454 < 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); > } 453c457,461 < 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", ""); > } 459,461c467,471 < 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); > } - 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