diff options
-rw-r--r-- | AUTHORS | 1 | ||||
-rw-r--r-- | src/modules/battery/e_mod_config.c | 16 | ||||
-rw-r--r-- | src/modules/battery/e_mod_main.c | 9 | ||||
-rw-r--r-- | src/modules/battery/e_mod_main.h | 7 |
4 files changed, 29 insertions, 4 deletions
@@ -31,3 +31,4 @@ Jihoon Kim <jihoon48.kim@samsung.com> | |||
31 | Sthitha <iamsthitha@gmail> | 31 | Sthitha <iamsthitha@gmail> |
32 | Doyoun Kang <doyoun.kang@samsung.com> | 32 | Doyoun Kang <doyoun.kang@samsung.com> |
33 | Gwanglim Lee <gl77.lee@samsung.com> | 33 | Gwanglim Lee <gl77.lee@samsung.com> |
34 | Thomas Gstädtner <thomas@gstaedtner.net> | ||
diff --git a/src/modules/battery/e_mod_config.c b/src/modules/battery/e_mod_config.c index 048b6c6f5..75f8861f5 100644 --- a/src/modules/battery/e_mod_config.c +++ b/src/modules/battery/e_mod_config.c | |||
@@ -13,6 +13,7 @@ struct _E_Config_Dialog_Data | |||
13 | int dismiss_alert; | 13 | int dismiss_alert; |
14 | int alert_timeout; | 14 | int alert_timeout; |
15 | int suspend_below; | 15 | int suspend_below; |
16 | int suspend_method; | ||
16 | int force_mode; // 0 == auto, 1 == batget, 2 == subsystem | 17 | int force_mode; // 0 == auto, 1 == batget, 2 == subsystem |
17 | #ifdef HAVE_ENOTIFY | 18 | #ifdef HAVE_ENOTIFY |
18 | int desktop_notifications; | 19 | int desktop_notifications; |
@@ -76,6 +77,7 @@ _fill_data(E_Config_Dialog_Data *cfdata) | |||
76 | cfdata->poll_interval = battery_config->poll_interval; | 77 | cfdata->poll_interval = battery_config->poll_interval; |
77 | cfdata->alert_timeout = battery_config->alert_timeout; | 78 | cfdata->alert_timeout = battery_config->alert_timeout; |
78 | cfdata->suspend_below = battery_config->suspend_below; | 79 | cfdata->suspend_below = battery_config->suspend_below; |
80 | cfdata->suspend_method = battery_config->suspend_method; | ||
79 | cfdata->force_mode = battery_config->force_mode; | 81 | cfdata->force_mode = battery_config->force_mode; |
80 | #ifdef HAVE_EEZE | 82 | #ifdef HAVE_EEZE |
81 | cfdata->fuzzy = battery_config->fuzzy; | 83 | cfdata->fuzzy = battery_config->fuzzy; |
@@ -236,11 +238,19 @@ _advanced_create_widgets(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_D | |||
236 | NULL, &(cfdata->poll_interval), 100); | 238 | NULL, &(cfdata->poll_interval), 100); |
237 | e_widget_table_object_append(o, ob, 0, 1, 1, 1, 1, 0, 1, 0); | 239 | e_widget_table_object_append(o, ob, 0, 1, 1, 1, 1, 0, 1, 0); |
238 | 240 | ||
239 | ob = e_widget_label_add(evas, _("Hibernate when below:")); | 241 | rg = e_widget_radio_group_new(&(cfdata->suspend_method)); |
242 | ob = e_widget_radio_add(evas, _("Suspend when below:"), 0, rg); | ||
243 | e_widget_on_change_hook_set(ob, _cb_radio_changed, cfdata); | ||
240 | e_widget_table_object_append(o, ob, 0, 2, 1, 1, 1, 0, 1, 0); | 244 | e_widget_table_object_append(o, ob, 0, 2, 1, 1, 1, 0, 1, 0); |
245 | ob = e_widget_radio_add(evas, _("Hibernate when below:"), 1, rg); | ||
246 | e_widget_on_change_hook_set(ob, _cb_radio_changed, cfdata); | ||
247 | e_widget_table_object_append(o, ob, 0, 3, 1, 1, 1, 0, 1, 0); | ||
248 | ob = e_widget_radio_add(evas, _("Shutdown when below:"), 2, rg); | ||
249 | e_widget_on_change_hook_set(ob, _cb_radio_changed, cfdata); | ||
250 | e_widget_table_object_append(o, ob, 0, 4, 1, 1, 1, 0, 1, 0); | ||
241 | ob = e_widget_slider_add(evas, 1, 0, _("%1.0f %%"), 0, 50, 1, 0, | 251 | ob = e_widget_slider_add(evas, 1, 0, _("%1.0f %%"), 0, 50, 1, 0, |
242 | NULL, &(cfdata->suspend_below), 100); | 252 | NULL, &(cfdata->suspend_below), 100); |
243 | e_widget_table_object_append(o, ob, 0, 3, 1, 1, 1, 0, 1, 0); | 253 | e_widget_table_object_append(o, ob, 0, 5, 1, 1, 1, 0, 1, 0); |
244 | 254 | ||
245 | e_widget_toolbook_page_append(otb, NULL, _("Polling"), o, 1, 0, 1, 0, | 255 | e_widget_toolbook_page_append(otb, NULL, _("Polling"), o, 1, 0, 1, 0, |
246 | 0.5, 0.0); | 256 | 0.5, 0.0); |
@@ -334,6 +344,7 @@ _advanced_apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfda | |||
334 | 344 | ||
335 | battery_config->force_mode = cfdata->force_mode; | 345 | battery_config->force_mode = cfdata->force_mode; |
336 | battery_config->suspend_below = cfdata->suspend_below; | 346 | battery_config->suspend_below = cfdata->suspend_below; |
347 | battery_config->suspend_method = cfdata->suspend_method; | ||
337 | 348 | ||
338 | _battery_config_updated(); | 349 | _battery_config_updated(); |
339 | e_config_save_queue(); | 350 | e_config_save_queue(); |
@@ -352,6 +363,7 @@ _advanced_check_changed(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *c | |||
352 | (cfdata->poll_interval != battery_config->poll_interval) || | 363 | (cfdata->poll_interval != battery_config->poll_interval) || |
353 | (cfdata->alert_timeout != battery_config->alert_timeout) || | 364 | (cfdata->alert_timeout != battery_config->alert_timeout) || |
354 | (cfdata->suspend_below != battery_config->suspend_below) || | 365 | (cfdata->suspend_below != battery_config->suspend_below) || |
366 | (cfdata->suspend_method != battery_config->suspend_method) || | ||
355 | #ifdef HAVE_EEZE | 367 | #ifdef HAVE_EEZE |
356 | (cfdata->fuzzy != battery_config->fuzzy) || | 368 | (cfdata->fuzzy != battery_config->fuzzy) || |
357 | #endif | 369 | #endif |
diff --git a/src/modules/battery/e_mod_main.c b/src/modules/battery/e_mod_main.c index 3cf967128..b29a1aada 100644 --- a/src/modules/battery/e_mod_main.c +++ b/src/modules/battery/e_mod_main.c | |||
@@ -610,7 +610,14 @@ _battery_update(int full, int time_left, int time_full, Eina_Bool have_battery, | |||
610 | if ((have_battery) && (!have_power) && (full >= 0) && | 610 | if ((have_battery) && (!have_power) && (full >= 0) && |
611 | (battery_config->suspend_below > 0) && | 611 | (battery_config->suspend_below > 0) && |
612 | (full < battery_config->suspend_below)) | 612 | (full < battery_config->suspend_below)) |
613 | e_sys_action_do(E_SYS_HIBERNATE, NULL); | 613 | { |
614 | if (battery_config->suspend_method == SUSPEND) | ||
615 | e_sys_action_do(E_SYS_SUSPEND, NULL); | ||
616 | else if (battery_config->suspend_method == HIBERNATE) | ||
617 | e_sys_action_do(E_SYS_HIBERNATE, NULL); | ||
618 | else if (battery_config->suspend_method == SHUTDOWN) | ||
619 | e_sys_action_do(E_SYS_HALT, NULL); | ||
620 | } | ||
614 | } | 621 | } |
615 | if (!have_battery) | 622 | if (!have_battery) |
616 | e_powersave_mode_set(E_POWERSAVE_MODE_LOW); | 623 | e_powersave_mode_set(E_POWERSAVE_MODE_LOW); |
diff --git a/src/modules/battery/e_mod_main.h b/src/modules/battery/e_mod_main.h index 6f347c820..d1bf8ecd8 100644 --- a/src/modules/battery/e_mod_main.h +++ b/src/modules/battery/e_mod_main.h | |||
@@ -19,6 +19,10 @@ typedef struct _Config Config; | |||
19 | #define NOSUBSYSTEM 1 | 19 | #define NOSUBSYSTEM 1 |
20 | #define SUBSYSTEM 2 | 20 | #define SUBSYSTEM 2 |
21 | 21 | ||
22 | #define SUSPEND 0 | ||
23 | #define HIBERNATE 1 | ||
24 | #define SHUTDOWN 2 | ||
25 | |||
22 | #define POPUP_DEBOUNCE_CYCLES 2 | 26 | #define POPUP_DEBOUNCE_CYCLES 2 |
23 | 27 | ||
24 | struct _Config | 28 | struct _Config |
@@ -28,7 +32,8 @@ struct _Config | |||
28 | int alert; /* Alert on minutes remaining */ | 32 | int alert; /* Alert on minutes remaining */ |
29 | int alert_p; /* Alert on percentage remaining */ | 33 | int alert_p; /* Alert on percentage remaining */ |
30 | int alert_timeout; /* Popup dismissal timeout */ | 34 | int alert_timeout; /* Popup dismissal timeout */ |
31 | int suspend_below; /* Suspend if batter drops below this level */ | 35 | int suspend_below; /* Suspend if battery drops below this level */ |
36 | int suspend_method; /* Method used to suspend the machine */ | ||
32 | int force_mode; /* force use of batget or hal */ | 37 | int force_mode; /* force use of batget or hal */ |
33 | /* just config state */ | 38 | /* just config state */ |
34 | E_Module *module; | 39 | E_Module *module; |