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
This commit is contained in:
Bruno Dilly 2012-11-29 16:53:29 +00:00
parent 98a1ef6bd1
commit 77d0c34587
2 changed files with 52 additions and 0 deletions

View File

@ -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;

View File

@ -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