2005-12-14 14:46:51 -08:00
|
|
|
#include "e.h"
|
|
|
|
#include "e_mod_main.h"
|
|
|
|
|
2006-01-14 08:10:57 -08:00
|
|
|
struct _E_Config_Dialog_Data
|
2005-12-14 14:46:51 -08:00
|
|
|
{
|
2008-05-03 12:51:49 -07:00
|
|
|
int show_alert;
|
2008-01-10 23:33:57 -08:00
|
|
|
int poll_interval;
|
2010-05-22 00:04:26 -07:00
|
|
|
#ifdef HAVE_EEZE
|
2010-05-18 03:39:30 -07:00
|
|
|
int fuzzy;
|
|
|
|
#endif
|
2008-05-03 12:51:49 -07:00
|
|
|
int alert_time;
|
|
|
|
int alert_percent;
|
|
|
|
int dismiss_alert;
|
|
|
|
int alert_timeout;
|
2011-08-21 03:44:23 -07:00
|
|
|
int suspend_below;
|
2012-03-25 21:00:53 -07:00
|
|
|
int suspend_method;
|
2010-05-18 03:39:30 -07:00
|
|
|
int force_mode; // 0 == auto, 1 == batget, 2 == subsystem
|
2012-01-10 16:29:42 -08:00
|
|
|
#ifdef HAVE_ENOTIFY
|
|
|
|
int desktop_notifications;
|
|
|
|
#endif
|
2010-03-09 08:54:05 -08: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;
|
2010-05-22 00:04:26 -07:00
|
|
|
#ifdef HAVE_EEZE
|
2010-05-18 03:39:30 -07:00
|
|
|
Evas_Object *fuzzy;
|
|
|
|
#endif
|
2010-03-09 08:54:05 -08:00
|
|
|
} ui;
|
2005-12-14 14:46:51 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Protos */
|
2009-08-25 04:23:46 -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);
|
|
|
|
static int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
2010-03-02 13:42:59 -08:00
|
|
|
static int _basic_check_changed(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
2009-08-25 04:23:46 -07:00
|
|
|
static Evas_Object *_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
|
|
|
|
static int _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
2010-03-02 13:42:59 -08:00
|
|
|
static int _advanced_check_changed(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
2010-05-18 16:47:47 -07:00
|
|
|
static void _cb_radio_changed(void *data, Evas_Object *obj __UNUSED__);
|
2005-12-14 14:46:51 -08:00
|
|
|
|
2010-01-22 12:28:39 -08:00
|
|
|
E_Config_Dialog *
|
2007-10-31 05:21:02 -07:00
|
|
|
e_int_config_battery_module(E_Container *con, const char *params __UNUSED__)
|
2005-12-14 14:46:51 -08:00
|
|
|
{
|
|
|
|
E_Config_Dialog *cfd;
|
2006-01-22 06:17:43 -08:00
|
|
|
E_Config_Dialog_View *v;
|
2010-02-28 10:42:58 -08:00
|
|
|
char buf[PATH_MAX];
|
2009-08-25 04:23:46 -07:00
|
|
|
|
2006-01-22 06:17:43 -08:00
|
|
|
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;
|
2010-03-02 13:42:59 -08:00
|
|
|
v->basic.check_changed = _basic_check_changed;
|
2006-01-22 06:17:43 -08:00
|
|
|
v->advanced.apply_cfdata = _advanced_apply_data;
|
|
|
|
v->advanced.create_widgets = _advanced_create_widgets;
|
2010-03-02 13:42:59 -08:00
|
|
|
v->advanced.check_changed = _advanced_check_changed;
|
2006-07-03 00:35:44 -07:00
|
|
|
|
2009-08-25 04:23:46 -07:00
|
|
|
snprintf(buf, sizeof(buf), "%s/e-module-battery.edj",
|
|
|
|
e_module_dir_get(battery_config->module));
|
2010-03-09 08:54:05 -08:00
|
|
|
cfd = e_config_dialog_new(con, _("Battery Monitor Settings"),
|
2006-08-14 08:22:46 -07:00
|
|
|
"E", "_e_mod_battery_config_dialog",
|
2006-07-03 00:35:44 -07:00
|
|
|
buf, 0, v, NULL);
|
2006-04-20 04:30:25 -07:00
|
|
|
battery_config->config_dialog = cfd;
|
2007-10-31 12:56:59 -07:00
|
|
|
return cfd;
|
2005-12-14 14:46:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-04-20 04:30:25 -07:00
|
|
|
_fill_data(E_Config_Dialog_Data *cfdata)
|
2005-12-14 14:46:51 -08:00
|
|
|
{
|
2006-04-20 04:30:25 -07:00
|
|
|
if (!battery_config) return;
|
2008-05-03 12:51:49 -07:00
|
|
|
cfdata->alert_time = battery_config->alert;
|
|
|
|
cfdata->alert_percent = battery_config->alert_p;
|
2008-01-10 23:33:57 -08:00
|
|
|
cfdata->poll_interval = battery_config->poll_interval;
|
2008-05-03 12:51:49 -07:00
|
|
|
cfdata->alert_timeout = battery_config->alert_timeout;
|
2011-08-21 03:44:23 -07:00
|
|
|
cfdata->suspend_below = battery_config->suspend_below;
|
2012-03-25 21:00:53 -07:00
|
|
|
cfdata->suspend_method = battery_config->suspend_method;
|
2009-07-24 22:30:25 -07:00
|
|
|
cfdata->force_mode = battery_config->force_mode;
|
2010-05-22 00:04:26 -07:00
|
|
|
#ifdef HAVE_EEZE
|
2010-05-18 03:39:30 -07:00
|
|
|
cfdata->fuzzy = battery_config->fuzzy;
|
2010-05-18 07:17:05 -07:00
|
|
|
#endif
|
2012-01-10 16:29:42 -08:00
|
|
|
#ifdef HAVE_ENOTIFY
|
|
|
|
cfdata->desktop_notifications = battery_config->desktop_notifications;
|
|
|
|
#endif
|
2010-05-20 22:10:10 -07:00
|
|
|
|
2009-08-25 04:23:46 -07:00
|
|
|
if ((cfdata->alert_time > 0) || (cfdata->alert_percent > 0))
|
2006-02-13 08:10:33 -08:00
|
|
|
cfdata->show_alert = 1;
|
2005-12-15 21:21:12 -08:00
|
|
|
else
|
2006-02-13 08:10:33 -08:00
|
|
|
cfdata->show_alert = 0;
|
2009-08-25 04:23:46 -07:00
|
|
|
|
2008-05-03 12:51:49 -07:00
|
|
|
if (cfdata->alert_timeout > 0)
|
|
|
|
cfdata->dismiss_alert = 1;
|
|
|
|
else
|
|
|
|
cfdata->dismiss_alert = 0;
|
2005-12-14 14:46:51 -08:00
|
|
|
}
|
|
|
|
|
2010-03-02 13:42:59 -08:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2006-01-08 01:29:42 -08:00
|
|
|
static void *
|
2010-03-02 13:42:59 -08:00
|
|
|
_create_data(E_Config_Dialog *cfd __UNUSED__)
|
2005-12-14 14:46:51 -08:00
|
|
|
{
|
2006-01-14 08:10:57 -08:00
|
|
|
E_Config_Dialog_Data *cfdata;
|
2009-08-25 04:23:46 -07:00
|
|
|
|
2006-01-14 08:10:57 -08:00
|
|
|
cfdata = E_NEW(E_Config_Dialog_Data, 1);
|
2006-04-20 04:30:25 -07:00
|
|
|
_fill_data(cfdata);
|
2005-12-14 14:46:51 -08:00
|
|
|
return cfdata;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-03-02 13:42:59 -08:00
|
|
|
_free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
2005-12-14 14:46:51 -08:00
|
|
|
{
|
2006-04-20 04:30:25 -07:00
|
|
|
if (!battery_config) return;
|
|
|
|
battery_config->config_dialog = NULL;
|
2009-08-25 04:23:46 -07:00
|
|
|
E_FREE(cfdata);
|
2005-12-14 14:46:51 -08:00
|
|
|
}
|
|
|
|
|
2006-01-08 01:29:42 -08:00
|
|
|
static Evas_Object *
|
2010-03-02 13:42:59 -08:00
|
|
|
_basic_create_widgets(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data *cfdata)
|
2005-12-14 14:46:51 -08:00
|
|
|
{
|
2010-03-08 05:02:01 -08:00
|
|
|
Evas_Object *o, *ob;
|
2009-08-25 04:23:46 -07:00
|
|
|
|
2005-12-14 14:46:51 -08:00
|
|
|
o = e_widget_list_add(evas, 0, 0);
|
2010-03-08 05:02:01 -08:00
|
|
|
ob = e_widget_check_add(evas, _("Show alert when battery is low"),
|
2009-08-25 04:23:46 -07:00
|
|
|
&(cfdata->show_alert));
|
2010-03-08 05:02:01 -08:00
|
|
|
e_widget_list_object_append(o, ob, 1, 0, 0.5);
|
2012-01-10 16:29:42 -08:00
|
|
|
#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
|
2005-12-14 14:46:51 -08:00
|
|
|
return o;
|
|
|
|
}
|
|
|
|
|
2010-03-02 13:42:59 -08:00
|
|
|
static int
|
|
|
|
_basic_apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
2005-12-14 14:46:51 -08:00
|
|
|
{
|
2006-07-02 07:34:42 -07:00
|
|
|
if (!battery_config) return 0;
|
2008-05-03 12:51:49 -07:00
|
|
|
|
2007-05-19 22:20:04 -07:00
|
|
|
if (cfdata->show_alert)
|
2010-03-02 13:42:59 -08:00
|
|
|
{
|
|
|
|
_ensure_alert_time(cfdata);
|
2008-05-03 12:51:49 -07:00
|
|
|
battery_config->alert = cfdata->alert_time;
|
|
|
|
battery_config->alert_p = cfdata->alert_percent;
|
2012-01-10 16:29:42 -08:00
|
|
|
#ifdef HAVE_ENOTIFY
|
|
|
|
battery_config->desktop_notifications = cfdata->desktop_notifications;
|
|
|
|
#endif
|
2008-05-03 12:51:49 -07:00
|
|
|
}
|
2007-05-19 22:20:04 -07:00
|
|
|
else
|
2010-03-02 13:42:59 -08:00
|
|
|
{
|
2008-05-03 12:51:49 -07:00
|
|
|
battery_config->alert = 0;
|
|
|
|
battery_config->alert_p = 0;
|
2012-01-10 16:29:42 -08:00
|
|
|
#ifdef HAVE_ENOTIFY
|
|
|
|
battery_config->desktop_notifications = EINA_FALSE;
|
|
|
|
#endif
|
2008-05-03 12:51:49 -07:00
|
|
|
}
|
|
|
|
|
2006-04-20 04:30:25 -07:00
|
|
|
_battery_config_updated();
|
2005-12-14 14:46:51 -08:00
|
|
|
e_config_save_queue();
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2010-03-02 13:42:59 -08:00
|
|
|
static int
|
|
|
|
_basic_check_changed(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
|
|
|
{
|
2012-01-10 16:29:42 -08:00
|
|
|
Eina_Bool ret;
|
2010-03-02 13:42:59 -08:00
|
|
|
int old_show_alert = ((battery_config->alert > 0) ||
|
|
|
|
(battery_config->alert_p > 0));
|
|
|
|
|
2012-01-10 16:29:42 -08:00
|
|
|
ret = (cfdata->show_alert != old_show_alert);
|
|
|
|
#ifdef HAVE_ENOTIFY
|
|
|
|
ret |= (cfdata->desktop_notifications != battery_config->desktop_notifications);
|
|
|
|
#endif
|
|
|
|
return ret;
|
2010-03-02 13:42:59 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2010-05-18 16:47:47 -07:00
|
|
|
static void
|
|
|
|
_cb_radio_changed(void *data, Evas_Object *obj __UNUSED__)
|
2010-05-18 03:39:30 -07:00
|
|
|
{
|
2010-05-18 16:47:47 -07:00
|
|
|
E_Config_Dialog_Data *cfdata;
|
|
|
|
Eina_Bool fuzzy;
|
2010-05-18 03:39:30 -07:00
|
|
|
|
2010-05-18 16:47:47 -07:00
|
|
|
if (!(cfdata = data)) return;
|
|
|
|
fuzzy = (cfdata->force_mode == SUBSYSTEM);
|
2010-05-22 00:04:26 -07:00
|
|
|
#ifdef HAVE_EEZE
|
2010-05-18 03:39:30 -07:00
|
|
|
e_widget_disabled_set(cfdata->ui.fuzzy, !fuzzy);
|
|
|
|
#endif
|
2010-05-18 16:47:47 -07:00
|
|
|
}
|
2010-05-18 03:39:30 -07:00
|
|
|
|
2006-01-08 01:29:42 -08:00
|
|
|
static Evas_Object *
|
2010-03-02 13:42:59 -08:00
|
|
|
_advanced_create_widgets(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data *cfdata)
|
2005-12-14 14:46:51 -08:00
|
|
|
{
|
2009-09-03 09:32:48 -07:00
|
|
|
Evas_Object *o, *ob, *otb;
|
2009-01-31 19:26:46 -08:00
|
|
|
E_Radio_Group *rg;
|
2007-05-19 22:20:04 -07:00
|
|
|
|
2010-02-28 10:42:58 -08:00
|
|
|
otb = e_widget_toolbook_add(evas, (48 * e_scale), (48 * e_scale));
|
2009-08-25 04:23:46 -07:00
|
|
|
|
2009-02-03 04:45:38 -08:00
|
|
|
/* Use Sliders for both cfg options */
|
|
|
|
o = e_widget_table_add(evas, 0);
|
2009-08-25 04:23:46 -07:00
|
|
|
|
2009-02-03 04:45:38 -08:00
|
|
|
ob = e_widget_label_add(evas, _("Check every:"));
|
|
|
|
e_widget_table_object_append(o, ob, 0, 0, 1, 1, 1, 0, 1, 0);
|
2009-08-25 04:23:46 -07:00
|
|
|
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f ticks"), 1, 256, 4, 0,
|
2010-03-02 13:42:59 -08:00
|
|
|
NULL, &(cfdata->poll_interval), 100);
|
2009-02-03 04:45:38 -08:00
|
|
|
e_widget_table_object_append(o, ob, 0, 1, 1, 1, 1, 0, 1, 0);
|
2011-08-21 03:44:23 -07:00
|
|
|
|
2012-03-25 21:00:53 -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);
|
2011-08-21 03:44:23 -07:00
|
|
|
e_widget_table_object_append(o, ob, 0, 2, 1, 1, 1, 0, 1, 0);
|
2012-03-25 21:00:53 -07:00
|
|
|
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);
|
2011-08-21 03:44:23 -07:00
|
|
|
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f %%"), 0, 50, 1, 0,
|
|
|
|
NULL, &(cfdata->suspend_below), 100);
|
2012-03-25 21:00:53 -07:00
|
|
|
e_widget_table_object_append(o, ob, 0, 5, 1, 1, 1, 0, 1, 0);
|
2011-08-21 03:44:23 -07:00
|
|
|
|
2010-03-09 08:54:05 -08:00
|
|
|
e_widget_toolbook_page_append(otb, NULL, _("Polling"), o, 1, 0, 1, 0,
|
2009-08-25 04:23:46 -07:00
|
|
|
0.5, 0.0);
|
2009-02-03 04:45:38 -08:00
|
|
|
|
|
|
|
o = e_widget_table_add(evas, 0);
|
2010-03-02 13:42:59 -08:00
|
|
|
ob = e_widget_check_add(evas, _("Show low battery alert"),
|
2009-08-25 04:23:46 -07:00
|
|
|
&(cfdata->show_alert));
|
2010-03-02 13:42:59 -08:00
|
|
|
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);
|
2009-02-03 04:45:38 -08:00
|
|
|
ob = e_widget_label_add(evas, _("Alert when at:"));
|
2010-03-02 13:42:59 -08:00
|
|
|
cfdata->ui.show_alert_label = ob;
|
2009-02-03 04:45:38 -08:00
|
|
|
e_widget_table_object_append(o, ob, 0, 1, 1, 1, 1, 0, 1, 1);
|
2009-08-25 04:23:46 -07:00
|
|
|
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f min"), 0, 60, 1, 0, NULL,
|
2010-03-02 13:42:59 -08:00
|
|
|
&(cfdata->alert_time), 100);
|
|
|
|
cfdata->ui.show_alert_time = ob;
|
2009-02-03 04:45:38 -08:00
|
|
|
e_widget_table_object_append(o, ob, 0, 2, 1, 1, 1, 0, 1, 0);
|
2009-08-25 04:23:46 -07:00
|
|
|
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f %%"), 0, 100, 1, 0, NULL,
|
2010-03-02 13:42:59 -08:00
|
|
|
&(cfdata->alert_percent), 100);
|
|
|
|
cfdata->ui.show_alert_percent = ob;
|
2009-02-03 04:45:38 -08:00
|
|
|
e_widget_table_object_append(o, ob, 0, 3, 1, 1, 1, 0, 1, 0);
|
2010-03-02 13:42:59 -08:00
|
|
|
ob = e_widget_check_add(evas, _("Auto dismiss in..."),
|
2009-08-25 04:23:46 -07:00
|
|
|
&(cfdata->dismiss_alert));
|
2010-03-02 13:42:59 -08:00
|
|
|
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 sec"), 1, 300, 1, 0, NULL,
|
|
|
|
&(cfdata->alert_timeout), 100);
|
|
|
|
cfdata->ui.alert_timeout = ob;
|
2009-02-03 04:45:38 -08:00
|
|
|
e_widget_table_object_append(o, ob, 0, 5, 1, 1, 1, 0, 1, 0);
|
2010-03-02 13:42:59 -08:00
|
|
|
|
|
|
|
_cb_show_alert_changed(cfdata, NULL);
|
|
|
|
|
2010-03-09 08:54:05 -08:00
|
|
|
e_widget_toolbook_page_append(otb, NULL, _("Alert"), o, 1, 0, 1, 0,
|
2009-08-25 04:23:46 -07:00
|
|
|
0.5, 0.0);
|
|
|
|
|
2009-02-03 04:45:38 -08:00
|
|
|
o = e_widget_list_add(evas, 0, 0);
|
2009-08-25 04:23:46 -07:00
|
|
|
|
2009-01-31 19:26:46 -08:00
|
|
|
rg = e_widget_radio_group_new(&(cfdata->force_mode));
|
2010-05-18 03:39:30 -07:00
|
|
|
ob = e_widget_radio_add(evas, _("Auto Detect"), UNKNOWN, rg);
|
2010-05-18 16:47:47 -07:00
|
|
|
e_widget_on_change_hook_set(ob, _cb_radio_changed, cfdata);
|
2010-05-18 03:39:30 -07:00
|
|
|
e_widget_list_object_append(o, ob, 1, 0, 0.0);
|
|
|
|
ob = e_widget_radio_add(evas, _("Internal"), NOSUBSYSTEM, rg);
|
2010-05-18 16:47:47 -07:00
|
|
|
e_widget_on_change_hook_set(ob, _cb_radio_changed, cfdata);
|
2009-02-03 04:45:38 -08:00
|
|
|
e_widget_list_object_append(o, ob, 1, 0, 0.0);
|
2010-05-22 00:04:26 -07:00
|
|
|
#ifdef HAVE_EEZE
|
2010-05-18 03:39:30 -07:00
|
|
|
ob = e_widget_radio_add(evas, _("udev"), SUBSYSTEM, rg);
|
2010-05-18 16:47:47 -07:00
|
|
|
e_widget_on_change_hook_set(ob, _cb_radio_changed, cfdata);
|
2009-02-03 04:45:38 -08:00
|
|
|
e_widget_list_object_append(o, ob, 1, 0, 0.0);
|
2010-05-18 03:39:30 -07:00
|
|
|
ob = e_widget_check_add(evas, _("Fuzzy Mode"),
|
|
|
|
&(cfdata->fuzzy));
|
|
|
|
cfdata->ui.fuzzy = ob;
|
2010-04-30 18:13:38 -07:00
|
|
|
#else
|
2009-01-31 19:26:46 -08:00
|
|
|
ob = e_widget_radio_add(evas, _("HAL"), 2, rg);
|
2010-05-18 16:47:47 -07:00
|
|
|
e_widget_on_change_hook_set(ob, _cb_radio_changed, cfdata);
|
2010-04-30 18:13:38 -07:00
|
|
|
#endif
|
2009-02-03 04:45:38 -08:00
|
|
|
e_widget_list_object_append(o, ob, 1, 0, 0.0);
|
2005-12-15 21:21:12 -08:00
|
|
|
|
2010-03-09 08:54:05 -08:00
|
|
|
e_widget_toolbook_page_append(otb, NULL, _("Hardware"), o, 1, 0, 1, 0,
|
2009-08-25 04:23:46 -07:00
|
|
|
0.5, 0.0);
|
2009-02-03 04:45:38 -08:00
|
|
|
|
|
|
|
e_widget_toolbook_page_show(otb, 0);
|
|
|
|
return otb;
|
2005-12-14 14:46:51 -08:00
|
|
|
}
|
|
|
|
|
2010-03-02 13:42:59 -08:00
|
|
|
static int
|
|
|
|
_advanced_apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
2005-12-14 14:46:51 -08:00
|
|
|
{
|
2006-07-02 07:34:42 -07:00
|
|
|
if (!battery_config) return 0;
|
2008-05-03 12:51:49 -07:00
|
|
|
|
2008-01-10 23:33:57 -08:00
|
|
|
battery_config->poll_interval = cfdata->poll_interval;
|
2010-05-22 00:04:26 -07:00
|
|
|
#ifdef HAVE_EEZE
|
2010-05-18 03:39:30 -07:00
|
|
|
battery_config->fuzzy = cfdata->fuzzy;
|
2010-05-18 07:17:05 -07:00
|
|
|
#endif
|
2010-05-20 22:10:10 -07:00
|
|
|
|
2007-05-19 22:20:04 -07:00
|
|
|
if (cfdata->show_alert)
|
2010-03-02 13:42:59 -08:00
|
|
|
{
|
|
|
|
_ensure_alert_time(cfdata);
|
2008-05-03 12:51:49 -07:00
|
|
|
battery_config->alert = cfdata->alert_time;
|
|
|
|
battery_config->alert_p = cfdata->alert_percent;
|
|
|
|
}
|
2010-03-02 13:42:59 -08:00
|
|
|
else
|
2008-05-03 12:51:49 -07:00
|
|
|
{
|
|
|
|
battery_config->alert = 0;
|
|
|
|
battery_config->alert_p = 0;
|
|
|
|
}
|
|
|
|
|
2010-03-02 13:42:59 -08:00
|
|
|
if ((cfdata->dismiss_alert) && (cfdata->alert_timeout > 0))
|
2008-05-03 12:51:49 -07:00
|
|
|
battery_config->alert_timeout = cfdata->alert_timeout;
|
|
|
|
else
|
|
|
|
battery_config->alert_timeout = 0;
|
|
|
|
|
2009-01-31 19:26:46 -08:00
|
|
|
battery_config->force_mode = cfdata->force_mode;
|
2011-08-21 16:46:03 -07:00
|
|
|
battery_config->suspend_below = cfdata->suspend_below;
|
2012-03-25 21:00:53 -07:00
|
|
|
battery_config->suspend_method = cfdata->suspend_method;
|
2009-08-25 04:23:46 -07:00
|
|
|
|
2006-04-20 04:30:25 -07:00
|
|
|
_battery_config_updated();
|
2005-12-14 14:46:51 -08:00
|
|
|
e_config_save_queue();
|
|
|
|
return 1;
|
|
|
|
}
|
2006-04-20 04:30:25 -07:00
|
|
|
|
2010-03-02 13:42:59 -08:00
|
|
|
static int
|
|
|
|
_advanced_check_changed(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
|
|
|
{
|
|
|
|
int old_show_alert = ((battery_config->alert > 0) ||
|
|
|
|
(battery_config->alert_p > 0));
|
|
|
|
int old_dismiss_alert = (battery_config->alert_timeout > 0);
|
|
|
|
|
|
|
|
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) ||
|
2011-08-21 03:44:23 -07:00
|
|
|
(cfdata->suspend_below != battery_config->suspend_below) ||
|
2012-03-25 21:00:53 -07:00
|
|
|
(cfdata->suspend_method != battery_config->suspend_method) ||
|
2010-05-22 00:04:26 -07:00
|
|
|
#ifdef HAVE_EEZE
|
2010-05-20 22:10:10 -07:00
|
|
|
(cfdata->fuzzy != battery_config->fuzzy) ||
|
|
|
|
#endif
|
2010-03-02 13:42:59 -08:00
|
|
|
(cfdata->force_mode != battery_config->force_mode) ||
|
|
|
|
(cfdata->show_alert != old_show_alert) ||
|
|
|
|
(cfdata->dismiss_alert != old_dismiss_alert));
|
|
|
|
}
|
|
|
|
|