Enlightenment CVS committal

Author  : devilhorns
Project : e_modules
Module  : net

Dir     : e_modules/net


Modified Files:
        Makefile.am e_mod_config.c e_mod_main.c e_mod_main.h 
        module_icon.png net.edc 
Added Files:
        module.eap rx_00.png rx_01.png rx_02.png rx_03.png rx_04.png 
        rx_05.png rx_06.png rx_07.png rx_08.png rx_09.png rx_10.png 
        tx_00.png tx_01.png tx_02.png tx_03.png tx_04.png tx_05.png 
        tx_06.png tx_07.png tx_08.png tx_09.png tx_10.png 
Removed Files:
        e_mod_config.h 


Log Message:
Net module meets shelf :)
    -Removed graphs (they ate memory for lunch).
    -Added led-type gradient indicators in place of graph.
    -Added mouse-over send and recieve values.
    
It may not be 100% perfect yet, but it won't crash E.

Users will need to remove any old module.net.cfg file they have before
running.

===================================================================
RCS file: /cvs/e/e_modules/net/Makefile.am,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- Makefile.am 9 Mar 2006 11:39:09 -0000       1.3
+++ Makefile.am 23 May 2006 22:07:36 -0000      1.4
@@ -10,6 +10,7 @@
 
 files_DATA = \
 module_icon.png \
+module.eap \
 net.edj \
 net.edc \
 VeraMono.ttf
@@ -24,9 +25,8 @@
 pkg_LTLIBRARIES        = module.la
 module_la_SOURCES      = e_mod_main.c \
                       e_mod_main.h \
-                      e_mod_config.c \
-                      e_mod_config.h
-
+                      e_mod_config.c
+                      
 module_la_LIBADD       = @e_libs@ -lm
 module_la_LDFLAGS      = -module -avoid-version
 module_la_DEPENDENCIES = $(top_builddir)/config.h
===================================================================
RCS file: /cvs/e/e_modules/net/e_mod_config.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- e_mod_config.c      5 Apr 2006 17:48:49 -0000       1.10
+++ e_mod_config.c      23 May 2006 22:07:37 -0000      1.11
@@ -1,14 +1,11 @@
 #include <e.h>
+#include <Ecore.h>
 #include "e_mod_main.h"
-#include "e_mod_config.h"
-#include "config.h"
 
 struct _E_Config_Dialog_Data
 {
    char *device;
-   int check_interval;
-   int show_text;
-   int show_graph;
+   double poll_time;
 
    Ecore_List *devs;
    int dev_num;
@@ -19,15 +16,16 @@
 static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
 static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, 
E_Config_Dialog_Data *cfdata);
 static int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data 
*cfdata);
-static void _fill_data(Net_Face *nf, E_Config_Dialog_Data *cfdata);
+static void _fill_data(Config_Item *ci, E_Config_Dialog_Data *cfdata);
 static void _net_config_get_devices(Ecore_List *devs);
 
 /* Config Calls */
 void
-_configure_net_module(Net_Face *nf)
+_config_net_module(Config_Item *ci)
 {
    E_Config_Dialog *cfd;
    E_Config_Dialog_View *v;
+   E_Container *con;
 
    v = E_NEW(E_Config_Dialog_View, 1);
 
@@ -36,22 +34,21 @@
    v->basic.apply_cfdata = _basic_apply_data;
    v->basic.create_widgets = _basic_create_widgets;
 
-   cfd = e_config_dialog_new(nf->con, D_("Net Configuration"), NULL, 0, v, nf);
-   nf->net->cfd = cfd;
+   con = e_container_current_get(e_manager_current_get());
+   cfd = e_config_dialog_new(con, D_("Net Configuration"), NULL, 0, v, ci);
+   net_config->config_dialog = cfd;
 }
 
 static void
