Re: [E-devel] Battery Gadget Feature Request

2012-03-25 Thread thomasg
On Sat, Mar 24, 2012 at 15:21, Jeff Hoogland jeffhoogl...@linux.com wrote:
 Would it be possible to add a shut down below percentage to the battery
 gadget? Had a few users request this over the months as some of them don't
 care to hibernate their systems.

 --
 ~Jeff Hoogland http://jeffhoogland.com/
 Thoughts on Technology http://jeffhoogland.blogspot.com/, Tech Blog
 Bodhi Linux http://bodhilinux.com/, Enlightenment for your Desktop
 --
 This SF email is sponsosred by:
 Try Windows Azure free for 90 days Click Here
 http://p.sf.net/sfu/sfd2d-msazure
 ___
 enlightenment-devel mailing list
 enlightenment-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Hello Jeff,

I took the liberty to write a patch to support multiple suspend methods.
I'm sitting on a desktop without battery here and can't test, it would
be nice if you could do that for me. If it works for you, I'll send
the patch to the list for official review.

I hope the attachment reaches the list, alternatively it is available here:
http://gstaedtner.net/e_battery_suspend_methods.patch

~thomasg
From f1a375c7fd4683edeeb31646a496bb4cded64ad8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20Gst=C3=A4dtner?= tho...@gstaedtner.net
Date: Sun, 25 Mar 2012 21:08:01 +0200
Subject: [PATCH] battery: add support for different suspend methods

Allow the user to select what to do when the battery runs low:
Suspend, Hibernate or Shutdown.

diff --git a/src/modules/battery/e_mod_config.c 
b/src/modules/battery/e_mod_config.c
index 048b6c6..75f8861 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
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;
@@ -76,6 +77,7 @@ _fill_data(E_Config_Dialog_Data *cfdata)
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;
@@ -236,11 +238,19 @@ _advanced_create_widgets(E_Config_Dialog *cfd __UNUSED__, 
Evas *evas, E_Config_D
 NULL, (cfdata-poll_interval), 100);
e_widget_table_object_append(o, ob, 0, 1, 1, 1, 1, 0, 1, 0);

-   ob = e_widget_label_add(evas, _(Hibernate when below:));
+   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);
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, 3, 1, 1, 1, 0, 1, 0);
+   e_widget_table_object_append(o, ob, 0, 5, 1, 1, 1, 0, 1, 0);

e_widget_toolbook_page_append(otb, NULL, _(Polling), o, 1, 0, 1, 0, 
  0.5, 0.0);
@@ -334,6 +344,7 @@ _advanced_apply_data(E_Config_Dialog *cfd __UNUSED__, 
E_Config_Dialog_Data *cfda
 
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();
@@ -352,6 +363,7 @@ _advanced_check_changed(E_Config_Dialog *cfd __UNUSED__, 
E_Config_Dialog_Data *c
   (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
(cfdata-fuzzy != battery_config-fuzzy) ||
 #endif   
diff --git a/src/modules/battery/e_mod_main.c b/src/modules/battery/e_mod_main.c
index 3cf9671..b29a1aa 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,
 if ((have_battery)  (!have_power)  (full = 0) 
 (battery_config-suspend_below  0) 
 (full  

Re: [E-devel] Battery Gadget Feature Request

2012-03-25 Thread Jeff Hoogland
Thank you very much for this! I don't have time to try a fresh build till
later this week (Thursday is my normal build day) will report back then
(also I see this is in the SVN already - awesome!)

On Sun, Mar 25, 2012 at 2:20 PM, thomasg tho...@gstaedtner.net wrote:

 On Sat, Mar 24, 2012 at 15:21, Jeff Hoogland jeffhoogl...@linux.com
 wrote:
  Would it be possible to add a shut down below percentage to the battery
  gadget? Had a few users request this over the months as some of them
 don't
  care to hibernate their systems.
 
  --
  ~Jeff Hoogland http://jeffhoogland.com/
  Thoughts on Technology http://jeffhoogland.blogspot.com/, Tech Blog
  Bodhi Linux http://bodhilinux.com/, Enlightenment for your Desktop
 
 --
  This SF email is sponsosred by:
  Try Windows Azure free for 90 days Click Here
  http://p.sf.net/sfu/sfd2d-msazure
  ___
  enlightenment-devel mailing list
  enlightenment-devel@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

 Hello Jeff,

 I took the liberty to write a patch to support multiple suspend methods.
 I'm sitting on a desktop without battery here and can't test, it would
 be nice if you could do that for me. If it works for you, I'll send
 the patch to the list for official review.

 I hope the attachment reaches the list, alternatively it is available here:
 http://gstaedtner.net/e_battery_suspend_methods.patch

 ~thomasg


 --
 This SF email is sponsosred by:
 Try Windows Azure free for 90 days Click Here
 http://p.sf.net/sfu/sfd2d-msazure
 ___
 enlightenment-devel mailing list
 enlightenment-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/enlightenment-devel




-- 
~Jeff Hoogland http://jeffhoogland.com/
Thoughts on Technology http://jeffhoogland.blogspot.com/, Tech Blog
Bodhi Linux http://bodhilinux.com/, Enlightenment for your Desktop
--
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


[E-devel] Battery Gadget Feature Request

2012-03-24 Thread Jeff Hoogland
Would it be possible to add a shut down below percentage to the battery
gadget? Had a few users request this over the months as some of them don't
care to hibernate their systems.

-- 
~Jeff Hoogland http://jeffhoogland.com/
Thoughts on Technology http://jeffhoogland.blogspot.com/, Tech Blog
Bodhi Linux http://bodhilinux.com/, Enlightenment for your Desktop
--
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel