From 363df287e4f74e65a7be71c0c4e689d348cdaa11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jard=C3=B3n?= Date: Thu, 30 Jun 2011 00:18:37 +0100 Subject: Change the status icon when the charge changes --- src/indicator-power.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/indicator-power.c') diff --git a/src/indicator-power.c b/src/indicator-power.c index f9c97d7..573c321 100644 --- a/src/indicator-power.c +++ b/src/indicator-power.c @@ -37,7 +37,7 @@ with this program. If not, see . #include #include -#define DEFAULT_ICON "battery" +#define DEFAULT_ICON "battery-empty" #define INDICATOR_POWER_TYPE (indicator_power_get_type ()) #define INDICATOR_POWER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), INDICATOR_POWER_TYPE, IndicatorPower)) @@ -162,6 +162,7 @@ get_primary_device_cb (GObject *source_object, GAsyncResult *res, gpointer user_data) { + IndicatorPowerPrivate *priv = INDICATOR_POWER (user_data)->priv; UpDeviceKind kind; UpDeviceState state; GVariant *result; @@ -184,7 +185,7 @@ get_primary_device_cb (GObject *source_object, return; } - /* set the text */ + /* set the icon and text */ g_variant_get (result, "((susdut))", &object_path, @@ -196,6 +197,10 @@ get_primary_device_cb (GObject *source_object, g_debug ("got data from object %s", object_path); + /* set icon */ + priv->status_image = indicator_image_helper (icon_name); + gtk_widget_show (GTK_WIDGET (priv->status_image)); + /* get the title * translate it as it has limited entries as devices that are * fully charged are not returned as the primary device */ @@ -477,7 +482,7 @@ get_image (IndicatorObject *io) if (priv->status_image == NULL) { /* Will create the status icon if it doesn't exist already */ - priv->status_image = indicator_image_helper (DEFAULT_ICON "-panel"); + priv->status_image = indicator_image_helper (DEFAULT_ICON); gtk_widget_show (GTK_WIDGET (priv->status_image)); } -- cgit v1.2.3