-_fill_data(Net_Face *nf, E_Config_Dialog_Data *cfdata)
+_fill_data(Config_Item *ci, E_Config_Dialog_Data *cfdata)
 {
    char *tmp;
    int i;
 
-   cfdata->check_interval = nf->conf->check_interval;
-   cfdata->show_text = nf->conf->show_text;
-   cfdata->show_graph = nf->conf->show_graph;
+   cfdata->poll_time = ci->poll_time;
 
-   if (nf->conf->device != NULL)
-      cfdata->device = strdup(nf->conf->device);
+   if (ci->device != NULL)
+      cfdata->device = strdup(ci->device);
    else
       cfdata->device = NULL;
 
@@ -81,22 +78,20 @@
 _create_data(E_Config_Dialog *cfd)
 {
    E_Config_Dialog_Data *cfdata;
-   Net_Face *nf;
+   Config_Item *ci;
 
-   nf = cfd->data;
+   ci = cfd->data;
    cfdata = E_NEW(E_Config_Dialog_Data, 1);
-
-   _fill_data(nf, cfdata);
+   _fill_data(ci, cfdata);
    return cfdata;
 }
 
 static void
 _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
 {
-   Net_Face *nf;
-
-   nf = cfd->data;
-   nf->net->cfd = NULL;
+   if (!net_config)
+     return;
+   net_config->config_dialog = NULL;
    E_FREE(cfdata->device);
    if (cfdata->devs)
       ecore_list_destroy(cfdata->devs);
@@ -112,13 +107,6 @@
    int i;
 
    o = e_widget_list_add(evas, 0, 0);
-   of = e_widget_framelist_add(evas, D_("General Settings"), 0);
-   ob = e_widget_check_add(evas, D_("Show Text"), (&(cfdata->show_text)));
-   e_widget_framelist_object_append(of, ob);
-   ob = e_widget_check_add(evas, D_("Show Graph"), (&(cfdata->show_graph)));
-   e_widget_framelist_object_append(of, ob);
-   e_widget_list_object_append(o, of, 1, 1, 0.5);
-
    of = e_widget_framelist_add(evas, D_("Device Settings"), 0);
    ot = e_widget_table_add(evas, 0);
    rg = e_widget_radio_group_new(&(cfdata->dev_num));
@@ -134,7 +122,7 @@
    ob = e_widget_label_add(evas, D_("Check Interval:"));
    e_widget_table_object_append(ot, ob, 0, i, 1, 1, 0, 0, 1, 0);
    i++;
-   ob = e_widget_slider_add(evas, 1, 0, _("%1.0f seconds"), 1, 60, 1, 0, NULL, 
&(cfdata->check_interval), 150);
+   ob = e_widget_slider_add(evas, 1, 0, _("%1.0f seconds"), 1, 60, 1, 0, 
&(cfdata->poll_time), NULL, 150);
    e_widget_table_object_append(ot, ob, 0, i, 1, 1, 1, 0, 1, 0);
    e_widget_framelist_object_append(of, ot);
    e_widget_list_object_append(o, of, 1, 1, 0.5);
@@ -146,27 +134,22 @@
 _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
 {
    char *tmp;
-   Net_Face *nf;
-
-   nf = cfd->data;
+   Config_Item *ci;
+   
+   ci = cfd->data;
    tmp = ecore_list_goto_index(cfdata->devs, cfdata->dev_num);
    if (tmp != NULL)
      {
-        if (strcmp(tmp, nf->conf->device))
+        if (strcmp(tmp, ci->device))
           {
-             _net_face_graph_clear(nf);
-             nf->conf->device = (char *)evas_stringshare_add(strdup(tmp));
+            evas_stringshare_del(ci->device);
+             ci->device = evas_stringshare_add(strdup(tmp));
           }
      }
 
-   nf->conf->check_interval = cfdata->check_interval;
-   nf->conf->show_text = cfdata->show_text;
-   nf->conf->show_graph = cfdata->show_graph;
+   ci->poll_time = cfdata->poll_time;
    e_config_save_queue();
-
-   if (nf->monitor)
-      ecore_timer_interval_set(nf->monitor, (double)cfdata->check_interval);
-
+   _net_config_updated(ci->id);
    return 1;
 }
 
===================================================================
RCS file: /cvs/e/e_modules/net/e_mod_main.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -3 -r1.25 -r1.26
--- e_mod_main.c        21 May 2006 08:06:38 -0000      1.25
+++ e_mod_main.c        23 May 2006 22:07:37 -0000      1.26
@@ -1,492 +1,427 @@
 #include <e.h>
 #include "e_mod_main.h"
-#include "e_mod_config.h"
-#include "config.h"
 
-static Net *_net_init(E_Module *m);
-static void _net_shutdown(Net *n);
-static void _net_config_menu_new(Net *n);
-
-static Net_Face *_net_face_init(Net *n, E_Container *con);
-static void _net_face_menu_new(Net_Face *nf);
-static void _net_face_enable(Net_Face *nf);
-static void _net_face_disable(Net_Face *nf);
-static void _net_face_free(Net_Face *nf);
-static void _net_face_cb_gmc_change(void *data, E_Gadman_Client *gmc, 
E_Gadman_Change change);
-static void _net_face_cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, 
void *event_info);
-static void _net_face_cb_menu_edit(void *data, E_Menu *mn, E_Menu_Item *mi);
-static void _net_face_cb_menu_configure(void *data, E_Menu *mn, E_Menu_Item 
*mi);
-static int _net_face_update_values(void *data);
-static void _net_face_graph_values(Net_Face *nf, int tx_val, int rx_val);
+typedef struct _Instance Instance;
+typedef struct _Net Net;
 
-static int net_count;
-
-static E_Config_DD *conf_edd;
-static E_Config_DD *conf_face_edd;
-
-EAPI E_Module_Api e_modapi = {
-   E_MODULE_API_VERSION,
-   "Net"
+struct _Instance 
+{
+   E_Gadcon_Client *gcc;
+   Evas_Object *net_obj;
+   Net *net;
+   Config_Item *ci;
+   Ecore_Timer *check_timer;
 };
 
-EAPI void *
-e_modapi_init(E_Module *m)
+struct _Net 
 {
-   Net *n;
-
-   /* Set up module's message catalogue */
-   bindtextdomain(PACKAGE, LOCALEDIR);
-   bind_textdomain_codeset(PACKAGE, "UTF-8");
+   Instance *inst;
+   Evas_Object *net_obj;
+};
 
-   n = _net_init(m);
-   if (!n)
-      return NULL;
+/* Func Protos for Gadcon */
+static E_Gadcon_Client *_gc_init(E_Gadcon *gc, char *name, char *id, char 
*style);
+static void _gc_shutdown(E_Gadcon_Client *gcc);
+static void _gc_orient(E_Gadcon_Client *gcc);
+static char *_gc_label(void);
+static Evas_Object *_gc_icon(Evas *evas);
+
+/* Func Protos for Module */
+static void _net_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void 
*event_info);
+static void _net_cb_mouse_in(void *data, Evas *e, Evas_Object *obj, void 
*event_info);
+static void _net_cb_mouse_out(void *data, Evas *e, Evas_Object *obj, void 
*event_info);
+static void _net_menu_cb_configure(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _net_menu_cb_post(void *data, E_Menu *m);
+static Config_Item *_net_config_item_get(const char *id);
+static Net *_net_new(Evas *evas);
+static void _net_free(Net *net);
+static void _net_update_rx(Instance *inst, int value);
+static void _net_update_tx(Instance *inst, int value);
+static int _net_cb_check(void *data);
+
+static E_Config_DD *conf_edd = NULL;
+static E_Config_DD *conf_item_edd = NULL;
 
-   m->config_menu = n->config_menu;
-   return n;
-}
+Config *net_config = NULL;
 
-EAPI int
-e_modapi_shutdown(E_Module *m)
+/* Define the gadcon class and functions provided by this module */
+static const E_Gadcon_Client_Class _gc_class = 
 {
-   Net *n;
-
-   n = m->data;
-   if (!n)
-      return 0;
-
-   if (m->config_menu)
-     {
-        e_menu_deactivate(m->config_menu);
-        e_object_del(E_OBJECT(m->config_menu));
-        m->config_menu = NULL;
-     }
-   if (n->cfd)
-     {
-        e_object_del(E_OBJECT(n->cfd));
-        n->cfd = NULL;
-     }
-   _net_shutdown(n);
-   return 1;
-}
+   GADCON_CLIENT_CLASS_VERSION,
+     "net", { _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon }
+};
 
-EAPI int
-e_modapi_save(E_Module *m)
+static E_Gadcon_Client *
+_gc_init(E_Gadcon *gc, char *name, char *id, char *style) 
 {
-   Net *n;
+   E_Gadcon_Client *gcc;
+   Evas_Object *o;
+   Instance *inst;
+   Config_Item *ci;
+   Net *net;
+   char buf[4096];
+   
+   inst = E_NEW(Instance, 1);
+   ci = _net_config_item_get(id);
+   if (!ci->id) ci->id = evas_stringshare_add(id);
+   
+   net = _net_new(gc->evas);
+   net->inst = inst;
+   inst->net = net;
+
+   o = net->net_obj;
+   gcc = e_gadcon_client_new(gc, name, id, style, o);
+   gcc->data = inst;
+   inst->gcc = gcc;
+   inst->net_obj = o;
+   
+   evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
+                                 _net_cb_mouse_down, inst);
+   evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_IN,
+                                 _net_cb_mouse_in, inst);
+   evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_OUT,
+                                 _net_cb_mouse_out, inst);
+
+   inst->check_timer = ecore_timer_add(ci->poll_time, _net_cb_check, inst);
+   
+   net_config->instances = evas_list_append(net_config->instances, inst);
+   
+   return gcc;
+}
 
-   n = m->data;
-   if (!n)
-      return 0;
-   e_config_domain_save("module.net", conf_edd, n->conf);
-   return 1;
+static void
+_gc_orient(E_Gadcon_Client *gcc) 
+{
+   e_gadcon_client_aspect_set(gcc, 16, 16);
+   e_gadcon_client_min_size_set(gcc, 16, 16);
 }
 
-EAPI int
-e_modapi_info(E_Module *m)
+static char *
+_gc_label(void) 
 {
-   m->icon_file = strdup(PACKAGE_DATA_DIR "/module_icon.png");
-   return 1;
+   return D_("Net");
 }
 
