Enlightenment CVS committal
Author : devilhorns
Project : e_modules
Module : tclock
Dir : e_modules/tclock
Modified Files:
e_mod_config.c e_mod_main.c e_mod_main.h tclock.edc
Log Message:
Code cleanup, reorganization.
Edc cleanup (removed some C++ comments)
===================================================================
RCS file: /cvs/e/e_modules/tclock/e_mod_config.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- e_mod_config.c 18 May 2006 11:18:23 -0000 1.18
+++ e_mod_config.c 19 May 2006 10:43:18 -0000 1.19
@@ -131,8 +131,9 @@
ci->show_time = cfdata->show_time;
ci->time_format = cfdata->time_format;
ci->date_format = cfdata->date_format;
- _tclock_config_updated();
e_config_save_queue();
+
+ _tclock_config_updated(ci->id);
return 1;
}
===================================================================
RCS file: /cvs/e/e_modules/tclock/e_mod_main.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -3 -r1.22 -r1.23
--- e_mod_main.c 18 May 2006 20:34:29 -0000 1.22
+++ e_mod_main.c 19 May 2006 10:43:18 -0000 1.23
@@ -53,7 +53,7 @@
ci = _tclock_config_item_get(gc->id);
if (!ci->id) ci->id = evas_stringshare_add(gc->id);
- inst->id = evas_stringshare_add(ci->id);
+ inst->id = evas_stringshare_add(gc->id);
o = edje_object_add(gc->evas);
snprintf(buf, sizeof(buf), "%s/tclock.edj",
e_module_dir_get(tclock_config->module));
@@ -68,10 +68,12 @@
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
_tclock_cb_mouse_down, inst);
+
tclock_config->instances = evas_list_append(tclock_config->instances, inst);
_tclock_cb_check(inst);
inst->check_timer = ecore_timer_add(ci->poll_time, _tclock_cb_check, inst);
+
return gcc;
}
@@ -81,9 +83,9 @@
Instance *inst;
inst = gcc->data;
+ evas_stringshare_del(inst->id);
if (inst->check_timer)
ecore_timer_del(inst->check_timer);
- evas_stringshare_del(inst->id);
tclock_config->instances = evas_list_remove(tclock_config->instances,
inst);
evas_object_del(inst->tclock);
free(inst);
@@ -168,37 +170,33 @@
Instance *inst;
Config_Item *ci;
- if (!tclock_config)
- return;
- if (tclock_config->config_dialog)
- return;
-
inst = data;
ci = _tclock_config_item_get(inst->gcc->gadcon->id);
_config_tclock_module(ci);
}
void
-_tclock_config_updated(void)
+_tclock_config_updated(const char *id)
{
Evas_List *l;
+ Config_Item *ci;
if (!tclock_config)
return;
+ ci = _tclock_config_item_get(id);
for (l = tclock_config->instances; l; l = l->next)
{
Instance *inst;
- Config_Item *ci;
inst = l->data;
- ci = _tclock_config_item_get(inst->gcc->gadcon->id);
- if ((inst->id) && (ci->id) && (!strcmp(inst->id, ci->id)))
+ if (!inst->gcc->gadcon->id) continue;
+ if (!strcmp(inst->gcc->gadcon->id, ci->id))
{
if (!ci->show_time)
edje_object_signal_emit(inst->tclock, "time_hidden", "");
else
- edje_object_signal_emit(inst->tclock, "time_visible", "");
+ edje_object_signal_emit(inst->tclock, "time_visible", "");
edje_object_message_signal_process(inst->tclock);
if (!ci->show_date)
@@ -207,11 +205,14 @@
edje_object_signal_emit(inst->tclock, "date_visible", "");
edje_object_message_signal_process(inst->tclock);
- if (inst->check_timer)
- ecore_timer_del(inst->check_timer);
-
_tclock_cb_check(inst);
- inst->check_timer = ecore_timer_add(ci->poll_time,
_tclock_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,
_tclock_cb_check, inst);
+
+ break;
}
}
}
@@ -226,13 +227,9 @@
struct tm *local_time;
char buf[1024];
- memset(buf, 0, sizeof(buf));
- current_time = time(NULL);
- local_time = localtime(¤t_time);
-
- inst = data;
+ inst = data;
ci = _tclock_config_item_get(inst->gcc->gadcon->id);
-
+
if (!ci->show_time)
edje_object_signal_emit(inst->tclock, "time_hidden", "");
else
@@ -244,7 +241,11 @@
else
edje_object_signal_emit(inst->tclock, "date_visible", "");
edje_object_message_signal_process(inst->tclock);
-
+
+ memset(buf, 0, sizeof(buf));
+ current_time = time(NULL);
+ local_time = localtime(¤t_time);
+
strftime(buf, 1024, ci->time_format, local_time);
edje_object_part_text_set(inst->tclock, "tclock_time", buf);
strftime(buf, 1024, ci->date_format, local_time);
@@ -262,9 +263,10 @@
for (l = tclock_config->items; l; l = l->next)
{
ci = l->data;
- if ((ci->id) && (!strcmp(ci->id, id)))
- return ci;
+ 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;
@@ -317,18 +319,13 @@
tclock_config = E_NEW(Config, 1);
ci = E_NEW(Config_Item, 1);
+ ci->id = evas_stringshare_add("0");
ci->poll_time = 1.0;
ci->resolution = RESOLUTION_SECOND;
ci->show_date = 1;
ci->show_time = 1;
ci->time_format = strdup("%T");
ci->date_format = strdup("%d/%m/%y");
- ci->id = evas_stringshare_add("0");
-
- E_CONFIG_LIMIT(ci->poll_time, 1.0, 60.0);
- E_CONFIG_LIMIT(ci->resolution, 0, 1);
- E_CONFIG_LIMIT(ci->show_date, 0, 1);
- E_CONFIG_LIMIT(ci->show_time, 0, 1);
tclock_config->items = evas_list_append(tclock_config->items, ci);
}
@@ -346,10 +343,7 @@
e_gadcon_provider_unregister(&_gc_class);
if (tclock_config->config_dialog)
- e_object_del(E_OBJECT(tclock_config->config_dialog));
-
-// if (tclock_config->tclock_check_timer)
-// ecore_timer_del(tclock_config->tclock_check_timer);
+ e_object_del(E_OBJECT(tclock_config->config_dialog));
if (tclock_config->menu)
{
e_menu_post_deactivate_callback_set(tclock_config->menu, NULL, NULL);
@@ -362,8 +356,8 @@
Config_Item *ci;
ci = tclock_config->items->data;
- if (ci->id) evas_stringshare_del(ci->id);
tclock_config->items = evas_list_remove_list(tclock_config->items,
tclock_config->items);
+ if (ci->id) evas_stringshare_del(ci->id);
free(ci);
}
@@ -398,7 +392,7 @@
ci = _tclock_config_item_get(inst->gcc->gadcon->id);
if (ci->id) evas_stringshare_del(ci->id);
ci->id = evas_stringshare_add(inst->gcc->gadcon->id);
- }
+ }
e_config_domain_save("module.tclock", conf_edd, tclock_config);
return 1;
}
===================================================================
RCS file: /cvs/e/e_modules/tclock/e_mod_main.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- e_mod_main.h 18 May 2006 20:34:29 -0000 1.13
+++ e_mod_main.h 19 May 2006 10:43:18 -0000 1.14
@@ -38,7 +38,7 @@
EAPI int e_modapi_about(E_Module *m);
void _config_tclock_module(Config_Item *ci);
-void _tclock_config_updated(void);
+void _tclock_config_updated(const char *id);
extern Config *tclock_config;
#endif
===================================================================
RCS file: /cvs/e/e_modules/tclock/tclock.edc,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- tclock.edc 19 May 2006 00:35:55 -0000 1.11
+++ tclock.edc 19 May 2006 10:43:18 -0000 1.12
@@ -20,7 +20,6 @@
name: "tclock_time";
type: TEXT;
effect: SOFT_SHADOW;
-// clip_to: "base";
description
{
state: "default" 0.0;
@@ -64,7 +63,6 @@
name: "tclock_date";
type: TEXT;
effect: SOFT_SHADOW;
-// clip_to: "base";
description
{
state: "default" 0.0;
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs