From 625032ba0b18b8bd9e1128cc2dc5e7ca931bba64 Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Wed, 28 Jan 2015 14:19:36 +0000 Subject: [PATCH] style updates --- src/e_mod_main.c | 81 +++++++++++++++++++++++++----------------------- 1 file changed, 42 insertions(+), 39 deletions(-) diff --git a/src/e_mod_main.c b/src/e_mod_main.c index a78d654..824d9ab 100644 --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -41,8 +41,9 @@ Config *tclock_config = NULL; 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, - NULL, NULL }, + { _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, + NULL, NULL + }, E_GADCON_CLIENT_STYLE_PLAIN }; @@ -66,13 +67,14 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style) inst = E_NEW(Instance, 1); inst->ci = _tclock_config_item_get(id); - if (!inst->ci->id) inst->ci->id = eina_stringshare_add(id); + if (!inst->ci->id) + inst->ci->id = eina_stringshare_add(id); 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", "modules/tclock/main")) - edje_object_file_set(o, buf, "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); @@ -87,12 +89,12 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style) evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_OUT, _tclock_cb_mouse_out, inst); - tclock_config->instances = - eina_list_append(tclock_config->instances, inst); + tclock_config->instances = eina_list_append(tclock_config->instances, inst); _tclock_cb_check(inst); if (!check_timer) check_timer = ecore_timer_add(1.0, _tclock_cb_check, NULL); + return gcc; } @@ -101,7 +103,8 @@ _gc_shutdown(E_Gadcon_Client *gcc) { Instance *inst; - if (!(inst = gcc->data)) return; + if (!(inst = gcc->data)) + return; evas_object_event_callback_del(inst->tclock, EVAS_CALLBACK_MOUSE_DOWN, _tclock_cb_mouse_down); @@ -110,14 +113,15 @@ _gc_shutdown(E_Gadcon_Client *gcc) evas_object_event_callback_del(inst->tclock, EVAS_CALLBACK_MOUSE_OUT, _tclock_cb_mouse_out); - if (inst->tclock) evas_object_del(inst->tclock); + if (inst->tclock) + evas_object_del(inst->tclock); - tclock_config->instances = - eina_list_remove(tclock_config->instances, inst); + tclock_config->instances = eina_list_remove(tclock_config->instances, inst); if (eina_list_count(tclock_config->instances) <= 0) { - if (check_timer) ecore_timer_del(check_timer); + if (check_timer) + ecore_timer_del(check_timer); check_timer = NULL; } @@ -130,7 +134,9 @@ _gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient __UNUSED__) Instance *inst; Evas_Coord mw; - if (!(inst = gcc->data)) return; + if (!(inst = gcc->data)) + return; + edje_object_size_min_calc(inst->tclock, &mw, NULL); e_gadcon_client_min_size_set(gcc, mw, 16); } @@ -147,7 +153,7 @@ _gc_icon(const E_Gadcon_Client_Class *client_class __UNUSED__, Evas *evas) Evas_Object *o; char buf[PATH_MAX]; - o = edje_object_add (evas); + o = edje_object_add(evas); snprintf(buf, sizeof(buf), "%s/e-module-tclock.edj", tclock_config->mod_dir); edje_object_file_set(o, buf, "icon"); return o; @@ -156,10 +162,7 @@ _gc_icon(const E_Gadcon_Client_Class *client_class __UNUSED__, Evas *evas) static const char * _gc_id_new(const E_Gadcon_Client_Class *client_class __UNUSED__) { - Config_Item *ci; - - ci = _tclock_config_item_get(NULL); - return ci->id; + return _tclock_config_item_get(NULL)->id; } static void @@ -187,10 +190,10 @@ _tclock_cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED_ 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()), - x + ev->output.x, y + ev->output.y, 1, 1, - E_MENU_POP_DIRECTION_DOWN, ev->timestamp); + e_menu_activate_mouse(m, + 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); } } @@ -202,9 +205,8 @@ _tclock_cb_mouse_in(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *even time_t current_time; struct tm *local_time; - if (!(inst = data)) return; - if (!inst->ci->show_tip) return; - if (inst->tip) return; + if (!(inst = data) || !inst->ci->show_tip || inst->tip) + return; inst->tip = e_gadcon_popup_new(inst->gcc, EINA_FALSE); @@ -223,9 +225,8 @@ static void _tclock_cb_mouse_out(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) { Instance *inst = NULL; - - if (!(inst = data)) return; - if (!inst->tip) return; + if (!(inst = data) || !inst->tip) + return; evas_object_del(inst->o_tip); e_object_del(E_OBJECT(inst->tip)); inst->tip = NULL; @@ -235,7 +236,8 @@ _tclock_cb_mouse_out(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__ static void _tclock_menu_cb_post(void *data __UNUSED__, E_Menu *m __UNUSED__) { - if (!tclock_config->menu) return; + if (!tclock_config->menu) + return; e_object_del(E_OBJECT(tclock_config->menu)); tclock_config->menu = NULL; } @@ -244,8 +246,8 @@ static void _tclock_menu_cb_configure(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__) { Instance *inst = NULL; - - if (!(inst = data)) return; + if (!(inst = data)) + return; _config_tclock_module(inst->ci); } @@ -254,13 +256,15 @@ _tclock_config_updated(Config_Item *ci) { Eina_List *l; - if (!tclock_config) return; + if (!tclock_config) + return; + for (l = tclock_config->instances; l; l = l->next) { - Instance *inst; + Instance *inst = l->data; + if (inst->ci != ci) + continue; - inst = l->data; - if (inst->ci != ci) continue; if (!inst->ci->show_time) edje_object_signal_emit(inst->tclock, "time_hidden", ""); else @@ -280,7 +284,6 @@ _tclock_config_updated(Config_Item *ci) static Eina_Bool _tclock_cb_check(void *data __UNUSED__) { - Instance *inst; Eina_List *l; time_t current_time; struct tm *local_time; @@ -288,9 +291,10 @@ _tclock_cb_check(void *data __UNUSED__) current_time = time(NULL); local_time = localtime(¤t_time); + for (l = tclock_config->instances; l; l = l->next) { - inst = l->data; + Instance *inst = l->data; if (!inst->ci->show_time) edje_object_signal_emit(inst->tclock, "time_hidden", ""); @@ -319,7 +323,7 @@ _tclock_cb_check(void *data __UNUSED__) 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); + elm_object_text_set(inst->o_tip, buf); } } @@ -341,7 +345,6 @@ _tclock_config_item_get(const char *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; @@ -459,7 +462,7 @@ e_modapi_shutdown(E_Module *m __UNUSED__) eina_stringshare_del(ci->date_format); if (ci->tip_format) eina_stringshare_del(ci->tip_format); - E_FREE (ci); + E_FREE(ci); } if (tclock_config->mod_dir) eina_stringshare_del(tclock_config->mod_dir);