-EAPI int
-e_modapi_about(E_Module *m)
+static Evas_Object *
+_gc_icon(Evas *evas) 
 {
-   e_module_dialog_show(D_("Enlightenment Network Monitor Module"), D_("This 
module is used to monitor a network device."));
-   return 1;
+   Evas_Object *o;
+   char buf[4096];
+   
+   o = edje_object_add(evas);
+   snprintf(buf, sizeof(buf), "%s/module.eap", 
e_module_dir_get(net_config->module));
+   edje_object_file_set(o, buf, "icon");
+   return o;
 }
 
-EAPI int
-e_modapi_config(E_Module *m)
+static void
+_gc_shutdown(E_Gadcon_Client *gcc) 
 {
-   Net *n;
-   Evas_List *l;
-   E_Container *con;
-
-   n = m->data;
-   if (!n)
-      return 0;
-   if (!n->faces)
-      return 0;
-
-   for (l = n->faces; l; l = l->next)
-     {
-        Net_Face *nf;
-
-        nf = l->data;
-        if (!nf)
-           continue;
-
-        con = e_container_current_get(e_manager_current_get());
-        if (nf->con == con)
-          {
-             _configure_net_module(nf);
-             break;
-          }
-     }
-   return 1;
+   Instance *inst;
+   
+   inst = gcc->data;
+   if (inst->check_timer)
+     ecore_timer_del(inst->check_timer);
+   net_config->instances = evas_list_remove(net_config->instances, inst);
+   _net_free(inst->net);
+   free(inst);
 }
 
-static Net *
-_net_init(E_Module *m)
+static void
+_net_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info) 
 {
-   Net *n;
-   E_Menu_Item *mi;
-   Evas_List *mans, *l, *l2, *fl;
-
-   n = E_NEW(Net, 1);
-
-   if (!n)
-      return NULL;
-
-   conf_face_edd = E_CONFIG_DD_NEW("Net_Config_Face", Config_Face);
-#undef T
-#undef D
-#define T Config_Face
-#define D conf_face_edd
-   E_CONFIG_VAL(D, T, enabled, UCHAR);
-   E_CONFIG_VAL(D, T, device, STR);
-   E_CONFIG_VAL(D, T, check_interval, INT);
-   E_CONFIG_VAL(D, T, show_text, INT);
-   E_CONFIG_VAL(D, T, show_graph, INT);
-
-   conf_edd = E_CONFIG_DD_NEW("Net_Config", Config);
+   Instance *inst;
+   Evas_Event_Mouse_Down *ev;
 
-#undef T
-#undef D
-#define T Config
-#define D conf_edd
-   E_CONFIG_LIST(D, T, faces, conf_face_edd);
-
-   n->conf = e_config_domain_load("module.net", conf_edd);
-   if (!n->conf)
-      n->conf = E_NEW(Config, 1);
-
-   _net_config_menu_new(n);
-
-   mans = e_manager_list();
-   fl = n->conf->faces;
-   for (l = mans; l; l = l->next)
+   inst = data;
+   ev = event_info;
+   if ((ev->button == 3) && (!net_config->menu))
      {
-        E_Manager *man;
+        E_Menu *mn;
+        E_Menu_Item *mi;
+        int x, y, w, h;
 
-        man = l->data;
-        for (l2 = man->containers; l2; l2 = l2->next)
-          {
-             E_Container *con;
-             Net_Face *nf;
+        mn = e_menu_new();
+        e_menu_post_deactivate_callback_set(mn, _net_menu_cb_post, inst);
+        net_config->menu = mn;
 
-             con = l2->data;
-             nf = _net_face_init(n, con);
-             if (nf)
-               {
-                  if (!fl)
-                    {
-                       nf->conf = E_NEW(Config_Face, 1);
-
-                       nf->conf->enabled = 1;
-                       nf->conf->device = (char *)evas_stringshare_add("eth0");
-                       nf->conf->check_interval = 1;
-                       nf->conf->show_text = 1;
-                       nf->conf->show_graph = 1;
-                       n->conf->faces = evas_list_append(n->conf->faces, 
nf->conf);
-                    }
-                  else
-                    {
-                       nf->conf = fl->data;
-                       fl = fl->next;
-                    }
-                  E_CONFIG_LIMIT(nf->conf->check_interval, 0, 60);
-                  E_CONFIG_LIMIT(nf->conf->show_text, 0, 1);
-                  E_CONFIG_LIMIT(nf->conf->show_graph, 0, 1);
-
-                  nf->monitor = 
ecore_timer_add((double)nf->conf->check_interval, _net_face_update_values, nf);
-
-                  _net_face_menu_new(nf);
-
-                  mi = e_menu_item_new(n->config_menu);
-                  e_menu_item_label_set(mi, _("Configuration"));
-                  e_menu_item_callback_set(mi, _net_face_cb_menu_configure, 
nf);
-
-                  mi = e_menu_item_new(n->config_menu);
-                  e_menu_item_label_set(mi, con->name);
-                  e_menu_item_submenu_set(mi, nf->menu);
-
-                  if (!nf->conf->enabled)
-                     _net_face_disable(nf);
-               }
-          }
+        mi = e_menu_item_new(mn);
+        e_menu_item_label_set(mi, D_("Configuration"));
+        e_util_menu_item_edje_icon_set(mi, "enlightenment/configuration");
+        e_menu_item_callback_set(mi, _net_menu_cb_configure, inst);
+
+        e_gadcon_client_util_menu_items_append(inst->gcc, mn, 0);
+        e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, &x, &y, &w, &h);
+        e_menu_activate_mouse(mn,
+                              e_util_zone_current_get(e_manager_current_get()),
+                              x + ev->output.x, y + ev->output.y, 1, 1, 
E_MENU_POP_DIRECTION_DOWN, ev->timestamp);
+        evas_event_feed_mouse_up(inst->gcc->gadcon->evas, ev->button, 
EVAS_BUTTON_NONE, ev->timestamp, NULL);
      }
-   return n;
 }
 
 static void
-_net_shutdown(Net *n)
+_net_menu_cb_post(void *data, E_Menu *m) 
 {
-   E_CONFIG_DD_FREE(conf_edd);
-   E_CONFIG_DD_FREE(conf_face_edd);
-
-   while (n->faces)
-      _net_face_free(n->faces->data);
-
-   e_object_del(E_OBJECT(n->config_menu));
-   evas_list_free(n->conf->faces);
-
-   E_FREE(n->conf);
-   E_FREE(n);
+   if (!net_config->menu)
+     return;
+   e_object_del(E_OBJECT(net_config->menu));
+   net_config->menu = NULL;
 }
 
 static void
-_net_config_menu_new(Net *n)
+_net_menu_cb_configure(void *data, E_Menu *m, E_Menu_Item *mi) 
 {
-   E_Menu *mn;
-
-   mn = e_menu_new();
-   n->config_menu = mn;
+   Instance *inst;
+   Config_Item *ci;
+   
+   inst = data;
+   ci = _net_config_item_get(inst->gcc->id);
+   _config_net_module(ci);
 }
 
-static Net_Face *
-_net_face_init(Net *n, E_Container *con)
+void
+_net_config_updated(const char *id) 
 {
-   Net_Face *nf;
-   Evas_Object *o;
-   char buf[4096];
+   Evas_List *l;
+   Config_Item *ci;
+   
+   if (!net_config)
+     return;
+   
+   ci = _net_config_item_get(id);
+   for (l = net_config->instances; l; l = l->next) 
+     {
+       Instance *inst;
+       
+       inst = l->data;
+       if (!inst->gcc->id)
+         continue;
+       
+       if (!strcmp(inst->gcc->id, ci->id)) 
+         {
+            _net_cb_check(inst);
+            if (inst->check_timer)
+              ecore_timer_interval_set(inst->check_timer, 
(double)ci->poll_time);
+            else
+              inst->check_timer = ecore_timer_add((double)ci->poll_time, 
_net_cb_check, inst);
+            break;
+         }
+     }
+}
 
-   nf = E_NEW(Net_Face, 1);
+static Config_Item *
+_net_config_item_get(const char *id) 
+{
+   Evas_List *l;
+   Config_Item *ci;
+   
+   for (l = net_config->items; l; l = l->next) 
+     {
+       ci = l->data;
+       if (!ci->id)
+         continue;
+       if (!strcmp(ci->id, id))
+         return ci;
+     }
+   ci = E_NEW(Config_Item, 1);
+   ci->id = evas_stringshare_add(id);
+   ci->device = evas_stringshare_add("eth0");
+   ci->poll_time = 1;
+   ci->max = 1500;
+   net_config->items = evas_list_append(net_config->items, ci);
+   return ci;
+}
 
