gnome-power-manager r3029 - in trunk: . src
- From: rhughes svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-power-manager r3029 - in trunk: . src
- Date: Wed, 22 Oct 2008 09:07:53 +0000 (UTC)
Author: rhughes
Date: Wed Oct 22 09:07:53 2008
New Revision: 3029
URL: http://svn.gnome.org/viewvc/gnome-power-manager?rev=3029&view=rev
Log:
2008-10-22 Richard Hughes <richard hughsie com>
* src/gpm-engine.c: (gpm_engine_class_init),
(gpm_engine_get_summary), (gpm_engine_get_icon),
(gpm_engine_recalculate_state_icon),
(gpm_cell_array_discharging_changed_cb), (gpm_engine_start):
* src/gpm-inhibit.c: (gpm_inhibit_find_cookie),
(gpm_inhibit_inhibit), (gpm_inhibit_un_inhibit):
* src/gpm-manager.c: (gpm_manager_error_quark),
(gpm_manager_is_inhibit_valid), (gpm_manager_unblank_screen),
(gpm_manager_action_suspend), (gpm_manager_action_hibernate),
(manager_policy_do), (gpm_manager_suspend),
(gpm_manager_hibernate), (gpm_manager_reboot),
(gpm_manager_shutdown), (gpm_manager_get_power_save_status),
(gpm_manager_get_on_battery), (idle_changed_cb),
(lid_button_pressed), (button_pressed_cb), (ac_adapter_changed_cb),
(gpm_manager_check_sleep_errors), (gpm_engine_fully_charged_cb),
(gpm_engine_discharging_cb),
(gpm_manager_get_time_until_action_text),
(gpm_engine_charge_critical_cb), (gpm_engine_charge_action_cb):
Whitespace cleanup, and add a couple of sound actions.
Modified:
trunk/ChangeLog
trunk/src/gpm-engine.c
trunk/src/gpm-inhibit.c
trunk/src/gpm-manager.c
Modified: trunk/src/gpm-engine.c
==============================================================================
--- trunk/src/gpm-engine.c (original)
+++ trunk/src/gpm-engine.c Wed Oct 22 09:07:53 2008
@@ -155,8 +155,7 @@
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GpmEngineClass, icon_changed),
- NULL,
- NULL,
+ NULL, NULL,
g_cclosure_marshal_VOID__STRING,
G_TYPE_NONE, 1, G_TYPE_STRING);
signals [SUMMARY_CHANGED] =
@@ -164,8 +163,7 @@
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GpmEngineClass, summary_changed),
- NULL,
- NULL,
+ NULL, NULL,
g_cclosure_marshal_VOID__STRING,
G_TYPE_NONE, 1, G_TYPE_STRING);
signals [LOW_CAPACITY] =
@@ -173,8 +171,7 @@
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GpmEngineClass, low_capacity),
- NULL,
- NULL,
+ NULL, NULL,
gpm_marshal_VOID__UINT_UINT,
G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_UINT);
signals [PERHAPS_RECALL] =
@@ -182,8 +179,7 @@
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GpmEngineClass, perhaps_recall),
- NULL,
- NULL,
+ NULL, NULL,
gpm_marshal_VOID__UINT_STRING_STRING,
G_TYPE_NONE,
3, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_STRING);
@@ -192,8 +188,7 @@
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GpmEngineClass, fully_charged),
- NULL,
- NULL,
+ NULL, NULL,
g_cclosure_marshal_VOID__UINT,
G_TYPE_NONE, 1, G_TYPE_UINT);
signals [DISCHARGING] =
@@ -201,8 +196,7 @@
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GpmEngineClass, discharging),
- NULL,
- NULL,
+ NULL, NULL,
g_cclosure_marshal_VOID__UINT,
G_TYPE_NONE, 1, G_TYPE_UINT);
signals [CHARGE_ACTION] =
@@ -210,8 +204,7 @@
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GpmEngineClass, charge_action),
- NULL,
- NULL,
+ NULL, NULL,
gpm_marshal_VOID__UINT_UINT,
G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_POINTER);
signals [CHARGE_LOW] =
@@ -219,8 +212,7 @@
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GpmEngineClass, charge_low),
- NULL,
- NULL,
+ NULL, NULL,
gpm_marshal_VOID__UINT_POINTER,
G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_POINTER);
signals [CHARGE_CRITICAL] =
@@ -228,8 +220,7 @@
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GpmEngineClass, charge_critical),
- NULL,
- NULL,
+ NULL, NULL,
gpm_marshal_VOID__UINT_POINTER,
G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_POINTER);
}
@@ -303,44 +294,37 @@
if (unit->is_present) {
if (accuracy == 0) {
- if (unit->is_discharging) {
+ if (unit->is_discharging)
tooltip = g_string_append (tooltip, _("Battery discharge time is currently unknown\n"));
- } else {
+ else
tooltip = g_string_append (tooltip, _("Battery charge time is currently unknown\n"));
- }
} else if (accuracy < GPM_PROFILE_GOOD_TRUST) {
- if (unit->is_discharging) {
+ if (unit->is_discharging)
tooltip = g_string_append (tooltip, _("Battery discharge time is estimated\n"));
- } else {
+ else
tooltip = g_string_append (tooltip, _("Battery charge time is estimated\n"));
- }
}
}
part = gpm_cell_array_get_description (collection->ups);
- if (part != NULL) {
+ if (part != NULL)
tooltip = g_string_append (tooltip, part);
- }
g_free (part);
part = gpm_cell_array_get_description (collection->mouse);
- if (part != NULL) {
+ if (part != NULL)
tooltip = g_string_append (tooltip, part);
- }
g_free (part);
part = gpm_cell_array_get_description (collection->keyboard);
- if (part != NULL) {
+ if (part != NULL)
tooltip = g_string_append (tooltip, part);
- }
g_free (part);
part = gpm_cell_array_get_description (collection->phone);
- if (part != NULL) {
+ if (part != NULL)
tooltip = g_string_append (tooltip, part);
- }
g_free (part);
part = gpm_cell_array_get_description (collection->pda);
- if (part != NULL) {
+ if (part != NULL)
tooltip = g_string_append (tooltip, part);
- }
g_free (part);
/* remove the last \n */
@@ -391,39 +375,33 @@
egg_debug ("Trying CRITICAL icon: primary, ups, mouse, keyboard");
if (unit_primary->is_present) {
state = gpm_warnings_get_state (engine->priv->warnings, unit_primary);
- if (state == GPM_WARNINGS_CRITICAL) {
+ if (state == GPM_WARNINGS_CRITICAL)
return gpm_cell_array_get_icon (collection->primary);
- }
}
if (unit_ups->is_present) {
state = gpm_warnings_get_state (engine->priv->warnings, unit_ups);
- if (state == GPM_WARNINGS_CRITICAL) {
+ if (state == GPM_WARNINGS_CRITICAL)
return gpm_cell_array_get_icon (collection->ups);
- }
}
if (unit_keyboard->is_present) {
state = gpm_warnings_get_state (engine->priv->warnings, unit_phone);
- if (state == GPM_WARNINGS_CRITICAL) {
+ if (state == GPM_WARNINGS_CRITICAL)
return gpm_cell_array_get_icon (collection->phone);
- }
}
if (unit_mouse->is_present) {
state = gpm_warnings_get_state (engine->priv->warnings, unit_mouse);
- if (state == GPM_WARNINGS_CRITICAL) {
+ if (state == GPM_WARNINGS_CRITICAL)
return gpm_cell_array_get_icon (collection->mouse);
- }
}
if (unit_keyboard->is_present) {
state = gpm_warnings_get_state (engine->priv->warnings, unit_keyboard);
- if (state == GPM_WARNINGS_CRITICAL) {
+ if (state == GPM_WARNINGS_CRITICAL)
return gpm_cell_array_get_icon (collection->keyboard);
- }
}
if (unit_keyboard->is_present) {
state = gpm_warnings_get_state (engine->priv->warnings, unit_pda);
- if (state == GPM_WARNINGS_CRITICAL) {
+ if (state == GPM_WARNINGS_CRITICAL)
return gpm_cell_array_get_icon (collection->pda);
- }
}
if (engine->priv->icon_policy == GPM_ICON_POLICY_CRITICAL) {
@@ -450,12 +428,10 @@
/* we try PRESENT: PRIMARY, UPS */
egg_debug ("Trying PRESENT icon: primary, ups");
- if (unit_primary->is_present) {
+ if (unit_primary->is_present)
return gpm_cell_array_get_icon (collection->primary);
-
- } else if (unit_ups->is_present) {
+ else if (unit_ups->is_present)
return gpm_cell_array_get_icon (collection->ups);
- }
/* Check if we should just fallback to the ac icon */
if (engine->priv->icon_policy == GPM_ICON_POLICY_PRESENT) {
@@ -556,9 +532,8 @@
if (icon == NULL) {
/* none before, now none */
- if (engine->priv->previous_icon == NULL) {
+ if (engine->priv->previous_icon == NULL)
return FALSE;
- }
/* icon before, now none */
egg_debug ("** EMIT: icon-changed: none");
@@ -712,9 +687,8 @@
show_discharging = gconf_client_get_bool (engine->priv->conf, GPM_CONF_NOTIFY_DISCHARGING, NULL);
/* don't show warning */
- if (show_discharging == FALSE) {
+ if (show_discharging == FALSE)
return;
- }
/* find the kind for easy multiplexing */
kind = gpm_cell_array_get_kind (cell_array);
@@ -1033,12 +1007,10 @@
/* only show the battery prefs section if we have batteries */
prefs_server = gpm_prefs_server_new ();
- if (gpm_cell_array_get_num_cells (collection->primary) > 0) {
+ if (gpm_cell_array_get_num_cells (collection->primary) > 0)
gpm_prefs_server_set_capability (prefs_server, GPM_PREFS_SERVER_BATTERY);
- }
- if (gpm_cell_array_get_num_cells (collection->ups) > 0) {
+ if (gpm_cell_array_get_num_cells (collection->ups) > 0)
gpm_prefs_server_set_capability (prefs_server, GPM_PREFS_SERVER_UPS);
- }
g_object_unref (prefs_server);
/* we're done */
Modified: trunk/src/gpm-inhibit.c
==============================================================================
--- trunk/src/gpm-inhibit.c (original)
+++ trunk/src/gpm-inhibit.c Wed Oct 22 09:07:53 2008
@@ -115,9 +115,8 @@
/* search list */
ret = g_slist_find_custom (inhibit->priv->list, &cookie,
gpm_inhibit_cookie_compare_func);
- if (ret == NULL) {
+ if (ret == NULL)
return NULL;
- }
data = (GpmInhibitData *) ret->data;
return data;
}
@@ -169,9 +168,7 @@
connection = dbus_g_method_get_sender (context);
/* handle where the application does not add required data */
- if (connection == NULL ||
- application == NULL ||
- reason == NULL) {
+ if (connection == NULL || application == NULL || reason == NULL) {
egg_warning ("Recieved Inhibit, but application "
"did not set the parameters correctly");
dbus_g_method_return (context, -1);
@@ -191,9 +188,8 @@
data->application, data->connection, data->reason, data->cookie);
/* only emit event on the first one */
- if (g_slist_length (inhibit->priv->list) == 1) {
+ if (g_slist_length (inhibit->priv->list) == 1)
g_signal_emit (inhibit, signals [HAS_INHIBIT_CHANGED], 0, TRUE);
- }
dbus_g_method_return (context, data->cookie);
}
@@ -238,9 +234,8 @@
inhibit->priv->list = g_slist_remove (inhibit->priv->list, (gconstpointer) data);
/* only emit event on the last one */
- if (g_slist_length (inhibit->priv->list) == 0) {
+ if (g_slist_length (inhibit->priv->list) == 0)
g_signal_emit (inhibit, signals [HAS_INHIBIT_CHANGED], 0, FALSE);
- }
return TRUE;
}
Modified: trunk/src/gpm-manager.c
==============================================================================
--- trunk/src/gpm-manager.c (original)
+++ trunk/src/gpm-manager.c Wed Oct 22 09:07:53 2008
@@ -138,9 +138,8 @@
gpm_manager_error_quark (void)
{
static GQuark quark = 0;
- if (!quark) {
+ if (!quark)
quark = g_quark_from_static_string ("gpm_manager_error");
- }
return quark;
}
@@ -263,24 +262,18 @@
const char *msg;
/*Compose message for each possible action*/
- if (strcmp (action, "suspend") == 0) {
+ if (strcmp (action, "suspend") == 0)
title = g_strdup (_("Request to suspend"));
-
- } else if (strcmp (action, "hibernate") == 0) {
+ else if (strcmp (action, "hibernate") == 0)
title = g_strdup (_("Request to hibernate"));
-
- } else if (strcmp (action, "policy action") == 0) {
+ else if (strcmp (action, "policy action") == 0)
title = g_strdup (_("Request to do policy action"));
-
- } else if (strcmp (action, "reboot") == 0) {
+ else if (strcmp (action, "reboot") == 0)
title = g_strdup (_("Request to reboot"));
-
- } else if (strcmp (action, "shutdown") == 0) {
+ else if (strcmp (action, "shutdown") == 0)
title = g_strdup (_("Request to shutdown"));
-
- } else if (strcmp (action, "timeout action") == 0) {
+ else if (strcmp (action, "timeout action") == 0)
title = g_strdup (_("Request to do timeout action"));
- }
gpm_inhibit_get_message (manager->priv->inhibit, message, action);
gpm_notify_display (manager->priv->notify,
@@ -392,9 +385,8 @@
}
do_lock = gpm_control_get_lock_policy (manager->priv->control, GPM_CONF_LOCK_ON_BLANK_SCREEN);
- if (do_lock) {
+ if (do_lock)
gpm_screensaver_poke (manager->priv->screensaver);
- }
return ret;
}
@@ -434,16 +426,14 @@
}
/* check to see if we are inhibited */
- if (gpm_manager_is_inhibit_valid (manager, FALSE, "suspend") == FALSE) {
+ if (gpm_manager_is_inhibit_valid (manager, FALSE, "suspend") == FALSE)
return FALSE;
- }
gpm_info_explain_reason (manager->priv->info, GPM_EVENT_SUSPEND,
_("Suspending computer."), reason);
gpm_control_suspend (manager->priv->control, &error);
- if (error != NULL) {
+ if (error != NULL)
g_error_free (error);
- }
return TRUE;
}
@@ -483,16 +473,14 @@
}
/* check to see if we are inhibited */
- if (gpm_manager_is_inhibit_valid (manager, FALSE, "hibernate") == FALSE) {
+ if (gpm_manager_is_inhibit_valid (manager, FALSE, "hibernate") == FALSE)
return FALSE;
- }
gpm_info_explain_reason (manager->priv->info, GPM_EVENT_HIBERNATE,
_("Hibernating computer."), reason);
gpm_control_hibernate (manager->priv->control, &error);
- if (error != NULL) {
+ if (error != NULL)
g_error_free (error);
- }
return TRUE;
}
@@ -512,16 +500,13 @@
gchar *action = NULL;
/* are we inhibited? */
- if (gpm_manager_is_inhibit_valid (manager, FALSE, "policy action") == FALSE) {
+ if (gpm_manager_is_inhibit_valid (manager, FALSE, "policy action") == FALSE)
return FALSE;
- }
egg_debug ("policy: %s", policy);
action = gconf_client_get_string (manager->priv->conf, policy, NULL);
-
- if (action == NULL) {
+ if (action == NULL)
return FALSE;
- }
if (strcmp (action, ACTION_NOTHING) == 0) {
gpm_info_explain_reason (manager->priv->info, GPM_EVENT_NOTIFICATION,
@@ -584,9 +569,8 @@
}
/* check to see if we are inhibited */
- if (gpm_manager_is_inhibit_valid (manager, FALSE, "hibernate") == FALSE) {
+ if (gpm_manager_is_inhibit_valid (manager, FALSE, "hibernate") == FALSE)
return FALSE;
- }
return gpm_control_suspend (manager->priv->control, error);
}
@@ -620,9 +604,8 @@
}
/* check to see if we are inhibited */
- if (gpm_manager_is_inhibit_valid (manager, FALSE, "hibernate") == FALSE) {
+ if (gpm_manager_is_inhibit_valid (manager, FALSE, "hibernate") == FALSE)
return FALSE;
- }
return gpm_control_hibernate (manager->priv->control, error);
}
@@ -640,9 +623,8 @@
g_return_val_if_fail (GPM_IS_MANAGER (manager), FALSE);
/* check to see if we are inhibited */
- if (gpm_manager_is_inhibit_valid (manager, FALSE, "reboot") == FALSE) {
+ if (gpm_manager_is_inhibit_valid (manager, FALSE, "reboot") == FALSE)
return FALSE;
- }
return gpm_control_reboot (manager->priv->control, error);
}
@@ -660,9 +642,8 @@
g_return_val_if_fail (GPM_IS_MANAGER (manager), FALSE);
/* check to see if we are inhibited */
- if (gpm_manager_is_inhibit_valid (manager, FALSE, "shutdown") == FALSE) {
+ if (gpm_manager_is_inhibit_valid (manager, FALSE, "shutdown") == FALSE)
return FALSE;
- }
return gpm_control_shutdown (manager->priv->control, error);
}
@@ -757,7 +738,6 @@
g_return_val_if_fail (manager != NULL, FALSE);
g_return_val_if_fail (GPM_IS_MANAGER (manager), FALSE);
*low_power = manager->priv->low_power;
-
return TRUE;
}
@@ -778,11 +758,7 @@
g_return_val_if_fail (manager != NULL, FALSE);
g_return_val_if_fail (GPM_IS_MANAGER (manager), FALSE);
on_ac = gpm_ac_adapter_is_present (manager->priv->ac_adapter);
- if (on_ac) {
- *on_battery = FALSE;
- } else {
- *on_battery = TRUE;
- }
+ *on_battery = !on_ac;
return TRUE;
}
@@ -908,9 +884,8 @@
} else if (mode == GPM_IDLE_MODE_SYSTEM) {
egg_debug ("Idle state changed: SYSTEM");
- if (gpm_manager_is_inhibit_valid (manager, FALSE, "timeout action") == FALSE) {
+ if (gpm_manager_is_inhibit_valid (manager, FALSE, "timeout action") == FALSE)
return;
- }
idle_do_sleep (manager);
}
}
@@ -982,8 +957,7 @@
* battery power.
**/
static void
-lid_button_pressed (GpmManager *manager,
- gboolean pressed)
+lid_button_pressed (GpmManager *manager, gboolean pressed)
{
gboolean on_ac;
gboolean has_inhibit;
@@ -992,6 +966,11 @@
on_ac = gpm_ac_adapter_is_present (manager->priv->ac_adapter);
+ if (pressed)
+ gpm_manager_play (manager, GPM_MANAGER_SOUND_LID_CLOSE, FALSE);
+ else
+ gpm_manager_play (manager, GPM_MANAGER_SOUND_LID_OPEN, FALSE);
+
if (pressed == FALSE) {
/* we turn the lid dpms back on unconditionally */
gpm_manager_unblank_screen (manager, NULL);
@@ -1018,9 +997,8 @@
/* if we are trying to suspend or hibernate then don't do action */
if ((strcmp (action, ACTION_SUSPEND) == 0) ||
- (strcmp (action, ACTION_HIBERNATE) == 0)) {
+ (strcmp (action, ACTION_HIBERNATE) == 0))
do_policy = FALSE;
- }
g_free (action);
}
@@ -1042,9 +1020,7 @@
* @manager: This class instance
**/
static void
-button_pressed_cb (GpmButton *button,
- const gchar *type,
- GpmManager *manager)
+button_pressed_cb (GpmButton *button, const gchar *type, GpmManager *manager)
{
egg_debug ("Button press event type=%s", type);
@@ -1053,27 +1029,20 @@
else if (strcmp (type, GPM_BUTTON_LID_OPEN) == 0)
gpm_info_event_log (manager->priv->info, GPM_EVENT_LID_OPENED, _("The laptop lid has been re-opened"));
- if (strcmp (type, GPM_BUTTON_POWER) == 0) {
+ if (strcmp (type, GPM_BUTTON_POWER) == 0)
power_button_pressed (manager);
-
- } else if (strcmp (type, GPM_BUTTON_SLEEP) == 0) {
+ else if (strcmp (type, GPM_BUTTON_SLEEP) == 0)
suspend_button_pressed (manager);
-
- } else if (strcmp (type, GPM_BUTTON_SUSPEND) == 0) {
+ else if (strcmp (type, GPM_BUTTON_SUSPEND) == 0)
suspend_button_pressed (manager);
-
- } else if (strcmp (type, GPM_BUTTON_HIBERNATE) == 0) {
+ else if (strcmp (type, GPM_BUTTON_HIBERNATE) == 0)
hibernate_button_pressed (manager);
-
- } else if (strcmp (type, GPM_BUTTON_LID_OPEN) == 0) {
+ else if (strcmp (type, GPM_BUTTON_LID_OPEN) == 0)
lid_button_pressed (manager, FALSE);
-
- } else if (strcmp (type, GPM_BUTTON_LID_CLOSED) == 0) {
+ else if (strcmp (type, GPM_BUTTON_LID_CLOSED) == 0)
lid_button_pressed (manager, TRUE);
-
- } else if (strcmp (type, GPM_BUTTON_BATTERY) == 0) {
+ else if (strcmp (type, GPM_BUTTON_BATTERY) == 0)
battery_button_pressed (manager);
- }
}
/**
@@ -1123,8 +1092,7 @@
/* We keep track of the lid state so we can do the
lid close on battery action if the ac_adapter is removed when the laptop
is closed. Fixes #331655 */
- if (event_when_closed && on_ac == FALSE &&
- gpm_button_is_lid_closed (manager->priv->button)) {
+ if (event_when_closed && on_ac == FALSE && gpm_button_is_lid_closed (manager->priv->button)) {
manager_policy_do (manager, GPM_CONF_BUTTON_LID_BATT,
_("The lid has been closed, and the ac adapter "
"removed (and gconf is okay)."));
@@ -1269,12 +1237,10 @@
hal_device_power_has_suspend_error (manager->priv->hal_device_power, &suspend_error);
hal_device_power_has_hibernate_error (manager->priv->hal_device_power, &hibernate_error);
- if (suspend_error) {
+ if (suspend_error)
gpm_notify_sleep_failed (manager->priv->notify, FALSE);
- }
- if (hibernate_error) {
+ if (hibernate_error)
gpm_notify_sleep_failed (manager->priv->notify, TRUE);
- }
}
/**
@@ -1401,9 +1367,8 @@
GpmCellUnitKind kind,
GpmManager *manager)
{
- if (kind == GPM_CELL_UNIT_KIND_PRIMARY) {
+ if (kind == GPM_CELL_UNIT_KIND_PRIMARY)
gpm_notify_fully_charged_primary (manager->priv->notify);
- }
}
/**
@@ -1414,11 +1379,10 @@
GpmCellUnitKind kind,
GpmManager *manager)
{
- if (kind == GPM_CELL_UNIT_KIND_PRIMARY) {
+ if (kind == GPM_CELL_UNIT_KIND_PRIMARY)
gpm_notify_discharging_primary (manager->priv->notify);
- } else if (kind == GPM_CELL_UNIT_KIND_UPS) {
+ else if (kind == GPM_CELL_UNIT_KIND_UPS)
gpm_notify_discharging_ups (manager->priv->notify);
- }
}
/**
@@ -1514,9 +1478,8 @@
/* we should tell the user how much time they have */
time = gpm_cell_array_get_time_until_action (collection->primary);
- if (time == 0) {
+ if (time == 0)
return g_strdup (_("a short time"));
- }
return gpm_get_timestring (time);
}
@@ -1550,18 +1513,14 @@
}
/* use different text for different actions */
- if (strcmp (action, ACTION_NOTHING) == 0) {
+ if (strcmp (action, ACTION_NOTHING) == 0)
action_text = g_strdup (_("Plug in your AC adapter to avoid losing data."));
-
- } else if (strcmp (action, ACTION_SUSPEND) == 0) {
+ else if (strcmp (action, ACTION_SUSPEND) == 0)
action_text = g_strdup_printf (_("This computer will suspend in %s if the AC is not connected."), time_text);
-
- } else if (strcmp (action, ACTION_HIBERNATE) == 0) {
+ else if (strcmp (action, ACTION_HIBERNATE) == 0)
action_text = g_strdup_printf (_("This computer will hibernate in %s if the AC is not connected."), time_text);
-
- } else if (strcmp (action, ACTION_SHUTDOWN) == 0) {
+ else if (strcmp (action, ACTION_SHUTDOWN) == 0)
action_text = g_strdup_printf (_("This computer will shutdown in %s if the AC is not connected."), time_text);
- }
message = g_strdup_printf (_("You have approximately <b>%s</b> of remaining battery life (%.1f%%). %s"),
remaining_text, unit->percentage, action_text);
@@ -1613,10 +1572,7 @@
* gpm_engine_charge_action_cb:
*/
static void
-gpm_engine_charge_action_cb (GpmEngine *engine,
- GpmCellUnitKind kind,
- GpmCellUnit *unit,
- GpmManager *manager)
+gpm_engine_charge_action_cb (GpmEngine *engine, GpmCellUnitKind kind, GpmCellUnit *unit, GpmManager *manager)
{
const gchar *title = NULL;
gchar *action;
@@ -1680,9 +1636,8 @@
}
/* not all types have actions */
- if (title == NULL) {
+ if (title == NULL)
return;
- }
/* get correct icon */
icon = gpm_cell_unit_get_icon (unit);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]