aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/battery/e_mod_config.c
diff options
context:
space:
mode:
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>2010-05-18 10:39:30 +0000
committerMike Blumenkrantz <michael.blumenkrantz@gmail.com>2010-05-18 10:39:30 +0000
commitf7f417298ba44499852e1267adbfb6c38265bc9b (patch)
tree79d4ab37b46e537959756b4888cefb4b1310d43c /src/modules/battery/e_mod_config.c
parent7c2df0efc675865d222e7cead5b1620d782a4f64 (diff)
downloadenlightenment-f7f417298ba44499852e1267adbfb6c38265bc9b.tar.gz
enlightenment-f7f417298ba44499852e1267adbfb6c38265bc9b.tar.xz
enlightenment-f7f417298ba44499852e1267adbfb6c38265bc9b.zip
udev mode enabled in battery module (--enable-device-udev) with polling time supported. udev times are extremely accurate AT THE TIME THAT THEY POLL.
I have added what I call "fuzzy mode", which (in udev mode only) averages the past 10 polling times to give a somewhat more readable measurement. bugs: none that I know of? todo: make fuzzy mode average the previous 10 times without resetting except on state change, fix "fuzzy mode" checkbox to only enable when udev is selected SVN revision: 48973
Diffstat (limited to 'src/modules/battery/e_mod_config.c')
-rw-r--r--src/modules/battery/e_mod_config.c35
1 files changed, 30 insertions, 5 deletions
diff --git a/src/modules/battery/e_mod_config.c b/src/modules/battery/e_mod_config.c
index 6c2d00907..ba6d10b11 100644
--- a/src/modules/battery/e_mod_config.c
+++ b/src/modules/battery/e_mod_config.c
@@ -5,11 +5,14 @@ struct _E_Config_Dialog_Data
{
int show_alert;
int poll_interval;
+#ifdef HAVE_EEZE_UDEV
+ int fuzzy;
+#endif
int alert_time;
int alert_percent;
int dismiss_alert;
int alert_timeout;
- int force_mode; // 0 == auto, 1 == batget, 2 == dbus
+ int force_mode; // 0 == auto, 1 == batget, 2 == subsystem
struct
{
Evas_Object *show_alert_label;
@@ -17,6 +20,9 @@ struct _E_Config_Dialog_Data
Evas_Object *show_alert_percent;
Evas_Object *dismiss_alert_label;
Evas_Object *alert_timeout;
+#ifdef HAVE_EEZE_UDEV
+ Evas_Object *fuzzy;
+#endif
} ui;
};
@@ -65,6 +71,7 @@ _fill_data(E_Config_Dialog_Data *cfdata)
cfdata->poll_interval = battery_config->poll_interval;
cfdata->alert_timeout = battery_config->alert_timeout;
cfdata->force_mode = battery_config->force_mode;
+ cfdata->fuzzy = battery_config->fuzzy;
if ((cfdata->alert_time > 0) || (cfdata->alert_percent > 0))
cfdata->show_alert = 1;
@@ -172,6 +179,17 @@ _cb_dismiss_alert_changed(void *data, Evas_Object *obj __UNUSED__)
e_widget_disabled_set(cfdata->ui.alert_timeout, !dismiss_alert);
}
+#ifdef HAVE_EEZE_UDEV
+static void
+_cb_fuzzy(void *data, Evas_Object *obj __UNUSED__)
+{
+ E_Config_Dialog_Data *cfdata = data;
+ Eina_Bool fuzzy = (cfdata->force_mode == SUBSYSTEM);
+
+ 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)
{
@@ -225,12 +243,17 @@ _advanced_create_widgets(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_D
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"), 0, rg);
+ ob = e_widget_radio_add(evas, _("Auto Detect"), UNKNOWN, rg);
+ e_widget_list_object_append(o, ob, 1, 0, 0.0);
+ ob = e_widget_radio_add(evas, _("Internal"), NOSUBSYSTEM, rg);
e_widget_list_object_append(o, ob, 1, 0, 0.0);
- ob = e_widget_radio_add(evas, _("Internal"), 1, rg);
+#ifdef HAVE_EEZE_UDEV
+ ob = e_widget_radio_add(evas, _("udev"), SUBSYSTEM, rg);
+ e_widget_on_change_hook_set(ob, _cb_fuzzy, cfdata);
e_widget_list_object_append(o, ob, 1, 0, 0.0);
-#ifdef HAVE_EUDEV
- ob = e_widget_radio_add(evas, _("udev"), 2, rg);
+ ob = e_widget_check_add(evas, _("Fuzzy Mode"),
+ &(cfdata->fuzzy));
+ cfdata->ui.fuzzy = ob;
#else
ob = e_widget_radio_add(evas, _("HAL"), 2, rg);
#endif
@@ -249,6 +272,7 @@ _advanced_apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfda
if (!battery_config) return 0;
battery_config->poll_interval = cfdata->poll_interval;
+ battery_config->fuzzy = cfdata->fuzzy;
if (cfdata->show_alert)
{
@@ -285,6 +309,7 @@ _advanced_check_changed(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *c
(cfdata->alert_percent != battery_config->alert_p) ||
(cfdata->poll_interval != battery_config->poll_interval) ||
(cfdata->alert_timeout != battery_config->alert_timeout) ||
+ (cfdata->fuzzy != battery_config->fuzzy) ||
(cfdata->force_mode != battery_config->force_mode) ||
(cfdata->show_alert != old_show_alert) ||
(cfdata->dismiss_alert != old_dismiss_alert));