aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-glib/menuitem.c
diff options
context:
space:
mode:
Diffstat (limited to 'libdbusmenu-glib/menuitem.c')
-rw-r--r--libdbusmenu-glib/menuitem.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c
index 28d3134..fce8ed5 100644
--- a/libdbusmenu-glib/menuitem.c
+++ b/libdbusmenu-glib/menuitem.c
@@ -1203,3 +1203,32 @@ dbusmenu_menuitem_handle_event (DbusmenuMenuitem * mi, const gchar * name, const
}
return;
}
+
+/**
+ dbusmenu_menuitem_send_about_to_show:
+ @mi: The #DbusmenuMenuitem to send the signal on.
+ @cb: Callback to call when the call has returned.
+ @cb_data: Data to pass to the callback.
+
+ This function is used to send the even that the submenu
+ of this item is about to be shown. Callers to this event
+ should delay showing the menu until their callback is
+ called if possible.
+*/
+void
+dbusmenu_menuitem_send_about_to_show (DbusmenuMenuitem * mi, dbusmenu_menuitem_about_to_show_cb cb, gpointer cb_data)
+{
+ g_return_if_fail(DBUSMENU_IS_MENUITEM(mi));
+ #ifdef MASSIVEDEBUGGING
+ g_debug("Submenu for menuitem %d (%s) is about to be shown", ID(mi), LABEL(mi));
+ #endif
+ DbusmenuMenuitemClass * class = DBUSMENU_MENUITEM_GET_CLASS(mi);
+
+ if (class->send_about_to_show != NULL) {
+ return class->send_about_to_show(mi, cb, cb_data);
+ } else if (cb != NULL) {
+ cb(mi, cb_data);
+ }
+
+ return;
+}