aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-gtk/client.c
diff options
context:
space:
mode:
authorKen VanDine <ken.vandine@canonical.com>2010-01-12 11:03:31 -0500
committerKen VanDine <ken.vandine@canonical.com>2010-01-12 11:03:31 -0500
commited575a3914e965e03e5eeb98cf5e4a38e510afcd (patch)
tree5e838db01837910bf60cedfa238a5901a393c487 /libdbusmenu-gtk/client.c
parentd670a52dd5214eda4d821c512774b4bca66eaa2b (diff)
parent438443e863be28a23c9494281a2a10bea6a9b6fc (diff)
downloadlibdbusmenu-ed575a3914e965e03e5eeb98cf5e4a38e510afcd.tar.gz
libdbusmenu-ed575a3914e965e03e5eeb98cf5e4a38e510afcd.tar.bz2
libdbusmenu-ed575a3914e965e03e5eeb98cf5e4a38e510afcd.zip
merged 0.2.1
Diffstat (limited to 'libdbusmenu-gtk/client.c')
-rw-r--r--libdbusmenu-gtk/client.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c
index 4a8637a..dd94663 100644
--- a/libdbusmenu-gtk/client.c
+++ b/libdbusmenu-gtk/client.c
@@ -511,13 +511,31 @@ image_property_handle (DbusmenuMenuitem * item, const gchar * property, const GV
icon either. */
gtkimage = NULL;
} else {
+ /* Look to see if we want to have an icon with the 'ltr' or
+ 'rtl' depending on what we're doing. */
+ gchar * finaliconname = g_strdup_printf("%s-%s", iconname,
+ gtk_widget_get_direction(GTK_WIDGET(gimi)) == GTK_TEXT_DIR_RTL ? "rtl" : "ltr");
+ if (!gtk_icon_theme_has_icon(gtk_icon_theme_get_default(), finaliconname)) {
+ /* If we don't have that icon, fall back to having one
+ without the extra bits. */
+ g_free(finaliconname);
+ finaliconname = (gchar *)iconname; /* Dropping const not
+ becaue we don't love it. */
+ }
+
/* If we don't have an image, we need to build
one so that we can set the name. Otherwise we
can just convert it to this name. */
if (gtkimage == NULL) {
- gtkimage = gtk_image_new_from_icon_name(iconname, GTK_ICON_SIZE_MENU);
+ gtkimage = gtk_image_new_from_icon_name(finaliconname, GTK_ICON_SIZE_MENU);
} else {
- gtk_image_set_from_icon_name(GTK_IMAGE(gtkimage), iconname, GTK_ICON_SIZE_MENU);
+ gtk_image_set_from_icon_name(GTK_IMAGE(gtkimage), finaliconname, GTK_ICON_SIZE_MENU);
+ }
+
+ /* If we're using the name with extra bits, then we need
+ to free that string. */
+ if (finaliconname != iconname) {
+ g_free(finaliconname);
}
}
} else {