From fc9d42883ae66f91ac330bd32bc3ffe31d88393c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 20 Aug 2010 14:49:33 -0500 Subject: Adding the signal and function to show the menu item to the user. --- libdbusmenu-glib/menuitem.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'libdbusmenu-glib/menuitem.c') diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 623539c..ea69776 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -70,6 +70,7 @@ enum { CHILD_REMOVED, CHILD_MOVED, REALIZED, + SHOW_TO_USER, LAST_SIGNAL }; @@ -211,6 +212,22 @@ dbusmenu_menuitem_class_init (DbusmenuMenuitemClass *klass) NULL, NULL, _dbusmenu_menuitem_marshal_VOID__VOID, G_TYPE_NONE, 0, G_TYPE_NONE); + /** + DbusmenuMenuitem::show-to-user: + @arg0: The #DbusmenuMenuitem which should be shown. + @arg1: Timestamp the event happened at + + Signaled when the application would like the visualization + of this menu item shown to the user. This usually requires + going over the bus to get it done. + */ + signals[SHOW_TO_USER] = g_signal_new(DBUSMENU_MENUITEM_SIGNAL_SHOW_TO_USER, + G_TYPE_FROM_CLASS(klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(DbusmenuMenuitemClass, show_to_user), + NULL, NULL, + g_cclosure_marshal_VOID__UINT, + G_TYPE_NONE, 1, G_TYPE_UINT, G_TYPE_NONE); g_object_class_install_property (object_class, PROP_ID, g_param_spec_int(PROP_ID_S, "ID for the menu item", @@ -1349,3 +1366,22 @@ dbusmenu_menuitem_send_about_to_show (DbusmenuMenuitem * mi, dbusmenu_menuitem_a return; } + +/** + dbusmenu_menuitem_show_to_user: + @mi: #DbusmenuMenuitem to show + @timestamp: The time that the user requested it to be shown + + Signals that this menu item should be shown to the user. If this is + server side the server will then take it and send it over the + bus. +*/ +void +dbusmenu_menuitem_show_to_user (DbusmenuMenuitem * mi, guint timestamp) +{ + g_return_if_fail(DBUSMENU_IS_MENUITEM(mi)); + + g_signal_emit(G_OBJECT(mi), signals[SHOW_TO_USER], 0, timestamp, TRUE); + + return; +} -- cgit v1.2.3 From d177c5f4692279198a2ff4b7e21e92208a69075b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 17 Sep 2010 16:33:38 -0500 Subject: Turn about to show into an activate for those with children. --- libdbusmenu-glib/menuitem.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'libdbusmenu-glib/menuitem.c') diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index ea69776..fb12163 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -97,6 +97,7 @@ static void get_property (GObject * obj, guint id, GValue * value, GParamSpec * static void g_value_transform_STRING_BOOLEAN (const GValue * in, GValue * out); static void g_value_transform_STRING_INT (const GValue * in, GValue * out); static void handle_event (DbusmenuMenuitem * mi, const gchar * name, const GValue * value, guint timestamp); +static void send_about_to_show (DbusmenuMenuitem * mi, dbusmenu_menuitem_about_to_show_cb cb, gpointer cb_data); /* GObject stuff */ G_DEFINE_TYPE (DbusmenuMenuitem, dbusmenu_menuitem, G_TYPE_OBJECT); @@ -114,6 +115,7 @@ dbusmenu_menuitem_class_init (DbusmenuMenuitemClass *klass) object_class->get_property = get_property; klass->handle_event = handle_event; + klass->send_about_to_show = send_about_to_show; /** DbusmenuMenuitem::property-changed: @@ -387,6 +389,28 @@ handle_event (DbusmenuMenuitem * mi, const gchar * name, const GValue * value, g return; } +/* Handles our about to show signal on items that submenus + exist. This is sending just activate now, but we should + probably consider a special signal in the future if GTK + gets more sophisticated about this. */ +static void +send_about_to_show (DbusmenuMenuitem * mi, dbusmenu_menuitem_about_to_show_cb cb, gpointer cb_data) +{ + g_return_if_fail(DBUSMENU_IS_MENUITEM(mi)); + + if (dbusmenu_menuitem_get_children(mi) == NULL) { + g_warning("About to Show called on an item wihtout submenus. We're ignoring it."); + } else { + g_signal_emit(G_OBJECT(mi), signals[ITEM_ACTIVATED], 0, 0 /* timestamp */, TRUE); + } + + if (cb != NULL) { + cb(mi, cb_data); + } + + return; +} + /* Public interface */ /** -- cgit v1.2.3 From d7c35c09381063b16ef2221fd3edf1d537ac5578 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 22 Sep 2010 09:39:21 -0500 Subject: Removing the typedef for the callback --- libdbusmenu-glib/menuitem.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'libdbusmenu-glib/menuitem.c') diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index fb12163..ef037d1 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -97,7 +97,7 @@ static void get_property (GObject * obj, guint id, GValue * value, GParamSpec * static void g_value_transform_STRING_BOOLEAN (const GValue * in, GValue * out); static void g_value_transform_STRING_INT (const GValue * in, GValue * out); static void handle_event (DbusmenuMenuitem * mi, const gchar * name, const GValue * value, guint timestamp); -static void send_about_to_show (DbusmenuMenuitem * mi, dbusmenu_menuitem_about_to_show_cb cb, gpointer cb_data); +static void send_about_to_show (DbusmenuMenuitem * mi, void (*cb) (DbusmenuMenuitem * mi, gpointer user_data), gpointer cb_data); /* GObject stuff */ G_DEFINE_TYPE (DbusmenuMenuitem, dbusmenu_menuitem, G_TYPE_OBJECT); @@ -394,7 +394,7 @@ handle_event (DbusmenuMenuitem * mi, const gchar * name, const GValue * value, g probably consider a special signal in the future if GTK gets more sophisticated about this. */ static void -send_about_to_show (DbusmenuMenuitem * mi, dbusmenu_menuitem_about_to_show_cb cb, gpointer cb_data) +send_about_to_show (DbusmenuMenuitem * mi, void (*cb) (DbusmenuMenuitem * mi, gpointer user_data), gpointer cb_data) { g_return_if_fail(DBUSMENU_IS_MENUITEM(mi)); @@ -1374,7 +1374,7 @@ dbusmenu_menuitem_handle_event (DbusmenuMenuitem * mi, const gchar * name, const called if possible. */ void -dbusmenu_menuitem_send_about_to_show (DbusmenuMenuitem * mi, dbusmenu_menuitem_about_to_show_cb cb, gpointer cb_data) +dbusmenu_menuitem_send_about_to_show (DbusmenuMenuitem * mi, void (*cb) (DbusmenuMenuitem * mi, gpointer user_data), gpointer cb_data) { g_return_if_fail(DBUSMENU_IS_MENUITEM(mi)); #ifdef MASSIVEDEBUGGING -- cgit v1.2.3 From 3dcaae7b7da97aa3b84f94ed5ebc3f6fba86cc41 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 12 Oct 2010 16:14:21 -0500 Subject: Putting the pointer to the private area in the instance --- libdbusmenu-glib/menuitem.c | 1 - 1 file changed, 1 deletion(-) (limited to 'libdbusmenu-glib/menuitem.c') diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index ef037d1..e9b70d4 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -52,7 +52,6 @@ License version 3 and version 2.1 along with this program. If not, see out of data that we have. They can still be gotten using accessor functions, but are protected appropriately. */ -typedef struct _DbusmenuMenuitemPrivate DbusmenuMenuitemPrivate; struct _DbusmenuMenuitemPrivate { gint id; -- cgit v1.2.3 From e437868558658d3c949b787566ab5668a0194d3a Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 12 Oct 2010 16:21:44 -0500 Subject: Switching to using the pointer in the instance --- libdbusmenu-glib/menuitem.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'libdbusmenu-glib/menuitem.c') diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index e9b70d4..73b765b 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -83,8 +83,7 @@ enum { #define PROP_ID_S "id" -#define DBUSMENU_MENUITEM_GET_PRIVATE(o) \ -(G_TYPE_INSTANCE_GET_PRIVATE ((o), DBUSMENU_TYPE_MENUITEM, DbusmenuMenuitemPrivate)) +#define DBUSMENU_MENUITEM_GET_PRIVATE(o) (DBUSMENU_MENUITEM(o)->priv) /* Prototypes */ static void dbusmenu_menuitem_class_init (DbusmenuMenuitemClass *klass); @@ -289,6 +288,8 @@ _g_value_free (gpointer data) static void dbusmenu_menuitem_init (DbusmenuMenuitem *self) { + self->priv = G_TYPE_INSTANCE_GET_PRIVATE ((self), DBUSMENU_TYPE_MENUITEM, DbusmenuMenuitemPrivate); + DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(self); priv->id = -1; -- cgit v1.2.3 From 92942cc10074b24d7e0c13e76754ab149c27b923 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 14 Oct 2010 16:00:38 -0500 Subject: Adding a helper function to get the menuitem properties as a variant --- libdbusmenu-glib/menuitem.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'libdbusmenu-glib/menuitem.c') diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 73b765b..5e700a5 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1220,6 +1220,50 @@ dbusmenu_menuitem_properties_copy (DbusmenuMenuitem * mi) return ret; } +/* Looks at each value in the hashtable and tries to convert it + into a variant and add it to our variant builder */ +static void +variant_helper (gpointer in_key, gpointer in_value, gpointer user_data) +{ + GValue vval = {0}; + g_value_init(&vval, G_TYPE_VARIANT); + + if (!g_value_transform((GValue *)in_value, &vval)) { + g_warning("Unable to convert property '%s' of type '%s'", (gchar *)in_key, G_VALUE_TYPE_NAME(in_value)); + return; + } + + g_variant_builder_add((GVariantBuilder *)user_data, "{sv}", in_key, g_value_get_variant(&vval)); + g_value_unset(&vval); + + return; +} + +/** + dbusmenu_menuitem_properties_variant: + @mi: #DbusmenuMenuitem to get properties from + + Grabs the properties of the menuitem as a GVariant with the + type "a{sv}". + + Return Value: A GVariant of type "a{sv}" or NULL on error. +*/ +GVariant * +dbusmenu_menuitem_properties_variant (DbusmenuMenuitem * mi) +{ + g_return_val_if_fail(DBUSMENU_IS_MENUITEM(mi), NULL); + + DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi); + + GVariantBuilder * builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}")); + + g_hash_table_foreach(priv->properties, variant_helper, builder); + + GVariant * final_variant = g_variant_builder_end(builder); + g_variant_builder_unref(builder); + return final_variant; +} + /** dbusmenu_menuitem_set_root: @mi: #DbusmenuMenuitem to set whether it's root -- cgit v1.2.3 From bf33041c44cc9edd029a2ebe1359a78103f8e9f9 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 15 Nov 2010 16:25:49 -0600 Subject: Some stub functions so that we can compile --- libdbusmenu-glib/menuitem.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'libdbusmenu-glib/menuitem.c') diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 5e700a5..7497697 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1021,6 +1021,13 @@ dbusmenu_menuitem_property_set_value (DbusmenuMenuitem * mi, const gchar * prope return TRUE; } +gboolean +dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * property, const GVariant * value) +{ + + return FALSE; +} + /** dbusmenu_menuitem_property_get: @mi: The #DbusmenuMenuitem to look for the property on. @@ -1065,6 +1072,13 @@ dbusmenu_menuitem_property_get_value (DbusmenuMenuitem * mi, const gchar * prope return (const GValue *)g_hash_table_lookup(priv->properties, property); } +const GVariant * +dbusmenu_menuitem_property_get_variant (DbusmenuMenuitem * mi, const gchar * property) +{ + + return NULL; +} + /** dbusmenu_menuitem_property_get_bool: @mi: The #DbusmenuMenuitem to look for the property on. -- cgit v1.2.3 From d2eaaa6de0019da3bb9202dc0cb194ca5ef9d79f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 16 Nov 2010 16:25:24 -0600 Subject: It doesn't really match standard GVariant syntax to have this be a const --- libdbusmenu-glib/menuitem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libdbusmenu-glib/menuitem.c') diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 7497697..80d9df4 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1072,7 +1072,7 @@ dbusmenu_menuitem_property_get_value (DbusmenuMenuitem * mi, const gchar * prope return (const GValue *)g_hash_table_lookup(priv->properties, property); } -const GVariant * +GVariant * dbusmenu_menuitem_property_get_variant (DbusmenuMenuitem * mi, const gchar * property) { -- cgit v1.2.3 From f39b7fe067855d42dd79300d2d283b02eef48a03 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 17 Nov 2010 16:25:52 -0600 Subject: Switch the internal hash table to be variant and implement the set and get functions. Also TODOs around other needed changes. --- libdbusmenu-glib/menuitem.c | 80 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 69 insertions(+), 11 deletions(-) (limited to 'libdbusmenu-glib/menuitem.c') diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 80d9df4..28a711a 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -271,15 +271,12 @@ g_value_transform_STRING_INT (const GValue * in, GValue * out) static gint menuitem_next_id = 1; -/* A small little function to both clear the insides of a - value as well as the memory it itself uses. */ +/* Make the unref function match the prototype need for the + hashtable destructor */ static void -_g_value_free (gpointer data) +_g_variant_unref (gpointer data) { - if (data == NULL) return; - GValue * value = (GValue*)data; - g_value_unset(value); - g_free(data); + g_variant_unref((GVariant *)data); return; } @@ -295,7 +292,7 @@ dbusmenu_menuitem_init (DbusmenuMenuitem *self) priv->id = -1; priv->children = NULL; - priv->properties = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, _g_value_free); + priv->properties = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, _g_variant_unref); priv->root = FALSE; priv->realized = FALSE; @@ -919,6 +916,7 @@ dbusmenu_menuitem_property_set (DbusmenuMenuitem * mi, const gchar * property, c GValue val = {0}; g_value_init(&val, G_TYPE_STRING); g_value_set_static_string(&val, value); + /* TODO: Switch to use variant */ return dbusmenu_menuitem_property_set_value(mi, property, &val); } @@ -943,6 +941,7 @@ dbusmenu_menuitem_property_set_bool (DbusmenuMenuitem * mi, const gchar * proper GValue val = {0}; g_value_init(&val, G_TYPE_BOOLEAN); g_value_set_boolean(&val, value); + /* TODO: Switch to use variant */ return dbusmenu_menuitem_property_set_value(mi, property, &val); } @@ -967,11 +966,12 @@ dbusmenu_menuitem_property_set_int (DbusmenuMenuitem * mi, const gchar * propert GValue val = {0}; g_value_init(&val, G_TYPE_INT); g_value_set_int(&val, value); + /* TODO: Switch to use variant */ return dbusmenu_menuitem_property_set_value(mi, property, &val); } /** - dbusmenu_menuitem_property_set: + dbusmenu_menuitem_property_set_value: @mi: The #DbusmenuMenuitem to set the property on. @property: Name of the property to set. @value: The value of the property. @@ -988,6 +988,7 @@ dbusmenu_menuitem_property_set_int (DbusmenuMenuitem * mi, const gchar * propert gboolean dbusmenu_menuitem_property_set_value (DbusmenuMenuitem * mi, const gchar * property, const GValue * value) { + /* TODO: Switch to use variant */ g_return_val_if_fail(DBUSMENU_IS_MENUITEM(mi), FALSE); g_return_val_if_fail(property != NULL, FALSE); g_return_val_if_fail(G_IS_VALUE(value), FALSE); @@ -1021,9 +1022,46 @@ dbusmenu_menuitem_property_set_value (DbusmenuMenuitem * mi, const gchar * prope return TRUE; } +/** + dbusmenu_menuitem_property_set_variant: + @mi: The #DbusmenuMenuitem to set the property on. + @property: Name of the property to set. + @value: The value of the property. + + Takes the pair of @property and @value and places them as a + property on @mi. If a property already exists by that name, + then the value is set to the new value. If not, the property + is added. If the value is changed or the property was previously + unset then the signal #DbusmenuMenuitem::prop-changed will be + emitted by this function. + + Return value: A boolean representing if the property value was set. +*/ gboolean -dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * property, const GVariant * value) +dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * property, GVariant * value) { + g_return_val_if_fail(DBUSMENU_IS_MENUITEM(mi), FALSE); + g_return_val_if_fail(property != NULL, FALSE); + + DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi); + + gchar * lprop = g_strdup(property); + g_variant_ref(value); + + gboolean replaced = FALSE; + gpointer currentval = g_hash_table_lookup(priv->properties, lprop); + if (currentval == NULL || !g_variant_equal((GVariant*)currentval, value)) { + g_hash_table_replace(priv->properties, lprop, value); + replaced = TRUE; + } + + /* NOTE: The actual value is invalid at this point + becuse it has been unref'd when replaced in the hash + table. But the fact that there was a value is + the imporant part. */ + if (currentval != NULL && replaced) { + g_signal_emit(G_OBJECT(mi), signals[PROPERTY_CHANGED], 0, lprop, value, TRUE); + } return FALSE; } @@ -1044,6 +1082,7 @@ dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * pro const gchar * dbusmenu_menuitem_property_get (DbusmenuMenuitem * mi, const gchar * property) { + /* TODO: Switch to use variant */ const GValue * value = dbusmenu_menuitem_property_get_value(mi, property); if (value == NULL) return NULL; if (G_VALUE_TYPE(value) != G_TYPE_STRING) return NULL; @@ -1064,6 +1103,7 @@ dbusmenu_menuitem_property_get (DbusmenuMenuitem * mi, const gchar * property) const GValue * dbusmenu_menuitem_property_get_value (DbusmenuMenuitem * mi, const gchar * property) { + /* TODO: Switch to use variant */ g_return_val_if_fail(DBUSMENU_IS_MENUITEM(mi), NULL); g_return_val_if_fail(property != NULL, NULL); @@ -1072,11 +1112,26 @@ dbusmenu_menuitem_property_get_value (DbusmenuMenuitem * mi, const gchar * prope return (const GValue *)g_hash_table_lookup(priv->properties, property); } +/** + dbusmenu_menuitem_property_get_variant: + @mi: The #DbusmenuMenuitem to look for the property on. + @property: The property to grab. + + Look up a property on @mi and return the value of it if + it exits. #NULL will be returned if the property doesn't + exist. + + Return value: A GVariant for the property. +*/ GVariant * dbusmenu_menuitem_property_get_variant (DbusmenuMenuitem * mi, const gchar * property) { + g_return_val_if_fail(DBUSMENU_IS_MENUITEM(mi), NULL); + g_return_val_if_fail(property != NULL, NULL); - return NULL; + DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi); + + return (GVariant *)g_hash_table_lookup(priv->properties, property); } /** @@ -1092,6 +1147,7 @@ dbusmenu_menuitem_property_get_variant (DbusmenuMenuitem * mi, const gchar * pro gboolean dbusmenu_menuitem_property_get_bool (DbusmenuMenuitem * mi, const gchar * property) { + /* TODO: Switch to use variant */ const GValue * value = dbusmenu_menuitem_property_get_value(mi, property); if (value == NULL) return FALSE; if (G_VALUE_TYPE(value) != G_TYPE_BOOLEAN) { @@ -1120,6 +1176,7 @@ dbusmenu_menuitem_property_get_bool (DbusmenuMenuitem * mi, const gchar * proper gint dbusmenu_menuitem_property_get_int (DbusmenuMenuitem * mi, const gchar * property) { + /* TODO: Switch to use variant */ const GValue * value = dbusmenu_menuitem_property_get_value(mi, property); if (value == NULL) return 0; if (G_VALUE_TYPE(value) != G_TYPE_INT) { @@ -1239,6 +1296,7 @@ dbusmenu_menuitem_properties_copy (DbusmenuMenuitem * mi) static void variant_helper (gpointer in_key, gpointer in_value, gpointer user_data) { + /* TODO: Switch to being a variant */ GValue vval = {0}; g_value_init(&vval, G_TYPE_VARIANT); -- cgit v1.2.3 From 7352a7e71fbe842b9429bb5fcc6ab23e6578d4d1 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 17 Nov 2010 17:22:59 -0600 Subject: Replacing the value based functions with variants instead of values. --- libdbusmenu-glib/menuitem.c | 81 +++++++++++++++++++++------------------------ 1 file changed, 38 insertions(+), 43 deletions(-) (limited to 'libdbusmenu-glib/menuitem.c') diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 28a711a..a9036f0 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -913,11 +913,8 @@ dbusmenu_menuitem_find_id (DbusmenuMenuitem * mi, gint id) gboolean dbusmenu_menuitem_property_set (DbusmenuMenuitem * mi, const gchar * property, const gchar * value) { - GValue val = {0}; - g_value_init(&val, G_TYPE_STRING); - g_value_set_static_string(&val, value); - /* TODO: Switch to use variant */ - return dbusmenu_menuitem_property_set_value(mi, property, &val); + GVariant * variant = g_variant_new("s", value); + return dbusmenu_menuitem_property_set_variant(mi, property, variant); } /** @@ -938,11 +935,8 @@ dbusmenu_menuitem_property_set (DbusmenuMenuitem * mi, const gchar * property, c gboolean dbusmenu_menuitem_property_set_bool (DbusmenuMenuitem * mi, const gchar * property, const gboolean value) { - GValue val = {0}; - g_value_init(&val, G_TYPE_BOOLEAN); - g_value_set_boolean(&val, value); - /* TODO: Switch to use variant */ - return dbusmenu_menuitem_property_set_value(mi, property, &val); + GVariant * variant = g_variant_new("b", value); + return dbusmenu_menuitem_property_set_variant(mi, property, variant); } /** @@ -963,11 +957,8 @@ dbusmenu_menuitem_property_set_bool (DbusmenuMenuitem * mi, const gchar * proper gboolean dbusmenu_menuitem_property_set_int (DbusmenuMenuitem * mi, const gchar * property, const gint value) { - GValue val = {0}; - g_value_init(&val, G_TYPE_INT); - g_value_set_int(&val, value); - /* TODO: Switch to use variant */ - return dbusmenu_menuitem_property_set_value(mi, property, &val); + GVariant * variant = g_variant_new("i", value); + return dbusmenu_menuitem_property_set_variant(mi, property, variant); } /** @@ -1082,11 +1073,10 @@ dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * pro const gchar * dbusmenu_menuitem_property_get (DbusmenuMenuitem * mi, const gchar * property) { - /* TODO: Switch to use variant */ - const GValue * value = dbusmenu_menuitem_property_get_value(mi, property); - if (value == NULL) return NULL; - if (G_VALUE_TYPE(value) != G_TYPE_STRING) return NULL; - return g_value_get_string(value); + GVariant * variant = dbusmenu_menuitem_property_get_variant(mi, property); + if (variant == NULL) return NULL; + if (!g_variant_type_equal(g_variant_get_type(variant), G_VARIANT_TYPE_STRING)) return NULL; + return g_variant_get_string(variant, NULL); } /** @@ -1147,20 +1137,25 @@ dbusmenu_menuitem_property_get_variant (DbusmenuMenuitem * mi, const gchar * pro gboolean dbusmenu_menuitem_property_get_bool (DbusmenuMenuitem * mi, const gchar * property) { - /* TODO: Switch to use variant */ - const GValue * value = dbusmenu_menuitem_property_get_value(mi, property); - if (value == NULL) return FALSE; - if (G_VALUE_TYPE(value) != G_TYPE_BOOLEAN) { - if (g_value_type_transformable(G_VALUE_TYPE(value), G_TYPE_BOOLEAN)) { - GValue boolval = {0}; - g_value_init(&boolval, G_TYPE_BOOLEAN); - g_value_transform(value, &boolval); - return g_value_get_boolean(&boolval); + GVariant * variant = dbusmenu_menuitem_property_get_variant(mi, property); + if (variant == NULL) return FALSE; + + if (g_variant_type_equal(g_variant_get_type(variant), G_VARIANT_TYPE_BOOLEAN)) { + return g_variant_get_boolean(variant); + } + + if (!g_variant_type_equal(g_variant_get_type(variant), G_VARIANT_TYPE_STRING)) { + const gchar * string = g_variant_get_string(variant, NULL); + + if (!g_strcmp0(string, "TRUE") || !g_strcmp0(string, "true") || !g_strcmp0(string, "True")) { + return TRUE; } else { return FALSE; } } - return g_value_get_boolean(value); + + g_warning("Property '%s' has been requested as an boolean but is not one.", property); + return FALSE; } /** @@ -1176,20 +1171,20 @@ dbusmenu_menuitem_property_get_bool (DbusmenuMenuitem * mi, const gchar * proper gint dbusmenu_menuitem_property_get_int (DbusmenuMenuitem * mi, const gchar * property) { - /* TODO: Switch to use variant */ - const GValue * value = dbusmenu_menuitem_property_get_value(mi, property); - if (value == NULL) return 0; - if (G_VALUE_TYPE(value) != G_TYPE_INT) { - if (g_value_type_transformable(G_VALUE_TYPE(value), G_TYPE_INT)) { - GValue intval = {0}; - g_value_init(&intval, G_TYPE_INT); - g_value_transform(value, &intval); - return g_value_get_int(&intval); - } else { - return 0; - } + GVariant * variant = dbusmenu_menuitem_property_get_variant(mi, property); + if (variant == NULL) return 0; + + if (g_variant_type_equal(g_variant_get_type(variant), G_VARIANT_TYPE_INT32)) { + return g_variant_get_int32(variant); + } + + if (!g_variant_type_equal(g_variant_get_type(variant), G_VARIANT_TYPE_STRING)) { + const gchar * string = g_variant_get_string(variant, NULL); + return atoi(string); } - return g_value_get_int(value); + + g_warning("Property '%s' has been requested as an int but is not one.", property); + return 0; } -- cgit v1.2.3 From 353802f51c23447bcc905767014dcc37b5b76e20 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 17 Nov 2010 20:08:39 -0600 Subject: Adding deprecation comment to the documentation. --- libdbusmenu-glib/menuitem.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'libdbusmenu-glib/menuitem.c') diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index a9036f0..d5d4d26 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -975,6 +975,7 @@ dbusmenu_menuitem_property_set_int (DbusmenuMenuitem * mi, const gchar * propert emitted by this function. Return value: A boolean representing if the property value was set. + Deprecated: Use dbusmenu_menuitem_property_set_variant() instead */ gboolean dbusmenu_menuitem_property_set_value (DbusmenuMenuitem * mi, const gchar * property, const GValue * value) @@ -1089,6 +1090,7 @@ dbusmenu_menuitem_property_get (DbusmenuMenuitem * mi, const gchar * property) exist. Return value: A GValue for the property. + Deprecated: Use dbusmenu_menuitem_property_get_variant() instead */ const GValue * dbusmenu_menuitem_property_get_value (DbusmenuMenuitem * mi, const gchar * property) -- cgit v1.2.3 From 01603a653335b7f4f09120fc5e04f3273c36a8b5 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 17 Nov 2010 20:50:45 -0600 Subject: Change all the event handling to use GVariants --- libdbusmenu-glib/menuitem.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'libdbusmenu-glib/menuitem.c') diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index d5d4d26..643321a 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -94,7 +94,7 @@ static void set_property (GObject * obj, guint id, const GValue * value, GParamS static void get_property (GObject * obj, guint id, GValue * value, GParamSpec * pspec); static void g_value_transform_STRING_BOOLEAN (const GValue * in, GValue * out); static void g_value_transform_STRING_INT (const GValue * in, GValue * out); -static void handle_event (DbusmenuMenuitem * mi, const gchar * name, const GValue * value, guint timestamp); +static void handle_event (DbusmenuMenuitem * mi, const gchar * name, GVariant * value, guint timestamp); static void send_about_to_show (DbusmenuMenuitem * mi, void (*cb) (DbusmenuMenuitem * mi, gpointer user_data), gpointer cb_data); /* GObject stuff */ @@ -377,7 +377,7 @@ get_property (GObject * obj, guint id, GValue * value, GParamSpec * pspec) /* Handles the activate event if it is sent. */ static void -handle_event (DbusmenuMenuitem * mi, const gchar * name, const GValue * value, guint timestamp) +handle_event (DbusmenuMenuitem * mi, const gchar * name, GVariant * value, guint timestamp) { if (g_strcmp0(name, "clicked") == 0) { g_signal_emit(G_OBJECT(mi), signals[ITEM_ACTIVATED], 0, timestamp, TRUE); @@ -1445,7 +1445,7 @@ dbusmenu_menuitem_foreach (DbusmenuMenuitem * mi, void (*func) (DbusmenuMenuitem dbusmenu_menuitem_handle_event: @mi: The #DbusmenuMenuitem to send the signal on. @name: The name of the signal - @value: A value that could be set for the event + @variant: A value that could be set for the event @timestamp: The timestamp of when the event happened This function is called to create an event. It is likely @@ -1461,7 +1461,7 @@ dbusmenu_menuitem_foreach (DbusmenuMenuitem * mi, void (*func) (DbusmenuMenuitem reason not to. */ void -dbusmenu_menuitem_handle_event (DbusmenuMenuitem * mi, const gchar * name, const GValue * value, guint timestamp) +dbusmenu_menuitem_handle_event (DbusmenuMenuitem * mi, const gchar * name, GVariant * variant, guint timestamp) { g_return_if_fail(DBUSMENU_IS_MENUITEM(mi)); #ifdef MASSIVEDEBUGGING @@ -1470,7 +1470,7 @@ dbusmenu_menuitem_handle_event (DbusmenuMenuitem * mi, const gchar * name, const DbusmenuMenuitemClass * class = DBUSMENU_MENUITEM_GET_CLASS(mi); if (class->handle_event != NULL) { - return class->handle_event(mi, name, value, timestamp); + return class->handle_event(mi, name, variant, timestamp); } return; } -- cgit v1.2.3 From a1c3b2b9d5ad5a8444a972a04faff1e70f9b2ad7 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 17 Nov 2010 20:55:15 -0600 Subject: Dropping set and get value --- libdbusmenu-glib/menuitem.c | 77 --------------------------------------------- 1 file changed, 77 deletions(-) (limited to 'libdbusmenu-glib/menuitem.c') diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 643321a..47fbdf9 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -961,59 +961,6 @@ dbusmenu_menuitem_property_set_int (DbusmenuMenuitem * mi, const gchar * propert return dbusmenu_menuitem_property_set_variant(mi, property, variant); } -/** - dbusmenu_menuitem_property_set_value: - @mi: The #DbusmenuMenuitem to set the property on. - @property: Name of the property to set. - @value: The value of the property. - - Takes the pair of @property and @value and places them as a - property on @mi. If a property already exists by that name, - then the value is set to the new value. If not, the property - is added. If the value is changed or the property was previously - unset then the signal #DbusmenuMenuitem::prop-changed will be - emitted by this function. - - Return value: A boolean representing if the property value was set. - Deprecated: Use dbusmenu_menuitem_property_set_variant() instead -*/ -gboolean -dbusmenu_menuitem_property_set_value (DbusmenuMenuitem * mi, const gchar * property, const GValue * value) -{ - /* TODO: Switch to use variant */ - g_return_val_if_fail(DBUSMENU_IS_MENUITEM(mi), FALSE); - g_return_val_if_fail(property != NULL, FALSE); - g_return_val_if_fail(G_IS_VALUE(value), FALSE); - - DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi); - /* g_debug("Setting a property. ID: %d Prop: %s Value: %s", priv->id, property, value); */ - - #if 0 - gpointer lookup = g_hash_table_lookup(priv->properties, property); - if (g_strcmp0((gchar *)lookup, value) == 0) { - /* The value is the same as the value currently in the - table so we don't really care. Just say everything's okay */ - return TRUE; - } - #endif - - gchar * lprop = g_strdup(property); - GValue * lval = g_new0(GValue, 1); - g_value_init(lval, G_VALUE_TYPE(value)); - g_value_copy(value, lval); - - g_hash_table_replace(priv->properties, lprop, lval); - #ifdef MASSIVEDEBUGGING - gchar * valstr = g_strdup_value_contents(lval); - g_debug("Menuitem %d (%s) signalling property '%s' changed to '%s'", ID(mi), LABEL(mi), property, g_utf8_strlen(valstr, 50) < 25 ? valstr : ""); - g_free(valstr); - #endif - - g_signal_emit(G_OBJECT(mi), signals[PROPERTY_CHANGED], 0, lprop, lval, TRUE); - - return TRUE; -} - /** dbusmenu_menuitem_property_set_variant: @mi: The #DbusmenuMenuitem to set the property on. @@ -1080,30 +1027,6 @@ dbusmenu_menuitem_property_get (DbusmenuMenuitem * mi, const gchar * property) return g_variant_get_string(variant, NULL); } -/** - dbusmenu_menuitem_property_get_value: - @mi: The #DbusmenuMenuitem to look for the property on. - @property: The property to grab. - - Look up a property on @mi and return the value of it if - it exits. #NULL will be returned if the property doesn't - exist. - - Return value: A GValue for the property. - Deprecated: Use dbusmenu_menuitem_property_get_variant() instead -*/ -const GValue * -dbusmenu_menuitem_property_get_value (DbusmenuMenuitem * mi, const gchar * property) -{ - /* TODO: Switch to use variant */ - g_return_val_if_fail(DBUSMENU_IS_MENUITEM(mi), NULL); - g_return_val_if_fail(property != NULL, NULL); - - DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi); - - return (const GValue *)g_hash_table_lookup(priv->properties, property); -} - /** dbusmenu_menuitem_property_get_variant: @mi: The #DbusmenuMenuitem to look for the property on. -- cgit v1.2.3 From 0dea1bb0779b8cddbf631ee80f76d13aa8920ec5 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 17 Nov 2010 21:11:40 -0600 Subject: Fixing our signals and marshallers for them as well --- libdbusmenu-glib/menuitem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libdbusmenu-glib/menuitem.c') diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 47fbdf9..24196fc 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -129,8 +129,8 @@ dbusmenu_menuitem_class_init (DbusmenuMenuitemClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET(DbusmenuMenuitemClass, property_changed), NULL, NULL, - _dbusmenu_menuitem_marshal_VOID__STRING_POINTER, - G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_POINTER); + _dbusmenu_menuitem_marshal_VOID__STRING_VARIANT, + G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_VARIANT); /** DbusmenuMenuitem::item-activated: @arg0: The #DbusmenuMenuitem object. -- cgit v1.2.3 From 1c2d3ea075efd02f8a655c45c89ec132d0e76828 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 18 Nov 2010 09:01:18 -0600 Subject: Eh, bad truth checking here. --- libdbusmenu-glib/menuitem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libdbusmenu-glib/menuitem.c') diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 24196fc..3b5011b 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1069,7 +1069,7 @@ dbusmenu_menuitem_property_get_bool (DbusmenuMenuitem * mi, const gchar * proper return g_variant_get_boolean(variant); } - if (!g_variant_type_equal(g_variant_get_type(variant), G_VARIANT_TYPE_STRING)) { + if (g_variant_type_equal(g_variant_get_type(variant), G_VARIANT_TYPE_STRING)) { const gchar * string = g_variant_get_string(variant, NULL); if (!g_strcmp0(string, "TRUE") || !g_strcmp0(string, "true") || !g_strcmp0(string, "True")) { @@ -1103,7 +1103,7 @@ dbusmenu_menuitem_property_get_int (DbusmenuMenuitem * mi, const gchar * propert return g_variant_get_int32(variant); } - if (!g_variant_type_equal(g_variant_get_type(variant), G_VARIANT_TYPE_STRING)) { + if (g_variant_type_equal(g_variant_get_type(variant), G_VARIANT_TYPE_STRING)) { const gchar * string = g_variant_get_string(variant, NULL); return atoi(string); } -- cgit v1.2.3 From f5227142593335542a62a8c7d3c122b8013cfead Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 18 Nov 2010 09:07:38 -0600 Subject: Fixing signal emition when there are new entries added to the property table. --- libdbusmenu-glib/menuitem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libdbusmenu-glib/menuitem.c') diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 3b5011b..d9fbf25 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -998,7 +998,7 @@ dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * pro becuse it has been unref'd when replaced in the hash table. But the fact that there was a value is the imporant part. */ - if (currentval != NULL && replaced) { + if (currentval == NULL || replaced) { g_signal_emit(G_OBJECT(mi), signals[PROPERTY_CHANGED], 0, lprop, value, TRUE); } -- cgit v1.2.3 From 233eec5d073b4101b3100598c60e497cf5075586 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 18 Nov 2010 13:21:36 -0600 Subject: Cleaning up the building of a properties variant --- libdbusmenu-glib/menuitem.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) (limited to 'libdbusmenu-glib/menuitem.c') diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index d9fbf25..66dfb66 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1216,18 +1216,7 @@ dbusmenu_menuitem_properties_copy (DbusmenuMenuitem * mi) static void variant_helper (gpointer in_key, gpointer in_value, gpointer user_data) { - /* TODO: Switch to being a variant */ - GValue vval = {0}; - g_value_init(&vval, G_TYPE_VARIANT); - - if (!g_value_transform((GValue *)in_value, &vval)) { - g_warning("Unable to convert property '%s' of type '%s'", (gchar *)in_key, G_VALUE_TYPE_NAME(in_value)); - return; - } - - g_variant_builder_add((GVariantBuilder *)user_data, "{sv}", in_key, g_value_get_variant(&vval)); - g_value_unset(&vval); - + g_variant_builder_add((GVariantBuilder *)user_data, "sv", in_key, in_value); return; } @@ -1247,12 +1236,17 @@ dbusmenu_menuitem_properties_variant (DbusmenuMenuitem * mi) DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi); - GVariantBuilder * builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}")); + GVariant * final_variant = NULL; + + if (g_hash_table_size(priv->properties) > 0) { + GVariantBuilder builder; + g_variant_builder_init(&builder, g_variant_type_new("a{sv}")); - g_hash_table_foreach(priv->properties, variant_helper, builder); + g_hash_table_foreach(priv->properties, variant_helper, &builder); + + final_variant = g_variant_builder_end(&builder); + } - GVariant * final_variant = g_variant_builder_end(builder); - g_variant_builder_unref(builder); return final_variant; } -- cgit v1.2.3 From c80c863e4191fe9b5f20e65887db7c2e278b13fb Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 18 Nov 2010 14:45:15 -0600 Subject: Oops, messed up the format here. --- libdbusmenu-glib/menuitem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libdbusmenu-glib/menuitem.c') diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 66dfb66..2f42704 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1216,7 +1216,7 @@ dbusmenu_menuitem_properties_copy (DbusmenuMenuitem * mi) static void variant_helper (gpointer in_key, gpointer in_value, gpointer user_data) { - g_variant_builder_add((GVariantBuilder *)user_data, "sv", in_key, in_value); + g_variant_builder_add((GVariantBuilder *)user_data, "{sv}", in_key, in_value); return; } -- cgit v1.2.3 From a25b09998a7b9a5a1e012b8648fdf135fdc59d33 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 23 Nov 2010 16:55:43 -0600 Subject: Uhm, there's no explaination for this one. Duh. --- libdbusmenu-glib/menuitem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libdbusmenu-glib/menuitem.c') diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 2f42704..ad6472b 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1002,7 +1002,7 @@ dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * pro g_signal_emit(G_OBJECT(mi), signals[PROPERTY_CHANGED], 0, lprop, value, TRUE); } - return FALSE; + return TRUE; } /** -- cgit v1.2.3 From 09cb60267e5a4773ec5965e7e1a2ff92a690d7f0 Mon Sep 17 00:00:00 2001 From: Chris Coulson Date: Mon, 13 Dec 2010 16:51:45 +0000 Subject: Add an about-to-show signal to the menu items and hook this up to be emitted when someone calls dbusmenu_menuitem_send_about_to_show --- libdbusmenu-glib/menuitem.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'libdbusmenu-glib/menuitem.c') diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index ad6472b..747cc01 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -70,6 +70,7 @@ enum { CHILD_MOVED, REALIZED, SHOW_TO_USER, + ABOUT_TO_SHOW, LAST_SIGNAL }; @@ -229,6 +230,21 @@ dbusmenu_menuitem_class_init (DbusmenuMenuitemClass *klass) g_cclosure_marshal_VOID__UINT, G_TYPE_NONE, 1, G_TYPE_UINT, G_TYPE_NONE); + /** + DbusmenuMenuitem::about-to-show: + @arg0: The #DbusmenuMenuitem object. + + Emitted when the submenu for this item + is about to be shown + */ + signals[ABOUT_TO_SHOW] = g_signal_new(DBUSMENU_MENUITEM_SIGNAL_ABOUT_TO_SHOW, + G_TYPE_FROM_CLASS(klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(DbusmenuMenuitemClass, about_to_show), + NULL, NULL, + _dbusmenu_menuitem_marshal_VOID__VOID, + G_TYPE_BOOLEAN, 0, G_TYPE_NONE); + g_object_class_install_property (object_class, PROP_ID, g_param_spec_int(PROP_ID_S, "ID for the menu item", "This is a unique indentifier for the menu item.", @@ -398,7 +414,8 @@ send_about_to_show (DbusmenuMenuitem * mi, void (*cb) (DbusmenuMenuitem * mi, gp if (dbusmenu_menuitem_get_children(mi) == NULL) { g_warning("About to Show called on an item wihtout submenus. We're ignoring it."); } else { - g_signal_emit(G_OBJECT(mi), signals[ITEM_ACTIVATED], 0, 0 /* timestamp */, TRUE); + gboolean dummy; + g_signal_emit(G_OBJECT(mi), signals[ABOUT_TO_SHOW], 0, &dummy); } if (cb != NULL) { -- cgit v1.2.3 From a02639a8849df82b563331783f5d571622d65208 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 5 Jan 2011 16:58:37 -0600 Subject: Handling the case of a NULL variant by making it clear the hashtable of that property. --- libdbusmenu-glib/menuitem.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'libdbusmenu-glib/menuitem.c') diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index ad6472b..50354ee 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -984,14 +984,22 @@ dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * pro DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi); - gchar * lprop = g_strdup(property); - g_variant_ref(value); - gboolean replaced = FALSE; - gpointer currentval = g_hash_table_lookup(priv->properties, lprop); - if (currentval == NULL || !g_variant_equal((GVariant*)currentval, value)) { - g_hash_table_replace(priv->properties, lprop, value); - replaced = TRUE; + gpointer currentval = g_hash_table_lookup(priv->properties, property); + + if (value != NULL) { + gchar * lprop = g_strdup(property); + g_variant_ref(value); + + if (currentval == NULL || !g_variant_equal((GVariant*)currentval, value)) { + g_hash_table_replace(priv->properties, lprop, value); + replaced = TRUE; + } + } else { + if (currentval != NULL) { + g_hash_table_remove(priv->properties, property); + replaced = TRUE; + } } /* NOTE: The actual value is invalid at this point @@ -999,7 +1007,7 @@ dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * pro table. But the fact that there was a value is the imporant part. */ if (currentval == NULL || replaced) { - g_signal_emit(G_OBJECT(mi), signals[PROPERTY_CHANGED], 0, lprop, value, TRUE); + g_signal_emit(G_OBJECT(mi), signals[PROPERTY_CHANGED], 0, property, value, TRUE); } return TRUE; -- cgit v1.2.3 From 47263d9b6c912d013a77ce2efda27df9c7571920 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 5 Jan 2011 20:51:51 -0600 Subject: Testing for the string being NULL before g_variant aborts on it. --- libdbusmenu-glib/menuitem.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'libdbusmenu-glib/menuitem.c') diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 50354ee..31c23f4 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -913,7 +913,10 @@ dbusmenu_menuitem_find_id (DbusmenuMenuitem * mi, gint id) gboolean dbusmenu_menuitem_property_set (DbusmenuMenuitem * mi, const gchar * property, const gchar * value) { - GVariant * variant = g_variant_new("s", value); + GVariant * variant = NULL; + if (value != NULL) { + g_variant_new_string(value); + } return dbusmenu_menuitem_property_set_variant(mi, property, variant); } -- cgit v1.2.3 From 1b77b621285fe681ca030bf3f548ad04b50dd242 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 5 Jan 2011 20:53:27 -0600 Subject: Oops, need to actually assign that return. --- libdbusmenu-glib/menuitem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libdbusmenu-glib/menuitem.c') diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 31c23f4..1e892c3 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -915,7 +915,7 @@ dbusmenu_menuitem_property_set (DbusmenuMenuitem * mi, const gchar * property, c { GVariant * variant = NULL; if (value != NULL) { - g_variant_new_string(value); + variant = g_variant_new_string(value); } return dbusmenu_menuitem_property_set_variant(mi, property, variant); } -- cgit v1.2.3 From 48e68b4411e70f0526fca90d3d714f10aea566bb Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 21 Jan 2011 13:27:26 -0600 Subject: Making the hashtable have a full copy and free itself appropriately. --- libdbusmenu-glib/menuitem.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'libdbusmenu-glib/menuitem.c') diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 827d6c5..b40195c 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1204,11 +1204,17 @@ dbusmenu_menuitem_properties_list (DbusmenuMenuitem * mi) return g_hash_table_get_keys(priv->properties); } +/* Copy the keys and make references to the variants that are + in the new table. They'll be free'd and unref'd when the + Hashtable gets destroyed. */ static void copy_helper (gpointer in_key, gpointer in_value, gpointer in_data) { GHashTable * table = (GHashTable *)in_data; - g_hash_table_insert(table, in_key, in_value); + gchar * key = (gchar *)in_key; + GVariant * value = (GVariant *)in_value; + g_variant_ref(value); + g_hash_table_insert(table, g_strdup(key), value); return; } @@ -1229,7 +1235,7 @@ copy_helper (gpointer in_key, gpointer in_value, gpointer in_data) GHashTable * dbusmenu_menuitem_properties_copy (DbusmenuMenuitem * mi) { - GHashTable * ret = g_hash_table_new(g_str_hash, g_str_equal); + GHashTable * ret = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, _g_variant_unref); g_return_val_if_fail(DBUSMENU_IS_MENUITEM(mi), ret); -- cgit v1.2.3 From 3548a02da37917e95564dfda60e97870274a53fa Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 4 Feb 2011 11:00:07 -0600 Subject: take_children() shouldn't unref the items as they might get deleted before the caller would be abel to use them. Making sure to put those annotations in the docs. --- libdbusmenu-glib/menuitem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libdbusmenu-glib/menuitem.c') diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index b40195c..159463b 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -547,7 +547,6 @@ take_children_signal (gpointer data, gpointer user_data) g_debug("Menuitem %d (%s) signalling child removed %d (%s)", ID(user_data), LABEL(user_data), ID(data), LABEL(data)); #endif g_signal_emit(G_OBJECT(user_data), signals[CHILD_REMOVED], 0, DBUSMENU_MENUITEM(data), TRUE); - g_object_unref(G_OBJECT(data)); return; } @@ -561,7 +560,8 @@ take_children_signal (gpointer data, gpointer user_data) on the children it has taken. A lot of responsibility involved in taking children. - Return value: A #GList of pointers to #DbusmenuMenuitem objects. + Return value: (transfer full) (array) (element-type Dbusmenu.Menuitem) + A #GList of pointers to #DbusmenuMenuitem objects. */ GList * dbusmenu_menuitem_take_children (DbusmenuMenuitem * mi) -- cgit v1.2.3 From a557b5f43a20bfcacf69769f4726b9411aceaf06 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 14 Feb 2011 09:00:42 -0600 Subject: Adding a function to check if the property is a default --- libdbusmenu-glib/menuitem.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'libdbusmenu-glib/menuitem.c') diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 159463b..3f85efa 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1473,3 +1473,13 @@ dbusmenu_menuitem_show_to_user (DbusmenuMenuitem * mi, guint timestamp) return; } + +/* Checks to see if the value of this property is unique or just the + default value. */ +/* TODO: Implement this */ +gboolean +dbusmenu_menuitem_property_is_default (DbusmenuMenuitem * mi, const gchar * property) +{ + /* No defaults system yet */ + return FALSE; +} -- cgit v1.2.3 From 8600ea3459e8307da36e6da90640ff49226e90ac Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 14 Feb 2011 14:43:27 -0600 Subject: Swapt out building XML for building a big variant structure --- libdbusmenu-glib/menuitem.c | 42 ++++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) (limited to 'libdbusmenu-glib/menuitem.c') diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 159463b..309f435 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1264,7 +1264,7 @@ variant_helper (gpointer in_key, gpointer in_value, gpointer user_data) Return Value: A GVariant of type "a{sv}" or NULL on error. */ GVariant * -dbusmenu_menuitem_properties_variant (DbusmenuMenuitem * mi) +dbusmenu_menuitem_properties_variant (DbusmenuMenuitem * mi, const gchar ** properties) { g_return_val_if_fail(DBUSMENU_IS_MENUITEM(mi), NULL); @@ -1322,7 +1322,7 @@ dbusmenu_menuitem_get_root (DbusmenuMenuitem * mi) /** - dbusmenu_menuitem_buildxml: + dbusmenu_menuitem_buildvariant: @mi: #DbusmenuMenuitem to represent in XML @array: (element-type utf8): A list of string that will be turned into an XML file @@ -1332,28 +1332,50 @@ dbusmenu_menuitem_get_root (DbusmenuMenuitem * mi) start tag and one that is a closing tag. It will allow it's children to place their own tags in the array in between those two. */ -void -dbusmenu_menuitem_buildxml (DbusmenuMenuitem * mi, GPtrArray * array) +GVariant * +dbusmenu_menuitem_build_variant (DbusmenuMenuitem * mi, const gchar ** properties) { - g_return_if_fail(DBUSMENU_IS_MENUITEM(mi)); + g_return_val_if_fail(DBUSMENU_IS_MENUITEM(mi), NULL); gint id = 0; if (!dbusmenu_menuitem_get_root(mi)) { id = dbusmenu_menuitem_get_id(mi); } + /* This is the tuple that'll build up being a representation of + this entry */ + GVariantBuilder tupleb; + g_variant_builder_init(&tupleb, G_VARIANT_TYPE_TUPLE); + + /* Add our ID */ + g_variant_builder_add_value(&tupleb, g_variant_new_int32(id)); + + /* Figure out the properties */ + GVariant * props = dbusmenu_menuitem_properties_variant(mi, properties); + if (props != NULL) { + g_variant_builder_add_value(&tupleb, props); + } else { + g_variant_builder_add_value(&tupleb, g_variant_parse(G_VARIANT_TYPE("a{sv}"), "[ ]", NULL, NULL, NULL)); + } + + /* Pillage the children */ GList * children = dbusmenu_menuitem_get_children(mi); if (children == NULL) { - g_ptr_array_add(array, g_strdup_printf("", id)); + g_variant_builder_add_value(&tupleb, g_variant_parse(G_VARIANT_TYPE("a(v)"), "[ ]", NULL, NULL, NULL)); } else { - g_ptr_array_add(array, g_strdup_printf("", id)); + GVariantBuilder childrenbuilder; + g_variant_builder_init(&childrenbuilder, G_VARIANT_TYPE_ARRAY); + for ( ; children != NULL; children = children->next) { - dbusmenu_menuitem_buildxml(DBUSMENU_MENUITEM(children->data), array); + GVariant * child = dbusmenu_menuitem_build_variant(DBUSMENU_MENUITEM(children->data), properties); + + g_variant_builder_add_value(&childrenbuilder, g_variant_new_variant(child)); } - g_ptr_array_add(array, g_strdup("")); + + g_variant_builder_add_value(&tupleb, g_variant_builder_end(&childrenbuilder)); } - return; + return g_variant_builder_end(&tupleb); } typedef struct { -- cgit v1.2.3 From 5da30c365a2196d488f9ea97f3455eefa3c3b058 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 14 Feb 2011 14:46:36 -0600 Subject: Use the recurse parameter --- libdbusmenu-glib/menuitem.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'libdbusmenu-glib/menuitem.c') diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 309f435..6a33499 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1333,7 +1333,7 @@ dbusmenu_menuitem_get_root (DbusmenuMenuitem * mi) children to place their own tags in the array in between those two. */ GVariant * -dbusmenu_menuitem_build_variant (DbusmenuMenuitem * mi, const gchar ** properties) +dbusmenu_menuitem_build_variant (DbusmenuMenuitem * mi, const gchar ** properties, gint recurse) { g_return_val_if_fail(DBUSMENU_IS_MENUITEM(mi), NULL); @@ -1360,14 +1360,14 @@ dbusmenu_menuitem_build_variant (DbusmenuMenuitem * mi, const gchar ** propertie /* Pillage the children */ GList * children = dbusmenu_menuitem_get_children(mi); - if (children == NULL) { + if (children == NULL && recurse != 0) { g_variant_builder_add_value(&tupleb, g_variant_parse(G_VARIANT_TYPE("a(v)"), "[ ]", NULL, NULL, NULL)); } else { GVariantBuilder childrenbuilder; g_variant_builder_init(&childrenbuilder, G_VARIANT_TYPE_ARRAY); for ( ; children != NULL; children = children->next) { - GVariant * child = dbusmenu_menuitem_build_variant(DBUSMENU_MENUITEM(children->data), properties); + GVariant * child = dbusmenu_menuitem_build_variant(DBUSMENU_MENUITEM(children->data), properties, recurse - 1); g_variant_builder_add_value(&childrenbuilder, g_variant_new_variant(child)); } -- cgit v1.2.3 From 8470e56b0fbc5ddf21100e2e9e4ec38c70c35717 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 14 Feb 2011 16:54:25 -0600 Subject: More explicit function calling --- libdbusmenu-glib/menuitem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libdbusmenu-glib/menuitem.c') diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 6a33499..da34ff0 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1361,7 +1361,7 @@ dbusmenu_menuitem_build_variant (DbusmenuMenuitem * mi, const gchar ** propertie /* Pillage the children */ GList * children = dbusmenu_menuitem_get_children(mi); if (children == NULL && recurse != 0) { - g_variant_builder_add_value(&tupleb, g_variant_parse(G_VARIANT_TYPE("a(v)"), "[ ]", NULL, NULL, NULL)); + g_variant_builder_add_value(&tupleb, g_variant_new_array(G_VARIANT_TYPE_VARIANT, NULL, 0)); } else { GVariantBuilder childrenbuilder; g_variant_builder_init(&childrenbuilder, G_VARIANT_TYPE_ARRAY); -- cgit v1.2.3 From b0c5bfe2e4d50d12dc4b8ab9828b67b47abbd5a3 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 14 Feb 2011 23:11:28 -0600 Subject: Splitting a few of these out so they're easier to follow --- libdbusmenu-glib/menuitem.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'libdbusmenu-glib/menuitem.c') diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 7ea54e2..044138e 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1250,7 +1250,9 @@ dbusmenu_menuitem_properties_copy (DbusmenuMenuitem * mi) static void variant_helper (gpointer in_key, gpointer in_value, gpointer user_data) { - g_variant_builder_add((GVariantBuilder *)user_data, "{sv}", in_key, in_value); + GVariant * value = g_variant_new_dict_entry(g_variant_new_string((gchar *)in_key), + g_variant_new_variant((GVariant *)in_value)); + g_variant_builder_add_value((GVariantBuilder *)user_data, value); return; } @@ -1274,7 +1276,7 @@ dbusmenu_menuitem_properties_variant (DbusmenuMenuitem * mi, const gchar ** prop if (g_hash_table_size(priv->properties) > 0) { GVariantBuilder builder; - g_variant_builder_init(&builder, g_variant_type_new("a{sv}")); + g_variant_builder_init(&builder, G_VARIANT_TYPE_ARRAY); g_hash_table_foreach(priv->properties, variant_helper, &builder); -- cgit v1.2.3 From 7a7981e687543d6abcf0109bec2551b366906303 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 15 Feb 2011 07:55:22 -0600 Subject: Should sink as well if given a floating reference. --- libdbusmenu-glib/menuitem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libdbusmenu-glib/menuitem.c') diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 044138e..55d17f1 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1009,7 +1009,7 @@ dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * pro if (value != NULL) { gchar * lprop = g_strdup(property); - g_variant_ref(value); + g_variant_ref_sink(value); if (currentval == NULL || !g_variant_equal((GVariant*)currentval, value)) { g_hash_table_replace(priv->properties, lprop, value); -- cgit v1.2.3 From ee4fda3072d31b828c5d607b9ac0a4ab6c7ee320 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 15 Feb 2011 11:42:52 -0600 Subject: Making sure all refs sink incase of floating variants --- libdbusmenu-glib/menuitem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libdbusmenu-glib/menuitem.c') diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 55d17f1..54d2540 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1213,7 +1213,7 @@ copy_helper (gpointer in_key, gpointer in_value, gpointer in_data) GHashTable * table = (GHashTable *)in_data; gchar * key = (gchar *)in_key; GVariant * value = (GVariant *)in_value; - g_variant_ref(value); + g_variant_ref_sink(value); g_hash_table_insert(table, g_strdup(key), value); return; } -- cgit v1.2.3 From bafe476c0fa84277c6136605680c3d349430db50 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 16 Feb 2011 20:34:17 +0100 Subject: Fix GI annotations for Dbusmenu Now everything is introspectable except for dbusmenu_client_add_type_handler{,_full}(). These do not take a standard GDestroyNotify argument, and thus the newfunc callback cannot get any valid scope annotation. To fix this we need to break the API and ABI. --- libdbusmenu-glib/menuitem.c | 723 ++++++++++++++++++++++---------------------- 1 file changed, 362 insertions(+), 361 deletions(-) (limited to 'libdbusmenu-glib/menuitem.c') diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 159463b..b5a87a4 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -95,7 +95,7 @@ static void set_property (GObject * obj, guint id, const GValue * value, GParamS static void get_property (GObject * obj, guint id, GValue * value, GParamSpec * pspec); static void g_value_transform_STRING_BOOLEAN (const GValue * in, GValue * out); static void g_value_transform_STRING_INT (const GValue * in, GValue * out); -static void handle_event (DbusmenuMenuitem * mi, const gchar * name, GVariant * value, guint timestamp); +static void handle_event (DbusmenuMenuitem * mi, const gchar * name, GVariant * variant, guint timestamp); static void send_about_to_show (DbusmenuMenuitem * mi, void (*cb) (DbusmenuMenuitem * mi, gpointer user_data), gpointer cb_data); /* GObject stuff */ @@ -428,12 +428,12 @@ send_about_to_show (DbusmenuMenuitem * mi, void (*cb) (DbusmenuMenuitem * mi, gp /* Public interface */ /** - dbusmenu_menuitem_new: - - Create a new #DbusmenuMenuitem with all default values. - - Return value: A newly allocated #DbusmenuMenuitem. -*/ + * dbusmenu_menuitem_new: + * + * Create a new #DbusmenuMenuitem with all default values. + * + * Return value: A newly allocated #DbusmenuMenuitem. + */ DbusmenuMenuitem * dbusmenu_menuitem_new (void) { @@ -441,13 +441,13 @@ dbusmenu_menuitem_new (void) } /** - dbusmenu_menuitem_new_with_id: - @id: ID to use for this menuitem - - This creates a blank #DbusmenuMenuitem with a specific ID. - - Return value: A newly allocated #DbusmenuMenuitem. -*/ + * dbusmenu_menuitem_new_with_id: + * @id: ID to use for this menuitem + * + * This creates a blank #DbusmenuMenuitem with a specific ID. + * + * Return value: A newly allocated #DbusmenuMenuitem. + */ DbusmenuMenuitem * dbusmenu_menuitem_new_with_id (gint id) { @@ -457,13 +457,13 @@ dbusmenu_menuitem_new_with_id (gint id) } /** - dbusmenu_menuitem_get_id: - @mi: The #DbusmenuMenuitem to query. - - Gets the unique ID for @mi. - - Return value: The ID of the @mi. -*/ + * dbusmenu_menuitem_get_id: + * @mi: The #DbusmenuMenuitem to query. + * + * Gets the unique ID for @mi. + * + * Return value: The ID of the @mi. + */ gint dbusmenu_menuitem_get_id (DbusmenuMenuitem * mi) { @@ -480,17 +480,17 @@ dbusmenu_menuitem_get_id (DbusmenuMenuitem * mi) } /** - dbusmenu_menuitem_realized: - @mi: #DbusmenuMenuitem to check on - - This function returns whether the menuitem has been realized or - not. This is significant mostly in client implementations that - can use this additional state to see if the second layers of - the implementation have been built yet. - - Return value: Returns whether or not the menu item has been realized - yet or not. -*/ + * dbusmenu_menuitem_realized: + * @mi: #DbusmenuMenuitem to check on + * + * This function returns whether the menuitem has been realized or + * not. This is significant mostly in client implementations that + * can use this additional state to see if the second layers of + * the implementation have been built yet. + * + * Return value: Returns whether or not the menu item has been realized + * yet or not. + */ gboolean dbusmenu_menuitem_realized (DbusmenuMenuitem * mi) { @@ -500,12 +500,12 @@ dbusmenu_menuitem_realized (DbusmenuMenuitem * mi) } /** - dbusmenu_menuitem_set_realized: - @mi: #DbusmenuMenuitem to realize - - Sets the internal variable tracking whether it's been realized and - signals the DbusmenuMenuitem::realized event. -*/ + * dbusmenu_menuitem_set_realized: + * @mi: #DbusmenuMenuitem to realize + * + * Sets the internal variable tracking whether it's been realized and + * signals the DbusmenuMenuitem::realized event. + */ void dbusmenu_menuitem_set_realized (DbusmenuMenuitem * mi) { @@ -520,15 +520,15 @@ dbusmenu_menuitem_set_realized (DbusmenuMenuitem * mi) } /** - dbusmenu_menuitem_get_children: - @mi: The #DbusmenuMenuitem to query. - - Returns simply the list of children that this menu item - has. The list is valid until another child related function - is called, where it might be changed. - - Return value: A #GList of pointers to #DbusmenuMenuitem objects. -*/ + * dbusmenu_menuitem_get_children: + * @mi: The #DbusmenuMenuitem to query. + * + * Returns simply the list of children that this menu item + * 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. + */ GList * dbusmenu_menuitem_get_children (DbusmenuMenuitem * mi) { @@ -551,18 +551,18 @@ take_children_signal (gpointer data, gpointer user_data) } /** - dbusmenu_menuitem_take_children: - @mi: The #DbusmenMenuitem to take the children from. - - While the name sounds devious that's exactly what this function - does. It takes the list of children from the @mi and clears the - internal list. The calling function is now in charge of the ref's - on the children it has taken. A lot of responsibility involved - in taking children. - - Return value: (transfer full) (array) (element-type Dbusmenu.Menuitem) - A #GList of pointers to #DbusmenuMenuitem objects. -*/ + * dbusmenu_menuitem_take_children: + * @mi: The #DbusmenMenuitem to take the children from. + * + * While the name sounds devious that's exactly what this function + * does. It takes the list of children from the @mi and clears the + * internal list. The calling function is now in charge of the ref's + * on the children it has taken. A lot of responsibility involved + * in taking children. + * + * Return value: (transfer full) (element-type Dbusmenu.Menuitem): + * A #GList of pointers to #DbusmenuMenuitem objects. + */ GList * dbusmenu_menuitem_take_children (DbusmenuMenuitem * mi) { @@ -579,16 +579,16 @@ dbusmenu_menuitem_take_children (DbusmenuMenuitem * mi) } /** - dbusmenu_menuitem_get_position: - @mi: The #DbusmenuMenuitem to find the position of - @parent: The #DbusmenuMenuitem who's children contain @mi - - This function returns the position of the menu item @mi - in the children of @parent. It will return zero if the - menu item can't be found. - - Return value: The position of @mi in the children of @parent. -*/ + * dbusmenu_menuitem_get_position: + * @mi: The #DbusmenuMenuitem to find the position of + * @parent: The #DbusmenuMenuitem who's children contain @mi + * + * This function returns the position of the menu item @mi + * in the children of @parent. It will return zero if the + * menu item can't be found. + * + * Return value: The position of @mi in the children of @parent. + */ guint dbusmenu_menuitem_get_position (DbusmenuMenuitem * mi, DbusmenuMenuitem * parent) { @@ -618,15 +618,15 @@ dbusmenu_menuitem_get_position (DbusmenuMenuitem * mi, DbusmenuMenuitem * parent } /** - dbusmenu_menuitem_get_position_realized: - @mi: The #DbusmenuMenuitem to find the position of - @parent: The #DbusmenuMenuitem who's children contain @mi - - This function is very similar to #dbusmenu_menuitem_get_position - except that it only counts in the children that have been realized. - - Return value: The position of @mi in the realized children of @parent. -*/ + * dbusmenu_menuitem_get_position_realized: + * @mi: The #DbusmenuMenuitem to find the position of + * @parent: The #DbusmenuMenuitem who's children contain @mi + * + * This function is very similar to #dbusmenu_menuitem_get_position + * except that it only counts in the children that have been realized. + * + * Return value: The position of @mi in the realized children of @parent. + */ guint dbusmenu_menuitem_get_position_realized (DbusmenuMenuitem * mi, DbusmenuMenuitem * parent) { @@ -662,15 +662,15 @@ dbusmenu_menuitem_get_position_realized (DbusmenuMenuitem * mi, DbusmenuMenuitem } /** - dbusmenu_menuitem_child_append: - @mi: The #DbusmenuMenuitem which will become a new parent - @child: The #DbusmenMenuitem that will be a child - - This function adds @child to the list of children on @mi at - the end of that list. - - Return value: Whether the child has been added successfully. -*/ + * dbusmenu_menuitem_child_append: + * @mi: The #DbusmenuMenuitem which will become a new parent + * @child: The #DbusmenMenuitem that will be a child + * + * This function adds @child to the list of children on @mi at + * the end of that list. + * + * Return value: Whether the child has been added successfully. + */ gboolean dbusmenu_menuitem_child_append (DbusmenuMenuitem * mi, DbusmenuMenuitem * child) { @@ -694,15 +694,15 @@ dbusmenu_menuitem_child_append (DbusmenuMenuitem * mi, DbusmenuMenuitem * child) } /** - dbusmenu_menuitem_child_prepend: - @mi: The #DbusmenuMenuitem which will become a new parent - @child: The #DbusmenMenuitem that will be a child - - This function adds @child to the list of children on @mi at - the beginning of that list. - - Return value: Whether the child has been added successfully. -*/ + * dbusmenu_menuitem_child_prepend: + * @mi: The #DbusmenuMenuitem which will become a new parent + * @child: The #DbusmenMenuitem that will be a child + * + * This function adds @child to the list of children on @mi at + * the beginning of that list. + * + * Return value: Whether the child has been added successfully. + */ gboolean dbusmenu_menuitem_child_prepend (DbusmenuMenuitem * mi, DbusmenuMenuitem * child) { @@ -726,16 +726,16 @@ dbusmenu_menuitem_child_prepend (DbusmenuMenuitem * mi, DbusmenuMenuitem * child } /** - dbusmenu_menuitem_child_delete: - @mi: The #DbusmenuMenuitem which has @child as a child - @child: The child #DbusmenuMenuitem that you want to no longer - be a child of @mi. - - This function removes @child from the children list of @mi. It does - not call #g_object_unref on @child. - - Return value: If we were able to delete @child. -*/ + * dbusmenu_menuitem_child_delete: + * @mi: The #DbusmenuMenuitem which has @child as a child + * @child: The child #DbusmenuMenuitem that you want to no longer + * be a child of @mi. + * + * This function removes @child from the children list of @mi. It does + * not call #g_object_unref on @child. + * + * Return value: If we were able to delete @child. + */ gboolean dbusmenu_menuitem_child_delete (DbusmenuMenuitem * mi, DbusmenuMenuitem * child) { @@ -758,17 +758,17 @@ dbusmenu_menuitem_child_delete (DbusmenuMenuitem * mi, DbusmenuMenuitem * child) } /** - dbusmenu_menuitem_child_add_position: - @mi: The #DbusmenuMenuitem that we're adding the child @child to. - @child: The #DbusmenuMenuitem to make a child of @mi. - @position: Where in @mi object's list of chidren @child should be placed. - - Puts @child in the list of children for @mi at the location - specified in @position. If there is not enough entires available - then @child will be placed at the end of the list. - - Return value: Whether @child was added successfully. -*/ + * dbusmenu_menuitem_child_add_position: + * @mi: The #DbusmenuMenuitem that we're adding the child @child to. + * @child: The #DbusmenuMenuitem to make a child of @mi. + * @position: Where in @mi object's list of chidren @child should be placed. + * + * Puts @child in the list of children for @mi at the location + * specified in @position. If there is not enough entires available + * then @child will be placed at the end of the list. + * + * Return value: Whether @child was added successfully. + */ gboolean dbusmenu_menuitem_child_add_position (DbusmenuMenuitem * mi, DbusmenuMenuitem * child, guint position) { @@ -792,17 +792,17 @@ dbusmenu_menuitem_child_add_position (DbusmenuMenuitem * mi, DbusmenuMenuitem * } /** - dbusmenu_menuitem_child_reorder: - @base: The #DbusmenuMenuitem that has children needing realignment - @child: The #DbusmenuMenuitem that is a child needing to be moved - @position: The position in the list to place it in - - This function moves a child on the list of children. It is - for a child that is already in the list, but simply needs a - new location. - - Return value: Whether the move was successful. -*/ + * dbusmenu_menuitem_child_reorder: + * @mi: The #DbusmenuMenuitem that has children needing realignment + * @child: The #DbusmenuMenuitem that is a child needing to be moved + * @position: The position in the list to place it in + * + * This function moves a child on the list of children. It is + * for a child that is already in the list, but simply needs a + * new location. + * + * Return value: Whether the move was successful. + */ gboolean dbusmenu_menuitem_child_reorder(DbusmenuMenuitem * mi, DbusmenuMenuitem * child, guint position) { @@ -832,16 +832,16 @@ dbusmenu_menuitem_child_reorder(DbusmenuMenuitem * mi, DbusmenuMenuitem * child, } /** - dbusmenu_menuitem_child_find: - @mi: The #DbusmenuMenuitem who's children to look on - @id: The ID of the child that we're looking for. - - Search the children of @mi to find one with the ID of @id. - If it doesn't exist then we return #NULL. - - Return value: The menu item with the ID @id or #NULL if it - can't be found. -*/ + * dbusmenu_menuitem_child_find: + * @mi: The #DbusmenuMenuitem who's children to look on + * @id: The ID of the child that we're looking for. + * + * Search the children of @mi to find one with the ID of @id. + * If it doesn't exist then we return #NULL. + * + * Return value: (transfer none): The menu item with the ID @id or #NULL if it + * can't be found. + */ DbusmenuMenuitem * dbusmenu_menuitem_child_find (DbusmenuMenuitem * mi, gint id) { @@ -885,18 +885,18 @@ find_id_helper (gpointer in_mi, gpointer in_find_id) } /** - dbusmenu_menuitem_find_id: - @mi: #DbusmenuMenuitem at the top of the tree to search - @id: ID of the #DbusmenuMenuitem to search for - - This function searchs the whole tree of children that - are attached to @mi. This could be quite a few nodes, all - the way down the tree. It is a depth first search. - - Return value: The #DbusmenuMenuitem with the ID of @id - or #NULL if there isn't such a menu item in the tree - represented by @mi. -*/ + * dbusmenu_menuitem_find_id: + * @mi: #DbusmenuMenuitem at the top of the tree to search + * @id: ID of the #DbusmenuMenuitem to search for + * + * This function searchs the whole tree of children that + * are attached to @mi. This could be quite a few nodes, all + * the way down the tree. It is a depth first search. + * + * Return value: (transfer none): The #DbusmenuMenuitem with the ID of @id + * or #NULL if there isn't such a menu item in the tree + * represented by @mi. + */ DbusmenuMenuitem * dbusmenu_menuitem_find_id (DbusmenuMenuitem * mi, gint id) { @@ -913,20 +913,20 @@ dbusmenu_menuitem_find_id (DbusmenuMenuitem * mi, gint id) } /** - dbusmenu_menuitem_property_set: - @mi: The #DbusmenuMenuitem to set the property on. - @property: Name of the property to set. - @value: The value of the property. - - Takes the pair of @property and @value and places them as a - property on @mi. If a property already exists by that name, - then the value is set to the new value. If not, the property - is added. If the value is changed or the property was previously - unset then the signal #DbusmenuMenuitem::prop-changed will be - emitted by this function. - - Return value: A boolean representing if the property value was set. -*/ + * dbusmenu_menuitem_property_set: + * @mi: The #DbusmenuMenuitem to set the property on. + * @property: Name of the property to set. + * @value: The value of the property. + * + * Takes the pair of @property and @value and places them as a + * property on @mi. If a property already exists by that name, + * then the value is set to the new value. If not, the property + * is added. If the value is changed or the property was previously + * unset then the signal #DbusmenuMenuitem::prop-changed will be + * emitted by this function. + * + * Return value: A boolean representing if the property value was set. + */ gboolean dbusmenu_menuitem_property_set (DbusmenuMenuitem * mi, const gchar * property, const gchar * value) { @@ -938,20 +938,20 @@ dbusmenu_menuitem_property_set (DbusmenuMenuitem * mi, const gchar * property, c } /** - dbusmenu_menuitem_property_set_bool: - @mi: The #DbusmenuMenuitem to set the property on. - @property: Name of the property to set. - @value: The value of the property. - - Takes a boolean @value and sets it on @property as a - property on @mi. If a property already exists by that name, - then the value is set to the new value. If not, the property - is added. If the value is changed or the property was previously - unset then the signal #DbusmenuMenuitem::prop-changed will be - emitted by this function. - - Return value: A boolean representing if the property value was set. -*/ + * dbusmenu_menuitem_property_set_bool: + * @mi: The #DbusmenuMenuitem to set the property on. + * @property: Name of the property to set. + * @value: The value of the property. + * + * Takes a boolean @value and sets it on @property as a + * property on @mi. If a property already exists by that name, + * then the value is set to the new value. If not, the property + * is added. If the value is changed or the property was previously + * unset then the signal #DbusmenuMenuitem::prop-changed will be + * emitted by this function. + * + * Return value: A boolean representing if the property value was set. + */ gboolean dbusmenu_menuitem_property_set_bool (DbusmenuMenuitem * mi, const gchar * property, const gboolean value) { @@ -960,20 +960,20 @@ dbusmenu_menuitem_property_set_bool (DbusmenuMenuitem * mi, const gchar * proper } /** - dbusmenu_menuitem_property_set_int: - @mi: The #DbusmenuMenuitem to set the property on. - @property: Name of the property to set. - @value: The value of the property. - - Takes a boolean @value and sets it on @property as a - property on @mi. If a property already exists by that name, - then the value is set to the new value. If not, the property - is added. If the value is changed or the property was previously - unset then the signal #DbusmenuMenuitem::prop-changed will be - emitted by this function. - - Return value: A boolean representing if the property value was set. -*/ + * dbusmenu_menuitem_property_set_int: + * @mi: The #DbusmenuMenuitem to set the property on. + * @property: Name of the property to set. + * @value: The value of the property. + * + * Takes a boolean @value and sets it on @property as a + * property on @mi. If a property already exists by that name, + * then the value is set to the new value. If not, the property + * is added. If the value is changed or the property was previously + * unset then the signal #DbusmenuMenuitem::prop-changed will be + * emitted by this function. + * + * Return value: A boolean representing if the property value was set. + */ gboolean dbusmenu_menuitem_property_set_int (DbusmenuMenuitem * mi, const gchar * property, const gint value) { @@ -982,20 +982,20 @@ dbusmenu_menuitem_property_set_int (DbusmenuMenuitem * mi, const gchar * propert } /** - dbusmenu_menuitem_property_set_variant: - @mi: The #DbusmenuMenuitem to set the property on. - @property: Name of the property to set. - @value: The value of the property. - - Takes the pair of @property and @value and places them as a - property on @mi. If a property already exists by that name, - then the value is set to the new value. If not, the property - is added. If the value is changed or the property was previously - unset then the signal #DbusmenuMenuitem::prop-changed will be - emitted by this function. - - Return value: A boolean representing if the property value was set. -*/ + * dbusmenu_menuitem_property_set_variant: + * @mi: The #DbusmenuMenuitem to set the property on. + * @property: Name of the property to set. + * @value: The value of the property. + * + * Takes the pair of @property and @value and places them as a + * property on @mi. If a property already exists by that name, + * then the value is set to the new value. If not, the property + * is added. If the value is changed or the property was previously + * unset then the signal #DbusmenuMenuitem::prop-changed will be + * emitted by this function. + * + * Return value: A boolean representing if the property value was set. + */ gboolean dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * property, GVariant * value) { @@ -1034,18 +1034,18 @@ dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * pro } /** - dbusmenu_menuitem_property_get: - @mi: The #DbusmenuMenuitem to look for the property on. - @property: The property to grab. - - Look up a property on @mi and return the value of it if - it exits. #NULL will be returned if the property doesn't - exist. - - Return value: A string with the value of the property - that shouldn't be free'd. Or #NULL if the property - is not set or is not a string. -*/ + * dbusmenu_menuitem_property_get: + * @mi: The #DbusmenuMenuitem to look for the property on. + * @property: The property to grab. + * + * Look up a property on @mi and return the value of it if + * it exits. #NULL will be returned if the property doesn't + * exist. + * + * Return value: (transfer none): A string with the value of the property + * that shouldn't be free'd. Or #NULL if the property + * is not set or is not a string. + */ const gchar * dbusmenu_menuitem_property_get (DbusmenuMenuitem * mi, const gchar * property) { @@ -1056,16 +1056,16 @@ dbusmenu_menuitem_property_get (DbusmenuMenuitem * mi, const gchar * property) } /** - dbusmenu_menuitem_property_get_variant: - @mi: The #DbusmenuMenuitem to look for the property on. - @property: The property to grab. - - Look up a property on @mi and return the value of it if - it exits. #NULL will be returned if the property doesn't - exist. - - Return value: A GVariant for the property. -*/ + * dbusmenu_menuitem_property_get_variant: + * @mi: The #DbusmenuMenuitem to look for the property on. + * @property: The property to grab. + * + * Look up a property on @mi and return the value of it if + * it exits. #NULL will be returned if the property doesn't + * exist. + * + * Return value: (transfer none): A GVariant for the property. + */ GVariant * dbusmenu_menuitem_property_get_variant (DbusmenuMenuitem * mi, const gchar * property) { @@ -1078,15 +1078,15 @@ dbusmenu_menuitem_property_get_variant (DbusmenuMenuitem * mi, const gchar * pro } /** - dbusmenu_menuitem_property_get_bool: - @mi: The #DbusmenuMenuitem to look for the property on. - @property: The property to grab. - - Look up a property on @mi and return the value of it if - it exits. Returns #FALSE if the property doesn't exist. - - Return value: The value of the property or #FALSE. -*/ + * dbusmenu_menuitem_property_get_bool: + * @mi: The #DbusmenuMenuitem to look for the property on. + * @property: The property to grab. + * + * Look up a property on @mi and return the value of it if + * it exits. Returns #FALSE if the property doesn't exist. + * + * Return value: The value of the property or #FALSE. + */ gboolean dbusmenu_menuitem_property_get_bool (DbusmenuMenuitem * mi, const gchar * property) { @@ -1112,15 +1112,15 @@ dbusmenu_menuitem_property_get_bool (DbusmenuMenuitem * mi, const gchar * proper } /** - dbusmenu_menuitem_property_get_int: - @mi: The #DbusmenuMenuitem to look for the property on. - @property: The property to grab. - - Look up a property on @mi and return the value of it if - it exits. Returns zero if the property doesn't exist. - - Return value: The value of the property or zero. -*/ + * dbusmenu_menuitem_property_get_int: + * @mi: The #DbusmenuMenuitem to look for the property on. + * @property: The property to grab. + * + * Look up a property on @mi and return the value of it if + * it exits. Returns zero if the property doesn't exist. + * + * Return value: The value of the property or zero. + */ gint dbusmenu_menuitem_property_get_int (DbusmenuMenuitem * mi, const gchar * property) { @@ -1142,15 +1142,15 @@ dbusmenu_menuitem_property_get_int (DbusmenuMenuitem * mi, const gchar * propert /** - dbusmenu_menuitem_property_exit: - @mi: The #DbusmenuMenuitem to look for the property on. - @property: The property to look for. - - Checkes to see if a particular property exists on @mi and - returns #TRUE if so. - - Return value: A boolean checking to see if the property is available -*/ + * dbusmenu_menuitem_property_exit: + * @mi: The #DbusmenuMenuitem to look for the property on. + * @property: The property to look for. + * + * Checkes to see if a particular property exists on @mi and + * returns #TRUE if so. + * + * Return value: A boolean checking to see if the property is available + */ gboolean dbusmenu_menuitem_property_exist (DbusmenuMenuitem * mi, const gchar * property) { @@ -1165,12 +1165,12 @@ dbusmenu_menuitem_property_exist (DbusmenuMenuitem * mi, const gchar * property) } /** - dbusmenu_menuitem_property_remove: - @mi: The #DbusmenuMenuitem to remove the property on. - @property: The property to look for. - - Removes a property from the menuitem. -*/ + * dbusmenu_menuitem_property_remove: + * @mi: The #DbusmenuMenuitem to remove the property on. + * @property: The property to look for. + * + * Removes a property from the menuitem. + */ void dbusmenu_menuitem_property_remove (DbusmenuMenuitem * mi, const gchar * property) { @@ -1185,15 +1185,16 @@ dbusmenu_menuitem_property_remove (DbusmenuMenuitem * mi, const gchar * property } /** - dbusmenu_menuitem_properties_list: - @mi: #DbusmenuMenuitem to list the properties on - - This functiong gets a list of the names of all the properties - that are set on this menu item. This data on the list is owned - by the menuitem but the list is not and should be freed using - g_list_free() when the calling function is done with it. - - Return value: A list of strings or NULL if there are none. + * dbusmenu_menuitem_properties_list: + * @mi: #DbusmenuMenuitem to list the properties on + * + * This functiong gets a list of the names of all the properties + * that are set on this menu item. This data on the list is owned + * by the menuitem but the list is not and should be freed using + * g_list_free() when the calling function is done with it. + * + * Return value: (transfer container): A list of strings or NULL if there are + * none. */ GList * dbusmenu_menuitem_properties_list (DbusmenuMenuitem * mi) @@ -1219,18 +1220,18 @@ copy_helper (gpointer in_key, gpointer in_value, gpointer in_data) } /** - dbusmenu_menuitem_properties_copy: - @mi: #DbusmenuMenuitem that we're interested in the properties of - - This function takes the properties of a #DbusmenuMenuitem - and puts them into a #GHashTable that is referenced by the - key of a string and has the value of a string. The hash - table may not have any entries if there aren't any or there - is an error in processing. It is the caller's responsibility - to destroy the created #GHashTable. - - Return value: A brand new #GHashTable that contains all of the - properties that are on this #DbusmenuMenuitem @mi. + * dbusmenu_menuitem_properties_copy: + * @mi: #DbusmenuMenuitem that we're interested in the properties of + * + * This function takes the properties of a #DbusmenuMenuitem + * and puts them into a #GHashTable that is referenced by the + * key of a string and has the value of a string. The hash + * table may not have any entries if there aren't any or there + * is an error in processing. It is the caller's responsibility + * to destroy the created #GHashTable. + * + * Return value: (transfer full): A brand new #GHashTable that contains all of + * theroperties that are on this #DbusmenuMenuitem @mi. */ GHashTable * dbusmenu_menuitem_properties_copy (DbusmenuMenuitem * mi) @@ -1255,14 +1256,14 @@ variant_helper (gpointer in_key, gpointer in_value, gpointer user_data) } /** - dbusmenu_menuitem_properties_variant: - @mi: #DbusmenuMenuitem to get properties from - - Grabs the properties of the menuitem as a GVariant with the - type "a{sv}". - - Return Value: A GVariant of type "a{sv}" or NULL on error. -*/ + * dbusmenu_menuitem_properties_variant: + * @mi: #DbusmenuMenuitem to get properties from + * + * Grabs the properties of the menuitem as a GVariant with the + * type "a{sv}". + * + * Return Value: (transfer full): A GVariant of type "a{sv}" or NULL on error. + */ GVariant * dbusmenu_menuitem_properties_variant (DbusmenuMenuitem * mi) { @@ -1285,15 +1286,15 @@ dbusmenu_menuitem_properties_variant (DbusmenuMenuitem * mi) } /** - dbusmenu_menuitem_set_root: - @mi: #DbusmenuMenuitem to set whether it's root - @root: Whether @mi is a root node or not - - This function sets the internal value of whether this is a - root node or not. - - Return value: None -*/ + * dbusmenu_menuitem_set_root: + * @mi: #DbusmenuMenuitem to set whether it's root + * @root: Whether @mi is a root node or not + * + * This function sets the internal value of whether this is a + * root node or not. + * + * Return value: None + */ void dbusmenu_menuitem_set_root (DbusmenuMenuitem * mi, gboolean root) { @@ -1304,14 +1305,14 @@ dbusmenu_menuitem_set_root (DbusmenuMenuitem * mi, gboolean root) } /** - dbusmenu_menuitem_get_root: - @mi: #DbusmenuMenuitem to see whether it's root - - This function returns the internal value of whether this is a - root node or not. - - Return value: #TRUE if this is a root node -*/ + * dbusmenu_menuitem_get_root: + * @mi: #DbusmenuMenuitem to see whether it's root + * + * This function returns the internal value of whether this is a + * root node or not. + * + * Return value: #TRUE if this is a root node + */ gboolean dbusmenu_menuitem_get_root (DbusmenuMenuitem * mi) { @@ -1322,16 +1323,16 @@ dbusmenu_menuitem_get_root (DbusmenuMenuitem * mi) /** - dbusmenu_menuitem_buildxml: - @mi: #DbusmenuMenuitem to represent in XML - @array: (element-type utf8): A list of string that will be turned into an XML file - - This function will add strings to the array @array. It will put - at least one entry if this menu item has no children. If it has - children it will put two for this entry, one representing the - start tag and one that is a closing tag. It will allow it's - children to place their own tags in the array in between those two. -*/ + * dbusmenu_menuitem_buildxml: + * @mi: #DbusmenuMenuitem to represent in XML + * @array: (element-type utf8): A list of string that will be turned into an XML file + * + * This function will add strings to the array @array. It will put + * at least one entry if this menu item has no children. If it has + * children it will put two for this entry, one representing the + * start tag and one that is a closing tag. It will allow it's + * children to place their own tags in the array in between those two. + */ void dbusmenu_menuitem_buildxml (DbusmenuMenuitem * mi, GPtrArray * array) { @@ -1369,15 +1370,15 @@ foreach_helper (gpointer data, gpointer user_data) } /** - dbusmenu_menuitem_foreach: - @mi: The #DbusmenItem to start from - @func: Function to call on every node in the tree - @data: (closure): User data to pass to the function - - This calls the function @func on this menu item and all - of the children of this item. And their children. And - their children. And... you get the point. It will get - called on the whole tree. + * dbusmenu_menuitem_foreach: + * @mi: The #DbusmenItem to start from + * @func: Function to call on every node in the tree + * @data: (closure): User data to pass to the function + * + * This calls the function @func on this menu item and all + * of the children of this item. And their children. And + * their children. And... you get the point. It will get + * called on the whole tree. */ void dbusmenu_menuitem_foreach (DbusmenuMenuitem * mi, void (*func) (DbusmenuMenuitem * mi, gpointer data), gpointer data) @@ -1393,23 +1394,23 @@ dbusmenu_menuitem_foreach (DbusmenuMenuitem * mi, void (*func) (DbusmenuMenuitem } /** - dbusmenu_menuitem_handle_event: - @mi: The #DbusmenuMenuitem to send the signal on. - @name: The name of the signal - @variant: A value that could be set for the event - @timestamp: The timestamp of when the event happened - - This function is called to create an event. It is likely - to be overrided by subclasses. The default menu item - will respond to the activate signal and do: - - Emits the #DbusmenuMenuitem::item-activate signal on this - menu item. Called by server objects when they get the - appropriate DBus signals from the client. - - If you subclass this function you should really think - about calling the parent function unless you have a good - reason not to. + * dbusmenu_menuitem_handle_event: + * @mi: The #DbusmenuMenuitem to send the signal on. + * @name: The name of the signal + * @variant: A value that could be set for the event + * @timestamp: The timestamp of when the event happened + * + * This function is called to create an event. It is likely + * to be overrided by subclasses. The default menu item + * will respond to the activate signal and do: + * + * Emits the #DbusmenuMenuitem::item-activate signal on this + * menu item. Called by server objects when they get the + * appropriate DBus signals from the client. + * + * If you subclass this function you should really think + * about calling the parent function unless you have a good + * reason not to. */ void dbusmenu_menuitem_handle_event (DbusmenuMenuitem * mi, const gchar * name, GVariant * variant, guint timestamp) @@ -1427,16 +1428,16 @@ dbusmenu_menuitem_handle_event (DbusmenuMenuitem * mi, const gchar * name, GVari } /** - 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: (closure): 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. -*/ + * 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: (closure): 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, void (*cb) (DbusmenuMenuitem * mi, gpointer user_data), gpointer cb_data) { @@ -1456,14 +1457,14 @@ dbusmenu_menuitem_send_about_to_show (DbusmenuMenuitem * mi, void (*cb) (Dbusmen } /** - dbusmenu_menuitem_show_to_user: - @mi: #DbusmenuMenuitem to show - @timestamp: The time that the user requested it to be shown - - Signals that this menu item should be shown to the user. If this is - server side the server will then take it and send it over the - bus. -*/ + * dbusmenu_menuitem_show_to_user: + * @mi: #DbusmenuMenuitem to show + * @timestamp: The time that the user requested it to be shown + * + * Signals that this menu item should be shown to the user. If this is + * server side the server will then take it and send it over the + * bus. + */ void dbusmenu_menuitem_show_to_user (DbusmenuMenuitem * mi, guint timestamp) { -- cgit v1.2.3