detab
This commit is contained in:
parent
eee6b70ec6
commit
d0ed2d6e00
106
src/e_mod_main.c
106
src/e_mod_main.c
|
@ -38,10 +38,10 @@ static Ecore_Timer *check_timer;
|
|||
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, _gc_id_new,
|
||||
GADCON_CLIENT_CLASS_VERSION, "tclock",
|
||||
{ _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new,
|
||||
NULL, NULL },
|
||||
E_GADCON_CLIENT_STYLE_PLAIN
|
||||
};
|
||||
|
@ -70,7 +70,7 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
|||
|
||||
o = edje_object_add(gc->evas);
|
||||
snprintf(buf, sizeof(buf), "%s/tclock.edj", tclock_config->mod_dir);
|
||||
if (!e_theme_edje_object_set(o, "base/theme/modules/tclock",
|
||||
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);
|
||||
|
@ -115,10 +115,10 @@ _gc_shutdown(E_Gadcon_Client *gcc)
|
|||
tclock_config->instances =
|
||||
eina_list_remove(tclock_config->instances, inst);
|
||||
|
||||
if (eina_list_count(tclock_config->instances) <= 0)
|
||||
if (eina_list_count(tclock_config->instances) <= 0)
|
||||
{
|
||||
if (check_timer) ecore_timer_del(check_timer);
|
||||
check_timer = NULL;
|
||||
if (check_timer) ecore_timer_del(check_timer);
|
||||
check_timer = NULL;
|
||||
}
|
||||
|
||||
E_FREE(inst);
|
||||
|
@ -185,17 +185,17 @@ _tclock_cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED_
|
|||
m = e_gadcon_client_util_menu_items_append(inst->gcc, m, 0);
|
||||
e_menu_post_deactivate_callback_set(m, _tclock_menu_cb_post, inst);
|
||||
tclock_config->menu = m;
|
||||
|
||||
|
||||
e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, &x, &y, NULL, NULL);
|
||||
e_menu_activate_mouse (m,
|
||||
e_util_zone_current_get(e_manager_current_get()),
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_tclock_cb_mouse_in(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||
static void
|
||||
_tclock_cb_mouse_in(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||
{
|
||||
Instance *inst = NULL;
|
||||
char buf[1024];
|
||||
|
@ -219,8 +219,8 @@ _tclock_cb_mouse_in(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *even
|
|||
e_gadcon_popup_show(inst->tip);
|
||||
}
|
||||
|
||||
static void
|
||||
_tclock_cb_mouse_out(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||
static void
|
||||
_tclock_cb_mouse_out(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||
{
|
||||
Instance *inst = NULL;
|
||||
|
||||
|
@ -288,39 +288,39 @@ _tclock_cb_check(void *data __UNUSED__)
|
|||
|
||||
current_time = time(NULL);
|
||||
local_time = localtime(¤t_time);
|
||||
for (l = tclock_config->instances; l; l = l->next)
|
||||
for (l = tclock_config->instances; l; l = l->next)
|
||||
{
|
||||
inst = l->data;
|
||||
inst = l->data;
|
||||
|
||||
if (!inst->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 (!inst->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);
|
||||
if (!inst->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);
|
||||
|
||||
memset(buf, 0, sizeof(buf));
|
||||
if (!inst->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);
|
||||
|
||||
if (inst->ci->time_format)
|
||||
{
|
||||
memset(buf, 0, sizeof(buf));
|
||||
|
||||
if (inst->ci->time_format)
|
||||
{
|
||||
strftime(buf, 1024, inst->ci->time_format, local_time);
|
||||
edje_object_part_text_set(inst->tclock, "tclock_time", buf);
|
||||
}
|
||||
if (inst->ci->date_format)
|
||||
{
|
||||
}
|
||||
if (inst->ci->date_format)
|
||||
{
|
||||
strftime(buf, 1024, inst->ci->date_format, local_time);
|
||||
edje_object_part_text_set(inst->tclock, "tclock_date", buf);
|
||||
}
|
||||
if ((inst->ci->tip_format) && (inst->o_tip))
|
||||
{
|
||||
}
|
||||
if ((inst->ci->tip_format) && (inst->o_tip))
|
||||
{
|
||||
strftime(buf, 1024, inst->ci->tip_format, local_time);
|
||||
elm_object_text_set(inst->o_tip, buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return EINA_TRUE;
|
||||
|
@ -334,29 +334,29 @@ _tclock_config_item_get(const char *id)
|
|||
|
||||
if (!id)
|
||||
{
|
||||
int num = 0;
|
||||
int num = 0;
|
||||
char buf[128];
|
||||
|
||||
/* Create id */
|
||||
if (tclock_config->items)
|
||||
{
|
||||
const char *p;
|
||||
/* Create id */
|
||||
if (tclock_config->items)
|
||||
{
|
||||
const char *p;
|
||||
|
||||
ci = eina_list_last(tclock_config->items)->data;
|
||||
p = strrchr(ci->id, '.');
|
||||
if (p) num = atoi(p + 1) + 1;
|
||||
}
|
||||
snprintf(buf, sizeof(buf), "%s.%d", _gc_class.name, num);
|
||||
id = buf;
|
||||
ci = eina_list_last(tclock_config->items)->data;
|
||||
p = strrchr(ci->id, '.');
|
||||
if (p) num = atoi(p + 1) + 1;
|
||||
}
|
||||
snprintf(buf, sizeof(buf), "%s.%d", _gc_class.name, num);
|
||||
id = buf;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (l = tclock_config->items; l; l = l->next)
|
||||
{
|
||||
ci = l->data;
|
||||
if (!ci->id) continue;
|
||||
if (!strcmp(ci->id, id)) return ci;
|
||||
}
|
||||
for (l = tclock_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);
|
||||
|
|
Loading…
Reference in New Issue