← Back to team overview

ayatana-commits team mailing list archive

[Branch ~dbusmenu-team/dbusmenu/trunk] Rev 87: Adding support for blank icons

 

Merge authors:
  Ted Gould (ted)
Related merge proposals:
  https://code.launchpad.net/~ted/dbusmenu/blank-icon-support/+merge/22044
  proposed by: Ted Gould (ted)
  review: Approve - Cody Russell (bratsche)
------------------------------------------------------------
revno: 87 [merge]
committer: Ted Gould <ted@xxxxxxxx>
branch nick: trunk
timestamp: Wed 2010-03-24 11:15:29 -0500
message:
  Adding support for blank icons
modified:
  libdbusmenu-glib/menuitem.h
  libdbusmenu-gtk/client.c
  tests/test-gtk-label.json


--
lp:dbusmenu
https://code.launchpad.net/~dbusmenu-team/dbusmenu/trunk

Your team ayatana-commits is subscribed to branch lp:dbusmenu.
To unsubscribe from this branch go to https://code.launchpad.net/~dbusmenu-team/dbusmenu/trunk/+edit-subscription.
=== modified file 'libdbusmenu-glib/menuitem.h'
--- libdbusmenu-glib/menuitem.h	2010-02-05 18:48:48 +0000
+++ libdbusmenu-glib/menuitem.h	2010-03-18 05:01:40 +0000
@@ -66,6 +66,8 @@
 #define DBUSMENU_MENUITEM_TOGGLE_STATE_CHECKED       1
 #define DBUSMENU_MENUITEM_TOGGLE_STATE_UNKNOWN       -1
 
+#define DBUSMENU_MENUITEM_ICON_NAME_BLANK            "blank-icon"
+
 /**
 	DbusmenuMenuitem:
 

=== modified file 'libdbusmenu-gtk/client.c'
--- libdbusmenu-gtk/client.c	2010-03-24 01:03:06 +0000
+++ libdbusmenu-gtk/client.c	2010-03-24 16:15:29 +0000
@@ -512,7 +512,7 @@
 	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 @@
 			/* 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 @@
 
 	}
 
+	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;

=== modified file 'tests/test-gtk-label.json'
--- tests/test-gtk-label.json	2010-02-05 17:53:19 +0000
+++ tests/test-gtk-label.json	2010-03-18 05:09:14 +0000
@@ -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",