-   if (!nf)
-      return NULL;
-   nf->net = n;
-   n->faces = evas_list_append(n->faces, nf);
-
-   nf->con = con;
-   e_object_ref(E_OBJECT(con));
-   nf->evas = con->bg_evas;
-
-   evas_event_freeze(nf->evas);
-
-   o = edje_object_add(nf->evas);
-   nf->net_obj = o;
-
-   if (!e_theme_edje_object_set(o, "base/theme/modules/net", 
"modules/net/main"))
-     {
-        snprintf(buf, sizeof(buf), PACKAGE_DATA_DIR "/net.edj");
-        edje_object_file_set(o, buf, "modules/net/main");
-     }
-   evas_object_show(o);
-
-   o = edje_object_add(nf->evas);
-   nf->chart_obj = o;
-   evas_object_layer_set(o, 1);
-   evas_object_repeat_events_set(o, 1);
-   evas_object_color_set(o, 255, 255, 255, 255);
-   evas_object_show(o);
-
-   o = edje_object_add(nf->evas);
-   nf->rtxt_obj = o;
-   if (!e_theme_edje_object_set(o, "base/theme/modules/net", 
"modules/net/rx_text"))
-     {
-        snprintf(buf, sizeof(buf), PACKAGE_DATA_DIR "/net.edj");
-        edje_object_file_set(o, buf, "modules/net/rx_text");
-     }
-   evas_object_layer_set(o, 2);
-   evas_object_repeat_events_set(o, 1);
-   evas_object_color_set(o, 255, 255, 255, 255);
-   evas_object_show(o);
-
-   o = edje_object_add(nf->evas);
-   nf->ttxt_obj = o;
-   if (!e_theme_edje_object_set(o, "base/theme/modules/net", 
"modules/net/tx_text"))
-     {
-        snprintf(buf, sizeof(buf), PACKAGE_DATA_DIR "/net.edj");
-        edje_object_file_set(o, buf, "modules/net/tx_text");
-     }
-   evas_object_layer_set(o, 2);
-   evas_object_repeat_events_set(o, 1);
-   evas_object_color_set(o, 255, 255, 255, 255);
-   evas_object_show(o);
-
-   o = evas_object_rectangle_add(nf->evas);
-   nf->event_obj = o;
-   evas_object_layer_set(o, 3);
-   evas_object_repeat_events_set(o, 1);
-   evas_object_color_set(o, 0, 0, 0, 0);
-   evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, 
_net_face_cb_mouse_down, nf);
-   evas_object_show(o);
-
-   nf->gmc = e_gadman_client_new(nf->con->gadman);
-   e_gadman_client_domain_set(nf->gmc, "module.net", net_count++);
-   e_gadman_client_policy_set(nf->gmc,
-                              E_GADMAN_POLICY_ANYWHERE |
-                              E_GADMAN_POLICY_HMOVE | E_GADMAN_POLICY_HSIZE | 
E_GADMAN_POLICY_VMOVE | E_GADMAN_POLICY_VSIZE);
-   //e_gadman_client_min_size_set(nf->gmc, 40, 40);
-   //e_gadman_client_max_size_set(nf->gmc, 128, 128);
-   e_gadman_client_auto_size_set(nf->gmc, 40, 40);
-   e_gadman_client_align_set(nf->gmc, 1.0, 1.0);
-   e_gadman_client_resize(nf->gmc, 40, 40);
-   e_gadman_client_change_func_set(nf->gmc, _net_face_cb_gmc_change, nf);
-   e_gadman_client_load(nf->gmc);
-   evas_event_thaw(nf->evas);
+/* Module routines */
+EAPI E_Module_Api e_modapi = 
+{
+   E_MODULE_API_VERSION,
+     "Net"
+};
 
-   return nf;
+EAPI void *
+e_modapi_init(E_Module *m) 
+{
+   bindtextdomain(PACKAGE, LOCALEDIR);
+   bind_textdomain_codeset(PACKAGE, "UTF-8");
+   
+   conf_item_edd = E_CONFIG_DD_NEW("Net_Config_Item", Config_Item);
+   
+   #undef T
+   #undef D
+   #define T Config_Item
+   #define D conf_item_edd
+   E_CONFIG_VAL(D, T, id, STR);
+   E_CONFIG_VAL(D, T, device, STR);
+   E_CONFIG_VAL(D, T, max, DOUBLE);
+   E_CONFIG_VAL(D, T, poll_time, DOUBLE);
+   
+   conf_edd = E_CONFIG_DD_NEW("Net_Config", Config);
+   
+   #undef T
+   #undef D
+   #define T Config
+   #define D conf_edd
+   E_CONFIG_LIST(D, T, items, conf_item_edd);
+   
+   net_config = e_config_domain_load("module.net", conf_edd);
+   if (!net_config) 
+     {
+       Config_Item *ci;
+       
+       net_config = E_NEW(Config, 1);
+       ci = E_NEW(Config_Item, 1);
+       ci->id = evas_stringshare_add("0");
+       ci->device = evas_stringshare_add("eth0");
+       ci->poll_time = 1;
+       ci->max = 1500;
+       net_config->items = evas_list_append(net_config->items, ci);
+     }
+   net_config->module = m;
+   e_gadcon_provider_register(&_gc_class);
+   return 1;
 }
 
-static void
-_net_face_menu_new(Net_Face *nf)
+EAPI int
+e_modapi_shutdown(E_Module *m) 
 {
-   E_Menu *mn;
-   E_Menu_Item *mi;
-
-   mn = e_menu_new();
-   nf->menu = mn;
+   net_config->module = NULL;
+   e_gadcon_provider_unregister(&_gc_class);
+   
+   if (net_config->config_dialog)
+     e_object_del(E_OBJECT(net_config->config_dialog));
+   if (net_config->menu) 
+     {
+       e_menu_post_deactivate_callback_set(net_config->menu, NULL, NULL);
+       e_object_del(E_OBJECT(net_config->menu));
+       net_config->menu = NULL;
+     }
+   while (net_config->items) 
+     {
+       Config_Item *ci;
+       
+       ci = net_config->items->data;
+       if (ci->id)
+         evas_stringshare_del(ci->id);
+       net_config->items = evas_list_remove_list(net_config->items, 
net_config->items);
+       free(ci);
+     }
+   free(net_config);
+   net_config = NULL;
+   E_CONFIG_DD_FREE(conf_item_edd);
+   E_CONFIG_DD_FREE(conf_edd);
+   return 1;
+}
 
-   mi = e_menu_item_new(mn);
-   e_menu_item_label_set(mi, _("Configuration"));
-   e_util_menu_item_edje_icon_set(mi, "enlightenment/configuration");
-   e_menu_item_callback_set(mi, _net_face_cb_menu_configure, nf);
-
-   mi = e_menu_item_new(mn);
-   e_menu_item_label_set(mi, _("Edit Mode"));
-   e_util_menu_item_edje_icon_set(mi, "enlightenment/gadgets");
-   e_menu_item_callback_set(mi, _net_face_cb_menu_edit, nf);
+EAPI int
+e_modapi_info(E_Module *m) 
+{
+   char buf[4096];
+   
+   snprintf(buf, sizeof(buf), "%s/module_icon.png", e_module_dir_get(m));
+   m->icon_file = strdup(buf);
+   return 1;
 }
 
-static void
-_net_face_enable(Net_Face *nf)
+EAPI int
+e_modapi_save(E_Module *m) 
 {
-   nf->conf->enabled = 1;
-   e_config_save_queue();
-   evas_object_show(nf->net_obj);
-   evas_object_show(nf->event_obj);
-   evas_object_show(nf->chart_obj);
-   evas_object_show(nf->rtxt_obj);
-   evas_object_show(nf->ttxt_obj);
+   Evas_List *l;
+   
+   for (l = net_config->instances; l; l = l->next) 
+     {
+       Instance *inst;
+       Config_Item *ci;
+       
+       inst = l->data;
+       ci = _net_config_item_get(inst->gcc->id);
+       if (ci->id)
+         evas_stringshare_del(ci->id);
+       ci->id = evas_stringshare_add(inst->gcc->id);
+     }
+   e_config_domain_save("module.net", conf_edd, net_config);
+   return 1;
 }
 
