Enlightenment CVS committal Author : mej Project : e_modules Module : mem
Dir : e_modules/mem Modified Files: e_mod_main.c Log Message: Wed Apr 18 20:32:05 2007 Michael Jennings (mej) Patches from Richard Kolkovich <[EMAIL PROTECTED]> and Christian Wiese <[EMAIL PROTECTED]>. ---------------------------------------------------------------------- =================================================================== RCS file: /cvs/e/e_modules/mem/e_mod_main.c,v retrieving revision 1.43 retrieving revision 1.44 diff -u -3 -r1.43 -r1.44 --- e_mod_main.c 30 Mar 2007 20:30:34 -0000 1.43 +++ e_mod_main.c 19 Apr 2007 00:32:46 -0000 1.44 @@ -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-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs