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
Log Message:
Indent for mej :)
===================================================================
RCS file: /cvs/e/e_modules/tclock/e_mod_config.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -3 -r1.20 -r1.21
--- e_mod_config.c 21 May 2006 15:29:30 -0000 1.20
+++ e_mod_config.c 22 May 2006 02:10:35 -0000 1.21
@@ -24,7 +24,7 @@
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;
@@ -39,7 +39,7 @@
static void
_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;
@@ -52,9 +52,10 @@
{
E_Config_Dialog_Data *cfdata;
Config_Item *ci;
-
+
ci = cfd->data;
cfdata = E_NEW(E_Config_Dialog_Data, 1);
+
_fill_data(ci, cfdata);
return cfdata;
}
@@ -63,7 +64,7 @@
_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{
if (!tclock_config)
- return;
+ return;
tclock_config->config_dialog = NULL;
free(cfdata);
}
@@ -95,10 +96,10 @@
e_widget_min_size_set(date_entry, 150, 1);
e_widget_frametable_object_append(of, date_entry, 0, 1, 1, 1, 1, 0, 1, 0);
ob = e_widget_label_add(evas, D_("Consult strftime(3) for format syntax"));
- e_widget_frametable_object_append(of, ob, 0, 2, 1, 1, 1, 0, 1, 0);
+ e_widget_frametable_object_append(of, ob, 0, 2, 1, 1, 1, 0, 1, 0);
e_widget_list_object_append(o, of, 1, 1, 0.5);
-
- of = e_widget_frametable_add(evas, D_("Time"), 1);
+
+ of = e_widget_frametable_add(evas, D_("Time"), 1);
time_check = e_widget_check_add(evas, D_("Show Time"),
&(cfdata->show_time));
if (cfdata->show_time)
e_widget_check_checked_set(time_check, 1);
@@ -109,9 +110,9 @@
e_widget_min_size_set(time_entry, 150, 1);
e_widget_frametable_object_append(of, time_entry, 0, 1, 1, 1, 1, 0, 1, 0);
ob = e_widget_label_add(evas, D_("Consult strftime(3) for format syntax"));
- e_widget_frametable_object_append(of, ob, 0, 2, 1, 1, 1, 0, 1, 0);
+ e_widget_frametable_object_append(of, ob, 0, 2, 1, 1, 1, 0, 1, 0);
e_widget_list_object_append(o, of, 1, 1, 0.5);
-
+
return o;
}
@@ -122,21 +123,21 @@
ci = cfd->data;
ci->show_date = cfdata->show_date;
- ci->show_time = cfdata->show_time;
+ ci->show_time = cfdata->show_time;
ci->time_format = cfdata->time_format;
ci->date_format = cfdata->date_format;
-
+
ci->resolution = cfdata->resolution;
if (cfdata->resolution == RESOLUTION_MINUTE)
- ci->poll_time = 60.0;
+ ci->poll_time = 60.0;
else
- ci->poll_time = 1.0;
-
+ ci->poll_time = 1.0;
+
/* If we're not showing time, no reason to update every second */
if (!cfdata->show_time)
- ci->poll_time = 60.0;
-
- e_config_save_queue();
+ ci->poll_time = 60.0;
+
+ e_config_save_queue();
_tclock_config_updated(ci->id);
return 1;
@@ -146,6 +147,7 @@
onTimeCheckChange(void *data, Evas_Object *obj)
{
int checked = e_widget_check_checked_get(obj);
+
e_widget_disabled_set(data, !checked);
}
@@ -153,5 +155,6 @@
onDateCheckChange(void *data, Evas_Object *obj)
{
int checked = e_widget_check_checked_get(obj);
+
e_widget_disabled_set(data, !checked);
}
===================================================================
RCS file: /cvs/e/e_modules/tclock/e_mod_main.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -3 -r1.26 -r1.27
--- e_mod_main.c 21 May 2006 14:45:49 -0000 1.26
+++ e_mod_main.c 22 May 2006 02:10:35 -0000 1.27
@@ -3,17 +3,17 @@
#include "e_mod_main.h"
/* Func Proto Requirements 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);
+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);
/* Module Protos */
-static void _tclock_cb_mouse_down (void *data, Evas *e, Evas_Object *obj, void
*event_info);
+static void _tclock_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void
*event_info);
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 int _tclock_cb_check(void *data);
static Config_Item *_tclock_config_item_get(const char *id);
static E_Config_DD *conf_edd = NULL;
@@ -22,17 +22,15 @@
Config *tclock_config = NULL;
/* Define the class and gadcon functions this module provides */
-static const E_Gadcon_Client_Class _gc_class =
-{
+static const E_Gadcon_Client_Class _gc_class = {
GADCON_CLIENT_CLASS_VERSION,
- "tclock",
- {
- _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon
- }
+ "tclock",
+ {
+ _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon}
};
typedef struct _Instance Instance;
-struct _Instance
+struct _Instance
{
E_Gadcon_Client *gcc;
Evas_Object *tclock;
@@ -40,182 +38,179 @@
};
static E_Gadcon_Client *
-_gc_init(E_Gadcon *gc, char *name, char *id, char *style)
+_gc_init(E_Gadcon *gc, char *name, char *id, char *style)
{
Evas_Object *o;
E_Gadcon_Client *gcc;
Instance *inst;
char buf[4096];
Config_Item *ci;
-
+
inst = E_NEW(Instance, 1);
-
+
ci = _tclock_config_item_get(id);
- if (!ci->id) ci->id = evas_stringshare_add(id);
-
+ if (!ci->id)
+ ci->id = evas_stringshare_add(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"))
edje_object_file_set(o, buf, "modules/tclock/main");
evas_object_show(o);
-
+
gcc = e_gadcon_client_new(gc, name, id, style, o);
gcc->data = inst;
inst->gcc = gcc;
inst->tclock = o;
-
- evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
- _tclock_cb_mouse_down, inst);
+
+ 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;
}
static void
-_gc_shutdown(E_Gadcon_Client *gcc)
+_gc_shutdown(E_Gadcon_Client *gcc)
{
Instance *inst;
-
+
inst = gcc->data;
if (inst->check_timer)
- ecore_timer_del(inst->check_timer);
- tclock_config->instances = evas_list_remove(tclock_config->instances,
inst);
+ ecore_timer_del(inst->check_timer);
+ tclock_config->instances = evas_list_remove(tclock_config->instances, inst);
evas_object_del(inst->tclock);
free(inst);
}
-static void
-_gc_orient(E_Gadcon_Client *gcc)
+static void
+_gc_orient(E_Gadcon_Client *gcc)
{
Instance *inst;
-
+
inst = gcc->data;
e_gadcon_client_aspect_set(gcc, 16, 16);
e_gadcon_client_min_size_set(gcc, 16, 16);
}
static char *
-_gc_label(void)
+_gc_label(void)
{
return D_("TClock");
}
static Evas_Object *
-_gc_icon(Evas *evas)
+_gc_icon(Evas *evas)
{
Evas_Object *o;
char buf[4096];
-
+
o = edje_object_add(evas);
- snprintf(buf, sizeof(buf), "%s/module.eap",
- e_module_dir_get(tclock_config->module));
+ snprintf(buf, sizeof(buf), "%s/module.eap",
e_module_dir_get(tclock_config->module));
edje_object_file_set(o, buf, "icon");
return o;
}
-static void
-_tclock_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
+static void
+_tclock_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Instance *inst;
Evas_Event_Mouse_Down *ev;
-
+
inst = data;
ev = event_info;
- if ((ev->button == 3) && (!tclock_config->menu))
+ if ((ev->button == 3) && (!tclock_config->menu))
{
- E_Menu *mn;
- E_Menu_Item *mi;
- int x, y, w, h;
-
- mn = e_menu_new();
- e_menu_post_deactivate_callback_set(mn, _tclock_menu_cb_post, inst);
- tclock_config->menu = mn;
-
- 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, _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,
- &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);
- }
+ E_Menu *mn;
+ E_Menu_Item *mi;
+ int x, y, w, h;
+
+ mn = e_menu_new();
+ e_menu_post_deactivate_callback_set(mn, _tclock_menu_cb_post, inst);
+ tclock_config->menu = mn;
+
+ 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, _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, &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);
+ }
}
static void
-_tclock_menu_cb_post(void *data, E_Menu *m)
+_tclock_menu_cb_post(void *data, E_Menu *m)
{
if (!tclock_config->menu)
- return;
+ return;
e_object_del(E_OBJECT(tclock_config->menu));
tclock_config->menu = NULL;
}
static void
-_tclock_menu_cb_configure(void *data, E_Menu *m, E_Menu_Item *mi)
+_tclock_menu_cb_configure(void *data, E_Menu *m, E_Menu_Item *mi)
{
Instance *inst;
Config_Item *ci;
-
+
inst = data;
ci = _tclock_config_item_get(inst->gcc->id);
_config_tclock_module(ci);
}
void
-_tclock_config_updated(const char *id)
+_tclock_config_updated(const char *id)
{
Evas_List *l;
Config_Item *ci;
-
+
if (!tclock_config)
- return;
+ return;
- ci = _tclock_config_item_get(id);
- for (l = tclock_config->instances; l; l = l->next)
+ ci = _tclock_config_item_get(id);
+ for (l = tclock_config->instances; l; l = l->next)
{
- Instance *inst;
-
- inst = l->data;
- if (!inst->gcc->id) continue;
- if (!strcmp(inst->gcc->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_message_signal_process(inst->tclock);
-
- if (!ci->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);
-
- _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;
- }
+ Instance *inst;
+
+ inst = l->data;
+ if (!inst->gcc->id)
+ continue;
+ if (!strcmp(inst->gcc->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_message_signal_process(inst->tclock);
+
+ if (!ci->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);
+
+ _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;
+ }
}
}
-static int
-_tclock_cb_check(void *data)
+static int
+_tclock_cb_check(void *data)
{
Instance *inst;
Config_Item *ci;
@@ -224,25 +219,25 @@
struct tm *local_time;
char buf[1024];
- inst = data;
+ inst = data;
ci = _tclock_config_item_get(inst->gcc->id);
- if (!ci->show_time)
- edje_object_signal_emit(inst->tclock, "time_hidden", "");
- else
- edje_object_signal_emit(inst->tclock, "time_visible", "");
+ if (!ci->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 (!ci->show_date)
- edje_object_signal_emit(inst->tclock, "date_hidden", "");
- else
- edje_object_signal_emit(inst->tclock, "date_visible", "");
+
+ if (!ci->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);
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);
@@ -252,16 +247,18 @@
}
static Config_Item *
-_tclock_config_item_get(const char *id)
+_tclock_config_item_get(const char *id)
{
Evas_List *l;
Config_Item *ci;
-
- for (l = tclock_config->items; l; l = l->next)
+
+ for (l = tclock_config->items; l; l = l->next)
{
- ci = l->data;
- if (!ci->id) continue;
- if (!strcmp(ci->id, id)) return ci;
+ ci = l->data;
+ if (!ci->id)
+ continue;
+ if (!strcmp(ci->id, id))
+ return ci;
}
ci = E_NEW(Config_Item, 1);
@@ -272,7 +269,7 @@
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;
}
@@ -284,15 +281,16 @@
EAPI void *
e_modapi_init(E_Module *m)
-{
+{
bindtextdomain(PACKAGE, LOCALEDIR);
bind_textdomain_codeset(PACKAGE, "UTF-8");
conf_item_edd = E_CONFIG_DD_NEW("TClock_Config_Item", Config_Item);
- #undef T
- #undef D
- #define T Config_Item
- #define D conf_item_edd
+
+#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, resolution, INT);
@@ -300,33 +298,35 @@
E_CONFIG_VAL(D, T, show_time, INT);
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
+
+#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)
+ if (!tclock_config)
{
- Config_Item *ci;
-
- 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");
-
- tclock_config->items = evas_list_append(tclock_config->items, ci);
+ Config_Item *ci;
+
+ 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");
+
+ tclock_config->items = evas_list_append(tclock_config->items, ci);
}
-
+
tclock_config->module = m;
e_gadcon_provider_register(&_gc_class);
@@ -338,26 +338,27 @@
{
tclock_config->module = NULL;
e_gadcon_provider_unregister(&_gc_class);
-
+
if (tclock_config->config_dialog)
- e_object_del(E_OBJECT(tclock_config->config_dialog));
- if (tclock_config->menu)
+ e_object_del(E_OBJECT(tclock_config->config_dialog));
+ if (tclock_config->menu)
{
- e_menu_post_deactivate_callback_set(tclock_config->menu, NULL, NULL);
- e_object_del(E_OBJECT(tclock_config->menu));
- tclock_config->menu = NULL;
+ e_menu_post_deactivate_callback_set(tclock_config->menu, NULL, NULL);
+ e_object_del(E_OBJECT(tclock_config->menu));
+ tclock_config->menu = NULL;
}
- while (tclock_config->items)
+ while (tclock_config->items)
{
- Config_Item *ci;
-
- ci = tclock_config->items->data;
- tclock_config->items = evas_list_remove_list(tclock_config->items,
tclock_config->items);
- if (ci->id) evas_stringshare_del(ci->id);
- free(ci);
+ Config_Item *ci;
+
+ ci = tclock_config->items->data;
+ tclock_config->items = evas_list_remove_list(tclock_config->items,
tclock_config->items);
+ if (ci->id)
+ evas_stringshare_del(ci->id);
+ free(ci);
}
-
+
free(tclock_config);
tclock_config = NULL;
E_CONFIG_DD_FREE(conf_item_edd);
@@ -369,7 +370,7 @@
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;
@@ -379,16 +380,17 @@
e_modapi_save(E_Module *m)
{
Evas_List *l;
-
- for (l = tclock_config->instances; l; l = l->next)
+
+ for (l = tclock_config->instances; l; l = l->next)
{
- Instance *inst;
- Config_Item *ci;
-
- inst = l->data;
- ci = _tclock_config_item_get(inst->gcc->id);
- if (ci->id) evas_stringshare_del(ci->id);
- ci->id = evas_stringshare_add(inst->gcc->id);
+ Instance *inst;
+ Config_Item *ci;
+
+ inst = l->data;
+ ci = _tclock_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.tclock", conf_edd, tclock_config);
return 1;
@@ -397,7 +399,6 @@
EAPI int
e_modapi_about(E_Module *m)
{
- e_module_dialog_show(D_("Simple Digital Clock"),
- D_("Displays a digital clock on the desktop"));
+ e_module_dialog_show(D_("Simple Digital Clock"), D_("Displays a digital
clock on the desktop"));
return 1;
}
===================================================================
RCS file: /cvs/e/e_modules/tclock/e_mod_main.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- e_mod_main.h 19 May 2006 10:43:18 -0000 1.14
+++ e_mod_main.h 22 May 2006 02:10:35 -0000 1.15
@@ -18,7 +18,7 @@
Evas_List *items;
};
-struct _Config_Item
+struct _Config_Item
{
const char *id;
int resolution;
@@ -26,7 +26,7 @@
int show_time;
int show_date;
char *time_format;
- char *date_format;
+ char *date_format;
};
EAPI extern E_Module_Api e_modapi;
-------------------------------------------------------
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