Enlightenment CVS committal
Author : devilhorns
Project : e_modules
Module : mem
Dir : e_modules/mem
Modified Files:
Makefile.am e_mod_config.c e_mod_main.c e_mod_main.h mem.edc
module_icon.png
Added Files:
module.eap real_00.png real_01.png real_02.png real_03.png
real_04.png real_05.png real_06.png real_07.png real_08.png
real_09.png real_10.png swap_00.png swap_01.png swap_02.png
swap_03.png swap_04.png swap_05.png swap_06.png swap_07.png
swap_08.png swap_09.png swap_10.png
Removed Files:
e_mod_config.h
Log Message:
Memory module into the shelf :)
Users should remove any old module.mem.cfg before running.
This will break themes and translations until they are fixed.
===================================================================
RCS file: /cvs/e/e_modules/mem/Makefile.am,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- Makefile.am 9 Mar 2006 11:37:42 -0000 1.4
+++ Makefile.am 25 May 2006 23:32:39 -0000 1.5
@@ -12,6 +12,7 @@
files_DATA = \
module_icon.png \
+module.eap \
mem.edj \
mem.edc \
VeraMono.ttf
@@ -26,8 +27,7 @@
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
===================================================================
RCS file: /cvs/e/e_modules/mem/e_mod_config.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- e_mod_config.c 5 Apr 2006 17:48:49 -0000 1.5
+++ e_mod_config.c 25 May 2006 23:32:39 -0000 1.6
@@ -1,13 +1,10 @@
#include <e.h>
#include "e_mod_main.h"
-#include "e_mod_config.h"
-#include "config.h"
struct _E_Config_Dialog_Data
{
- int check_interval;
- int show_text;
- int show_graph;
+ double poll_time;
+ int always_text;
int show_percent;
int real_ignore_buffers;
int real_ignore_cached;
@@ -18,15 +15,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(Mem *c, E_Config_Dialog_Data *cfdata);
+static void _fill_data(Config_Item *ci, E_Config_Dialog_Data *cfdata);
/* Config Calls */
void
-_configure_mem_module(E_Container *con, Mem *c)
+_config_mem_module(Config_Item *ci)
{
E_Config_Dialog *cfd;
E_Config_Dialog_View *v;
-
+ E_Container *con;
+
v = E_NEW(E_Config_Dialog_View, 1);
v->create_cfdata = _create_data;
@@ -34,41 +32,41 @@
v->basic.apply_cfdata = _basic_apply_data;
v->basic.create_widgets = _basic_create_widgets;
- cfd = e_config_dialog_new(con, D_("Mem Configuration"), NULL, 0, v, c);
- c->cfd = cfd;
+ con = e_container_current_get(e_manager_current_get());
+ cfd = e_config_dialog_new(con, D_("Mem Configuration"), NULL, 0, v, ci);
+ mem_config->config_dialog = cfd;
}
static void
-_fill_data(Mem *c, E_Config_Dialog_Data *cfdata)
+_fill_data(Config_Item *ci, E_Config_Dialog_Data *cfdata)
{
- cfdata->check_interval = c->conf->check_interval;
- cfdata->real_ignore_buffers = c->conf->real_ignore_buffers;
- 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;
+ cfdata->poll_time = ci->poll_time;
+ cfdata->real_ignore_buffers = ci->real_ignore_buffers;
+ cfdata->real_ignore_cached = ci->real_ignore_cached;
+// cfdata->show_text = c->conf->show_text;
+ cfdata->always_text = ci->always_text;
+ cfdata->show_percent = ci->show_percent;
}
static void *
_create_data(E_Config_Dialog *cfd)
{
E_Config_Dialog_Data *cfdata;
- Mem *c;
+ Config_Item *ci;
- c = cfd->data;
+ ci = cfd->data;
cfdata = E_NEW(E_Config_Dialog_Data, 1);
- _fill_data(c, cfdata);
+ _fill_data(ci, cfdata);
return cfdata;
}
static void
_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{
- Mem *c;
-
- c = cfd->data;
- c->cfd = NULL;
+ if (!mem_config)
+ return;
+ mem_config->config_dialog = NULL;
free(cfdata);
}
@@ -76,17 +74,16 @@
_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
*cfdata)
{
Evas_Object *o, *of, *ob;
- Mem *c;
-
- c = cfd->data;
-
+ E_Radio_Group *rg;
+
o = e_widget_list_add(evas, 0, 0);
- of = e_widget_framelist_add(evas, D_("Mem Settings"), 0);
- ob = e_widget_check_add(evas, D_("Show Text"), &(cfdata->show_text));
+ of = e_widget_framelist_add(evas, D_("General Settings"), 0);
+ rg = e_widget_radio_group_new(&(cfdata->always_text));
+ ob = e_widget_radio_add(evas, D_("Always Show Text"), 1, rg);
e_widget_framelist_object_append(of, ob);
- ob = e_widget_check_add(evas, D_("Show Text As Percent"),
&(cfdata->show_percent));
+ ob = e_widget_radio_add(evas, D_("Show Text On Mouse Over"), 0, rg);
e_widget_framelist_object_append(of, ob);
- ob = e_widget_check_add(evas, D_("Show Graph"), &(cfdata->show_graph));
+ ob = e_widget_check_add(evas, D_("Show Text As Percent"),
&(cfdata->show_percent));
e_widget_framelist_object_append(of, ob);
ob = e_widget_check_add(evas, D_("Ignore Buffers"),
&(cfdata->real_ignore_buffers));
e_widget_framelist_object_append(of, ob);
@@ -94,7 +91,7 @@
e_widget_framelist_object_append(of, ob);
ob = e_widget_label_add(evas, D_("Check Interval:"));
e_widget_framelist_object_append(of, ob);
- 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.0, 60.0, 1.0, 0,
&(cfdata->poll_time), NULL, 150);
e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o, of, 1, 1, 0.5);
@@ -105,18 +102,16 @@
_basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{
char *tmp;
- Mem *c;
-
- c = cfd->data;
- c->conf->check_interval = cfdata->check_interval;
- c->conf->real_ignore_buffers = cfdata->real_ignore_buffers;
- 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;
+ Config_Item *ci;
+
+ ci = cfd->data;
+ ci->poll_time = cfdata->poll_time;
+ ci->real_ignore_buffers = cfdata->real_ignore_buffers;
+ ci->real_ignore_cached = cfdata->real_ignore_cached;
+ ci->always_text = cfdata->always_text;
+ ci->show_percent = cfdata->show_percent;
e_config_save_queue();
- if (c->face->monitor)
- ecore_timer_interval_set(c->face->monitor,
(double)cfdata->check_interval);
-
+ _mem_config_updated(ci->id);
+
return 1;
}
===================================================================
RCS file: /cvs/e/e_modules/mem/e_mod_main.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -3 -r1.23 -r1.24
--- e_mod_main.c 5 Apr 2006 17:48:49 -0000 1.23
+++ e_mod_main.c 25 May 2006 23:32:39 -0000 1.24
@@ -1,512 +1,455 @@
#include <e.h>
#include "e_mod_main.h"
-#include "e_mod_config.h"
-#include "config.h"
-static Mem *_mem_init(E_Module *m);
-static void _mem_shutdown(Mem *n);
-static void _mem_config_menu_new(Mem *n);
-static int _mem_face_init(Mem_Face *cf);
-static void _mem_face_menu_new(Mem_Face *cf);
-static void _mem_face_enable(Mem_Face *cf);
-static void _mem_face_disable(Mem_Face *cf);
-static void _mem_face_free(Mem_Face *cf);
-static void _mem_face_cb_gmc_change(void *data, E_Gadman_Client *gmc,
E_Gadman_Change change);
-static void _mem_face_cb_mouse_down(void *data, Evas *evas, Evas_Object *obj,
void *event_info);
-static void _mem_face_cb_menu_edit(void *data, E_Menu *mn, E_Menu_Item *mi);
-static void _mem_face_cb_menu_configure(void *data, E_Menu *mn, E_Menu_Item
*mi);
-static int _mem_face_update_values(void *data);
-static void _mem_face_get_mem_values(Mem_Face *cf, int *real, int *swap, int
*total_real, int *total_swap);
-static void _mem_face_graph_values(Mem_Face *mf, int rval, int sval);
-static void _mem_face_graph_clear(Mem_Face *mf);
-static int mem_count;
+typedef struct _Instance Instance;
+typedef struct _Mem Mem;
-EAPI E_Module_Api e_modapi = {
- E_MODULE_API_VERSION,
- "Mem"
+struct _Instance
+{
+ E_Gadcon_Client *gcc;
+ Evas_Object *mem_obj;
+ Mem *mem;
+ Ecore_Timer *check_timer;
};
-EAPI void *
-e_modapi_init(E_Module *m)
+struct _Mem
{
- Mem *c;
-
- /* Set up module's message catalogue */
- bindtextdomain(PACKAGE, LOCALEDIR);
- bind_textdomain_codeset(PACKAGE, "UTF-8");
+ Instance *inst;
+ Evas_Object *mem_obj;
+};
- c = _mem_init(m);
- if (!c)
- 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 _mem_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void
*event_info);
+static void _mem_cb_mouse_in(void *data, Evas *e, Evas_Object *obj, void
*event_info);
+static void _mem_cb_mouse_out(void *data, Evas *e, Evas_Object *obj, void
*event_info);
+static void _mem_menu_cb_configure(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _mem_menu_cb_post(void *data, E_Menu *m);
+static Config_Item *_mem_config_item_get(const char *id);
+static Mem *_mem_new(Evas *evas);
+static void _mem_free(Mem *mem);
+static int _mem_cb_check(void *data);
+static void _mem_get_values(Config_Item *ci, int *real, int *swap, int
*total_real, int *total_swap);
+
+static E_Config_DD *conf_edd = NULL;
+static E_Config_DD *conf_item_edd = NULL;
- m->config_menu = c->config_menu;
- return c;
-}
+Config *mem_config = NULL;
-EAPI int
-e_modapi_shutdown(E_Module *m)
+static const E_Gadcon_Client_Class _gc_class =
{
- Mem *c;
-
- c = m->data;
- if (!c)
- 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 (c->cfd)
- {
- e_object_del(E_OBJECT(c->cfd));
- c->cfd = NULL;
- }
- _mem_shutdown(c);
- return 1;
-}
+ GADCON_CLIENT_CLASS_VERSION,
+ "mem", {_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)
{
- Mem *c;
+ E_Gadcon_Client *gcc;
+ Evas_Object *o;
+ Instance *inst;
+ Config_Item *ci;
+ Mem *mem;
+ char buf[4096];
+
+ inst = E_NEW(Instance, 1);
+
+ ci = _mem_config_item_get(id);
+ if (!ci->id)
+ ci->id = evas_stringshare_add(id);
+
+ mem = _mem_new(gc->evas);
+ mem->inst = inst;
+ inst->mem = mem;
+
+ o = mem->mem_obj;
+ gcc = e_gadcon_client_new(gc, name, id, style, o);
+ gcc->data = inst;
+ inst->gcc = gcc;
+ inst->mem_obj = o;
+
+ evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
_mem_cb_mouse_down, inst);
+ evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_IN, _mem_cb_mouse_in,
inst);
+ evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_OUT,
_mem_cb_mouse_out, inst);
+
+ if (ci->always_text)
+ edje_object_signal_emit(inst->mem_obj, "label_active", "");
+
+ _mem_cb_check(inst);
+
+ inst->check_timer = ecore_timer_add(ci->poll_time, _mem_cb_check, inst);
+ mem_config->instances = evas_list_append(mem_config->instances, inst);
+ return gcc;
+}
- c = m->data;
- if (!c)
- return 0;
- e_config_domain_save("module.mem", c->conf_edd, c->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_("Mem");
}
-EAPI int
-e_modapi_about(E_Module *m)
+static Evas_Object *
+_gc_icon(Evas *evas)
{
- e_module_dialog_show(D_("Enlightenment Mem Monitor Module"), D_("This
module is used to monitor memory."));
- return 1;
+ Evas_Object *o;
+ char buf[4096];
+
+ o = edje_object_add(evas);
+ snprintf(buf, sizeof(buf), "%s/module.eap",
e_module_dir_get(mem_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)
{
- Mem *c;
- E_Container *con;
-
- c = m->data;
- if (!c)
- return 0;
- if (!c->face)
- return 0;
-
- con = e_container_current_get(e_manager_current_get());
- if (c->face->con == con)
- _configure_mem_module(con, c);
-
- return 1;
+ Instance *inst;
+
+ inst = gcc->data;
+ if (inst->check_timer)
+ ecore_timer_del(inst->check_timer);
+ mem_config->instances = evas_list_remove(mem_config->instances, inst);
+ _mem_free(inst->mem);
+ free(inst);
}
-static Mem *
-_mem_init(E_Module *m)
+static void
+_mem_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
- Mem *c;
- E_Menu_Item *mi;
- Evas_List *mans, *l, *l2;
-
- c = E_NEW(Mem, 1);
-
- if (!c)
- return NULL;
-
- c->conf_edd = E_CONFIG_DD_NEW("Mem_Config", Config);
-#undef T
-#undef D
-#define T Config
-#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);
-
- c->conf = e_config_domain_load("module.mem", c->conf_edd);
- if (!c->conf)
- {
- c->conf = E_NEW(Config, 1);
-
- 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);
+ Instance *inst;
+ Evas_Event_Mouse_Down *ev;
- mans = e_manager_list();
- for (l = mans; l; l = l->next)
+ inst = data;
+ ev = event_info;
+ if ((ev->button == 3) && (!mem_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;
- Mem_Face *cf;
+ mn = e_menu_new();
+ e_menu_post_deactivate_callback_set(mn, _mem_menu_cb_post, inst);
+ mem_config->menu = mn;
- con = l2->data;
- cf = E_NEW(Mem_Face, 1);
+ 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, _mem_menu_cb_configure, inst);
- if (cf)
- {
- cf->conf_face_edd = E_CONFIG_DD_NEW("Mem_Face_Config",
Config_Face);
+ mi = e_menu_item_new(mn);
+ e_menu_item_separator_set(mi, 1);
-#undef T
-#undef D
-#define T Config_Face
-#define D cf->conf_face_edd
- E_CONFIG_VAL(D, T, enabled, UCHAR);
+ 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);
+ }
+}
- c->face = cf;
- cf->mem = c;
- cf->con = con;
- cf->evas = con->bg_evas;
+static void
+_mem_menu_cb_post(void *data, E_Menu *m)
+{
+ if (!mem_config->menu)
+ return;
+ e_object_del(E_OBJECT(mem_config->menu));
+ mem_config->menu = NULL;
+}
- cf->conf = E_NEW(Config_Face, 1);
+static void
+_mem_menu_cb_configure(void *data, E_Menu *m, E_Menu_Item *mi)
+{
+ Instance *inst;
+ Config_Item *ci;
+
+ inst = data;
+ ci = _mem_config_item_get(inst->gcc->id);
+ _config_mem_module(ci);
+}
- cf->conf->enabled = 1;
+void
+_mem_config_updated(const char *id)
+{
+ Evas_List *l;
+ Config_Item *ci;
- if (!_mem_face_init(cf))
- return NULL;
+ if (!mem_config)
+ return;
- _mem_face_menu_new(cf);
+ ci = _mem_config_item_get(id);
+ for (l = mem_config->instances; l; l = l->next)
+ {
+ Instance *inst;
- mi = e_menu_item_new(c->config_menu);
- e_menu_item_label_set(mi, _("Configuration"));
- e_menu_item_callback_set(mi, _mem_face_cb_menu_configure,
cf);
+ inst = l->data;
+ if (!inst->gcc->id)
+ continue;
- mi = e_menu_item_new(c->config_menu);
- e_menu_item_label_set(mi, con->name);
- e_menu_item_submenu_set(mi, cf->menu);
+ if (!strcmp(inst->gcc->id, ci->id))
+ {
+ if (inst->check_timer)
+ ecore_timer_del(inst->check_timer);
+ inst->check_timer = ecore_timer_add((double)ci->poll_time,
_mem_cb_check, inst);
+ if (ci->always_text)
+ edje_object_signal_emit(inst->mem_obj, "label_active", "");
+ else
+ edje_object_signal_emit(inst->mem_obj, "label_passive", "");
- if (!cf->conf->enabled)
- _mem_face_disable(cf);
- else
- _mem_face_enable(cf);
- }
+ break;
}
- }
- return c;
+ }
}
-static void
-_mem_shutdown(Mem *c)
+static Config_Item *
+_mem_config_item_get(const char *id)
{
- _mem_face_free(c->face);
+ Evas_List *l;
+ Config_Item *ci;
- E_FREE(c->conf);
- E_CONFIG_DD_FREE(c->conf_edd);
- E_FREE(c);
+ for (l = mem_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->poll_time = 1.0;
+ ci->always_text = 0;
+ ci->show_percent = 1;
+ ci->real_ignore_buffers = 0;
+ ci->real_ignore_cached = 0;
+
+ mem_config->items = evas_list_append(mem_config->items, ci);
+ return ci;
}
-static void
-_mem_config_menu_new(Mem *c)
+EAPI E_Module_Api e_modapi =
{
- E_Menu *mn;
-
- mn = e_menu_new();
- c->config_menu = mn;
-}
+ E_MODULE_API_VERSION,
+ "Mem"
+};
-static int
-_mem_face_init(Mem_Face *cf)
+EAPI void *
+e_modapi_init(E_Module *m)
{
- Evas_Object *o;
- char buf[4096];
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ bind_textdomain_codeset(PACKAGE, "UTF-8");
- evas_event_freeze(cf->evas);
+ conf_item_edd = E_CONFIG_DD_NEW("Mem_Config_Item", Config_Item);
- o = edje_object_add(cf->evas);
- cf->mem_obj = o;
+#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, poll_time, DOUBLE);
+ E_CONFIG_VAL(D, T, always_text, INT);
+ E_CONFIG_VAL(D, T, show_percent, INT);
+ E_CONFIG_VAL(D, T, real_ignore_buffers, INT);
+ E_CONFIG_VAL(D, T, real_ignore_cached, INT);
- if (!e_theme_edje_object_set(o, "base/theme/modules/mem",
"modules/mem/main"))
- {
- snprintf(buf, sizeof(buf), PACKAGE_DATA_DIR "/mem.edj");
- edje_object_file_set(o, buf, "modules/mem/main");
- }
- evas_object_show(o);
+ conf_edd = E_CONFIG_DD_NEW("Mem_Config", Config);
- o = edje_object_add(cf->evas);
- cf->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_pass_events_set(o, 1);
- evas_object_show(o);
-
- o = edje_object_add(cf->evas);
- cf->rtxt_obj = o;
- if (!e_theme_edje_object_set(o, "base/theme/modules/mem",
"modules/mem/real_text"))
- {
- snprintf(buf, sizeof(buf), PACKAGE_DATA_DIR "/mem.edj");
- edje_object_file_set(o, buf, "modules/mem/real_text");
- }
- evas_object_layer_set(o, 2);
- evas_object_repeat_events_set(o, 0);
- evas_object_color_set(o, 255, 255, 255, 255);
- evas_object_pass_events_set(o, 1);
- evas_object_show(o);
-
- o = edje_object_add(cf->evas);
- cf->stxt_obj = o;
- if (!e_theme_edje_object_set(o, "base/theme/modules/mem",
"modules/mem/swap_text"))
+#undef T
+#undef D
+#define T Config
+#define D conf_edd
+ E_CONFIG_LIST(D, T, items, conf_item_edd);
+
+ mem_config = e_config_domain_load("module.mem", conf_edd);
+ if (!mem_config)
{
- snprintf(buf, sizeof(buf), PACKAGE_DATA_DIR "/mem.edj");
- edje_object_file_set(o, buf, "modules/mem/swap_text");
- }
- evas_object_layer_set(o, 2);
- evas_object_repeat_events_set(o, 0);
- evas_object_color_set(o, 255, 255, 255, 255);
- evas_object_pass_events_set(o, 1);
- evas_object_show(o);
-
- o = evas_object_rectangle_add(cf->evas);
- cf->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,
_mem_face_cb_mouse_down, cf);
- evas_object_show(o);
-
- cf->gmc = e_gadman_client_new(cf->con->gadman);
- e_gadman_client_domain_set(cf->gmc, "module.mem", mem_count++);
- e_gadman_client_policy_set(cf->gmc,
- E_GADMAN_POLICY_ANYWHERE |
- E_GADMAN_POLICY_HMOVE | E_GADMAN_POLICY_HSIZE |
E_GADMAN_POLICY_VMOVE | E_GADMAN_POLICY_VSIZE);
- e_gadman_client_auto_size_set(cf->gmc, 40, 40);
- e_gadman_client_align_set(cf->gmc, 1.0, 1.0);
- e_gadman_client_resize(cf->gmc, 40, 40);
- e_gadman_client_change_func_set(cf->gmc, _mem_face_cb_gmc_change, cf);
- e_gadman_client_load(cf->gmc);
- evas_event_thaw(cf->evas);
+ Config_Item *ci;
- cf->monitor = ecore_timer_add((double)cf->mem->conf->check_interval,
_mem_face_update_values, cf);
- return 1;
+ mem_config = E_NEW(Config, 1);
+
+ ci = E_NEW(Config_Item, 1);
+ ci->id = evas_stringshare_add("0");
+ ci->poll_time = 1.0;
+ ci->always_text = 0;
+ ci->show_percent = 1;
+ ci->real_ignore_buffers = 0;
+ ci->real_ignore_cached = 0;
+ mem_config->items = evas_list_append(mem_config->items, ci);
+ }
+ mem_config->module = m;
+ e_gadcon_provider_register(&_gc_class);
+ return 1;
}
-static void
-_mem_face_menu_new(Mem_Face *cf)
+EAPI int
+e_modapi_shutdown(E_Module *m)
{
- E_Menu *mn;
- E_Menu_Item *mi;
-
- mn = e_menu_new();
- cf->menu = mn;
+ mem_config->module = NULL;
+ e_gadcon_provider_unregister(&_gc_class);
- 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, _mem_face_cb_menu_configure, cf);
-
- 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, _mem_face_cb_menu_edit, cf);
+ if (mem_config->config_dialog)
+ e_object_del(E_OBJECT(mem_config->config_dialog));
+ if (mem_config->menu)
+ {
+ e_menu_post_deactivate_callback_set(mem_config->menu, NULL, NULL);
+ e_object_del(E_OBJECT(mem_config->menu));
+ mem_config->menu = NULL;
+ }
+ while (mem_config->items)
+ {
+ Config_Item *ci;
+
+ ci = mem_config->items->data;
+ mem_config->items = evas_list_remove_list(mem_config->items,
mem_config->items);
+ if (ci->id)
+ evas_stringshare_del(ci->id);
+ free(ci);
+ }
+ free(mem_config);
+ mem_config = NULL;
+ E_CONFIG_DD_FREE(conf_item_edd);
+ E_CONFIG_DD_FREE(conf_edd);
+ return 1;
}
-static void
-_mem_face_enable(Mem_Face *cf)
+EAPI int
+e_modapi_info(E_Module *m)
{
- cf->conf->enabled = 1;
- e_config_save_queue();
- evas_object_show(cf->mem_obj);
- evas_object_show(cf->chart_obj);
- evas_object_show(cf->event_obj);
- evas_object_show(cf->rtxt_obj);
- evas_object_show(cf->stxt_obj);
-}
+ char buf[4096];
-static void
-_mem_face_disable(Mem_Face *cf)
-{
- cf->conf->enabled = 0;
- e_config_save_queue();
- evas_object_hide(cf->event_obj);
- evas_object_hide(cf->chart_obj);
- evas_object_hide(cf->mem_obj);
- evas_object_hide(cf->rtxt_obj);
- evas_object_hide(cf->stxt_obj);
+ snprintf(buf, sizeof(buf), "%s/module_icon.png", e_module_dir_get(m));
+ m->icon_file = strdup(buf);
+ return 1;
}
-static void
-_mem_face_free(Mem_Face *cf)
+EAPI int
+e_modapi_save(E_Module *m)
{
- if (cf->monitor)
- ecore_timer_del(cf->monitor);
- if (cf->menu)
- e_object_del(E_OBJECT(cf->menu));
- if (cf->event_obj)
- evas_object_del(cf->event_obj);
- if (cf->mem_obj)
- evas_object_del(cf->mem_obj);
- if (cf->chart_obj)
- evas_object_del(cf->chart_obj);
- if (cf->rtxt_obj)
- evas_object_del(cf->rtxt_obj);
- if (cf->stxt_obj)
- evas_object_del(cf->stxt_obj);
- if (cf->old_real || cf->old_swap)
- _mem_face_graph_clear(cf);
+ Evas_List *l;
- if (cf->gmc)
+ for (l = mem_config->instances; l; l = l->next)
{
- e_gadman_client_save(cf->gmc);
- e_object_del(E_OBJECT(cf->gmc));
+ Instance *inst;
+ Config_Item *ci;
+
+ inst = l->data;
+ ci = _mem_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.mem", conf_edd, mem_config);
+ return 1;
+}
- E_FREE(cf->conf);
- E_FREE(cf);
- mem_count--;
+EAPI int
+e_modapi_about(E_Module *m)
+{
+ e_module_dialog_show(D_("Enlightenment Mem Monitor Module"),
+ D_("This module is used to monitor memory."));
+ return 1;
}
-static void
-_mem_face_cb_gmc_change(void *data, E_Gadman_Client *gmc, E_Gadman_Change
change)
+static Mem *
+_mem_new(Evas *evas)
{
- Mem_Face *cf;
- Evas_Coord x, y, w, h;
+ Mem *mem;
+ char buf[4096];
- cf = data;
- switch (change)
- {
- case E_GADMAN_CHANGE_MOVE_RESIZE:
- e_gadman_client_geometry_get(cf->gmc, &x, &y, &w, &h);
- evas_object_move(cf->mem_obj, x, y);
- evas_object_move(cf->chart_obj, x, y);
- evas_object_move(cf->event_obj, x, y);
- evas_object_move(cf->rtxt_obj, x, y);
- evas_object_move(cf->stxt_obj, x, y);
- evas_object_resize(cf->mem_obj, w, h);
- evas_object_resize(cf->chart_obj, w, h);
- evas_object_resize(cf->event_obj, w, h);
- evas_object_resize(cf->rtxt_obj, w, h);
- evas_object_resize(cf->stxt_obj, w, h);
- _mem_face_graph_clear(cf);
- break;
- case E_GADMAN_CHANGE_RAISE:
- evas_object_raise(cf->mem_obj);
- evas_object_raise(cf->chart_obj);
- evas_object_raise(cf->event_obj);
- evas_object_raise(cf->rtxt_obj);
- evas_object_raise(cf->stxt_obj);
- break;
- default:
- break;
- }
+ mem = E_NEW(Mem, 1);
+
+ mem->mem_obj = edje_object_add(evas);
+ snprintf(buf, sizeof(buf), "%s/mem.edj",
e_module_dir_get(mem_config->module));
+ if (!e_theme_edje_object_set(mem->mem_obj, "base/theme/modules/mem",
"modules/mem/main"))
+ edje_object_file_set(mem->mem_obj, buf, "modules/mem/main");
+ evas_object_show(mem->mem_obj);
+
+ return mem;
}
static void
-_mem_face_cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, void
*event_info)
+_mem_free(Mem *m)
{
- Mem_Face *cf;
- Evas_Event_Mouse_Down *ev;
-
- ev = event_info;
- cf = data;
- if (ev->button == 3)
- {
- e_menu_activate_mouse(cf->menu, e_zone_current_get(cf->con),
- ev->output.x, ev->output.y, 1, 1,
E_MENU_POP_DIRECTION_DOWN, ev->timestamp);
- e_util_container_fake_mouse_up_all_later(cf->con);
- }
+ evas_object_del(m->mem_obj);
+ free(m);
}
static void
-_mem_face_cb_menu_edit(void *data, E_Menu *mn, E_Menu_Item *mi)
+_mem_cb_mouse_in(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
- Mem_Face *cf;
+ Instance *inst;
- cf = data;
- e_gadman_mode_set(cf->gmc->gadman, E_GADMAN_MODE_EDIT);
+ inst = data;
+ edje_object_signal_emit(inst->mem_obj, "label_active", "");
}
static void
-_mem_face_cb_menu_configure(void *data, E_Menu *mn, E_Menu_Item *mi)
+_mem_cb_mouse_out(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
- Mem_Face *cf;
+ Instance *inst;
+ Config_Item *ci;
- cf = data;
- _configure_mem_module(cf->con, cf->mem);
+ inst = data;
+ ci = _mem_config_item_get(inst->gcc->id);
+ if (!ci->always_text)
+ edje_object_signal_emit(inst->mem_obj, "label_passive", "");
}
static int
-_mem_face_update_values(void *data)
+_mem_cb_check(void *data)
{
- Mem_Face *cf;
+ Instance *inst;
+ Config_Item *ci;
+ Edje_Message_Float msg;
int real, swap, total_real, total_swap;
char real_str[100];
char swap_str[100];
- Edje_Message_Float msg;
-
- cf = data;
- _mem_face_get_mem_values(cf, &real, &swap, &total_real, &total_swap);
- if (cf->mem->conf->show_text)
+ inst = data;
+ ci = _mem_config_item_get(inst->gcc->id);
+ _mem_get_values(ci, &real, &swap, &total_real, &total_swap);
+
+ if (!ci->show_percent)
{
- 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);
+ 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));
}
else
{
- edje_object_part_text_set(cf->rtxt_obj, "real-text", "");
- edje_object_part_text_set(cf->stxt_obj, "swap-text", "");
+ double tr;
+
+ 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);
}
+ edje_object_part_text_set(inst->mem_obj, "real_label", real_str);
+ edje_object_part_text_set(inst->mem_obj, "swap_label", swap_str);
double tr = ((double)real / (double)total_real);
-
msg.val = tr;
- edje_object_message_send(cf->mem_obj, EDJE_MESSAGE_FLOAT, 9, &msg);
+ 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(cf->mem_obj, EDJE_MESSAGE_FLOAT, 10, &msg);
-
- if ((cf->mem->conf->show_graph) && (edje_object_part_exists(cf->mem_obj,
"lines")))
- _mem_face_graph_values(cf, (tr * 100), (ts * 100));
- else
- _mem_face_graph_clear(cf);
-
- return 1;
+ edje_object_message_send(inst->mem_obj, EDJE_MESSAGE_FLOAT, 2, &msg);
}
static void
-_mem_face_get_mem_values(Mem_Face *cf, int *real, int *swap, int *total_real,
int *total_swap)
+_mem_get_values(Config_Item *ci, int *real, int *swap, int *total_real, int
*total_swap)
{
FILE *pmeminfo = NULL;
int cursor = 0;
@@ -515,16 +458,13 @@
long int value = 0, mtotal = 0, stotal = 0, mfree = 0, sfree = 0;
ldiv_t ldresult;
long int liresult;
- Edje_Message_Float msg;
- /* open /proc/meminfo */
if (!(pmeminfo = fopen("/proc/meminfo", "r")))
{
fprintf(stderr, "can't open /proc/meminfo");
return;
}
- /* parse /proc/meminfo */
line = (char *)calloc(64, sizeof(char));
while (fscanf(pmeminfo, "%c", &c) != EOF)
{
@@ -535,47 +475,20 @@
field = (char *)malloc(strlen(line) * sizeof(char));
sscanf(line, "%s %ld kB", field, &value);
if (!strcmp(field, "MemTotal:"))
- {
- mtotal = value;
- msg.val = value;
- edje_object_message_send(cf->mem_obj, EDJE_MESSAGE_FLOAT, 0,
&msg);
- }
+ mtotal = value;
else if (!strcmp(field, "MemFree:"))
- {
- mfree = value;
- msg.val = value;
- edje_object_message_send(cf->mem_obj, EDJE_MESSAGE_FLOAT, 1,
&msg);
- }
- else if (cf->mem->conf->real_ignore_buffers && (!strcmp(field,
"Buffers:")))
- {
- mfree += value;
- msg.val = value;
- edje_object_message_send(cf->mem_obj, EDJE_MESSAGE_FLOAT, 2,
&msg);
- }
- else if (cf->mem->conf->real_ignore_cached && (!strcmp(field,
"Cached:")))
- {
- mfree += value;
- msg.val = value;
- edje_object_message_send(cf->mem_obj, EDJE_MESSAGE_FLOAT, 3,
&msg);
- }
- else if (cf->mem->conf->real_ignore_cached && (!strcmp(field,
"SwapCached:")))
- {
- sfree += value;
- msg.val = value;
- edje_object_message_send(cf->mem_obj, EDJE_MESSAGE_FLOAT, 4,
&msg);
- }
+ mfree = value;
+ else if (ci->real_ignore_buffers && (!strcmp(field, "Buffers:")))
+ mfree += value;
+ else if (ci->real_ignore_cached && (!strcmp(field, "Cached:")))
+ mfree += value;
+ else if (ci->real_ignore_cached && (!strcmp(field,
"SwapCached:")))
+ sfree += value;
else if (!strcmp(field, "SwapTotal:"))
- {
- stotal = value;
- msg.val = stotal;
- edje_object_message_send(cf->mem_obj, EDJE_MESSAGE_FLOAT, 5,
&msg);
- }
+ stotal = value;
else if (!strcmp(field, "SwapFree:"))
- {
- sfree = value;
- msg.val = sfree;
- edje_object_message_send(cf->mem_obj, EDJE_MESSAGE_FLOAT, 6,
&msg);
- }
+ sfree = value;
+
free(line);
free(field);
cursor = 0;
@@ -584,7 +497,6 @@
}
fclose(pmeminfo);
- /* calculate swap usage in percent */
if (stotal >= 1)
{
ldresult = ldiv(stotal, 100);
@@ -592,141 +504,12 @@
ldresult = ldiv((stotal - sfree), liresult);
}
- /* calculate memory usage in percent */
- /* FIXME : figure out a better way to do this */
ldresult = ldiv(mtotal, 100);
liresult = ldresult.quot;
ldresult = ldiv((mtotal - mfree), liresult);
*real = (mtotal - mfree);
- msg.val = *real;
- edje_object_message_send(cf->mem_obj, EDJE_MESSAGE_FLOAT, 7, &msg);
-
*swap = (stotal - sfree);
- msg.val = *swap;
- edje_object_message_send(cf->mem_obj, EDJE_MESSAGE_FLOAT, 8, &msg);
-
*total_real = mtotal;
*total_swap = stotal;
- return;
-}
-
-static void
-_mem_face_graph_values(Mem_Face *mf, int rval, int sval)
-{
- int x, y, w, h;
- Evas_Object *o;
- Evas_Object *last = NULL;
- Evas_List *l;
- int i, j = 0;
-
- evas_event_freeze(mf->evas);
-
- evas_object_geometry_get(mf->chart_obj, &x, &y, &w, &h);
-
- rval = (int)(((double)rval) * (((double)h) / ((double)100)));
- sval = (int)(((double)sval) * (((double)h) / ((double)100)));
-
- o = evas_object_line_add(mf->evas);
- edje_object_part_swallow(mf->chart_obj, "lines", o);
- evas_object_layer_set(o, 1);
- if (rval == 0)
- evas_object_hide(o);
- else
- {
- evas_object_line_xy_set(o, (x + w), y, (x + w), (y + rval));
- evas_object_color_set(o, 213, 91, 91, 125);
- evas_object_pass_events_set(o, 1);
- evas_object_show(o);
- }
-
- /* Add new value to list */
- mf->old_real = evas_list_prepend(mf->old_real, o);
- l = mf->old_real;
- 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)
- {
- mf->old_real = evas_list_remove(mf->old_real, last);
- edje_object_part_unswallow(mf->chart_obj, last);
- evas_object_del(last);
- }
-
- j = 0;
- last = NULL;
- o = evas_object_line_add(mf->evas);
- edje_object_part_swallow(mf->chart_obj, "lines", o);
- evas_object_layer_set(o, 1);
- if (sval == 0)
- evas_object_hide(o);
- else
- {
- evas_object_line_xy_set(o, (x + w), (y + h), (x + w), (y + h - sval));
- evas_object_color_set(o, 218, 195, 35, 125);
- evas_object_pass_events_set(o, 1);
- evas_object_show(o);
- }
-
- mf->old_swap = evas_list_prepend(mf->old_swap, o);
- l = mf->old_swap;
- 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)
- {
- mf->old_swap = evas_list_remove(mf->old_swap, last);
- edje_object_part_unswallow(mf->chart_obj, last);
- evas_object_del(last);
- }
-
- evas_event_thaw(mf->evas);
-}
-
-static void
-_mem_face_graph_clear(Mem_Face *mf)
-{
- Evas_List *l;
-
- evas_event_freeze(mf->evas);
-
- for (l = mf->old_real; l; l = l->next)
- {
- Evas_Object *o;
-
- o = evas_list_data(l);
- edje_object_part_unswallow(mf->chart_obj, o);
- evas_object_del(o);
- }
- evas_list_free(mf->old_real);
- mf->old_real = NULL;
-
- for (l = mf->old_swap; l; l = l->next)
- {
- Evas_Object *o;
-
- o = evas_list_data(l);
- edje_object_part_unswallow(mf->chart_obj, o);
- evas_object_del(o);
- }
- evas_list_free(mf->old_swap);
- mf->old_swap = NULL;
-
- evas_event_thaw(mf->evas);
}
===================================================================
RCS file: /cvs/e/e_modules/mem/e_mod_main.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- e_mod_main.h 5 Apr 2006 17:48:49 -0000 1.6
+++ e_mod_main.h 25 May 2006 23:32:39 -0000 1.7
@@ -4,55 +4,25 @@
#define E_MOD_MAIN_H
typedef struct _Config Config;
-typedef struct _Config_Face Config_Face;
-typedef struct _Mem Mem;
-typedef struct _Mem_Face Mem_Face;
+typedef struct _Config_Item Config_Item;
-struct _Config
+struct _Config
{
- int check_interval;
- int show_text;
- int show_graph;
- int show_percent;
- unsigned char real_ignore_buffers;
- unsigned char real_ignore_cached;
-};
-
-struct _Config_Face
-{
- unsigned char enabled;
-};
-
-struct _Mem
-{
- E_Menu *config_menu;
- Mem_Face *face;
- Config *conf;
-
- E_Config_DD *conf_edd;
- E_Config_Dialog *cfd;
+ E_Module *module;
+ E_Config_Dialog *config_dialog;
+ E_Menu *menu;
+ Evas_List *instances;
+ Evas_List *items;
};
-struct _Mem_Face
+struct _Config_Item
{
- Evas *evas;
- E_Container *con;
- E_Menu *menu;
- Mem *mem;
- Evas_List *old_real, *old_swap;
-
- Config_Face *conf;
- E_Config_DD *conf_face_edd;
-
- Evas_Object *mem_obj;
- Evas_Object *event_obj;
- Evas_Object *chart_obj;
- Evas_Object *rtxt_obj;
- Evas_Object *stxt_obj;
-
- Ecore_Timer *monitor;
-
- E_Gadman_Client *gmc;
+ const char *id;
+ double poll_time;
+ int show_percent;
+ int always_text;
+ int real_ignore_buffers;
+ int real_ignore_cached;
};
EAPI extern E_Module_Api e_modapi;
@@ -62,6 +32,9 @@
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 _mem_config_updated(const char *id);
+void _config_mem_module(Config_Item *ci);
+extern Config *mem_config;
#endif
===================================================================
RCS file: /cvs/e/e_modules/mem/mem.edc,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- mem.edc 21 May 2006 19:11:51 -0000 1.12
+++ mem.edc 25 May 2006 23:32:39 -0000 1.13
@@ -1,6 +1,28 @@
images
{
- image: "mem.png" COMP;
+ image: "module_icon.png" COMP;
+ image: "real_00.png" COMP;
+ image: "real_01.png" COMP;
+ image: "real_02.png" COMP;
+ image: "real_03.png" COMP;
+ image: "real_04.png" COMP;
+ image: "real_05.png" COMP;
+ image: "real_06.png" COMP;
+ image: "real_07.png" COMP;
+ image: "real_08.png" COMP;
+ image: "real_09.png" COMP;
+ image: "real_10.png" COMP;
+ image: "swap_00.png" COMP;
+ image: "swap_01.png" COMP;
+ image: "swap_02.png" COMP;
+ image: "swap_03.png" COMP;
+ image: "swap_04.png" COMP;
+ image: "swap_05.png" COMP;
+ image: "swap_06.png" COMP;
+ image: "swap_07.png" COMP;
+ image: "swap_08.png" COMP;
+ image: "swap_09.png" COMP;
+ image: "swap_10.png" COMP;
}
fonts
@@ -13,190 +35,430 @@
group
{
name: "modules/mem/main";
+ min: 4 4;
+ max: 128 128;
+ script
+ {
+ public message(Msg_Type:type, id, ...)
+ {
+ if ((type == MSG_FLOAT) && (id == 1))
+ {
+ new Float:value;
+
+ value = getfarg(2);
+ set_state(PART:"real_meter", "default", value);
+ }
+ if ((type == MSG_FLOAT) && (id == 2))
+ {
+ new Float:value;
+
+ value = getfarg(2);
+ set_state(PART:"swap_meter", "default", value);
+ }
+ }
+ }
+
parts
{
part
{
- name: "mem_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: "mem";
- clip_to: "mem_clip";
- mouse_events: 0;
+ name: "mem";
+ type: IMAGE;
+ mouse_events: 1;
+ clip_to: "fade_clip";
description
{
- state: "default" 0.0;
- color: 255 255 255 255;
+ 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: "mem.png";
- }
- fill
- {
- smooth: 0;
+ normal: "module_icon.png";
}
+ color: 255 255 255 192;
}
}
part
{
- name: "lines";
- mouse_events: 0;
- type: SWALLOW;
- clip_to: "mem_clip";
+ name: "real_meter";
+ type: IMAGE;
+ clip_to: "fade_clip";
+ mouse_events: 1;
description
{
- state: "default" 0.0;
- color: 0 0 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;
+ }
+ image
+ {
+ normal: "real_00.png";
+ }
+ color: 255 255 255 192;
}
- }
-
- }
- }
- group
- {
- name: "modules/mem/real_text";
- parts
- {
- part
- {
- name: "text_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: "real_01.png";
}
- rel2
+ }
+ description
+ {
+ state: "default" 0.2;
+ inherit: "default" 0.0;
+ image
{
- relative: 1.0 1.0;
- offset: -1 -1;
- }
+ normal: "real_02.png";
+ }
}
- }
- part
- {
- name: "real-text";
- type: TEXT;
- effect: OUTLINE_SOFT_SHADOW;
- mouse_events: 0;
- clip_to: "text_clip";
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: "real_03.png";
}
- rel2
+ }
+ description
+ {
+ state: "default" 0.4;
+ inherit: "default" 0.0;
+ image
+ {
+ normal: "real_04.png";
+ }
+ }
+ description
+ {
+ state: "default" 0.5;
+ inherit: "default" 0.0;
+ image
{
- relative: 1.0 0.0;
+ normal: "real_05.png";
}
- color: 255 160 112 255;
- color2: 0 0 0 192;
- color3: 128 128 128 192;
- text
+ }
+ description
+ {
+ state: "default" 0.6;
+ inherit: "default" 0.0;
+ image
{
- text: "real";
- font: "VeraMono";
- size: 10;
- min: 1 1;
- align: 1.0 0.0;
+ normal: "real_06.png";
+ }
+ }
+ description
+ {
+ state: "default" 0.7;
+ inherit: "default" 0.0;
+ image
+ {
+ normal: "real_07.png";
+ }
+ }
+ description
+ {
+ state: "default" 0.8;
+ inherit: "default" 0.0;
+ image
+ {
+ normal: "real_08.png";
+ }
+ }
+ description
+ {
+ state: "default" 0.9;
+ inherit: "default" 0.0;
+ image
+ {
+ normal: "real_09.png";
+ }
+ }
+ description
+ {
+ state: "default" 1.0;
+ inherit: "default" 0.0;
+ image
+ {
+ normal: "real_10.png";
}
}
}
- }
- }
- group
- {
- name: "modules/mem/swap_text";
- parts
- {
- part
+ part
{
- name: "text_clip";
- type: RECT;
- mouse_events: 0;
- description
+ name: "real_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: "real_meter";
}
rel2
{
- relative: 1.0 1.0;
- offset: -1 -1;
- }
+ relative: 0.5 1.0;
+ offset: -1 -1;
+ to: "real_meter";
+ }
+ text
+ {
+ text: "Real:";
+ 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: "swap-text";
- type: TEXT;
- effect: OUTLINE_SOFT_SHADOW;
- mouse_events: 0;
- clip_to: "text_clip";
+ name: "swap_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;
}
-
- color: 218 195 35 255;
- color2: 0 0 0 192;
- color3: 128 128 128 192;
- text
+ image
{
- text: "swap";
+ normal: "swap_00.png";
+ }
+ color: 255 255 255 192;
+ }
+ description
+ {
+ state: "default" 0.1;
+ inherit: "default" 0.0;
+ image
+ {
+ normal: "swap_01.png";
+ }
+ }
+ description
+ {
+ state: "default" 0.2;
+ inherit: "default" 0.0;
+ image
+ {
+ normal: "swap_02.png";
+ }
+ }
+ description
+ {
+ state: "default" 0.3;
+ inherit: "default" 0.0;
+ image
+ {
+ normal: "swap_03.png";
+ }
+ }
+ description
+ {
+ state: "default" 0.4;
+ inherit: "default" 0.0;
+ image
+ {
+ normal: "swap_04.png";
+ }
+ }
+ description
+ {
+ state: "default" 0.5;
+ inherit: "default" 0.0;
+ image
+ {
+ normal: "swap_05.png";
+ }
+ }
+ description
+ {
+ state: "default" 0.6;
+ inherit: "default" 0.0;
+ image
+ {
+ normal: "swap_06.png";
+ }
+ }
+ description
+ {
+ state: "default" 0.7;
+ inherit: "default" 0.0;
+ image
+ {
+ normal: "swap_07.png";
+ }
+ }
+ description
+ {
+ state: "default" 0.8;
+ inherit: "default" 0.0;
+ image
+ {
+ normal: "swap_08.png";
+ }
+ }
+ description
+ {
+ state: "default" 0.9;
+ inherit: "default" 0.0;
+ image
+ {
+ normal: "swap_09.png";
+ }
+ }
+ description
+ {
+ state: "default" 1.0;
+ inherit: "default" 0.0;
+ image
+ {
+ normal: "swap_10.png";
+ }
+ }
+ }
+ part
+ {
+ name: "swap_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: "swap_meter";
+ }
+ rel2
+ {
+ relative: 0.5 1.0;
+ offset: -1 -1;
+ to: "swap_meter";
+ }
+ text
+ {
+ text: "Swap:";
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: "real_label";
+ target: "swap_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: "real_label";
+ target: "swap_label";
}
-
}
}
}
-
===================================================================
RCS file: /cvs/e/e_modules/mem/module_icon.png,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
Binary files /tmp/cvsuMQPiB and /tmp/cvs4IIMsS differ
-------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs