Enlightenment CVS committal
Author : devilhorns
Project : e_modules
Module : tclock
Dir : e_modules/tclock
Modified Files:
Makefile.am configure.in e_mod_config.c e_mod_main.c
e_mod_main.h tclock.edc
Log Message:
Tclock now supports multiple clocks in multiple shelves, each with it's
own config. (DoubleHP: what you wanted can be done now)
Clipping of text to the module in the edc.
Themers: Minor changes to the edc (removal of background.png)
Translators: No Changes.
Users: You'll have to remove old module.tclock.cfg one more time :(
===================================================================
RCS file: /cvs/e/e_modules/tclock/Makefile.am,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- Makefile.am 16 May 2006 16:44:52 -0000 1.4
+++ Makefile.am 18 May 2006 11:18:23 -0000 1.5
@@ -3,15 +3,14 @@
SUBDIRS = po
EDJE_CC = @edje_cc@
-EDJE_FLAGS = -id $(srcdir)/images -fd $(srcdir)/fonts
+EDJE_FLAGS = -id . -fd $(srcdir)/fonts
filesdir = $(datadir)
files_DATA = module_icon.png \
module.eap \
$(wildcard tclock.ed?) \
- $(wildcard fonts/*.ttf) \
- $(wildcard images/*.png)
-
+ $(wildcard fonts/*.ttf)
+
EXTRA_DIST = $(files_DATA) e_modules-tclock.spec
CONFIG_CLEAN_FILES = e_modules-tclock.spec tclock.edj
===================================================================
RCS file: /cvs/e/e_modules/tclock/configure.in,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- configure.in 17 May 2006 14:27:23 -0000 1.8
+++ configure.in 18 May 2006 11:18:23 -0000 1.9
@@ -7,7 +7,7 @@
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
-AM_INIT_AUTOMAKE(tclock, 0.3.0)
+AM_INIT_AUTOMAKE(tclock, 0.3.2)
AM_CONFIG_HEADER(config.h)
AC_ISC_POSIX
AC_PROG_CC
===================================================================
RCS file: /cvs/e/e_modules/tclock/e_mod_config.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -3 -r1.17 -r1.18
--- e_mod_config.c 16 May 2006 16:44:52 -0000 1.17
+++ e_mod_config.c 18 May 2006 11:18:23 -0000 1.18
@@ -19,7 +19,7 @@
static void onDateCheckChange(void *data, Evas_Object *obj);
void
-_config_tclock_module(void)
+_config_tclock_module(Config_Item *ci)
{
E_Config_Dialog *cfd;
E_Config_Dialog_View *v;
@@ -33,30 +33,29 @@
v->basic.create_widgets = _basic_create_widgets;
con = e_container_current_get(e_manager_current_get());
- cfd = e_config_dialog_new(con, D_("Tclock Configuration"), NULL, 0, v,
NULL);
+ cfd = e_config_dialog_new(con, D_("Tclock Configuration"), NULL, 0, v, ci);
tclock_config->config_dialog = cfd;
}
static void
-_fill_data(E_Config_Dialog_Data *cfdata)
-{
- if (!tclock_config)
- return;
-
- cfdata->resolution = tclock_config->resolution;
- cfdata->show_time = tclock_config->show_time;
- cfdata->show_date = tclock_config->show_date;
- cfdata->time_format = strdup(tclock_config->time_format);
- cfdata->date_format = strdup(tclock_config->date_format);
+_fill_data(Config_Item *ci, E_Config_Dialog_Data *cfdata)
+{
+ cfdata->resolution = ci->resolution;
+ cfdata->show_time = ci->show_time;
+ cfdata->show_date = ci->show_date;
+ cfdata->time_format = strdup(ci->time_format);
+ cfdata->date_format = strdup(ci->date_format);
}
static void *
_create_data(E_Config_Dialog *cfd)
{
E_Config_Dialog_Data *cfdata;
-
+ Config_Item *ci;
+
+ ci = cfd->data;
cfdata = E_NEW(E_Config_Dialog_Data, 1);
- _fill_data(cfdata);
+ _fill_data(ci, cfdata);
return cfdata;
}
@@ -119,19 +118,19 @@
static int
_basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{
- if (!tclock_config)
- return;
+ Config_Item *ci;
- tclock_config->resolution = cfdata->resolution;
+ ci = cfd->data;
+ ci->resolution = cfdata->resolution;
if (cfdata->resolution == RESOLUTION_MINUTE)
- tclock_config->poll_time = 60.0;
+ ci->poll_time = 60.0;
else
- tclock_config->poll_time = 1.0;
+ ci->poll_time = 1.0;
- tclock_config->show_date = cfdata->show_date;
- tclock_config->show_time = cfdata->show_time;
- tclock_config->time_format = cfdata->time_format;
- tclock_config->date_format = cfdata->date_format;
+ ci->show_date = cfdata->show_date;
+ 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();
return 1;
===================================================================
RCS file: /cvs/e/e_modules/tclock/e_mod_main.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- e_mod_main.c 16 May 2006 16:44:52 -0000 1.18
+++ e_mod_main.c 18 May 2006 11:18:23 -0000 1.19
@@ -14,8 +14,11 @@
static void _tclock_menu_cb_configure(void *data, E_Menu *m, E_Menu_Item *mi);
static void _tclock_menu_cb_post(void *data, E_Menu *m);
static int _tclock_cb_check(void *data);
+static Config_Item *_tclock_config_item_get(const char *id);
static E_Config_DD *conf_edd = NULL;
+static E_Config_DD *conf_item_edd = NULL;
+
Config *tclock_config = NULL;
/* Define the class and gadcon functions this module provides */
@@ -33,6 +36,8 @@
{
E_Gadcon_Client *gcc;
Evas_Object *tclock;
+ Config_Item *cfg;
+ const char *id;
};
static E_Gadcon_Client *
@@ -42,9 +47,14 @@
E_Gadcon_Client *gcc;
Instance *inst;
char buf[4096];
+ Config_Item *ci;
inst = E_NEW(Instance, 1);
+ ci = _tclock_config_item_get(gc->id);
+ if (!ci->id) evas_stringshare_add(gc->id);
+ inst->id = evas_stringshare_add(ci->id);
+
o = edje_object_add(gc->evas);
snprintf(buf, sizeof(buf), "%s/tclock.edj",
e_module_dir_get(tclock_config->module));
if (!e_theme_edje_object_set(o, "base/theme/modules/tclock",
"modules/tclock/main"))
@@ -55,6 +65,7 @@
gcc->data = inst;
inst->gcc = gcc;
inst->tclock = o;
+ inst->cfg = ci;
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
_tclock_cb_mouse_down, inst);
@@ -70,6 +81,7 @@
Instance *inst;
inst = gcc->data;
+ evas_stringshare_del(inst->id);
tclock_config->instances = evas_list_remove(tclock_config->instances,
inst);
evas_object_del(inst->tclock);
free(inst);
@@ -81,8 +93,8 @@
Instance *inst;
inst = gcc->data;
- e_gadcon_client_aspect_set(gcc, 30, 16);
- e_gadcon_client_min_size_set(gcc, 30, 16);
+ e_gadcon_client_aspect_set(gcc, 16, 16);
+ e_gadcon_client_min_size_set(gcc, 16, 16);
}
static char *
@@ -125,7 +137,7 @@
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, _tclock_menu_cb_configure, NULL);
+ e_menu_item_callback_set(mi, _tclock_menu_cb_configure, inst);
e_gadcon_client_util_menu_items_append(inst->gcc, mn, 0);
e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon,
@@ -151,11 +163,17 @@
static void
_tclock_menu_cb_configure(void *data, E_Menu *m, E_Menu_Item *mi)
{
+ Instance *inst;
+ Config_Item *ci;
+
if (!tclock_config)
return;
if (tclock_config->config_dialog)
return;
- _config_tclock_module();
+
+ inst = data;
+ ci = _tclock_config_item_get(inst->gcc->gadcon->id);
+ _config_tclock_module(ci);
}
void
@@ -169,33 +187,34 @@
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)))
+ {
+ inst->cfg = ci;
- if (!tclock_config->show_time)
- edje_object_signal_emit(inst->tclock, "time_hidden", "");
- else
- edje_object_signal_emit(inst->tclock, "time_visible", "");
- edje_object_message_signal_process(inst->tclock);
+ if (!inst->cfg->show_time)
+ edje_object_signal_emit(inst->tclock, "time_hidden", "");
+ else
+ edje_object_signal_emit(inst->tclock, "time_visible", "");
+ edje_object_message_signal_process(inst->tclock);
- if (!tclock_config->show_date)
- {
- printf("Not Date\n");
- edje_object_signal_emit(inst->tclock, "date_hidden", "");
- }
- else
- {
- edje_object_signal_emit(inst->tclock, "date_visible", "");
+ if (!inst->cfg->show_date)
+ edje_object_signal_emit(inst->tclock, "date_hidden", "");
+ else
+ edje_object_signal_emit(inst->tclock, "date_visible", "");
+ edje_object_message_signal_process(inst->tclock);
+
+ if (tclock_config->tclock_check_timer)
+ ecore_timer_del(tclock_config->tclock_check_timer);
+
+ tclock_config->tclock_check_timer =
ecore_timer_add(inst->cfg->poll_time,
+
_tclock_cb_check, NULL);
+ _tclock_cb_check(NULL);
}
- edje_object_message_signal_process(inst->tclock);
}
-
- if (tclock_config->tclock_check_timer)
- ecore_timer_del(tclock_config->tclock_check_timer);
-
- tclock_config->tclock_check_timer =
ecore_timer_add(tclock_config->poll_time,
- _tclock_cb_check, NULL);
- _tclock_cb_check(NULL);
}
static int
@@ -214,31 +233,57 @@
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);
+ inst->cfg = ci;
- if (!tclock_config->show_time)
+ if (!inst->cfg->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 (!tclock_config->show_date)
+ if (!inst->cfg->show_date)
edje_object_signal_emit(inst->tclock, "date_hidden", "");
else
- edje_object_signal_emit(inst->tclock, "date_visible", "");
-
+ edje_object_signal_emit(inst->tclock, "date_visible", "");
edje_object_message_signal_process(inst->tclock);
- strftime(buf, 1024, tclock_config->time_format, local_time);
+ strftime(buf, 1024, inst->cfg->time_format, local_time);
edje_object_part_text_set(inst->tclock, "tclock_time", buf);
- strftime(buf, 1024, tclock_config->date_format, local_time);
+ strftime(buf, 1024, inst->cfg->date_format, local_time);
edje_object_part_text_set(inst->tclock, "tclock_date", buf);
}
return 1;
}
+static Config_Item *
+_tclock_config_item_get(const char *id)
+{
+ Evas_List *l;
+ Config_Item *ci;
+
+ for (l = tclock_config->items; l; l = l->next)
+ {
+ ci = l->data;
+ if ((ci->id) && (!strcmp(ci->id, id)))
+ return ci;
+ }
+ ci = E_NEW(Config_Item, 1);
+ ci->id = evas_stringshare_add(id);
+ 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");
+
+ tclock_config->items = evas_list_append(tclock_config->items, ci);
+ return ci;
+}
+
EAPI E_Module_Api e_modapi = {
E_MODULE_API_VERSION,
"TClock"
@@ -249,12 +294,13 @@
{
bindtextdomain(PACKAGE, LOCALEDIR);
bind_textdomain_codeset(PACKAGE, "UTF-8");
-
- conf_edd = E_CONFIG_DD_NEW("TClock_Config", Config);
+
+ conf_item_edd = E_CONFIG_DD_NEW("TClock_Config_Item", Config_Item);
#undef T
#undef D
- #define T Config
- #define D conf_edd
+ #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, resolution, INT);
E_CONFIG_VAL(D, T, show_date, INT);
@@ -262,25 +308,39 @@
E_CONFIG_VAL(D, T, date_format, STR);
E_CONFIG_VAL(D, T, time_format, STR);
+ conf_edd = E_CONFIG_DD_NEW("TClock_Config", Config);
+ #undef T
+ #undef D
+ #define T Config
+ #define D conf_edd
+ E_CONFIG_LIST(D, T, items, conf_item_edd);
+
tclock_config = e_config_domain_load("module.tclock", conf_edd);
if (!tclock_config)
{
+ Config_Item *ci;
+
tclock_config = E_NEW(Config, 1);
- tclock_config->poll_time = 1.0;
- tclock_config->resolution = RESOLUTION_SECOND;
- tclock_config->show_date = 1;
- tclock_config->show_time = 1;
- tclock_config->time_format = strdup("%T");
- tclock_config->date_format = strdup("%d/%m/%y");
+
+ ci = E_NEW(Config_Item, 1);
+ 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);
+ tclock_config->tclock_check_timer = ecore_timer_add(ci->poll_time,
+ _tclock_cb_check, NULL);
}
- E_CONFIG_LIMIT(tclock_config->poll_time, 1.0, 60.0);
- E_CONFIG_LIMIT(tclock_config->resolution, 0, 1);
- E_CONFIG_LIMIT(tclock_config->show_date, 0, 1);
- E_CONFIG_LIMIT(tclock_config->show_time, 0, 1);
-
- tclock_config->tclock_check_timer =
ecore_timer_add(tclock_config->poll_time,
- _tclock_cb_check, NULL);
tclock_config->module = m;
e_gadcon_provider_register(&_gc_class);
@@ -304,9 +364,20 @@
e_object_del(E_OBJECT(tclock_config->menu));
tclock_config->menu = NULL;
}
+
+ while (tclock_config->items)
+ {
+ 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);
+ free(ci);
+ }
free(tclock_config);
tclock_config = NULL;
+ E_CONFIG_DD_FREE(conf_item_edd);
E_CONFIG_DD_FREE(conf_edd);
return 1;
}
@@ -324,6 +395,18 @@
EAPI int
e_modapi_save(E_Module *m)
{
+ Evas_List *l;
+
+ 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 (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;
}
@@ -333,17 +416,5 @@
{
e_module_dialog_show(D_("Simple Digital Clock"),
D_("Displays a digital clock on the desktop"));
- return 1;
-}
-
-EAPI int
-e_modapi_config(E_Module *m)
-{
- if (!tclock_config)
- return 0;
- if (tclock_config->config_dialog)
- return 0;
-
- _config_tclock_module();
return 1;
}
===================================================================
RCS file: /cvs/e/e_modules/tclock/e_mod_main.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- e_mod_main.h 16 May 2006 16:44:52 -0000 1.11
+++ e_mod_main.h 18 May 2006 11:18:23 -0000 1.12
@@ -7,21 +7,27 @@
#define RESOLUTION_SECOND 1
typedef struct _Config Config;
+typedef struct _Config_Item Config_Item;
+
struct _Config
{
E_Module *module;
E_Config_Dialog *config_dialog;
E_Menu *menu;
Evas_List *instances;
-
+ Evas_List *items;
Ecore_Timer *tclock_check_timer;
-
+};
+
+struct _Config_Item
+{
+ const char *id;
int resolution;
double poll_time;
int show_time;
int show_date;
char *time_format;
- char *date_format;
+ char *date_format;
};
EAPI extern E_Module_Api e_modapi;
@@ -31,9 +37,8 @@
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 _config_tclock_module(void);
+void _config_tclock_module(Config_Item *ci);
void _tclock_config_updated(void);
extern Config *tclock_config;
===================================================================
RCS file: /cvs/e/e_modules/tclock/tclock.edc,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- tclock.edc 16 May 2006 17:49:13 -0000 1.7
+++ tclock.edc 18 May 2006 11:18:23 -0000 1.8
@@ -1,8 +1,3 @@
-images
-{
- image: "background.png" COMP;
-}
-
collections
{
group
@@ -12,24 +7,21 @@
{
part
{
- name: "background";
- type: IMAGE;
+ name: "base";
+ type: RECT;
description
{
state: "default" 0.0;
- image
- {
- normal: "background.png";
- border: 3 3 3 3;
- }
+ color: 255 255 255 255;
}
}
part
{
name: "tclock_time";
type: TEXT;
- effect: SOFT_SHADOW;
- mouse_events: 0;
+ effect: SOFT_SHADOW;
+ clip_to: "base";
+ //mouse_events: 0;
description
{
state: "default" 0.0;
@@ -73,7 +65,8 @@
name: "tclock_date";
type: TEXT;
effect: SOFT_SHADOW;
- mouse_events: 0;
+ clip_to: "base";
+ //mouse_events: 0;
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