aboutsummaryrefslogtreecommitdiff
path: root/src/indicator-power.c
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2012-04-15 09:20:51 -0500
committerCharles Kerr <charles.kerr@canonical.com>2012-04-15 09:20:51 -0500
commit3e9263995e880ac53322ed8229ca0b47dc5a7064 (patch)
tree1b31369ce8a9f60e665f2cd8933afda08412dde8 /src/indicator-power.c
parentfd5fac8de3af29f2d7a3ccd985092f9e14361026 (diff)
parent3242c72d1491b07ee04753e047c72854a0b88d26 (diff)
downloadayatana-indicator-power-3e9263995e880ac53322ed8229ca0b47dc5a7064.tar.gz
ayatana-indicator-power-3e9263995e880ac53322ed8229ca0b47dc5a7064.tar.bz2
ayatana-indicator-power-3e9263995e880ac53322ed8229ca0b47dc5a7064.zip
sync with lp:indicator-power
Diffstat (limited to 'src/indicator-power.c')
-rw-r--r--src/indicator-power.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/indicator-power.c b/src/indicator-power.c
index ea831e5..cf16fbf 100644
--- a/src/indicator-power.c
+++ b/src/indicator-power.c
@@ -512,9 +512,7 @@ get_device_icon (UpDeviceKind kind,
guint64 time_sec,
const gchar *device_icon)
{
- GIcon *gicon;
-
- gicon = g_icon_new_for_string (device_icon, NULL);
+ GIcon *gicon = NULL;
if (kind == UP_DEVICE_KIND_BATTERY &&
(state == UP_DEVICE_STATE_FULLY_CHARGED ||
@@ -538,6 +536,9 @@ get_device_icon (UpDeviceKind kind,
}
}
+ if (gicon == NULL)
+ gicon = g_icon_new_for_string (device_icon, NULL);
+
return gicon;
}
@@ -561,6 +562,7 @@ menu_add_device (GtkMenu *menu,
gchar *short_details = NULL;
gchar *details = NULL;
gchar *accessible_name = NULL;
+ AtkObject *atk_object;
if (device == NULL)
return;
@@ -583,6 +585,7 @@ menu_add_device (GtkMenu *menu,
device_gicons = get_device_icon (kind, state, time, device_icon);
icon = gtk_image_new_from_gicon (device_gicons,
GTK_ICON_SIZE_SMALL_TOOLBAR);
+ g_clear_object (&device_gicons);
device_name = device_kind_to_localised_string (kind);
@@ -590,6 +593,9 @@ menu_add_device (GtkMenu *menu,
/* Create menu item */
item = gtk_image_menu_item_new ();
+ atk_object = gtk_widget_get_accessible(item);
+ if (atk_object != NULL)
+ atk_object_set_name (atk_object, accessible_name);
grid = gtk_grid_new ();
gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
@@ -802,6 +808,7 @@ put_primary_device (IndicatorPower *self,
gtk_image_set_from_gicon (self->status_image,
device_gicons,
GTK_ICON_SIZE_LARGE_TOOLBAR);
+ g_clear_object (&device_gicons);
gtk_widget_show (GTK_WIDGET (self->status_image));