ayatana-commits team mailing list archive
-
ayatana-commits team
-
Mailing list archive
-
Message #01276
[Merge] lp:~ted/dbusmenu/blank-icon-support into lp:dbusmenu
Ted Gould has proposed merging lp:~ted/dbusmenu/blank-icon-support into lp:dbusmenu.
Requested reviews:
DBus Menu Team (dbusmenu-team)
Adding the ability to set the icon to "blank" so that there is space
taken but no icon placed there.
--
https://code.launchpad.net/~ted/dbusmenu/blank-icon-support/+merge/22044
Your team ayatana-commits is subscribed to branch lp:dbusmenu.
=== modified file 'libdbusmenu-glib/menuitem.h'
--- libdbusmenu-glib/menuitem.h 2010-02-05 18:48:48 +0000
+++ libdbusmenu-glib/menuitem.h 2010-03-24 16:30:36 +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-02-04 18:56:49 +0000
+++ libdbusmenu-gtk/client.c 2010-03-24 16:30:36 +0000
@@ -513,7 +513,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;
}
}
@@ -525,6 +525,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. */
@@ -584,6 +590,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-24 16:30:36 +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",
Follow ups