Enlightenment CVS committal Author : mekius Project : e17 Module : apps/e
Dir : e17/apps/e/src/modules/battery Modified Files: e_mod_main.c Log Message: Fix an issue with the auto popup hiding. Reenable popup after reconfiguring the battery module. =================================================================== RCS file: /cvs/e/e17/apps/e/src/modules/battery/e_mod_main.c,v retrieving revision 1.117 retrieving revision 1.118 diff -u -3 -r1.117 -r1.118 --- e_mod_main.c 3 May 2008 20:12:57 -0000 1.117 +++ e_mod_main.c 3 May 2008 21:49:37 -0000 1.118 @@ -44,9 +44,10 @@ static void _battery_face_time_set(Evas_Object *battery, int time); static void _battery_face_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *mi); +static int _battery_cb_warning_popup_timeout(void *data); static void _battery_cb_warning_popup_hide(void *data, Evas *e, Evas_Object *obj, void *event); static void _battery_warning_popup_resize(Evas_Object *obj, int *w, int *h); -static int _battery_warning_popup_destroy(void *data); +static void _battery_warning_popup_destroy(Instance *inst); static void _battery_warning_popup(Instance *inst, int time, double percent); static E_Config_DD *conf_edd = NULL; @@ -167,7 +168,7 @@ mi = e_menu_item_new(mn); e_menu_item_label_set(mi, _("Configuration")); - e_util_menu_item_edje_icon_set(mi, "enlightenment/configuration"); + e_util_menu_item_edje_icon_set(mi, "enlightenment/configuration"); e_menu_item_callback_set(mi, _battery_face_cb_menu_configure, NULL); e_gadcon_client_util_menu_items_append(inst->gcc, mn, 0); @@ -232,9 +233,17 @@ void _battery_config_updated(void) { + Evas_List *l = NULL; char buf[4096]; if (!battery_config) return; + + if(battery_config->instances) + { + for (l = battery_config->instances; l; l = l->next) + _battery_warning_popup_destroy(l->data); + } + if (battery_config->batget_exe) { ecore_exe_terminate(battery_config->batget_exe); @@ -252,16 +261,13 @@ } static int -_battery_warning_popup_destroy(void *data) +_battery_cb_warning_popup_timeout(void *data) { Instance *inst; inst = data; - if ((!inst) || (!inst->warning)) return; - e_object_del(E_OBJECT(inst->warning)); - inst->warning = NULL; - inst->popup_battery = NULL; + e_gadcon_popup_hide(inst->warning); return 0; } @@ -274,7 +280,17 @@ inst = (Instance *)data; if ((!inst) || (!inst->warning)) return; - _battery_warning_popup_destroy(inst); + e_gadcon_popup_hide(inst->warning); +} + +static void +_battery_warning_popup_destroy(Instance *inst) +{ + if(!inst || !inst->warning) return; + + e_object_del(E_OBJECT(inst->warning)); + inst->warning = NULL; + inst->popup_battery = NULL; } static void @@ -341,7 +357,7 @@ if (battery_config->alert_timeout) { ecore_timer_add(battery_config->alert_timeout, - _battery_warning_popup_destroy, inst); + _battery_cb_warning_popup_timeout, inst); } } @@ -500,6 +516,9 @@ int mins, hrs; static int debounce_popup = 0; + if (debounce_popup > POPUP_DEBOUNCE_CYCLES) + debounce_popup = 0; + if (sscanf(ev->lines[i].line, "%i %i %i %i", &full, &time_left, &have_battery, &have_power) == 4) @@ -560,11 +579,8 @@ if (++debounce_popup == POPUP_DEBOUNCE_CYCLES) _battery_warning_popup(inst, time_left, (double)full/100.0); } - else if (have_power) - { - _battery_warning_popup_destroy(inst); - debounce_popup = 0; - } + else if(have_power) + _battery_warning_popup_destroy(inst); } if (!have_battery) e_powersave_mode_set(E_POWERSAVE_MODE_LOW); ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs