aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-gtk
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-03-09 16:52:46 -0600
committerTed Gould <ted@gould.cx>2011-03-09 16:52:46 -0600
commit02b4e66962229f0d2ed48732466c6258b3b9a20a (patch)
tree98ef78ed27c68b7f71e94479a1021665f7bd53a0 /libdbusmenu-gtk
parentda12001cce940316c26b8dc68da507f62ea689a7 (diff)
downloadlibdbusmenu-02b4e66962229f0d2ed48732466c6258b3b9a20a.tar.gz
libdbusmenu-02b4e66962229f0d2ed48732466c6258b3b9a20a.tar.bz2
libdbusmenu-02b4e66962229f0d2ed48732466c6258b3b9a20a.zip
Add a function to get the cached menu item
Diffstat (limited to 'libdbusmenu-gtk')
-rw-r--r--libdbusmenu-gtk/parser.c19
-rw-r--r--libdbusmenu-gtk/parser.h1
2 files changed, 20 insertions, 0 deletions
diff --git a/libdbusmenu-gtk/parser.c b/libdbusmenu-gtk/parser.c
index a890543..1b032bb 100644
--- a/libdbusmenu-gtk/parser.c
+++ b/libdbusmenu-gtk/parser.c
@@ -109,6 +109,25 @@ dbusmenu_gtk_parse_menu_structure (GtkWidget * widget)
return recurse.parent;
}
+/**
+ * dbusmenu_gtk_parse_get_cached_item:
+ * @widget: A #GtkMenuItem that may have a cached #DbusmenuMenuitem from the parser
+ *
+ * The Dbusmenu GTK parser adds cached items on the various
+ * menu items throughout the tree. Sometimes it can be useful
+ * to get that cached item to use directly. This function
+ * will retrieve it for you.
+ *
+ * Return value: (transfer none): A pointer to the cached item
+ * or NULL if it isn't there.
+ */
+DbusmenuMenuitem *
+dbusmenu_gtk_parse_get_cached_item (GtkWidget * widget)
+{
+ g_return_val_if_fail(GTK_IS_MENU_ITEM(widget), NULL);
+ return DBUSMENU_MENUITEM(g_object_get_data(G_OBJECT(widget), CACHED_MENUITEM));
+}
+
static void
parse_data_free (gpointer data)
{
diff --git a/libdbusmenu-gtk/parser.h b/libdbusmenu-gtk/parser.h
index 8187a8e..97fa9c6 100644
--- a/libdbusmenu-gtk/parser.h
+++ b/libdbusmenu-gtk/parser.h
@@ -35,6 +35,7 @@ License version 3 and version 2.1 along with this program. If not, see
G_BEGIN_DECLS
DbusmenuMenuitem * dbusmenu_gtk_parse_menu_structure (GtkWidget * widget);
+DbusmenuMenuitem * dbusmenu_gtk_parse_get_cached_item (GtkWidget * widget);
/**
SECTION:parser