aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/e_powersave.c
diff options
context:
space:
mode:
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>2012-08-13 06:51:24 +0000
committerMike Blumenkrantz <michael.blumenkrantz@gmail.com>2012-08-13 06:51:24 +0000
commit6cb077ac45b6d1a0c0d0c091179fc730975f116d (patch)
tree7420c1cc9ef200b7cb954b4206d34d8404892184 /src/bin/e_powersave.c
parentset radio text to blank in power management settings to avoid using unreliabl... (diff)
downloadenlightenment-6cb077ac45b6d1a0c0d0c091179fc730975f116d.tar.gz
formatting
SVN revision: 75187
Diffstat (limited to 'src/bin/e_powersave.c')
-rw-r--r--src/bin/e_powersave.c86
1 files changed, 46 insertions, 40 deletions
diff --git a/src/bin/e_powersave.c b/src/bin/e_powersave.c
index a90f2e340..fc5a16eeb 100644
--- a/src/bin/e_powersave.c
+++ b/src/bin/e_powersave.c
@@ -2,15 +2,15 @@
struct _E_Powersave_Deferred_Action
{
- void (*func) (void *data);
- const void *data;
+ void (*func)(void *data);
+ const void *data;
unsigned char delete_me : 1;
};
/* local subsystem functions */
static Eina_Bool _e_powersave_cb_deferred_timer(void *data);
-static void _e_powersave_mode_eval(void);
-static void _e_powersave_event_update_free(void *data __UNUSED__, void *event);
+static void _e_powersave_mode_eval(void);
+static void _e_powersave_event_update_free(void *data __UNUSED__, void *event);
/* local subsystem globals */
EAPI int E_EVENT_POWERSAVE_UPDATE = 0;
@@ -38,7 +38,7 @@ e_powersave_shutdown(void)
}
EAPI E_Powersave_Deferred_Action *
-e_powersave_deferred_action_add(void (*func) (void *data), const void *data)
+e_powersave_deferred_action_add(void (*func)(void *data), const void *data)
{
E_Powersave_Deferred_Action *pa;
@@ -46,8 +46,8 @@ e_powersave_deferred_action_add(void (*func) (void *data), const void *data)
if (!pa) return NULL;
if (deferred_timer) ecore_timer_del(deferred_timer);
deferred_timer = ecore_timer_add(defer_time,
- _e_powersave_cb_deferred_timer,
- NULL);
+ _e_powersave_cb_deferred_timer,
+ NULL);
pa->func = func;
pa->data = data;
deferred_actions = eina_list_append(deferred_actions, pa);
@@ -59,21 +59,21 @@ e_powersave_deferred_action_del(E_Powersave_Deferred_Action *pa)
{
if (walking_deferred_actions)
{
- pa->delete_me = 1;
- return;
+ pa->delete_me = 1;
+ return;
}
else
{
- deferred_actions = eina_list_remove(deferred_actions, pa);
- free(pa);
- if (!deferred_actions)
- {
- if (deferred_timer)
- {
- ecore_timer_del(deferred_timer);
- deferred_timer = NULL;
- }
- }
+ deferred_actions = eina_list_remove(deferred_actions, pa);
+ free(pa);
+ if (!deferred_actions)
+ {
+ if (deferred_timer)
+ {
+ ecore_timer_del(deferred_timer);
+ deferred_timer = NULL;
+ }
+ }
}
}
@@ -83,7 +83,8 @@ e_powersave_mode_set(E_Powersave_Mode mode)
E_Event_Powersave_Update *ev;
if (mode < e_config->powersave.min) mode = e_config->powersave.min;
- else if (mode > e_config->powersave.max) mode = e_config->powersave.max;
+ else if (mode > e_config->powersave.max)
+ mode = e_config->powersave.max;
if (powersave_mode == mode) return;
printf("CHANGE PW SAVE MODE TO %i / %i\n", (int)mode, E_POWERSAVE_MODE_EXTREME);
powersave_mode = mode;
@@ -94,7 +95,6 @@ e_powersave_mode_set(E_Powersave_Mode mode)
_e_powersave_mode_eval();
}
-
EAPI E_Powersave_Mode
e_powersave_mode_get(void)
{
@@ -123,8 +123,8 @@ _e_powersave_cb_deferred_timer(void *data __UNUSED__)
walking_deferred_actions++;
EINA_LIST_FREE(deferred_actions, pa)
{
- if (!pa->delete_me) pa->func((void *)pa->data);
- free(pa);
+ if (!pa->delete_me) pa->func((void *)pa->data);
+ free(pa);
}
walking_deferred_actions--;
if (!deferred_actions) deferred_timer = NULL;
@@ -139,31 +139,36 @@ _e_powersave_mode_eval(void)
switch (powersave_mode)
{
case E_POWERSAVE_MODE_NONE:
- t = e_config->powersave.none; /* time to defer "power expensive" activities */
- break;
+ t = e_config->powersave.none; /* time to defer "power expensive" activities */
+ break;
+
case E_POWERSAVE_MODE_LOW:
- t = e_config->powersave.low;
- break;
+ t = e_config->powersave.low;
+ break;
+
case E_POWERSAVE_MODE_MEDIUM:
- t = e_config->powersave.medium;
- break;
+ t = e_config->powersave.medium;
+ break;
+
case E_POWERSAVE_MODE_HIGH:
- t = e_config->powersave.high;
- break;
+ t = e_config->powersave.high;
+ break;
+
case E_POWERSAVE_MODE_EXTREME:
- t = e_config->powersave.extreme;
- break;
+ t = e_config->powersave.extreme;
+ break;
+
default:
- return;
- break;
+ return;
+ break;
}
if (t != defer_time)
{
- if (deferred_timer) ecore_timer_del(deferred_timer);
- deferred_timer = ecore_timer_add(defer_time,
- _e_powersave_cb_deferred_timer,
- NULL);
- defer_time = t;
+ if (deferred_timer) ecore_timer_del(deferred_timer);
+ deferred_timer = ecore_timer_add(defer_time,
+ _e_powersave_cb_deferred_timer,
+ NULL);
+ defer_time = t;
}
}
@@ -172,3 +177,4 @@ _e_powersave_event_update_free(void *data __UNUSED__, void *event)
{
free(event);
}
+