-static void
-_net_face_disable(Net_Face *nf)
+EAPI int
+e_modapi_about(E_Module *m) 
 {
-   nf->conf->enabled = 0;
-   e_config_save_queue();
-   evas_object_hide(nf->event_obj);
-   evas_object_hide(nf->net_obj);
-   evas_object_hide(nf->chart_obj);
-   evas_object_hide(nf->rtxt_obj);
-   evas_object_hide(nf->ttxt_obj);
+   e_module_dialog_show(D_("Enlightenment Network Monitor Module"), 
+                       D_("This module is used to monitor a network device."));
+   return 1;
 }
 
-static void
-_net_face_free(Net_Face *nf)
+static Net *
+_net_new(Evas *evas) 
 {
-   e_object_unref(E_OBJECT(nf->con));
-   e_object_del(E_OBJECT(nf->menu));
+   Net *net;
+   char buf[4096];
+   
+   net = E_NEW(Net, 1);
+   net->net_obj = edje_object_add(evas);
+   
+   snprintf(buf, sizeof(buf), "%s/net.edj", 
e_module_dir_get(net_config->module));
+   if (!e_theme_edje_object_set(net->net_obj, "base/theme/modules/net", 
"modules/net/main"))
+     edje_object_file_set(net->net_obj, buf, "modules/net/main");
+   evas_object_show(net->net_obj);
 
-   if (nf->monitor)
-      ecore_timer_del(nf->monitor);
-   if (nf->menu)
-      e_object_del(E_OBJECT(nf->menu));
-   if (nf->event_obj)
-      evas_object_del(nf->event_obj);
-   if (nf->net_obj)
-      evas_object_del(nf->net_obj);
-   if (nf->chart_obj)
-      evas_object_del(nf->chart_obj);
-   if (nf->rtxt_obj)
-      evas_object_del(nf->rtxt_obj);
-   if (nf->ttxt_obj)
-      evas_object_del(nf->ttxt_obj);
-   if (nf->old_rx || nf->old_tx)
-      _net_face_graph_clear(nf);
-
-   if (nf->gmc)
-     {
-        e_gadman_client_save(nf->gmc);
-        e_object_del(E_OBJECT(nf->gmc));
-     }
-
-   nf->net->faces = evas_list_remove(nf->net->faces, nf);
-
-   E_FREE(nf->conf);
-   E_FREE(nf);
-   net_count--;
+   return net;
 }
 
 static void
-_net_face_cb_gmc_change(void *data, E_Gadman_Client *gmc, E_Gadman_Change 
change)
+_net_free(Net *n) 
 {
-   Net_Face *nf;
-   Evas_Coord x, y, w, h;
-
-   nf = data;
-   switch (change)
-     {
-     case E_GADMAN_CHANGE_MOVE_RESIZE:
-        e_gadman_client_geometry_get(nf->gmc, &x, &y, &w, &h);
-        evas_object_move(nf->net_obj, x, y);
-        evas_object_move(nf->event_obj, x, y);
-        evas_object_move(nf->chart_obj, x, y);
-        evas_object_move(nf->rtxt_obj, x, y);
-        evas_object_move(nf->ttxt_obj, x, y);
-        evas_object_resize(nf->net_obj, w, h);
-        evas_object_resize(nf->event_obj, w, h);
-        evas_object_resize(nf->chart_obj, w, h);
-        evas_object_resize(nf->rtxt_obj, w, h);
-        evas_object_resize(nf->ttxt_obj, w, h);
-        _net_face_graph_clear(nf);
-        break;
-     case E_GADMAN_CHANGE_RAISE:
-        evas_object_raise(nf->net_obj);
-        evas_object_raise(nf->event_obj);
-        evas_object_raise(nf->chart_obj);
-        evas_object_raise(nf->rtxt_obj);
-        evas_object_raise(nf->ttxt_obj);
-        break;
-     default:
-        break;
-     }
+   evas_object_del(n->net_obj);
+   free(n);
 }
 
-static void
-_net_face_cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, void 
*event_info)
+static void 
+_net_update_rx(Instance *inst, int value) 
 {
-   Net_Face *nf;
-   Evas_Event_Mouse_Down *ev;
+   Edje_Message_Int_Set *val;
 
-   ev = event_info;
-   nf = data;
-   if (ev->button == 3)
-     {
-        e_menu_activate_mouse(nf->menu, e_zone_current_get(nf->con),
-                              ev->output.x, ev->output.y, 1, 1, 
E_MENU_POP_DIRECTION_DOWN, ev->timestamp);
-        e_util_container_fake_mouse_up_all_later(nf->con);
-     }
+   val = malloc(sizeof(Edje_Message_Int_Set) + (1 * sizeof(int)));
+   val->count = 1;
+   val->val[0] = value;
+   edje_object_message_send(inst->net_obj, EDJE_MESSAGE_INT_SET, 1, val);
+   free(val);   
 }
 
-static void
-_net_face_cb_menu_edit(void *data, E_Menu *mn, E_Menu_Item *mi)
+static void 
+_net_update_tx(Instance *inst, int value) 
 {
-   Net_Face *nf;
+   Edje_Message_Int_Set *val;
 
-   nf = data;
-   e_gadman_mode_set(nf->gmc->gadman, E_GADMAN_MODE_EDIT);
+   val = malloc(sizeof(Edje_Message_Int_Set) + (1 * sizeof(int)));
+   val->count = 1;
+   val->val[0] = value;
+   edje_object_message_send(inst->net_obj, EDJE_MESSAGE_INT_SET, 2, val);
+   free(val);
 }
 
-static void
-_net_face_cb_menu_configure(void *data, E_Menu *mn, E_Menu_Item *mi)
+static void 
+_net_cb_mouse_in(void *data, Evas *e, Evas_Object *obj, void *event_info) 
 {
-   Net_Face *nf;
-
-   nf = data;
-   if (!nf)
-      return;
+   Instance *inst;
+   
+   inst = data;   
+   edje_object_signal_emit(inst->net_obj, "label_active", "");
+}
 
-   _configure_net_module(nf);
+static void 
+_net_cb_mouse_out(void *data, Evas *e, Evas_Object *obj, void *event_info) 
+{
+   Instance *inst;
+   
+   inst = data;
+   edje_object_signal_emit(inst->net_obj, "label_passive", "");
 }
 
-static int
-_net_face_update_values(void *data)
+static int 
+_net_cb_check(void *data) 
 {
-   Net_Face *nf;
+   Instance *inst;
+   Config_Item *ci;
    FILE *stat;
    char dev[64];
    char buf[256];
@@ -500,12 +435,15 @@
    long max_out = 28672;
    long bytes_in;
    long bytes_out;
-   int in_use = 0;
-   int out_use = 0;
+   double in_use = 0.0;
+   double out_use = 0.0;
    Edje_Message_Float msg;
-
-   nf = data;
-
+   char in_str[100];
+   char out_str[100];
+   
+   inst = data;
+   ci = _net_config_item_get(inst->gcc->id);
+   
    stat = fopen("/proc/net/dev", "r");
    if (!stat)
       return 1;
@@ -524,7 +462,7 @@
                    "%lu %lu %lu %lu\n", dev, &in, &dummy, &dummy,
                    &dummy, &dummy, &dummy, &dummy, &dummy, &out, &dummy, 
&dummy, &dummy, &dummy, &dummy, &dummy, &dummy) < 17)
            continue;
-        if (!strcmp(dev, strdup(nf->conf->device)))
+        if (!strcmp(dev, strdup(ci->device)))
           {
              found = 1;
              break;
@@ -556,20 +494,11 @@
 
    old_in = in;
    old_out = out;
-
-   /* Update the modules text */
-   char in_str[100];
-   char out_str[100];
-
-   if (!nf->conf->show_text)
-     {
-        edje_object_part_text_set(nf->ttxt_obj, "tx-text", "");
-        edje_object_part_text_set(nf->rtxt_obj, "rx-text", "");
-     }
-   else if ((bytes_in < 0) || (bytes_out < 0))
+      
+   if ((bytes_in < 0) || (bytes_out < 0))
      {
-        edje_object_part_text_set(nf->ttxt_obj, "tx-text", "Tx: 0 B");
-        edje_object_part_text_set(nf->rtxt_obj, "rx-text", "Rx: 0 B");
+        edje_object_part_text_set(inst->net_obj, "tx_label", "Tx: 0 B");
+        edje_object_part_text_set(inst->net_obj, "rx_label", "Rx: 0 B");
      }
    else
      {
@@ -599,142 +528,27 @@
         else
            snprintf(out_str, sizeof(out_str), "Tx: %d B", bytes_out);
 
-        edje_object_part_text_set(nf->ttxt_obj, "tx-text", out_str);
-        edje_object_part_text_set(nf->rtxt_obj, "rx-text", in_str);
+        edje_object_part_text_set(inst->net_obj, "tx_label", out_str);
+        edje_object_part_text_set(inst->net_obj, "rx_label", in_str);
      }
 
-   msg.val = in_use;
-   edje_object_message_send(nf->net_obj, EDJE_MESSAGE_FLOAT, 1, &msg);
-
-   msg.val = out_use;
-   edje_object_message_send(nf->net_obj, EDJE_MESSAGE_FLOAT, 2, &msg);
-
-   if (nf->conf->show_graph)
-      _net_face_graph_values(nf, out_use, in_use);
-   else
-      _net_face_graph_clear(nf);
-
-   return 1;
-}
-
-static void
-_net_face_graph_values(Net_Face *nf, int tx_val, int rx_val)
-{
    int x, y, w, h;
-   Evas_Object *o;
-   Evas_Object *last = NULL;
-   Evas_List *l;
-   int i, j = 0;
-
-   evas_event_freeze(nf->evas);
-
-   evas_object_geometry_get(nf->chart_obj, &x, &y, &w, &h);
-
-   if (rx_val > 100)
-      rx_val = 100;
-   if (tx_val > 100)
-      tx_val = 100;
-
-   rx_val = (int)(((double)rx_val) * (((double)h) / ((double)100)));
-   tx_val = (int)(((double)tx_val) * (((double)h) / ((double)100)));
-
-   o = evas_object_line_add(nf->evas);
-   edje_object_part_swallow(nf->chart_obj, "lines", o);
-   evas_object_layer_set(o, 1);
-   if (rx_val == 0)
-      evas_object_hide(o);
-   else
-     {
-        evas_object_line_xy_set(o, (x + w), (y + h), (x + w), (y + h - 
rx_val));
-        evas_object_color_set(o, 255, 0, 0, 100);
-        evas_object_pass_events_set(o, 1);
-        evas_object_show(o);
-     }
-
-   nf->old_rx = evas_list_prepend(nf->old_rx, o);
-   l = nf->old_rx;
-   for (i = (x + w); l && ((j - 2) < w); l = l->next, j++)
-     {
-        Evas_Coord oy;
-        Evas_Object *lo;
-
-        lo = (Evas_Object *)evas_list_data(l);
-        evas_object_geometry_get(lo, NULL, &oy, NULL, NULL);
-        evas_object_move(lo, i--, oy);
-        last = lo;
-     }
-   if ((j - 2) >= w)
-     {
-        nf->old_rx = evas_list_remove(nf->old_rx, last);
-        edje_object_part_unswallow(nf->chart_obj, last);
-        evas_object_del(last);
-     }
-
-   j = 0;
-   last = NULL;
-   o = evas_object_line_add(nf->evas);
-   edje_object_part_swallow(nf->chart_obj, "lines", o);
-   evas_object_layer_set(o, 1);
-   if (tx_val == 0)
-      evas_object_hide(o);
-   else
-     {
-        evas_object_line_xy_set(o, (x + w), y, (x + w), (y + tx_val));
-        evas_object_color_set(o, 0, 255, 0, 100);
-        evas_object_pass_events_set(o, 1);
-        evas_object_show(o);
-     }
-
-   nf->old_tx = evas_list_prepend(nf->old_tx, o);
-   l = nf->old_tx;
-   for (i = (x + w); l && ((j - 2) < w); l = l->next, j++)
-     {
-        Evas_Coord oy;
-        Evas_Object *lo;
-
-        lo = (Evas_Object *)evas_list_data(l);
-        evas_object_geometry_get(lo, NULL, &oy, NULL, NULL);
-        evas_object_move(lo, i--, oy);
-        last = lo;
-     }
-   if ((j - 2) >= w)
-     {
-        nf->old_tx = evas_list_remove(nf->old_tx, last);
-        edje_object_part_unswallow(nf->chart_obj, last);
-        evas_object_del(last);
-     }
-
-   evas_event_thaw(nf->evas);
-}
-
-void
-_net_face_graph_clear(Net_Face *nf)
-{
-   Evas_List *l;
-
-   evas_event_freeze(nf->evas);
-
-   for (l = nf->old_rx; l; l = l->next)
-     {
-        Evas_Object *o;
-
-        o = evas_list_data(l);
-        edje_object_part_unswallow(nf->chart_obj, o);
-        evas_object_del(o);
-     }
-   evas_list_free(nf->old_rx);
-   nf->old_rx = NULL;
-
-   for (l = nf->old_tx; l; l = l->next)
-     {
-        Evas_Object *o;
-
-        o = evas_list_data(l);
-        edje_object_part_unswallow(nf->chart_obj, o);
-        evas_object_del(o);
-     }
-   evas_list_free(nf->old_tx);
-   nf->old_tx = NULL;
-
-   evas_event_thaw(nf->evas);
+   double i, o;
+   evas_object_geometry_get(inst->net_obj, &x, &y, &w, &h);
+   if (in_use > 100)
+     in_use = 100;
+   if (out_use > 100)
+     out_use = 100;
+   i = ((double)in_use * ((double)w / (double)100));
+   o = ((double)out_use * ((double)w / (double)100));
+
+   if ((i > 0) && (i < 1))
+     i = 10.0;
+   if ((o > 0) && (o < 1))
+     o = 10.0;
+   
+   _net_update_rx(inst, (i / 10));
+   _net_update_tx(inst, (o / 10));
+   
+   return 1;
 }
===================================================================
RCS file: /cvs/e/e_modules/net/e_mod_main.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- e_mod_main.h        5 Apr 2006 17:48:49 -0000       1.8
+++ e_mod_main.h        23 May 2006 22:07:37 -0000      1.9
@@ -4,61 +4,34 @@
 #define E_MOD_MAIN_H
 
 typedef struct _Config Config;
-typedef struct _Config_Face Config_Face;
-typedef struct _Net Net;
-typedef struct _Net_Face Net_Face;
+typedef struct _Config_Item Config_Item;
 
