diff options
author | Ted Gould <ted@gould.cx> | 2010-05-27 11:22:34 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-05-27 11:22:34 -0500 |
commit | ccd0a443edd807a13dafb41eb1539001719ac7f2 (patch) | |
tree | 6cf0fdc1040772683ac680f4bfd617787f4aebb3 /libdbusmenu-gtk | |
parent | 2d693fbc746eff5624cbe396e80398361cf4540f (diff) | |
parent | dece0b82c06a7ad23d204c394341d50a64ba3b7b (diff) | |
download | libdbusmenu-ccd0a443edd807a13dafb41eb1539001719ac7f2.tar.gz libdbusmenu-ccd0a443edd807a13dafb41eb1539001719ac7f2.tar.bz2 libdbusmenu-ccd0a443edd807a13dafb41eb1539001719ac7f2.zip |
Adding a simple function to get the submenu on the menuitem.
Diffstat (limited to 'libdbusmenu-gtk')
-rw-r--r-- | libdbusmenu-gtk/client.c | 23 | ||||
-rw-r--r-- | libdbusmenu-gtk/client.h | 1 |
2 files changed, 24 insertions, 0 deletions
diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c index b13af6a..3bd0af6 100644 --- a/libdbusmenu-gtk/client.c +++ b/libdbusmenu-gtk/client.c @@ -423,6 +423,29 @@ dbusmenu_gtkclient_menuitem_get (DbusmenuGtkClient * client, DbusmenuMenuitem * return GTK_MENU_ITEM(data); } +/** + dbusmenu_gtkclient_menuitem_get_submenu: + @client: A #DbusmenuGtkClient with the item in it. + @item: #DbusmenuMenuitem to get associated #GtkMenu on. + + This grabs the submenu associated with the menuitem. + + Return value: The #GtkMenu if there is one. +*/ +GtkMenu * +dbusmenu_gtkclient_menuitem_get_submenu (DbusmenuGtkClient * client, DbusmenuMenuitem * item) +{ + g_return_val_if_fail(DBUSMENU_IS_GTKCLIENT(client), NULL); + g_return_val_if_fail(DBUSMENU_IS_MENUITEM(item), NULL); + + gpointer data = g_object_get_data(G_OBJECT(item), data_menu); + if (data == NULL) { + return NULL; + } + + return GTK_MENU(data); +} + /* The base type handler that builds a plain ol' GtkMenuItem to represent, well, the GtkMenuItem */ static gboolean diff --git a/libdbusmenu-gtk/client.h b/libdbusmenu-gtk/client.h index 4cfbdcf..7672bf7 100644 --- a/libdbusmenu-gtk/client.h +++ b/libdbusmenu-gtk/client.h @@ -77,6 +77,7 @@ struct _DbusmenuGtkClient { GType dbusmenu_gtkclient_get_type (void); DbusmenuGtkClient * dbusmenu_gtkclient_new (gchar * dbus_name, gchar * dbus_object); GtkMenuItem * dbusmenu_gtkclient_menuitem_get (DbusmenuGtkClient * client, DbusmenuMenuitem * item); +GtkMenu * dbusmenu_gtkclient_menuitem_get_submenu (DbusmenuGtkClient * client, DbusmenuMenuitem * item); void dbusmenu_gtkclient_newitem_base (DbusmenuGtkClient * client, DbusmenuMenuitem * item, GtkMenuItem * gmi, DbusmenuMenuitem * parent); |