From 77d0c345871528311e43c882da8fd8d8d6d4d8db Mon Sep 17 00:00:00 2001 From: Bruno Dilly Date: Thu, 29 Nov 2012 16:53:29 +0000 Subject: [PATCH] e/connman: just update popup list at each 5 secs If time is not good enough, can be fine tunned very easily (just change the define). I couldn't test this commit, so if tasn or other could, it would be great. I believe it won't be a perfect solution yet, since this way it will take some time to confirm visually the network states (association / configuration / connect) in the popup. We need to handle this case properly (if I'm correct). SVN revision: 79842 --- src/modules/connman/e_mod_main.c | 47 ++++++++++++++++++++++++++++++++ src/modules/connman/e_mod_main.h | 5 ++++ 2 files changed, 52 insertions(+) diff --git a/src/modules/connman/e_mod_main.c b/src/modules/connman/e_mod_main.c index 0d25e52db..85efef353 100644 --- a/src/modules/connman/e_mod_main.c +++ b/src/modules/connman/e_mod_main.c @@ -3,6 +3,8 @@ #include "E_Connman.h" +#define REFRESH_TIME (5) + E_Module *connman_mod = NULL; static char tmpbuf[4096]; /* general purpose buffer, just use immediately */ @@ -10,6 +12,8 @@ const char _e_connman_name[] = "connman"; const char _e_connman_Name[] = "Connection Manager"; int _e_connman_log_dom = -1; +static Eina_Bool _refresh_cb(void *data); + const char * e_connman_theme_path(void) { @@ -139,6 +143,17 @@ _econnman_popup_update(struct Connman_Manager *cm, E_Connman_Instance *inst) EINA_SAFETY_ON_NULL_RETURN(cm); + if (inst->popup_locked) + { + inst->popup_dirty = EINA_TRUE; + return; + } + + inst->popup_dirty = EINA_FALSE; + inst->popup_locked = EINA_TRUE; + if (!inst->refresh_timer) + inst->refresh_timer = ecore_timer_add(REFRESH_TIME, _refresh_cb, inst); + e_widget_ilist_freeze(list); e_widget_ilist_clear(list); @@ -268,6 +283,30 @@ _econnman_powered_changed(void *data, Evas_Object *obj, void *info __UNUSED__) econnman_powered_set(ctxt->cm, ctxt->powered); } +static Eina_Bool +_refresh_cb(void *data) +{ + E_Connman_Instance *inst = data; + E_Connman_Module_Context *ctxt = inst->ctxt; + + if ((!inst->popup) || (!ctxt->cm)) + { + inst->refresh_timer = NULL; + return EINA_FALSE; + } + + if (inst->popup_dirty) + { + _econnman_popup_update(ctxt->cm, inst); + return EINA_TRUE; + } + + inst->popup_locked = EINA_FALSE; + inst->refresh_timer = NULL; + + return EINA_FALSE; +} + static void _econnman_popup_new(E_Connman_Instance *inst) { @@ -295,6 +334,7 @@ _econnman_popup_new(E_Connman_Instance *inst) evas_object_smart_callback_add(ck, "changed", _econnman_powered_changed, inst); + inst->popup_locked = EINA_FALSE; _econnman_popup_update(ctxt->cm, inst); bt = e_widget_button_add(evas, _("Configure"), NULL, @@ -317,6 +357,13 @@ void econnman_popup_del(E_Connman_Instance *inst) { if (!inst->popup) return; + + if (inst->refresh_timer) + { + ecore_timer_del(inst->refresh_timer); + inst->refresh_timer = NULL; + } + _econnman_popup_input_window_destroy(inst); e_object_del(E_OBJECT(inst->popup)); inst->popup = NULL; diff --git a/src/modules/connman/e_mod_main.h b/src/modules/connman/e_mod_main.h index 4aa939543..75cd6e257 100644 --- a/src/modules/connman/e_mod_main.h +++ b/src/modules/connman/e_mod_main.h @@ -35,6 +35,11 @@ struct E_Connman_Instance Ecore_Event_Handler *input_mouse_up; } popup; } ui; + + Ecore_Timer *refresh_timer; + + Eina_Bool popup_dirty:1; + Eina_Bool popup_locked:1; }; struct E_Connman_Module_Context