All pastes #1557893 Raw Edit

Diskio

public text v1 · immutable
#1557893 ·published 2009-09-08 01:53 UTC
rendered paste body
Index: e-module-diskio.edc
===================================================================
--- e-module-diskio.edc	(revision 42331)
+++ e-module-diskio.edc	(working copy)
@@ -89,7 +89,7 @@
 		       color: 255 255 255 255;
 		    }
 	       }
-/////////////
+	       
 		part {
 		  name: "e.text.display_name";
 		  type: TEXT;
@@ -100,7 +100,7 @@
 		       state: "default" 0.0;
 		       rel1
 			 {
-			    relative: 0.0 0.2;
+			    relative: 0.0 -0.4;
 			    offset:   0 0;
 			    to_x:     "icon";
 			 }
@@ -123,8 +123,76 @@
 			    text_class: "module_small";
 			 }
 		    }
-///////////////////
-}
+		}
+		part {
+		  name: "e.text.read_speed";
+		  type: TEXT;
+		  effect: OUTLINE_SOFT_SHADOW;
+		  mouse_events: 0;
+		  description
+		    {
+		       state: "default" 0.0;
+		       rel1
+			 {
+			    relative: 0.0 0.3;
+			    offset:   0 0;
+			    to_x:     "icon";
+			 }
+		       rel2
+		         {
+			    relative: 0.95 0.95;
+			    offset:   -1  -1;
+			 }
+		       color:  255 255 255 255;
+		       color2: 0 0 0 96;
+		       color3: 0 0 0 32;
+		       color_class: "module_label";
+		       text
+		         {
+			    text:  "RS";
+			    font:  "Sans:style=Bold";
+			    size:  8;
+			    min:   1 1;
+			    align: 0.5 0.5;
+			    text_class: "module_small";
+			 }
+		    }
+		}
+		part {
+		  name: "e.text.write_speed";
+		  type: TEXT;
+		  effect: OUTLINE_SOFT_SHADOW;
+		  mouse_events: 0;
+		  description
+		    {
+		       state: "default" 0.0;
+		       rel1
+			 {
+			    relative: 0.0 0.8;
+			    offset:   0 0;
+			    to_x:     "icon";
+			 }
+		       rel2
+		         {
+			    relative: 0.95 0.95;
+			    offset:   -1  -1;
+			 }
+		       color:  255 255 255 255;
+		       color2: 0 0 0 96;
+		       color3: 0 0 0 32;
+		       color_class: "module_label";
+		       text
+		         {
+			    text:  "WS";
+			    font:  "Sans:style=Bold";
+			    size:  8;
+			    min:   1 1;
+			    align: 0.5 0.5;
+			    text_class: "module_small";
+			 }
+		    }
+		}
+		
 	  }
 	programs 
 	  {
Index: src/e_mod_main.c
===================================================================
--- src/e_mod_main.c	(revision 42331)
+++ src/e_mod_main.c	(working copy)
@@ -38,6 +38,8 @@
    Ecore_Timer *timer;
    unsigned long bytes_r;
    unsigned long bytes_w;
+   unsigned long read_io;
+   unsigned long write_io;
 };
 
 /* Local Variables */
@@ -249,6 +251,8 @@
    char buffer[128];
    char dummy[16];
    char path[128];
+   char read[1024];
+   char write[1024];
    unsigned long dummy0, dummy1, dummy2, dummy3, dummy4, dummy5,
 				 dummy6, dummy7, dummy8, bytes_r_new=0, bytes_w_new=0;
 
@@ -282,19 +286,33 @@
 
    if (inst->bytes_r != bytes_r_new)
      {
+	snprintf (read, sizeof (read), "R:%d MB/s", dummy0 - inst->read_io);
+	edje_object_part_text_set(inst->o_diskio, "e.text.read_speed",read);
+	
         edje_object_signal_emit(inst->o_diskio, "read,on", "");
 		inst->bytes_r = bytes_r_new;
+		inst->read_io = dummy0;
      }
    else
+   {
      edje_object_signal_emit(inst->o_diskio, "read,off", "");
-
+     edje_object_part_text_set(inst->o_diskio, "e.text.read_speed","R:0 MB/s");
+   }
+   
    if (inst->bytes_w != bytes_w_new)
      {
+		snprintf (write, sizeof (write), "W:%d MB/s", dummy3 - inst->write_io);
+		edje_object_part_text_set(inst->o_diskio, "e.text.write_speed",write);
+	     
 		edje_object_signal_emit(inst->o_diskio, "write,on", "");
 		inst->bytes_w = bytes_w_new;
+		inst->write_io = dummy3;
      }
    else
+   {
      edje_object_signal_emit(inst->o_diskio, "write,off", "");
+     edje_object_part_text_set(inst->o_diskio, "e.text.write_speed","W:0 MB/s");
+   }
 
    return 1;
 }