diff options
author | Cody Russell <cody.russell@canonical.com> | 2009-12-09 22:30:45 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2009-12-09 22:30:45 -0600 |
commit | 9e7a9fb39945611092f7f35d20cd2da8e762870b (patch) | |
tree | 20bd8246f7e898d63607bfb43b859b4d9c1407f6 /src | |
parent | 0e959b1d94b05b560d7de08c167a9a27ba9f68ff (diff) | |
parent | 6cb0e1a6708ea0aae9b07cb08e49f06220fceeb4 (diff) | |
download | ayatana-indicator-application-9e7a9fb39945611092f7f35d20cd2da8e762870b.tar.gz ayatana-indicator-application-9e7a9fb39945611092f7f35d20cd2da8e762870b.tar.bz2 ayatana-indicator-application-9e7a9fb39945611092f7f35d20cd2da8e762870b.zip |
Adding support for separators.
Diffstat (limited to 'src')
-rw-r--r-- | src/libappindicator/app-indicator.c | 42 |
1 files changed, 26 insertions, 16 deletions
diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index 5c04819..791f9ff 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -33,6 +33,7 @@ License version 3 and version 2.1 along with this program. If not, see #include <dbus/dbus-glib.h> #include <libdbusmenu-glib/server.h> +#include <libdbusmenu-gtk/client.h> #include "libappindicator/app-indicator.h" #include "libappindicator/app-indicator-enum-types.h" @@ -677,33 +678,42 @@ container_iterate (GtkWidget *widget, { DbusmenuMenuitem *root = (DbusmenuMenuitem *)data; DbusmenuMenuitem *child; - const gchar *label; + const gchar *label = NULL; gboolean label_set = FALSE; - label = gtk_menu_item_get_label (GTK_MENU_ITEM (widget)); - child = dbusmenu_menuitem_new (); - if (GTK_IS_IMAGE_MENU_ITEM (widget)) + if (GTK_IS_SEPARATOR_MENU_ITEM (widget)) + { + dbusmenu_menuitem_property_set (child, + "type", + DBUSMENU_CLIENT_TYPES_SEPARATOR); + } + else { - GtkWidget *image = gtk_image_menu_item_get_image (GTK_IMAGE_MENU_ITEM (widget)); + label = gtk_menu_item_get_label (GTK_MENU_ITEM (widget)); - if (gtk_image_get_storage_type (GTK_IMAGE (image)) == GTK_IMAGE_STOCK) + if (GTK_IS_IMAGE_MENU_ITEM (widget)) { - GtkStockItem stock; + GtkWidget *image = gtk_image_menu_item_get_image (GTK_IMAGE_MENU_ITEM (widget)); - gtk_stock_lookup (GTK_IMAGE (image)->data.stock.stock_id, &stock); + if (gtk_image_get_storage_type (GTK_IMAGE (image)) == GTK_IMAGE_STOCK) + { + GtkStockItem stock; - dbusmenu_menuitem_property_set (child, - DBUSMENU_MENUITEM_PROP_ICON, - GTK_IMAGE (image)->data.stock.stock_id); + gtk_stock_lookup (GTK_IMAGE (image)->data.stock.stock_id, &stock); - if (stock.label != NULL) - { dbusmenu_menuitem_property_set (child, - DBUSMENU_MENUITEM_PROP_LABEL, - stock.label); - label_set = TRUE; + DBUSMENU_MENUITEM_PROP_ICON, + GTK_IMAGE (image)->data.stock.stock_id); + + if (stock.label != NULL) + { + dbusmenu_menuitem_property_set (child, + DBUSMENU_MENUITEM_PROP_LABEL, + stock.label); + label_set = TRUE; + } } } } |