enlightenment/src/modules/battery/e_mod_config.c

375 lines
13 KiB
C
Raw Normal View History

#include "e.h"
#include "e_mod_main.h"
2006-01-14 08:10:57 -08:00
struct _E_Config_Dialog_Data
{
int show_alert;
e: 1. configure/build changes to allow cross-compiling painlessly 2. pager module namespace changes - this was still dirty afdter the namespace cleanup, so clean it up 3. add a powersave subsystem - doesnt have an "automatic" way to turn on and off right now, this i think is best provided by modules (that do things like monitor acpi status's (eg close lid of laptop), AC power status etc. etc. this allows e to nicely defer "power" expensive actions to avoid disk spinups etc. 4. move to use the new ecore poller system - discussed long ago as part of power management/saving issues. now it exists 5. add a canvas idle flush call that helsp cope with the new shm greedy software x11 engine stuff 6. use the new powersave subsystem where appropriate 7. fix non-zeroed/initted memory access in e_fm_main 8. fix mem leak for e menus 9. remove ipc handlers for changed/removed config values 10. use animaotr not timer for menu scrolls - then menu scrolls obey the fps config 11. fix up timer/poll happienss of cursor idle stuff 12. remove avoid damage from popups for now - causing problems 13. change battery and temp readouts to b e shorter so they fit 14. pager can emit signals on focus change for mini-windows now 15. temperature module now uses a slave process and uses stdin/out to talk to it and get output - this makes e smoother as in my expereicne i found getting the temp on my laptop actually took like 200ms so e "hang" for 200ms while reading the acpi files - so now the subprocess does it and just writesa back to e when it gets it. ecore: 1. add ecore_pollers. see the documentation on them in doxygen comments :) 2. fix timers to only go off when they have to - bug there that made e's select time out a LOT more than it needed to. defensive coding hid the problem. now fixed. e should be much more power friendly now. 3. formatting/niceness in ecore_exe stuff 4. some comments on comments with SIGIO ideas vs. select 5. add call to be able to add an idle enterer at the start of the list of them, not just the end (as has been the default) 6. fix ecore_evas to support auto evas idler calls after 0.5 secs of idle in all canvases - and to do it right 7. if argb destination - set the shape EVENT shape (to mask out events in transparent regions much like shape does withotu translucency) 8. in ecore_x add support for the event shape evas: 1. fix cache to work properly and not just always fill up (as it seemed to like to think cahce useage dropped below 0 when it didnt and thus just over-fill) 2. software x11 engine now ONLY uses shm segments - no ximages over the socket. this ximage hack was there to avoid the 2 round trips involved in setting up an shm image - now i mitigated that wih an shm image cache pool. it keeps shm images around and repurposes them for new update regions if appropriate. this means many fewer shm creates (about 1/100th the number) and since we recycle the memory less 0 memory page filling by the kernel - in the end, i recorded about a 10-20% speedup over the old software x11 engine. simple tests i have seen up to 120% speedups. idle flush now does something - it frees all the cached shm segments. it has a hard-coded limit of 4mb worth of shm segments (or 32 segments - whichever comes first) to keep around. once can never complain much about speedups methinks :). also evas will defer sync until the NEXT frame is written - this means evas can calculate the next frame of data while x dma's/copies the images to the screen at the same time (if you hve a dual core or multi-cpu machnike or your xserver is able to use DMA to copy image data to the screen/video ram then this should see a decent speedup). SVN revision: 33448
2008-01-10 23:33:57 -08:00
int poll_interval;
#ifdef HAVE_EEZE
int fuzzy;
#endif
int alert_time;
int alert_percent;
int dismiss_alert;
int alert_timeout;
int suspend_below;
int suspend_method;
int force_mode; // 0 == auto, 1 == batget, 2 == subsystem
#ifdef HAVE_ENOTIFY
int desktop_notifications;
#endif
2012-08-13 02:24:51 -07:00
struct
{
Evas_Object *show_alert_label;
Evas_Object *show_alert_time;
Evas_Object *show_alert_percent;
Evas_Object *dismiss_alert_label;
Evas_Object *alert_timeout;
#ifdef HAVE_EEZE
2012-08-13 02:24:51 -07:00
Evas_Object *fuzzy;
#endif
2012-08-13 02:24:51 -07:00
} ui;
};
/* Protos */
2012-08-13 02:24:51 -07:00
static void *_create_data(E_Config_Dialog *cfd);
static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
2012-08-13 02:24:51 -07:00
static int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
static int _basic_check_changed(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
static Evas_Object *_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
2012-08-13 02:24:51 -07:00
static int _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
static int _advanced_check_changed(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
static void _cb_radio_changed(void *data, Evas_Object *obj __UNUSED__);
2010-01-22 12:28:39 -08:00
E_Config_Dialog *
e_int_config_battery_module(Evas_Object *parent EINA_UNUSED, const char *params __UNUSED__)
{
E_Config_Dialog *cfd;
E_Config_Dialog_View *v;
2010-02-28 10:42:58 -08:00
char buf[PATH_MAX];
v = E_NEW(E_Config_Dialog_View, 1);
v->create_cfdata = _create_data;
v->free_cfdata = _free_data;
v->basic.apply_cfdata = _basic_apply_data;
v->basic.create_widgets = _basic_create_widgets;
v->basic.check_changed = _basic_check_changed;
v->advanced.apply_cfdata = _advanced_apply_data;
v->advanced.create_widgets = _advanced_create_widgets;
v->advanced.check_changed = _advanced_check_changed;
2012-08-13 02:24:51 -07:00
snprintf(buf, sizeof(buf), "%s/e-module-battery.edj",
e_module_dir_get(battery_config->module));
cfd = e_config_dialog_new(NULL, _("Battery Monitor Settings"),
2012-08-13 02:24:51 -07:00
"E", "_e_mod_battery_config_dialog",
buf, 0, v, NULL);
battery_config->config_dialog = cfd;
2007-10-31 12:56:59 -07:00
return cfd;
}
static void
2012-08-13 02:24:51 -07:00
_fill_data(E_Config_Dialog_Data *cfdata)
{
if (!battery_config) return;
cfdata->alert_time = battery_config->alert;
cfdata->alert_percent = battery_config->alert_p;
e: 1. configure/build changes to allow cross-compiling painlessly 2. pager module namespace changes - this was still dirty afdter the namespace cleanup, so clean it up 3. add a powersave subsystem - doesnt have an "automatic" way to turn on and off right now, this i think is best provided by modules (that do things like monitor acpi status's (eg close lid of laptop), AC power status etc. etc. this allows e to nicely defer "power" expensive actions to avoid disk spinups etc. 4. move to use the new ecore poller system - discussed long ago as part of power management/saving issues. now it exists 5. add a canvas idle flush call that helsp cope with the new shm greedy software x11 engine stuff 6. use the new powersave subsystem where appropriate 7. fix non-zeroed/initted memory access in e_fm_main 8. fix mem leak for e menus 9. remove ipc handlers for changed/removed config values 10. use animaotr not timer for menu scrolls - then menu scrolls obey the fps config 11. fix up timer/poll happienss of cursor idle stuff 12. remove avoid damage from popups for now - causing problems 13. change battery and temp readouts to b e shorter so they fit 14. pager can emit signals on focus change for mini-windows now 15. temperature module now uses a slave process and uses stdin/out to talk to it and get output - this makes e smoother as in my expereicne i found getting the temp on my laptop actually took like 200ms so e "hang" for 200ms while reading the acpi files - so now the subprocess does it and just writesa back to e when it gets it. ecore: 1. add ecore_pollers. see the documentation on them in doxygen comments :) 2. fix timers to only go off when they have to - bug there that made e's select time out a LOT more than it needed to. defensive coding hid the problem. now fixed. e should be much more power friendly now. 3. formatting/niceness in ecore_exe stuff 4. some comments on comments with SIGIO ideas vs. select 5. add call to be able to add an idle enterer at the start of the list of them, not just the end (as has been the default) 6. fix ecore_evas to support auto evas idler calls after 0.5 secs of idle in all canvases - and to do it right 7. if argb destination - set the shape EVENT shape (to mask out events in transparent regions much like shape does withotu translucency) 8. in ecore_x add support for the event shape evas: 1. fix cache to work properly and not just always fill up (as it seemed to like to think cahce useage dropped below 0 when it didnt and thus just over-fill) 2. software x11 engine now ONLY uses shm segments - no ximages over the socket. this ximage hack was there to avoid the 2 round trips involved in setting up an shm image - now i mitigated that wih an shm image cache pool. it keeps shm images around and repurposes them for new update regions if appropriate. this means many fewer shm creates (about 1/100th the number) and since we recycle the memory less 0 memory page filling by the kernel - in the end, i recorded about a 10-20% speedup over the old software x11 engine. simple tests i have seen up to 120% speedups. idle flush now does something - it frees all the cached shm segments. it has a hard-coded limit of 4mb worth of shm segments (or 32 segments - whichever comes first) to keep around. once can never complain much about speedups methinks :). also evas will defer sync until the NEXT frame is written - this means evas can calculate the next frame of data while x dma's/copies the images to the screen at the same time (if you hve a dual core or multi-cpu machnike or your xserver is able to use DMA to copy image data to the screen/video ram then this should see a decent speedup). SVN revision: 33448
2008-01-10 23:33:57 -08:00
cfdata->poll_interval = battery_config->poll_interval;
cfdata->alert_timeout = battery_config->alert_timeout;
cfdata->suspend_below = battery_config->suspend_below;
cfdata->suspend_method = battery_config->suspend_method;
cfdata->force_mode = battery_config->force_mode;
#ifdef HAVE_EEZE
cfdata->fuzzy = battery_config->fuzzy;
2010-05-18 07:17:05 -07:00
#endif
#ifdef HAVE_ENOTIFY
cfdata->desktop_notifications = battery_config->desktop_notifications;
#endif
2010-05-20 22:10:10 -07:00
2012-08-13 02:24:51 -07:00
if ((cfdata->alert_time > 0) || (cfdata->alert_percent > 0))
cfdata->show_alert = 1;
2012-08-13 02:24:51 -07:00
else
cfdata->show_alert = 0;
if (cfdata->alert_timeout > 0)
cfdata->dismiss_alert = 1;
else
cfdata->dismiss_alert = 0;
}
static void
_ensure_alert_time(E_Config_Dialog_Data *cfdata)
{
if ((cfdata->alert_time > 0) || (cfdata->alert_percent > 0))
return;
// must handle the case where user toggled the checkbox but set no threshold
cfdata->alert_time = 5;
}
static void *
_create_data(E_Config_Dialog *cfd __UNUSED__)
{
2006-01-14 08:10:57 -08:00
E_Config_Dialog_Data *cfdata;
2006-01-14 08:10:57 -08:00
cfdata = E_NEW(E_Config_Dialog_Data, 1);
_fill_data(cfdata);
return cfdata;
}
static void
_free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
{
if (!battery_config) return;
battery_config->config_dialog = NULL;
E_FREE(cfdata);
}
static Evas_Object *
_basic_create_widgets(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data *cfdata)
{
Evas_Object *o, *ob;
o = e_widget_list_add(evas, 0, 0);
ob = e_widget_check_add(evas, _("Show alert when battery is low"),
&(cfdata->show_alert));
e_widget_list_object_append(o, ob, 1, 0, 0.5);
#ifdef HAVE_ENOTIFY
ob = e_widget_check_add(evas, _("Use desktop notifications for alert"),
&(cfdata->desktop_notifications));
e_widget_list_object_append(o, ob, 1, 0, 0.5);
#endif
return o;
}
static int
_basic_apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
{
if (!battery_config) return 0;
if (cfdata->show_alert)
{
2012-08-13 02:24:51 -07:00
_ensure_alert_time(cfdata);
battery_config->alert = cfdata->alert_time;
battery_config->alert_p = cfdata->alert_percent;
#ifdef HAVE_ENOTIFY
battery_config->desktop_notifications = cfdata->desktop_notifications;
#endif
}
else
{
battery_config->alert = 0;
battery_config->alert_p = 0;
#ifdef HAVE_ENOTIFY
battery_config->desktop_notifications = EINA_FALSE;
#endif
}
_battery_config_updated();
e_config_save_queue();
return 1;
}
static int
_basic_check_changed(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
{
Eina_Bool ret;
int old_show_alert = ((battery_config->alert > 0) ||
2012-08-13 02:24:51 -07:00
(battery_config->alert_p > 0));
ret = (cfdata->show_alert != old_show_alert);
#ifdef HAVE_ENOTIFY
ret |= (cfdata->desktop_notifications != battery_config->desktop_notifications);
#endif
return ret;
}
static void
_cb_show_alert_changed(void *data, Evas_Object *obj __UNUSED__)
{
E_Config_Dialog_Data *cfdata = data;
Eina_Bool show_alert = cfdata->show_alert;
Eina_Bool dismiss_alert = cfdata->show_alert && cfdata->dismiss_alert;
e_widget_disabled_set(cfdata->ui.show_alert_label, !show_alert);
e_widget_disabled_set(cfdata->ui.show_alert_time, !show_alert);
e_widget_disabled_set(cfdata->ui.show_alert_percent, !show_alert);
e_widget_disabled_set(cfdata->ui.dismiss_alert_label, !show_alert);
e_widget_disabled_set(cfdata->ui.alert_timeout, !dismiss_alert);
}
static void
_cb_dismiss_alert_changed(void *data, Evas_Object *obj __UNUSED__)
{
E_Config_Dialog_Data *cfdata = data;
Eina_Bool dismiss_alert = cfdata->show_alert && cfdata->dismiss_alert;
e_widget_disabled_set(cfdata->ui.alert_timeout, !dismiss_alert);
}
2012-08-13 02:24:51 -07:00
static void
_cb_radio_changed(void *data, Evas_Object *obj __UNUSED__)
{
E_Config_Dialog_Data *cfdata;
Eina_Bool fuzzy;
if (!(cfdata = data)) return;
fuzzy = (cfdata->force_mode == SUBSYSTEM);
#ifdef HAVE_EEZE
e_widget_disabled_set(cfdata->ui.fuzzy, !fuzzy);
#endif
}
static Evas_Object *
_advanced_create_widgets(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data *cfdata)
{
Evas_Object *o, *ob, *otb;
E_Radio_Group *rg;
2010-02-28 10:42:58 -08:00
otb = e_widget_toolbook_add(evas, (48 * e_scale), (48 * e_scale));
/* Use Sliders for both cfg options */
o = e_widget_table_add(e_win_evas_win_get(evas), 0);
ob = e_widget_label_add(evas, _("Check every:"));
e_widget_table_object_append(o, ob, 0, 0, 1, 1, 1, 0, 1, 0);
2012-08-13 02:24:51 -07:00
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f ticks"), 1, 256, 4, 0,
NULL, &(cfdata->poll_interval), 100);
e_widget_table_object_append(o, ob, 0, 1, 1, 1, 1, 0, 1, 0);
2012-08-13 02:24:51 -07:00
rg = e_widget_radio_group_new(&(cfdata->suspend_method));
ob = e_widget_radio_add(evas, _("Suspend when below:"), 0, rg);
e_widget_on_change_hook_set(ob, _cb_radio_changed, cfdata);
e_widget_table_object_append(o, ob, 0, 2, 1, 1, 1, 0, 1, 0);
ob = e_widget_radio_add(evas, _("Hibernate when below:"), 1, rg);
e_widget_on_change_hook_set(ob, _cb_radio_changed, cfdata);
e_widget_table_object_append(o, ob, 0, 3, 1, 1, 1, 0, 1, 0);
ob = e_widget_radio_add(evas, _("Shutdown when below:"), 2, rg);
e_widget_on_change_hook_set(ob, _cb_radio_changed, cfdata);
e_widget_table_object_append(o, ob, 0, 4, 1, 1, 1, 0, 1, 0);
2012-08-13 02:24:51 -07:00
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f %%"), 0, 50, 1, 0,
NULL, &(cfdata->suspend_below), 100);
e_widget_table_object_append(o, ob, 0, 5, 1, 1, 1, 0, 1, 0);
2012-08-13 02:24:51 -07:00
e_widget_toolbook_page_append(otb, NULL, _("Polling"), o, 1, 0, 1, 0,
0.5, 0.0);
o = e_widget_table_add(e_win_evas_win_get(evas), 0);
ob = e_widget_check_add(evas, _("Show low battery alert"),
&(cfdata->show_alert));
e_widget_on_change_hook_set(ob, _cb_show_alert_changed, cfdata);
e_widget_table_object_append(o, ob, 0, 0, 1, 1, 1, 1, 1, 0);
ob = e_widget_label_add(evas, _("Alert when at:"));
cfdata->ui.show_alert_label = ob;
e_widget_table_object_append(o, ob, 0, 1, 1, 1, 1, 0, 1, 1);
2012-08-13 02:24:51 -07:00
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f min"), 0, 60, 1, 0, NULL,
&(cfdata->alert_time), 100);
cfdata->ui.show_alert_time = ob;
e_widget_table_object_append(o, ob, 0, 2, 1, 1, 1, 0, 1, 0);
2012-08-13 02:24:51 -07:00
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f %%"), 0, 100, 1, 0, NULL,
&(cfdata->alert_percent), 100);
cfdata->ui.show_alert_percent = ob;
e_widget_table_object_append(o, ob, 0, 3, 1, 1, 1, 0, 1, 0);
ob = e_widget_check_add(evas, _("Auto dismiss in..."),
&(cfdata->dismiss_alert));
cfdata->ui.dismiss_alert_label = ob;
e_widget_on_change_hook_set(ob, _cb_dismiss_alert_changed, cfdata);
e_widget_table_object_append(o, ob, 0, 4, 1, 1, 1, 1, 1, 0);
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f s"), 1, 300, 1, 0, NULL,
&(cfdata->alert_timeout), 100);
cfdata->ui.alert_timeout = ob;
e_widget_table_object_append(o, ob, 0, 5, 1, 1, 1, 0, 1, 0);
_cb_show_alert_changed(cfdata, NULL);
2012-08-13 02:24:51 -07:00
e_widget_toolbook_page_append(otb, NULL, _("Alert"), o, 1, 0, 1, 0,
0.5, 0.0);
o = e_widget_list_add(evas, 0, 0);
rg = e_widget_radio_group_new(&(cfdata->force_mode));
ob = e_widget_radio_add(evas, _("Auto Detect"), UNKNOWN, rg);
e_widget_on_change_hook_set(ob, _cb_radio_changed, cfdata);
e_widget_list_object_append(o, ob, 1, 0, 0.0);
ob = e_widget_radio_add(evas, _("Internal"), NOSUBSYSTEM, rg);
e_widget_on_change_hook_set(ob, _cb_radio_changed, cfdata);
e_widget_list_object_append(o, ob, 1, 0, 0.0);
#ifdef HAVE_EEZE
ob = e_widget_radio_add(evas, _("udev"), SUBSYSTEM, rg);
e_widget_on_change_hook_set(ob, _cb_radio_changed, cfdata);
e_widget_list_object_append(o, ob, 1, 0, 0.0);
ob = e_widget_check_add(evas, _("Fuzzy Mode"),
&(cfdata->fuzzy));
cfdata->ui.fuzzy = ob;
#else
ob = e_widget_radio_add(evas, _("HAL"), 2, rg);
e_widget_on_change_hook_set(ob, _cb_radio_changed, cfdata);
#endif
e_widget_list_object_append(o, ob, 1, 0, 0.0);
2012-08-13 02:24:51 -07:00
e_widget_toolbook_page_append(otb, NULL, _("Hardware"), o, 1, 0, 1, 0,
0.5, 0.0);
e_widget_toolbook_page_show(otb, 0);
return otb;
}
static int
_advanced_apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
{
if (!battery_config) return 0;
e: 1. configure/build changes to allow cross-compiling painlessly 2. pager module namespace changes - this was still dirty afdter the namespace cleanup, so clean it up 3. add a powersave subsystem - doesnt have an "automatic" way to turn on and off right now, this i think is best provided by modules (that do things like monitor acpi status's (eg close lid of laptop), AC power status etc. etc. this allows e to nicely defer "power" expensive actions to avoid disk spinups etc. 4. move to use the new ecore poller system - discussed long ago as part of power management/saving issues. now it exists 5. add a canvas idle flush call that helsp cope with the new shm greedy software x11 engine stuff 6. use the new powersave subsystem where appropriate 7. fix non-zeroed/initted memory access in e_fm_main 8. fix mem leak for e menus 9. remove ipc handlers for changed/removed config values 10. use animaotr not timer for menu scrolls - then menu scrolls obey the fps config 11. fix up timer/poll happienss of cursor idle stuff 12. remove avoid damage from popups for now - causing problems 13. change battery and temp readouts to b e shorter so they fit 14. pager can emit signals on focus change for mini-windows now 15. temperature module now uses a slave process and uses stdin/out to talk to it and get output - this makes e smoother as in my expereicne i found getting the temp on my laptop actually took like 200ms so e "hang" for 200ms while reading the acpi files - so now the subprocess does it and just writesa back to e when it gets it. ecore: 1. add ecore_pollers. see the documentation on them in doxygen comments :) 2. fix timers to only go off when they have to - bug there that made e's select time out a LOT more than it needed to. defensive coding hid the problem. now fixed. e should be much more power friendly now. 3. formatting/niceness in ecore_exe stuff 4. some comments on comments with SIGIO ideas vs. select 5. add call to be able to add an idle enterer at the start of the list of them, not just the end (as has been the default) 6. fix ecore_evas to support auto evas idler calls after 0.5 secs of idle in all canvases - and to do it right 7. if argb destination - set the shape EVENT shape (to mask out events in transparent regions much like shape does withotu translucency) 8. in ecore_x add support for the event shape evas: 1. fix cache to work properly and not just always fill up (as it seemed to like to think cahce useage dropped below 0 when it didnt and thus just over-fill) 2. software x11 engine now ONLY uses shm segments - no ximages over the socket. this ximage hack was there to avoid the 2 round trips involved in setting up an shm image - now i mitigated that wih an shm image cache pool. it keeps shm images around and repurposes them for new update regions if appropriate. this means many fewer shm creates (about 1/100th the number) and since we recycle the memory less 0 memory page filling by the kernel - in the end, i recorded about a 10-20% speedup over the old software x11 engine. simple tests i have seen up to 120% speedups. idle flush now does something - it frees all the cached shm segments. it has a hard-coded limit of 4mb worth of shm segments (or 32 segments - whichever comes first) to keep around. once can never complain much about speedups methinks :). also evas will defer sync until the NEXT frame is written - this means evas can calculate the next frame of data while x dma's/copies the images to the screen at the same time (if you hve a dual core or multi-cpu machnike or your xserver is able to use DMA to copy image data to the screen/video ram then this should see a decent speedup). SVN revision: 33448
2008-01-10 23:33:57 -08:00
battery_config->poll_interval = cfdata->poll_interval;
#ifdef HAVE_EEZE
battery_config->fuzzy = cfdata->fuzzy;
2010-05-18 07:17:05 -07:00
#endif
2010-05-20 22:10:10 -07:00
if (cfdata->show_alert)
{
2012-08-13 02:24:51 -07:00
_ensure_alert_time(cfdata);
battery_config->alert = cfdata->alert_time;
battery_config->alert_p = cfdata->alert_percent;
}
else
{
battery_config->alert = 0;
battery_config->alert_p = 0;
}
if ((cfdata->dismiss_alert) && (cfdata->alert_timeout > 0))
battery_config->alert_timeout = cfdata->alert_timeout;
else
battery_config->alert_timeout = 0;
battery_config->force_mode = cfdata->force_mode;
battery_config->suspend_below = cfdata->suspend_below;
battery_config->suspend_method = cfdata->suspend_method;
_battery_config_updated();
e_config_save_queue();
return 1;
}
static int
_advanced_check_changed(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
{
int old_show_alert = ((battery_config->alert > 0) ||
2012-08-13 02:24:51 -07:00
(battery_config->alert_p > 0));
int old_dismiss_alert = (battery_config->alert_timeout > 0);
2012-08-13 02:24:51 -07:00
return (cfdata->alert_time != battery_config->alert) ||
(cfdata->alert_percent != battery_config->alert_p) ||
(cfdata->poll_interval != battery_config->poll_interval) ||
(cfdata->alert_timeout != battery_config->alert_timeout) ||
(cfdata->suspend_below != battery_config->suspend_below) ||
(cfdata->suspend_method != battery_config->suspend_method) ||
#ifdef HAVE_EEZE
2012-08-13 02:24:51 -07:00
(cfdata->fuzzy != battery_config->fuzzy) ||
#endif
(cfdata->force_mode != battery_config->force_mode) ||
(cfdata->show_alert != old_show_alert) ||
(cfdata->dismiss_alert != old_dismiss_alert);
}