From 0e6db378e81e24f2ee2ff4498ff40dc60d1915bc Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 1 Mar 2011 21:19:43 -0600 Subject: Don't tell us everytime, we know you're good, you don't have to brag. --- libdbusmenu-glib/client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index d368a0e..e1f20d1 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -1168,7 +1168,7 @@ menuproxy_signal_cb (GDBusProxy * proxy, gchar * sender, gchar * signal, GVarian gchar * property; while (g_variant_iter_next(&properties, "s", &property)) { - g_debug("Removing property '%s' on %d", property, id); + /* g_debug("Removing property '%s' on %d", property, id); */ dbusmenu_menuitem_property_remove(menuitem, property); } } -- cgit v1.2.3 From 33b4e34124c38f8159ea4af25f2b3622b3cc392e Mon Sep 17 00:00:00 2001 From: Aurelien Gateau Date: Wed, 2 Mar 2011 12:07:07 +0100 Subject: Rename dbus properties to follow dbus naming conventions - version => Version - text-direction => TextDirection - status => Status --- libdbusmenu-glib/client.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index d368a0e..8424d6f 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -1026,7 +1026,7 @@ menuproxy_build_cb (GObject * object, GAsyncResult * res, gpointer user_data) } /* Check the text direction if available */ - GVariant * textdir = g_dbus_proxy_get_cached_property(priv->menuproxy, "text-direction"); + GVariant * textdir = g_dbus_proxy_get_cached_property(priv->menuproxy, "TextDirection"); if (textdir != NULL) { GVariant * str = textdir; if (g_variant_is_of_type(str, G_VARIANT_TYPE_VARIANT)) { @@ -1069,10 +1069,10 @@ menuproxy_prop_changed_cb (GDBusProxy * proxy, GVariant * properties, GStrv inva gchar * invalid; gint i = 0; for (invalid = invalidated[i]; invalid != NULL; invalid = invalidated[++i]) { - if (g_strcmp0(invalid, "text-direction") == 0) { + if (g_strcmp0(invalid, "TextDirection") == 0) { priv->text_direction = DBUSMENU_TEXT_DIRECTION_NONE; } - if (g_strcmp0(invalid, "status") == 0) { + if (g_strcmp0(invalid, "Status") == 0) { priv->status = DBUSMENU_STATUS_NORMAL; } } @@ -1082,7 +1082,7 @@ menuproxy_prop_changed_cb (GDBusProxy * proxy, GVariant * properties, GStrv inva gchar * key; GVariant * value; g_variant_iter_init(&iters, properties); while (g_variant_iter_next(&iters, "{sv}", &key, &value)) { - if (g_strcmp0(key, "text-direction") == 0) { + if (g_strcmp0(key, "TextDirection") == 0) { GVariant * str = value; if (g_variant_is_of_type(str, G_VARIANT_TYPE_VARIANT)) { str = g_variant_get_variant(str); @@ -1090,7 +1090,7 @@ menuproxy_prop_changed_cb (GDBusProxy * proxy, GVariant * properties, GStrv inva priv->text_direction = dbusmenu_text_direction_get_value_from_nick(g_variant_get_string(str, NULL)); } - if (g_strcmp0(key, "status") == 0) { + if (g_strcmp0(key, "Status") == 0) { GVariant * str = value; if (g_variant_is_of_type(str, G_VARIANT_TYPE_VARIANT)) { str = g_variant_get_variant(str); -- cgit v1.2.3 From ecd64358f931dc26bd806f72f774cac54e3bfad7 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 2 Mar 2011 10:04:25 -0600 Subject: Changing the destroy notification function to be a GDestroyNotify for GIR purposes --- libdbusmenu-glib/client.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 83ca056..8415b95 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -129,7 +129,7 @@ typedef struct _type_handler_t type_handler_t; struct _type_handler_t { DbusmenuClient * client; DbusmenuClientTypeHandler cb; - DbusmenuClientTypeDestroyHandler destroy_cb; + GDestroyNotify destroy_cb; gpointer user_data; gchar * type; }; @@ -1881,7 +1881,7 @@ type_handler_destroy (gpointer user_data) { type_handler_t * th = (type_handler_t *)user_data; if (th->destroy_cb != NULL) { - th->destroy_cb(th->client, th->type, th->user_data); + th->destroy_cb(th->user_data); } g_free(th->type); g_free(th); @@ -1893,7 +1893,7 @@ type_handler_destroy (gpointer user_data) * @client: Client where we're getting types coming in * @type: A text string that will be matched with the 'type' * property on incoming menu items - * @newfunc: The function that will be executed with those new + * @newfunc: (scope notified): The function that will be executed with those new * items when they come in. * * This function connects into the type handling of the #DbusmenuClient. @@ -1920,7 +1920,7 @@ dbusmenu_client_add_type_handler (DbusmenuClient * client, const gchar * type, D * @client: Client where we're getting types coming in * @type: A text string that will be matched with the 'type' * property on incoming menu items - * @newfunc: The function that will be executed with those new + * @newfunc: (scope notified): The function that will be executed with those new * items when they come in. * @user_data: Data passed to @newfunc when it is called * @destroy_func: A function that is called when the type handler is @@ -1941,7 +1941,7 @@ dbusmenu_client_add_type_handler (DbusmenuClient * client, const gchar * type, D * Return value: If registering the new type was successful. */ gboolean -dbusmenu_client_add_type_handler_full (DbusmenuClient * client, const gchar * type, DbusmenuClientTypeHandler newfunc, gpointer user_data, DbusmenuClientTypeDestroyHandler destroy_func) +dbusmenu_client_add_type_handler_full (DbusmenuClient * client, const gchar * type, DbusmenuClientTypeHandler newfunc, gpointer user_data, GDestroyNotify destroy_func) { g_return_val_if_fail(DBUSMENU_IS_CLIENT(client), FALSE); g_return_val_if_fail(type != NULL, FALSE); -- cgit v1.2.3 From 653e6aaf8dfbc91f728cd8766991a50c2fc6f275 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 2 Mar 2011 22:47:54 -0600 Subject: Adding the private variable for icon directories --- libdbusmenu-glib/client.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 83ca056..a91e9f6 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -98,6 +98,7 @@ struct _DbusmenuClientPrivate DbusmenuTextDirection text_direction; DbusmenuStatus status; + GStrv icon_dirs; }; typedef struct _newItemPropData newItemPropData; @@ -358,6 +359,7 @@ dbusmenu_client_init (DbusmenuClient *self) priv->text_direction = DBUSMENU_TEXT_DIRECTION_NONE; priv->status = DBUSMENU_STATUS_NORMAL; + priv->icon_dirs = NULL; return; } @@ -466,6 +468,11 @@ dbusmenu_client_finalize (GObject *object) g_hash_table_destroy(priv->type_handlers); } + if (priv->icon_dirs != NULL) { + g_strfreev(priv->icon_dirs); + priv->icon_dirs = NULL; + } + G_OBJECT_CLASS (dbusmenu_client_parent_class)->finalize (object); return; } -- cgit v1.2.3 From 75eb455e972b3e04b2fc8b89ead2815dff070fa5 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 2 Mar 2011 22:53:09 -0600 Subject: Handle getting the property and/or getting an update to it. --- libdbusmenu-glib/client.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index a91e9f6..9954683 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -1071,6 +1071,7 @@ menuproxy_prop_changed_cb (GDBusProxy * proxy, GVariant * properties, GStrv inva DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(user_data); DbusmenuTextDirection olddir = priv->text_direction; DbusmenuStatus oldstatus = priv->status; + gboolean dirs_changed = FALSE; /* Invalidate first */ gchar * invalid; @@ -1082,6 +1083,13 @@ menuproxy_prop_changed_cb (GDBusProxy * proxy, GVariant * properties, GStrv inva if (g_strcmp0(invalid, "Status") == 0) { priv->status = DBUSMENU_STATUS_NORMAL; } + if (g_strcmp0(invalid, "IconThemePath") == 0) { + if (priv->icon_dirs != NULL) { + dirs_changed = TRUE; + g_strfreev(priv->icon_dirs); + priv->icon_dirs = NULL; + } + } } /* Check updates */ @@ -1105,6 +1113,15 @@ menuproxy_prop_changed_cb (GDBusProxy * proxy, GVariant * properties, GStrv inva priv->status = dbusmenu_status_get_value_from_nick(g_variant_get_string(str, NULL)); } + if (g_strcmp0(key, "IconThemePath") == 0) { + if (priv->icon_dirs != NULL) { + g_strfreev(priv->icon_dirs); + priv->icon_dirs = NULL; + } + + priv->icon_dirs = g_variant_dup_strv(value, NULL); + dirs_changed = TRUE; + } g_variant_unref(value); g_free(key); @@ -1118,6 +1135,10 @@ menuproxy_prop_changed_cb (GDBusProxy * proxy, GVariant * properties, GStrv inva g_object_notify(G_OBJECT(user_data), DBUSMENU_CLIENT_PROP_STATUS); } + if (dirs_changed) { + // TODO: We need to tell someone! + } + return; } -- cgit v1.2.3 From 9dd7d767dfc3388d549e2b2ed6004618dcf84270 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 3 Mar 2011 10:31:22 -0600 Subject: Adding a signal for theme directories changing. --- libdbusmenu-glib/client.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 9954683..30fe1ba 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -62,6 +62,7 @@ enum { NEW_MENUITEM, ITEM_ACTIVATE, EVENT_RESULT, + ICON_THEME_DIRS, LAST_SIGNAL }; @@ -273,6 +274,20 @@ dbusmenu_client_class_init (DbusmenuClientClass *klass) NULL, NULL, _dbusmenu_client_marshal_VOID__OBJECT_STRING_VARIANT_UINT_POINTER, G_TYPE_NONE, 5, G_TYPE_OBJECT, G_TYPE_STRING, G_TYPE_VARIANT, G_TYPE_UINT, G_TYPE_POINTER); + /** + DbusmenuClient::icon-theme-dirs-changed: + @arg0: The #DbusmenuClient object + @arg1: A #GStrv of theme directories + + Signaled when the theme directories are changed by the server. + */ + signals[ICON_THEME_DIRS] = g_signal_new(DBUSMENU_CLIENT_SIGNAL_ICON_THEME_DIRS_CHANGED, + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (DbusmenuClientClass, icon_theme_dirs), + NULL, NULL, + _dbusmenu_client_marshal_VOID__POINTER, + G_TYPE_NONE, 1, G_TYPE_POINTER); g_object_class_install_property (object_class, PROP_DBUSOBJECT, g_param_spec_string(DBUSMENU_CLIENT_PROP_DBUS_OBJECT, "DBus Object we represent", -- cgit v1.2.3 From c975ec882ef2842aec03e799c5fc807d8dc6c3b4 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 3 Mar 2011 10:34:54 -0600 Subject: Emit the signal when needed --- libdbusmenu-glib/client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 30fe1ba..26c7942 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -1151,7 +1151,7 @@ menuproxy_prop_changed_cb (GDBusProxy * proxy, GVariant * properties, GStrv inva } if (dirs_changed) { - // TODO: We need to tell someone! + g_signal_emit(G_OBJECT(user_data), signals[ICON_THEME_DIRS], 0, priv->icon_dirs, TRUE); } return; -- cgit v1.2.3 From 10a95caedd896115b4d479c0328d575ce20e32d9 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 3 Mar 2011 10:43:26 -0600 Subject: Add a 'get' function for the icon theme directories. --- libdbusmenu-glib/client.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 26c7942..f041730 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -2055,4 +2055,21 @@ dbusmenu_client_get_status (DbusmenuClient * client) return priv->status; } +/** + * dbusmenu_client_get_icon_paths: + * @client: The #DbusmenuClient to get the icon paths from + * + * Gets the stored and exported icon paths from the client. + * + * Return value: (transfer none): A NULL-terminated list of icon paths with + * memory managed by the client. Duplicate if you want + * to keep them. + */ +const GStrv +dbusmenu_client_get_icon_paths (DbusmenuClient * client) +{ + g_return_val_if_fail(DBUSMENU_IS_CLIENT(client), NULL); + DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); + return priv->icon_dirs; +} -- cgit v1.2.3