diff options
author | Javier Jardón <javier.jardon@codethink.co.uk> | 2011-09-12 13:59:15 +0100 |
---|---|---|
committer | Javier Jardón <javier.jardon@codethink.co.uk> | 2011-09-12 13:59:15 +0100 |
commit | 49ac0f5b5d346cb2851526bc36b7faa63561c7e5 (patch) | |
tree | 79e04de4a7c23b7d00218b599564b64d80927de8 | |
parent | 0a7452093ee5e9a6e0535341aebd4c2992147e7a (diff) | |
download | ayatana-indicator-power-49ac0f5b5d346cb2851526bc36b7faa63561c7e5.tar.gz ayatana-indicator-power-49ac0f5b5d346cb2851526bc36b7faa63561c7e5.tar.bz2 ayatana-indicator-power-49ac0f5b5d346cb2851526bc36b7faa63561c7e5.zip |
Use the same icon for all charge levels if we are in the charging status
From the designers (see bug comments):
"I think the shading inside the battery when charging is obscuring the
lightning bolt, and also giving the icon a visual style that is obviously
different from the text and discourages "reading" it together with the text.
So, I suggest leaving the brackets in place, but removing the shading from
the icon.
Fixes https://bugs.launchpad.net/indicator-power/+bug/824629
-rw-r--r-- | src/indicator-power.c | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/src/indicator-power.c b/src/indicator-power.c index a8ce859..28a8f17 100644 --- a/src/indicator-power.c +++ b/src/indicator-power.c @@ -359,6 +359,41 @@ set_accessible_desc (IndicatorPower *self, priv->accessible_desc = g_strdup (desc); } +static GIcon* +get_device_icon (UpDeviceKind kind, + UpDeviceState state, + gchar *device_icon) +{ + GIcon *gicon; + + if (kind == UP_DEVICE_KIND_BATTERY && + state == UP_DEVICE_STATE_CHARGING) + { + GString *filename; + gchar **iconnames; + const gchar *kind_str; + + kind_str = up_device_kind_to_string (kind); + filename = g_string_new (NULL); + g_string_append_printf (filename, "battery-caution-charging-symbolic;"); + g_string_append_printf (filename, "gpm-%s-000-charging;", kind_str); + g_string_append_printf (filename, "battery-caution-charging;"); + + iconnames = g_strsplit (filename->str, ";", -1); + gicon = g_themed_icon_new_from_names (iconnames, -1); + + g_strfreev (iconnames); + g_string_free (filename, TRUE); + } + else + { + gicon = g_icon_new_for_string (device_icon, NULL); + } + + return gicon; +} + + static void menu_add_device (GtkMenu *menu, GVariant *device) @@ -397,7 +432,7 @@ menu_add_device (GtkMenu *menu, g_debug ("%s: got data from object %s", G_STRFUNC, object_path); /* Process the data */ - device_gicons = g_icon_new_for_string (device_icon, NULL); + device_gicons = get_device_icon (kind, state, device_icon); icon = gtk_image_new_from_gicon (device_gicons, GTK_ICON_SIZE_SMALL_TOOLBAR); @@ -623,7 +658,7 @@ put_primary_device (IndicatorPower *self, g_debug ("%s: got data from object %s", G_STRFUNC, object_path); /* set icon */ - device_gicons = g_icon_new_for_string (device_icon, NULL); + device_gicons = get_device_icon (kind, state, device_icon); gtk_image_set_from_gicon (priv->status_image, device_gicons, GTK_ICON_SIZE_LARGE_TOOLBAR); |