Enlightenment CVS committal

Author  : devilhorns
Project : e_modules
Module  : mem

Dir     : e_modules/mem


Modified Files:
        e_mod_main.h e_mod_main.c e_mod_config.c 


Log Message:
Added Option to show text as percent.

===================================================================
RCS file: /cvsroot/enlightenment/e_modules/mem/e_mod_main.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- e_mod_main.h        28 Feb 2006 21:49:29 -0000      1.2
+++ e_mod_main.h        1 Mar 2006 17:25:58 -0000       1.3
@@ -11,6 +11,7 @@
    int check_interval;
    int show_text;
    int show_graph;
+   int show_percent;
    unsigned char real_ignore_buffers;
    unsigned char real_ignore_cached;
 };
===================================================================
RCS file: /cvsroot/enlightenment/e_modules/mem/e_mod_main.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- e_mod_main.c        1 Mar 2006 16:32:59 -0000       1.12
+++ e_mod_main.c        1 Mar 2006 17:25:58 -0000       1.13
@@ -128,6 +128,7 @@
    #define D c->conf_edd
    E_CONFIG_VAL(D, T, check_interval, INT);
    E_CONFIG_VAL(D, T, show_text, INT);
+   E_CONFIG_VAL(D, T, show_percent, INT);   
    E_CONFIG_VAL(D, T, show_graph, INT);   
    E_CONFIG_VAL(D, T, real_ignore_buffers, UCHAR);
    E_CONFIG_VAL(D, T, real_ignore_cached, UCHAR);
@@ -139,12 +140,14 @@
        c->conf->check_interval = 1;
        c->conf->show_text = 1;
        c->conf->show_graph = 1;
+       c->conf->show_percent = 1;
        c->conf->real_ignore_buffers = 0;
        c->conf->real_ignore_cached = 0;
      }
    E_CONFIG_LIMIT(c->conf->check_interval, 0, 60);
    E_CONFIG_LIMIT(c->conf->show_text, 0, 1);
    E_CONFIG_LIMIT(c->conf->show_graph, 0, 1);
+   E_CONFIG_LIMIT(c->conf->show_percent, 0, 1);
    
    _mem_config_menu_new(c);
    
@@ -457,8 +460,19 @@
 
    if (cf->mem->conf->show_text) 
      {
-       snprintf(real_str, sizeof(real_str), "%d/%d MB", (real / 1024), 
(total_real / 1024));
-       snprintf(swap_str, sizeof(swap_str), "%d/%d MB", (swap / 1024), 
(total_swap / 1024));
+       if (!cf->mem->conf->show_percent) 
+         {
+            snprintf(real_str, sizeof(real_str), "%d/%d MB", (real / 1024), 
(total_real / 1024));
+            snprintf(swap_str, sizeof(swap_str), "%d/%d MB", (swap / 1024), 
(total_swap / 1024));
+         }
+        else 
+         {
+            double tr;
+            tr = (((double)real / (double)total_real) * 100);   
+            snprintf(real_str, sizeof(real_str), "%1.2f%%", tr);
+            tr = (((double)swap / (double)total_swap) * 100);   
+            snprintf(swap_str, sizeof(swap_str), "%1.2f%%", tr);
+         }
        edje_object_part_text_set(cf->rtxt_obj, "real-text", real_str);
        edje_object_part_text_set(cf->stxt_obj, "swap-text", swap_str);
      }
===================================================================
RCS file: /cvsroot/enlightenment/e_modules/mem/e_mod_config.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- e_mod_config.c      28 Feb 2006 21:49:29 -0000      1.2
+++ e_mod_config.c      1 Mar 2006 17:25:58 -0000       1.3
@@ -8,6 +8,7 @@
    int check_interval;
    int show_text;
    int show_graph;
+   int show_percent;
    int real_ignore_buffers;
    int real_ignore_cached;
 };
@@ -45,6 +46,7 @@
    cfdata->real_ignore_cached = c->conf->real_ignore_cached;
    cfdata->show_text = c->conf->show_text;
    cfdata->show_graph = c->conf->show_graph;
+   cfdata->show_percent = c->conf->show_percent;
 }
 
 static void *
@@ -81,6 +83,8 @@
    of = e_widget_framelist_add(evas, _("Mem Settings"), 0);
    ob = e_widget_check_add(evas, _("Show Text"), &(cfdata->show_text));
    e_widget_framelist_object_append(of, ob);
+   ob = e_widget_check_add(evas, _("Show Text As Percent"), 
&(cfdata->show_percent));
+   e_widget_framelist_object_append(of, ob);
    ob = e_widget_check_add(evas, _("Show Graph"), &(cfdata->show_graph));
    e_widget_framelist_object_append(of, ob);   
    ob = e_widget_check_add(evas, _("Ignore Buffers"), 
&(cfdata->real_ignore_buffers));
@@ -108,6 +112,7 @@
    c->conf->real_ignore_cached = cfdata->real_ignore_cached;
    c->conf->show_text = cfdata->show_text;
    c->conf->show_graph = cfdata->show_graph;
+   c->conf->show_percent = cfdata->show_percent;
    e_config_save_queue ();
    if (c->face->monitor)
      ecore_timer_interval_set(c->face->monitor, 
(double)cfdata->check_interval);




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to