-struct _Config
+struct _Config 
 {
-   Evas_List *faces;
-};
-
-struct _Config_Face
-{
-   unsigned char enabled;
-   char *device;
-   int check_interval;
-   int show_text;
-   int show_graph;
-};
-
-struct _Net
-{
-   E_Menu *config_menu;
-   Evas_List *faces;
-   Config *conf;
-   E_Config_Dialog *cfd;
+   E_Module *module;
+   E_Config_Dialog *config_dialog;
+   E_Menu *menu;
+   Evas_List *instances;
+   Evas_List *items;
 };
 
-struct _Net_Face
+struct _Config_Item 
 {
-   Evas *evas;
-   E_Container *con;
-   E_Menu *menu;
-   Net *net;
-   Evas_List *old_rx, *old_tx;
-   Config_Face *conf;
-
-   Evas_Object *net_obj;
-   Evas_Object *event_obj;
-   Evas_Object *chart_obj;
-   Evas_Object *rtxt_obj;
-   Evas_Object *ttxt_obj;
-
-   Ecore_Timer *monitor;
-
-   E_Gadman_Client *gmc;
+   const char *id;
+   const char *device;
+   double poll_time;
+   double max;
 };
 
 EAPI extern E_Module_Api e_modapi;
-
 EAPI void *e_modapi_init(E_Module *m);
 EAPI int e_modapi_shutdown(E_Module *m);
 EAPI int e_modapi_save(E_Module *m);
 EAPI int e_modapi_info(E_Module *m);
 EAPI int e_modapi_about(E_Module *m);
-EAPI int e_modapi_config(E_Module *m);
 
-void _net_face_graph_clear(Net_Face *nf);
+void _net_config_updated(const char *id);
+void _config_net_module(Config_Item *ci);
+extern Config *net_config;
 
 #endif
===================================================================
RCS file: /cvs/e/e_modules/net/module_icon.png,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
Binary files /tmp/cvswHP9CQ and /tmp/cvslEz4P2 differ
===================================================================
RCS file: /cvs/e/e_modules/net/net.edc,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -3 -r1.16 -r1.17
--- net.edc     21 May 2006 08:06:38 -0000      1.16
+++ net.edc     23 May 2006 22:07:37 -0000      1.17
@@ -1,6 +1,28 @@
 images
 {
-   image: "eth_dev.png" COMP;
+   image: "module_icon.png" COMP;
+   image: "rx_00.png" COMP;
+   image: "rx_01.png" COMP;
+   image: "rx_02.png" COMP;
+   image: "rx_03.png" COMP;
+   image: "rx_04.png" COMP;
+   image: "rx_05.png" COMP;
+   image: "rx_06.png" COMP;
+   image: "rx_07.png" COMP;
+   image: "rx_08.png" COMP;
+   image: "rx_09.png" COMP;
+   image: "rx_10.png" COMP;
+   image: "tx_00.png" COMP;
+   image: "tx_01.png" COMP;
+   image: "tx_02.png" COMP;
+   image: "tx_03.png" COMP;
+   image: "tx_04.png" COMP;
+   image: "tx_05.png" COMP;
+   image: "tx_06.png" COMP;
+   image: "tx_07.png" COMP;
+   image: "tx_08.png" COMP;
+   image: "tx_09.png" COMP;
+   image: "tx_10.png" COMP;
 }
 
 fonts
