aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCody Russell <crussell@canonical.com>2009-12-09 22:10:40 -0600
committerCody Russell <crussell@canonical.com>2009-12-09 22:10:40 -0600
commit6cb0e1a6708ea0aae9b07cb08e49f06220fceeb4 (patch)
tree4ce8c2d7b47fd0f2551d32c817144f2d9aee2ce4
parentbae74eff1707ab9abac1f6122506ff1b7cc20098 (diff)
downloadlibayatana-appindicator-6cb0e1a6708ea0aae9b07cb08e49f06220fceeb4.tar.gz
libayatana-appindicator-6cb0e1a6708ea0aae9b07cb08e49f06220fceeb4.tar.bz2
libayatana-appindicator-6cb0e1a6708ea0aae9b07cb08e49f06220fceeb4.zip
Add support for separator menuitems
-rw-r--r--src/libappindicator/app-indicator.c42
1 files changed, 26 insertions, 16 deletions
diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c
index 6f4a6fd..f73369d 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"
@@ -660,33 +661,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;
+ }
}
}
}