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.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c
index 70b5fd2..4e037ee 100644
--- a/libdbusmenu-glib/menuitem.c
+++ b/libdbusmenu-glib/menuitem.c
@@ -446,7 +446,7 @@ send_about_to_show (DbusmenuMenuitem * mi, void (*cb) (DbusmenuMenuitem * mi, gp
{
g_return_if_fail(DBUSMENU_IS_MENUITEM(mi));
- if (dbusmenu_menuitem_get_children(mi) == NULL) {
+ if (dbusmenu_menuitem_get_children(mi) == NULL && g_strcmp0(DBUSMENU_MENUITEM_CHILD_DISPLAY_SUBMENU, dbusmenu_menuitem_property_get(mi, DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY)) != 0) {
g_warning("About to Show called on an item wihtout submenus. We're ignoring it.");
} else {
gboolean dummy;
@@ -575,7 +575,7 @@ dbusmenu_menuitem_set_realized (DbusmenuMenuitem * mi)
* has. The list is valid until another child related function
* is called, where it might be changed.
*
- * Return value: (transfer none): A #GList of pointers to #DbusmenuMenuitem objects.
+ * Return value: (transfer none) (element-type Dbusmenu.Menuitem): A #GList of pointers to #DbusmenuMenuitem objects.
*/
GList *
dbusmenu_menuitem_get_children (DbusmenuMenuitem * mi)
@@ -1694,25 +1694,20 @@ dbusmenu_menuitem_handle_event (DbusmenuMenuitem * mi, const gchar * name, GVari
#endif
DbusmenuMenuitemClass * class = DBUSMENU_MENUITEM_GET_CLASS(mi);
- /* We need to keep a ref to the variant because the signal
- handler will drop the floating ref and then we'll be up
- a creek if we don't have our own later. */
- if (variant != NULL) {
- g_variant_ref_sink(variant);
+ gboolean handled = FALSE;
+ if (variant == NULL) {
+ variant = g_variant_new_int32(0);
}
- gboolean handled = FALSE;
+ g_variant_ref_sink(variant);
+
g_signal_emit(G_OBJECT(mi), signals[EVENT], g_quark_from_string(name), name, variant, timestamp, &handled);
if (!handled && class->handle_event != NULL) {
class->handle_event(mi, name, variant, timestamp);
}
- if (variant != NULL) {
- g_variant_unref(variant);
- }
-
- return;
+ g_variant_unref(variant);
}
/**