@@ -13,190 +35,434 @@
    group
      {
        name: "modules/net/main";
+       min: 4 4;
+       max: 128 128;
+       script 
+         {
+          public message(Msg_Type:type, id, ...) 
+              {
+                 if ((type == MSG_INT_SET) && (id == 1)) 
+                   {
+                      new f = getarg(2);
+                      new Float:value;
+                      
+                      value = f;
+                      value = (value / 10);
+                      set_state(PART:"rx_meter", "default", value);
+                   }
+                 if ((type == MSG_INT_SET) && (id == 2)) 
+                   {
+                      new f = getarg(2);
+                      new Float:value;
+                      
+                      value = f;
+                      value = (value / 10);
+                      set_state(PART:"tx_meter", "default", value);
+                   }             
+              }             
+         }
+       
        parts
          {
             part
               {
-                 name:           "net_clip";
-                 type:           RECT;
-                 mouse_events:   0;
+                 name: "fade_clip";
+                 type: RECT;
+                 mouse_events: 1;
                  description
                    {
                       state: "default" 0.0;
                       color: 255 255 255 255;
+                      rel1
+                        {
+                           relative: 0.0 0.0;
+                           offset: 0 0;
+                        }
+                      rel2
+                        {
+                           relative: 1.0 1.0;
+                           offset: -1 -1;
+                        }
                    }
               }
             part
               {
-                 name:          "net";
-                 clip_to: "net_clip";
-                 mouse_events:  0;
+                 name: "net";
+                 type: IMAGE;
+                 mouse_events: 1;
+                 clip_to: "fade_clip";
                  description
                    {
-                      state:    "default" 0.0;
-                      color: 255 255 255 176;
-                      //aspect:   0.5 2.25;
+                      state: "default" 0.0;
+                      aspect: 1.0 1.0;
                       rel1
                         {
                            relative: 0.0 0.0;
+                           offset: 0 0;
                         }
                       rel2
                         {
                            relative: 1.0 1.0;
+                           offset: -1 -1;
                         }
                       image
                         {
-                           normal: "eth_dev.png";
-                        }
-                      fill
-                        {
-                           smooth: 0;
+                           normal: "module_icon.png";
                         }
+                      color: 255 255 255 192;
                    }
               }
             part
               {
-                 name,          "lines";
-                 mouse_events,  0;
-                 type,          SWALLOW;
-                 clip_to:      "net_clip";
+                 name: "rx_meter";
+                 type: IMAGE;
+                 clip_to: "fade_clip";
+                 mouse_events: 1;
                  description
                    {
-                      state,    "default" 0.0;
+                      state: "default" 0.0;
                       rel1
                         {
                            relative: 0.0 0.0;
+                           offset: 0 0;
                         }
                       rel2
                         {
-                           relative: 1.0 1.0;
+                           relative: 1.0 0.25;
+                           offset: -1 -1;
                         }
-                      color, 0 0 0 0;
+                      image
+                        {
+                           normal: "rx_00.png";
+                        }
+                      color: 255 255 255 192;
                    }
-              }
-         }
-     }
-
-   group
-     {
-       name: "modules/net/tx_text";
-       parts
-         {
-            part
-              {
-                 name:           "net_clip";
-                 type:           RECT;
-                 mouse_events:   0;
                  description
                    {
-                      state: "default" 0.0;
-                      color: 255 255 255 255;
-                      rel1 
+                      state: "default" 0.1;
+                      inherit: "default" 0.0;
+                      image
                         {
-                           relative: 0.0 0.0;
-                           offset: 0 0;
+                           normal: "rx_01.png";
                         }
-                      rel2 
+                   }
+                 description
+                   {
+                      state: "default" 0.2;
+                      inherit: "default" 0.0;
+                      image
                         {
-                           relative: 1.0 1.0;
-                           offset: -1 -1;
+                           normal: "rx_02.png";
                         }
                    }
-              }             
-            part
-              {
-                 name:           "tx-text";
-                 type:           TEXT;
-                 effect:         OUTLINE_SOFT_SHADOW;
-                 clip_to: "net_clip";
-                 mouse_events: 0;
                  description
                    {
-                      state: "default" 0.0;
-                      align: 1.0 0.0;
-                      rel1
+                      state: "default" 0.3;
+                      inherit: "default" 0.0;
+                      image
                         {
-                           relative: 0.0 0.0;
+                           normal: "rx_03.png";
                         }
-                      rel2
+                   }
+                 description
+                   {
+                      state: "default" 0.4;
+                      inherit: "default" 0.0;
+                      image
+                        {
+                           normal: "rx_04.png";
+                        }
+                   }
+                 description
+                   {
+                      state: "default" 0.5;
+                      inherit: "default" 0.0;
+                      image
                         {
-                           relative: 1.0 0.0;
+                           normal: "rx_05.png";
                         }
-                      color: 128 255 128 255;
-             color2: 0 0 0 192;
-                      color3: 128 128 128 192;
-                      text
+                   }
+                 description
+                   {
+                      state: "default" 0.6;
+                      inherit: "default" 0.0;
+                      image
                         {
-                           text: "Tx";
-                           font: "VeraMono";
-                           size:  10;
-                           min:     1 1;
-                           align: 1.0 0.0;
+                           normal: "rx_06.png";
+                        }
+                   }
+                 description
+                   {
+                      state: "default" 0.7;
+                      inherit: "default" 0.0;
+                      image
+                        {
+                           normal: "rx_07.png";
+                        }
+                   }
+                 description
+                   {
+                      state: "default" 0.8;
+                      inherit: "default" 0.0;
+                      image
+                        {
+                           normal: "rx_08.png";
+                        }
+                   }
+                 description
+                   {
+                      state: "default" 0.9;
+                      inherit: "default" 0.0;
+                      image
+                        {
+                           normal: "rx_09.png";
+                        }
+                   }
+                 description
+                   {
+                      state: "default" 1.0;
+                      inherit: "default" 0.0;
+                      image
+                        {
+                           normal: "rx_10.png";
                         }
                    }
               }
-         }
-     }
-
-   group
-     {
-       name: "modules/net/rx_text";
-       parts
-         {
-            part
+            part 
               {
-                 name:           "net_clip";
-                 type:           RECT;
-                 mouse_events:   0;
-                 description
+                 name: "rx_label";
+                 type: TEXT;
+                 clip_to: "fade_clip";
+                 effect: SOFT_SHADOW;
+                 description 
                    {
                       state: "default" 0.0;
-                      color: 255 255 255 255;
+                      color: 255 255 255 0;
+                      color3: 0 0 0 0;
+                      visible: 0;
                       rel1 
                         {
-                           relative: 0.0 0.0;
+                           relative: 0.5 0.0;
                            offset: 0 0;
+                           to: "rx_meter";
                         }
                       rel2 
                         {
-                           relative: 1.0 1.0;
+                           relative: 0.5 1.0;
                            offset: -1 -1;
+                           to: "rx_meter";
                         }
+                      text 
+                        {
+                           text: "Rx: 10 Kbps";
+                           font: "VeraMono";
+                           size: 9;
+                           min: 1 1;
+                           align: 0.5 1.0;
+                           text_class: "module_small";
+                        }
+                   }
+                 description 
+                   {
+                      state: "visible" 0.0;
+                      inherit: "default" 0.0;
+                      visible: 1;
+                      color: 255 255 255 255;
+                      color3: 0 0 0 42;
                    }
               }
             part
               {
-                 name:           "rx-text";
-                 type:           TEXT;
-                 effect:         OUTLINE_SOFT_SHADOW;
-                 clip_to: "net_clip";
-                 mouse_events: 0;
+                 name: "tx_meter";
+                 type: IMAGE;
+                 clip_to: "fade_clip";
+                 mouse_events: 1;
                  description
                    {
                       state: "default" 0.0;
-                      align: 1.0 1.0;
                       rel1
                         {
-                           relative: 0.0 0.0;
+                           relative: 0.0 0.75;
+                           offset: 0 0;
                         }
                       rel2
                         {
                            relative: 1.0 1.0;
+                           offset: -1 -1;
+                        }
+                      image
+                        {
+                           normal: "tx_00.png";
+                        }
+                      color: 255 255 255 192;
+                   }
+                 description
+                   {
+                      state: "default" 0.1;
+                      inherit: "default" 0.0;
+                      image
+                        {
+                           normal: "tx_01.png";
+                        }
+                   }
+                 description
+                   {
+                      state: "default" 0.2;
+                      inherit: "default" 0.0;
+                      image
+                        {
+                           normal: "tx_02.png";
+                        }
+                   }
+                 description
+                   {
+                      state: "default" 0.3;
+                      inherit: "default" 0.0;
+                      image
+                        {
+                           normal: "tx_03.png";
+                        }
+                   }
+                 description
+                   {
+                      state: "default" 0.4;
+                      inherit: "default" 0.0;
+                      image
+                        {
+                           normal: "tx_04.png";
+                        }
+                   }
+                 description
+                   {
+                      state: "default" 0.5;
+                      inherit: "default" 0.0;
+                      image
+                        {
+                           normal: "tx_05.png";
+                        }
+                   }
+                 description
+                   {
+                      state: "default" 0.6;
+                      inherit: "default" 0.0;
+                      image
+                        {
+                           normal: "tx_06.png";
+                        }
+                   }
+                 description
+                   {
+                      state: "default" 0.7;
+                      inherit: "default" 0.0;
+                      image
+                        {
+                           normal: "tx_07.png";
+                        }
+                   }
+                 description
+                   {
+                      state: "default" 0.8;
+                      inherit: "default" 0.0;
+                      image
+                        {
+                           normal: "tx_08.png";
+                        }
+                   }
+                 description
+                   {
+                      state: "default" 0.9;
+                      inherit: "default" 0.0;
+                      image
+                        {
+                           normal: "tx_09.png";
+                        }
+                   }
+                 description
+                   {
+                      state: "default" 1.0;
+                      inherit: "default" 0.0;
+                      image
+                        {
+                           normal: "tx_10.png";
+                        }
+                   }
+              }
+            part 
+              {
+                 name: "tx_label";
+                 type: TEXT;
+                 clip_to: "fade_clip";
+                 effect: SOFT_SHADOW;
+                 description 
+                   {
+                      state: "default" 0.0;
+                      color: 255 255 255 0;
+                      color3: 0 0 0 0;
+                      visible: 0;
+                      rel1 
+                        {
+                           relative: 0.5 0.0;
+                           offset: 0 0;
+                           to: "tx_meter";
+                        }
+                      rel2 
+                        {
+                           relative: 0.5 1.0;
+                           offset: -1 -1;
+                           to: "tx_meter";
                         }
-                      color: 255 192 128 255;
-             color2: 0 0 0 216;
-                      color3: 128 128 128 192;
-                      text
+                      text 
                         {
-                           text: "Rx";
+                           text: "Tx: 10 Kbps";
                            font: "VeraMono";
-                           size:  10;
-                           min:     1 1;
-                           align: 1.0 1.0;
+                           size: 9;
+                           min: 1 1;
+                           align: 0.5 1.0;
+                           text_class: "module_small";
                         }
                    }
+                 description 
+                   {
+                      state: "visible" 0.0;
+                      inherit: "default" 0.0;
+                      visible: 1;
+                      color: 255 255 255 255;
+                      color3: 0 0 0 42;
+                   }
+              }             
+         }
+       programs 
+         {
+            program 
+              {
+                 name: "go_active";
+                 signal: "label_active";
+                 source: "";
+                 action: STATE_SET "visible" 0.0;
+                 transition: SINUSOIDAL 0.5;
+                 target: "rx_label";
+                 target: "tx_label";
+                 //after: "go_passive2";
+              }
+            program 
+              {
+                 name: "go_passive2";
+                 signal: "label_passive2";
+                 source: "";
+                 action: ACTION_STOP;
+                 target: "go_active";
+                 //after: "go_passive2";
+              }
+            program 
+              {
+                 name: "go_passive";
+                 signal: "label_passive";
+                 source: "";
+                 action: STATE_SET "default" 0.0;
+                 transition: SINUSOIDAL 1.0;             
+                 target: "rx_label";
+                 target: "tx_label";
               }
          }
      }
 }
-




-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to