diff options
author | Ted Gould <ted@gould.cx> | 2010-03-24 11:15:29 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-03-24 11:15:29 -0500 |
commit | 61885859a612061a04e1791b30265aa5fafa7b27 (patch) | |
tree | 3d56dfad6358113e4468a8aef7aee5eb68152c6a /libdbusmenu-gtk | |
parent | a4aaeaa22b710fdf74d6e19f0b29c8742c5a86f2 (diff) | |
parent | d8debfa0837737c6ecc59960197ca59c071ead0b (diff) | |
download | libdbusmenu-61885859a612061a04e1791b30265aa5fafa7b27.tar.gz libdbusmenu-61885859a612061a04e1791b30265aa5fafa7b27.tar.bz2 libdbusmenu-61885859a612061a04e1791b30265aa5fafa7b27.zip |
Adding support for blank icons
Diffstat (limited to 'libdbusmenu-gtk')
-rw-r--r-- | libdbusmenu-gtk/client.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c index bc97b97..e79d088 100644 --- a/libdbusmenu-gtk/client.c +++ b/libdbusmenu-gtk/client.c @@ -512,7 +512,7 @@ image_property_handle (DbusmenuMenuitem * item, const gchar * property, const GV if (!g_strcmp0(property, DBUSMENU_MENUITEM_PROP_ICON_DATA)) { /* If we have an image already built from a name that is way better than a pixbuf. Keep it. */ - if (gtkimage != NULL && gtk_image_get_storage_type(GTK_IMAGE(gtkimage)) == GTK_IMAGE_ICON_NAME) { + if (gtkimage != NULL && (gtk_image_get_storage_type(GTK_IMAGE(gtkimage)) == GTK_IMAGE_ICON_NAME || gtk_image_get_storage_type(GTK_IMAGE(gtkimage)) == GTK_IMAGE_EMPTY)) { return; } } @@ -524,6 +524,12 @@ image_property_handle (DbusmenuMenuitem * item, const gchar * property, const GV /* If there is no name, by golly we want no icon either. */ gtkimage = NULL; + } else if (g_strcmp0(iconname, DBUSMENU_MENUITEM_ICON_NAME_BLANK) == 0) { + if (gtkimage != NULL) { + g_object_unref(gtkimage); + } + + gtkimage = gtk_image_new(); } else { /* Look to see if we want to have an icon with the 'ltr' or 'rtl' depending on what we're doing. */ @@ -583,6 +589,14 @@ image_property_handle (DbusmenuMenuitem * item, const gchar * property, const GV } + if (gtkimage != NULL) { + gint width, height; + gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height); + + gtk_widget_set_size_request(GTK_WIDGET(gtkimage), width, height); + gtk_misc_set_alignment(GTK_MISC(gtkimage), 0.0, 0.5); + } + genericmenuitem_set_image(GENERICMENUITEM(gimi), gtkimage); return; |