gnome-power-manager r2681 - in trunk: . src



Author: rhughes
Date: Tue Feb 19 15:21:46 2008
New Revision: 2681
URL: http://svn.gnome.org/viewvc/gnome-power-manager?rev=2681&view=rev

Log:
2008-02-19  Richard Hughes  <richard hughsie com>

* src/gpm-engine.c: (gpm_engine_get_icon):
Only get the state if the collection item is present, to avoid lots of
printing of 'percentage zero, something's gone wrong'.
Should be no functional change.


Modified:
   trunk/ChangeLog
   trunk/src/gpm-engine.c

Modified: trunk/src/gpm-engine.c
==============================================================================
--- trunk/src/gpm-engine.c	(original)
+++ trunk/src/gpm-engine.c	Tue Feb 19 15:21:46 2008
@@ -389,29 +389,41 @@
 
 	/* we try CRITICAL: PRIMARY, UPS, MOUSE, KEYBOARD */
 	gpm_debug ("Trying CRITICAL icon: primary, ups, mouse, keyboard");
-	state = gpm_warnings_get_state (engine->priv->warnings, unit_primary);
-	if (unit_primary->is_present == TRUE && state == GPM_WARNINGS_CRITICAL) {
-		return gpm_cell_array_get_icon (collection->primary);
+	if (unit_primary->is_present == TRUE) {
+		state = gpm_warnings_get_state (engine->priv->warnings, unit_primary);
+		if (state == GPM_WARNINGS_CRITICAL) {
+			return gpm_cell_array_get_icon (collection->primary);
+		}
 	}
-	state = gpm_warnings_get_state (engine->priv->warnings, unit_ups); 
-	if (unit_ups->is_present == TRUE && state == GPM_WARNINGS_CRITICAL) {
-		return gpm_cell_array_get_icon (collection->ups);
+	if (unit_ups->is_present == TRUE) {
+		state = gpm_warnings_get_state (engine->priv->warnings, unit_ups); 
+		if (state == GPM_WARNINGS_CRITICAL) {
+			return gpm_cell_array_get_icon (collection->ups);
+		}
+	}
+	if (unit_keyboard->is_present == TRUE) {
+		state = gpm_warnings_get_state (engine->priv->warnings, unit_phone);
+		if (state == GPM_WARNINGS_CRITICAL) {
+			return gpm_cell_array_get_icon (collection->phone);
+		}
+	}
+	if (unit_mouse->is_present == TRUE) {
+		state = gpm_warnings_get_state (engine->priv->warnings, unit_mouse);
+		if (state == GPM_WARNINGS_CRITICAL) {
+			return gpm_cell_array_get_icon (collection->mouse);
+		}
 	}
-	state = gpm_warnings_get_state (engine->priv->warnings, unit_phone);
-	if (unit_keyboard->is_present == TRUE && state == GPM_WARNINGS_CRITICAL) {
-		return gpm_cell_array_get_icon (collection->phone);
-	}
-	state = gpm_warnings_get_state (engine->priv->warnings, unit_mouse);
-	if (unit_mouse->is_present == TRUE && state == GPM_WARNINGS_CRITICAL) {
-		return gpm_cell_array_get_icon (collection->mouse);
-	}
-	state = gpm_warnings_get_state (engine->priv->warnings, unit_keyboard);
-	if (unit_keyboard->is_present == TRUE && state == GPM_WARNINGS_CRITICAL) {
-		return gpm_cell_array_get_icon (collection->keyboard);
-	}
-	state = gpm_warnings_get_state (engine->priv->warnings, unit_pda);
-	if (unit_keyboard->is_present == TRUE && state == GPM_WARNINGS_CRITICAL) {
-		return gpm_cell_array_get_icon (collection->pda);
+	if (unit_keyboard->is_present == TRUE) {
+		state = gpm_warnings_get_state (engine->priv->warnings, unit_keyboard);
+		if (state == GPM_WARNINGS_CRITICAL) {
+			return gpm_cell_array_get_icon (collection->keyboard);
+		}
+	}
+	if (unit_keyboard->is_present == TRUE) {
+		state = gpm_warnings_get_state (engine->priv->warnings, unit_pda);
+		if (state == GPM_WARNINGS_CRITICAL) {
+			return gpm_cell_array_get_icon (collection->pda);
+		}
 	}
 
 	if (engine->priv->icon_policy == GPM_ICON_POLICY_CRITICAL) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]