From 6eef17fbf0844823f52d6971c5f597e366d6f24e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 18 Mar 2010 00:01:40 -0500 Subject: Adding a define to provide a blank icon in the icon name --- libdbusmenu-glib/menuitem.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libdbusmenu-glib/menuitem.h b/libdbusmenu-glib/menuitem.h index 1382335..04fd911 100644 --- a/libdbusmenu-glib/menuitem.h +++ b/libdbusmenu-glib/menuitem.h @@ -66,6 +66,8 @@ G_BEGIN_DECLS #define DBUSMENU_MENUITEM_TOGGLE_STATE_CHECKED 1 #define DBUSMENU_MENUITEM_TOGGLE_STATE_UNKNOWN -1 +#define DBUSMENU_MENUITEM_ICON_NAME_BLANK "blank-icon" + /** DbusmenuMenuitem: -- cgit v1.2.3 From e6a3a5a5c120082af8f45471646498d1ed957aa2 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 18 Mar 2010 00:06:21 -0500 Subject: Check to see if we sent the blank icon, and space appropriately. --- libdbusmenu-gtk/client.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c index 781326e..13a7499 100644 --- a/libdbusmenu-gtk/client.c +++ b/libdbusmenu-gtk/client.c @@ -525,6 +525,16 @@ 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); + } + + gint width, height; + gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height); + + gtkimage = gtk_image_new(); + gtk_widget_set_size_request(GTK_WIDGET(gtkimage), width, height); } else { /* Look to see if we want to have an icon with the 'ltr' or 'rtl' depending on what we're doing. */ -- cgit v1.2.3 From 7f482a71845029ea5bdb865b1acf6736315ca511 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 18 Mar 2010 00:09:14 -0500 Subject: Adding a blank item test, replacing sick. Bad icon. --- tests/test-gtk-label.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test-gtk-label.json b/tests/test-gtk-label.json index 973ab7b..755bd44 100644 --- a/tests/test-gtk-label.json +++ b/tests/test-gtk-label.json @@ -242,8 +242,8 @@ "label": "sad"}, {"id": 89, "type": "standard", - "icon-name": "face-sick", - "label": "sick"} + "icon-name": "blank-icon", + "label": "blank"} ] }, {"id": 9, "type": "standard", -- cgit v1.2.3 From c73fc61a3c5d997a21065c6269495e393d9e7bbe Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 18 Mar 2010 00:32:53 -0500 Subject: Add alignment settings to the icons --- libdbusmenu-gtk/client.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c index 13a7499..8483675 100644 --- a/libdbusmenu-gtk/client.c +++ b/libdbusmenu-gtk/client.c @@ -594,6 +594,10 @@ image_property_handle (DbusmenuMenuitem * item, const gchar * property, const GV } + if (gtkimage != NULL) { + gtk_misc_set_alignment(GTK_MISC(gtkimage), 0.0, 0.5); + } + genericmenuitem_set_image(GENERICMENUITEM(gimi), gtkimage); return; -- cgit v1.2.3 From 9855cec4e4cbc745fdafb6270975be7f3e4f99fc Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 23 Mar 2010 23:14:57 -0500 Subject: This is crazy --- libdbusmenu-gtk/client.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c index 8483675..dfa2fe2 100644 --- a/libdbusmenu-gtk/client.c +++ b/libdbusmenu-gtk/client.c @@ -533,7 +533,32 @@ image_property_handle (DbusmenuMenuitem * item, const gchar * property, const GV gint width, height; gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height); +#if 0 + /* Not work */ + GError * error = NULL; + GdkPixbuf * pixbuf = gdk_pixbuf_new_from_file("/usr/share/icons/hicolor/16x16/apps/wine.png", &error); + if (error != NULL) { g_warning("Blank error: %s", error->message); } + gtkimage = gtk_image_new_from_pixbuf(pixbuf); +#endif +#if 1 + /* Work */ + gtkimage = gtk_image_new_from_icon_name("stock_person", GTK_ICON_SIZE_MENU); +#endif +#if 0 + /* Not Work */ gtkimage = gtk_image_new(); +#endif +#if 0 + /* Not work */ + gtkimage = gtk_image_new_from_icon_name("stock_person", GTK_ICON_SIZE_MENU); + gtk_image_clear(GTK_IMAGE(gtkimage)); +#endif +#if 0 + /* Not work */ + gtkimage = gtk_image_new(); + gtk_widget_show(gtkimage); +#endif + gtk_widget_set_size_request(GTK_WIDGET(gtkimage), width, height); } else { /* Look to see if we want to have an icon with the 'ltr' or -- cgit v1.2.3 From f43fd84cd34b07a2966f858ca9c68985670fbe82 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 24 Mar 2010 11:05:34 -0500 Subject: Checking for blank icon when we get a pixmap paramater. --- libdbusmenu-gtk/client.c | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c index dfa2fe2..ba01800 100644 --- a/libdbusmenu-gtk/client.c +++ b/libdbusmenu-gtk/client.c @@ -513,7 +513,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; } } @@ -533,32 +533,7 @@ image_property_handle (DbusmenuMenuitem * item, const gchar * property, const GV gint width, height; gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height); -#if 0 - /* Not work */ - GError * error = NULL; - GdkPixbuf * pixbuf = gdk_pixbuf_new_from_file("/usr/share/icons/hicolor/16x16/apps/wine.png", &error); - if (error != NULL) { g_warning("Blank error: %s", error->message); } - gtkimage = gtk_image_new_from_pixbuf(pixbuf); -#endif -#if 1 - /* Work */ - gtkimage = gtk_image_new_from_icon_name("stock_person", GTK_ICON_SIZE_MENU); -#endif -#if 0 - /* Not Work */ gtkimage = gtk_image_new(); -#endif -#if 0 - /* Not work */ - gtkimage = gtk_image_new_from_icon_name("stock_person", GTK_ICON_SIZE_MENU); - gtk_image_clear(GTK_IMAGE(gtkimage)); -#endif -#if 0 - /* Not work */ - gtkimage = gtk_image_new(); - gtk_widget_show(gtkimage); -#endif - gtk_widget_set_size_request(GTK_WIDGET(gtkimage), width, height); } else { /* Look to see if we want to have an icon with the 'ltr' or -- cgit v1.2.3 From d8debfa0837737c6ecc59960197ca59c071ead0b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 24 Mar 2010 11:12:02 -0500 Subject: Moving the requesition to be for all icons. No reason not to just double check. --- libdbusmenu-gtk/client.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c index ba01800..d93bb93 100644 --- a/libdbusmenu-gtk/client.c +++ b/libdbusmenu-gtk/client.c @@ -530,11 +530,7 @@ image_property_handle (DbusmenuMenuitem * item, const gchar * property, const GV g_object_unref(gtkimage); } - gint width, height; - gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height); - gtkimage = gtk_image_new(); - gtk_widget_set_size_request(GTK_WIDGET(gtkimage), width, height); } else { /* Look to see if we want to have an icon with the 'ltr' or 'rtl' depending on what we're doing. */ @@ -595,6 +591,10 @@ 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); } -- cgit v1.2.3