[Xfce4-commits] [xfce/xfce4-power-manager] 11/64: Update line power when state changes

noreply at xfce.org noreply at xfce.org
Mon May 26 06:00:06 CEST 2014


This is an automated email from the git hooks/post-receive script.

eric pushed a commit to branch master
in repository xfce/xfce4-power-manager.

commit 65d8b439dc4ae11a814c6c46650d4e10321f92a4
Author: Eric Koegel <eric.koegel at gmail.com>
Date:   Fri May 2 07:24:57 2014 +0300

    Update line power when state changes
---
 common/xfpm-power-common.c             |   11 +++++------
 panel-plugins/battery/battery-button.c |   12 +++++-------
 2 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/common/xfpm-power-common.c b/common/xfpm-power-common.c
index 980f236..fff15f6 100644
--- a/common/xfpm-power-common.c
+++ b/common/xfpm-power-common.c
@@ -230,7 +230,7 @@ get_device_icon_name (UpClient *upower, UpDevice *device)
 {
     gchar *icon_name = NULL, *icon_prefix;
     guint type = 0, state = 0;
-    gboolean on_battery;
+    gboolean online;
     gboolean present;
     gdouble percentage;
 
@@ -240,15 +240,14 @@ get_device_icon_name (UpClient *upower, UpDevice *device)
 		  "state", &state,
 		  "is-present", &present,
 		  "percentage", &percentage,
+		  "online", &online,
 		   NULL);
 
-    on_battery = up_client_get_on_battery (upower);
-
     icon_prefix = xfpm_battery_get_icon_prefix_device_enum_type (type);
 
     if ( type == UP_DEVICE_KIND_LINE_POWER )
     {
-	if ( !on_battery )
+	if ( online )
 	{
 	    icon_name = g_strdup_printf ("%s", XFPM_AC_ADAPTER_ICON);
 	}
@@ -265,7 +264,7 @@ get_device_icon_name (UpClient *upower, UpDevice *device)
 	}
 	else if (state == UP_DEVICE_STATE_FULLY_CHARGED )
 	{
-	    icon_name = g_strdup_printf ("%s%s", icon_prefix, on_battery ? "100" : "charged");
+	    icon_name = g_strdup_printf ("%s%s", icon_prefix, online ? "charged" : "100");
 	}
 	else if ( state == UP_DEVICE_STATE_CHARGING || state == UP_DEVICE_STATE_PENDING_CHARGE)
 	{
@@ -277,7 +276,7 @@ get_device_icon_name (UpClient *upower, UpDevice *device)
 	}
 	else if ( state == UP_DEVICE_STATE_EMPTY)
 	{
-	    icon_name = g_strdup_printf ("%s%s", icon_prefix, on_battery ? "000" : "000-charging");
+	    icon_name = g_strdup_printf ("%s%s", icon_prefix, online ? "000-charging" : "000");
 	}
     }
     else
diff --git a/panel-plugins/battery/battery-button.c b/panel-plugins/battery/battery-button.c
index 9d268dc..a55c4bd 100644
--- a/panel-plugins/battery/battery-button.c
+++ b/panel-plugins/battery/battery-button.c
@@ -342,7 +342,7 @@ get_device_description (UpClient *upower, UpDevice *device)
     gchar *est_time_str = NULL;
     guint type = 0, state = 0;
     gchar *model = NULL, *vendor = NULL;
-    gboolean on_battery;
+    gboolean online;
     gboolean present;
     gdouble percentage;
     guint64 time_to_empty, time_to_full;
@@ -357,20 +357,19 @@ get_device_description (UpClient *upower, UpDevice *device)
 		  "percentage", &percentage,
 		  "time-to-empty", &time_to_empty,
 		  "time-to-full", &time_to_full,
+		  "online", &online,
 		   NULL);
 
 
     if (type == UP_DEVICE_KIND_LINE_POWER)
     {
-	 on_battery = up_client_get_on_battery (upower);
-
-	if (on_battery)
+	if ( online )
 	{
-	    tip = g_strdup_printf(_("<b>On Battery</b>\t"));
+	    tip = g_strdup_printf(_("<b>Plugged In</b>\t"));
 	}
 	else
 	{
-	    tip = g_strdup_printf(_("<b>Plugged In</b>\t"));
+	    tip = g_strdup_printf(_("<b>On Battery</b>\t"));
 	}
 
 	return tip;
@@ -495,7 +494,6 @@ find_device_in_tree (BatteryButton *button, const gchar *object_path)
     return NULL;
 }
 
-
 static void
 #if UP_CHECK_VERSION(0, 99, 0)
 device_changed_cb (UpDevice *device, GParamSpec *pspec, BatteryButton *button)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list