From 72650a318c8d65419fa53929e004ee48f98e6b09 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 22 Feb 2011 10:30:47 -0600 Subject: Adding a property for icon theme path collection. --- libdbusmenu-glib/dbus-menu.xml | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'libdbusmenu-glib') diff --git a/libdbusmenu-glib/dbus-menu.xml b/libdbusmenu-glib/dbus-menu.xml index 3b42f7d..738a0b0 100644 --- a/libdbusmenu-glib/dbus-menu.xml +++ b/libdbusmenu-glib/dbus-menu.xml @@ -189,6 +189,15 @@ License version 3 and version 2.1 along with this program. If not, see + + + A list of directories that should be used for finding icons using + the icon naming spec. Idealy there should only be one for the icon + theme, but additional ones are often added by applications for + app specific icons. + + + -- cgit v1.2.3 From d5b20b1b8f51a56c05a20aa58e54d6d231f30729 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 22 Feb 2011 12:10:20 -0600 Subject: Prototypes and stubs for the get/set icon paths --- libdbusmenu-glib/server.c | 15 +++++++++++++++ libdbusmenu-glib/server.h | 3 +++ 2 files changed, 18 insertions(+) (limited to 'libdbusmenu-glib') diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index 91e7a25..259167b 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -1685,3 +1685,18 @@ dbusmenu_server_set_status (DbusmenuServer * server, DbusmenuStatus status) return; } + +const GStrv +dbusmenu_server_get_icon_paths (DbusmenuServer * server) +{ + + return NULL; +} + +void +dbusmenu_server_set_icon_paths (DbusmenuServer * server, GStrv icon_paths) +{ + + + return; +} diff --git a/libdbusmenu-glib/server.h b/libdbusmenu-glib/server.h index 54cf5fc..bed567f 100644 --- a/libdbusmenu-glib/server.h +++ b/libdbusmenu-glib/server.h @@ -119,6 +119,9 @@ void dbusmenu_server_set_text_direction (DbusmenuServer * DbusmenuStatus dbusmenu_server_get_status (DbusmenuServer * server); void dbusmenu_server_set_status (DbusmenuServer * server, DbusmenuStatus status); +const GStrv dbusmenu_server_get_icon_paths (DbusmenuServer * server); +void dbusmenu_server_set_icon_paths (DbusmenuServer * server, + GStrv icon_paths); /** SECIONT:server -- cgit v1.2.3 From 3786fda6e30b90f71e55cb325a342a019a548007 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 22 Feb 2011 12:22:53 -0600 Subject: Adding some documentation --- libdbusmenu-glib/server.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'libdbusmenu-glib') diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index 259167b..8d55cea 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -1686,6 +1686,16 @@ dbusmenu_server_set_status (DbusmenuServer * server, DbusmenuStatus status) return; } +/** + dbusmenu_server_get_icon_paths: + @server: The #DbusmenuServer to get the icon paths from + + Gets the stored and exported icon paths from the server. + + Return value: A NULL-terminated list of icon paths with + memory managed by the server. Duplicate if you want + to keep them. +*/ const GStrv dbusmenu_server_get_icon_paths (DbusmenuServer * server) { @@ -1693,6 +1703,13 @@ dbusmenu_server_get_icon_paths (DbusmenuServer * server) return NULL; } +/** + dbusmenu_server_set_icon_paths: + @server: The #DbusmenuServer to set the icon paths on + + Sets the icon paths for the server. This will replace previously + set icon theme paths. +*/ void dbusmenu_server_set_icon_paths (DbusmenuServer * server, GStrv icon_paths) { -- cgit v1.2.3 From aff9b26c5c82ce54126d9cecc0a66a3abb5bfcc7 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 22 Feb 2011 13:39:21 -0600 Subject: Adding a private variable for the string list --- libdbusmenu-glib/server.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'libdbusmenu-glib') diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index 8d55cea..6199a39 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -59,6 +59,7 @@ struct _DbusmenuServerPrivate DbusmenuTextDirection text_direction; DbusmenuStatus status; + GStrv icon_dirs; GArray * prop_array; guint property_idle; @@ -368,6 +369,7 @@ dbusmenu_server_init (DbusmenuServer *self) default_text_direction(self); priv->status = DBUSMENU_STATUS_NORMAL; + priv->icon_dirs = NULL; return; } @@ -425,6 +427,13 @@ dbusmenu_server_dispose (GObject *object) static void dbusmenu_server_finalize (GObject *object) { + DbusmenuServerPrivate * priv = DBUSMENU_SERVER_GET_PRIVATE(object); + + if (priv->icon_dirs != NULL) { + g_strfreev(priv->icon_dirs); + priv->icon_dirs = NULL; + } + G_OBJECT_CLASS (dbusmenu_server_parent_class)->finalize (object); return; } -- cgit v1.2.3 From b6260e5ce88bda9aef711e1fdddc75cd807dd5f7 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 22 Feb 2011 13:40:56 -0600 Subject: Fleshing out getting the dirs --- libdbusmenu-glib/server.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'libdbusmenu-glib') diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index 6199a39..123472d 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -1706,10 +1706,11 @@ dbusmenu_server_set_status (DbusmenuServer * server, DbusmenuStatus status) to keep them. */ const GStrv -dbusmenu_server_get_icon_paths (DbusmenuServer * server) +dbusmenu_server_get_icon_paths (DbusmenuServer * server) { - - return NULL; + g_return_val_if_fail(DBUSMENU_IS_SERVER(server), NULL); + DbusmenuServerPrivate * priv = DBUSMENU_SERVER_GET_PRIVATE(server); + return priv->icon_dirs; } /** -- cgit v1.2.3 From a72bcc0edc0da201b2cf112e057ee2273d4dd6d8 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 22 Feb 2011 14:03:09 -0600 Subject: Fleshing out the function to set the icon dirs --- libdbusmenu-glib/server.c | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'libdbusmenu-glib') diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index 123472d..d969a55 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -85,7 +85,8 @@ enum { PROP_ROOT_NODE, PROP_VERSION, PROP_TEXT_DIRECTION, - PROP_STATUS + PROP_STATUS, + PROP_ICON_THEME_DIRS }; /* Errors */ @@ -1723,7 +1724,41 @@ dbusmenu_server_get_icon_paths (DbusmenuServer * server) void dbusmenu_server_set_icon_paths (DbusmenuServer * server, GStrv icon_paths) { + g_return_if_fail(DBUSMENU_IS_SERVER(server)); + DbusmenuServerPrivate * priv = DBUSMENU_SERVER_GET_PRIVATE(server); + + if (priv->icon_dirs != NULL) { + g_strfreev(priv->icon_dirs); + priv->icon_dirs = NULL; + } + + if (icon_paths != NULL) { + priv->icon_dirs = g_strdupv(icon_paths); + } + if (priv->bus != NULL && priv->dbusobject != NULL) { + GVariantBuilder params; + g_variant_builder_init(¶ms, G_VARIANT_TYPE_ARRAY); + g_variant_builder_add_value(¶ms, g_variant_new_string(DBUSMENU_INTERFACE)); + GVariant * items = NULL; + if (priv->icon_dirs != NULL) { + GVariant * dict = g_variant_new_dict_entry(g_variant_new_string("icon-theme-path"), g_variant_new_strv((const gchar * const *)priv->icon_dirs, -1)); + items = g_variant_new_array(NULL, &dict, 1); + } else { + items = g_variant_new_array(G_VARIANT_TYPE("{sv}"), NULL, 0); + } + g_variant_builder_add_value(¶ms, items); + g_variant_builder_add_value(¶ms, g_variant_new_array(G_VARIANT_TYPE_STRING, NULL, 0)); + GVariant * vparams = g_variant_builder_end(¶ms); + + g_dbus_connection_emit_signal(priv->bus, + NULL, + priv->dbusobject, + "org.freedesktop.DBus.Properties", + "PropertiesChanged", + vparams, + NULL); + } return; } -- cgit v1.2.3 From 08409e83ad0cc9beeb27f3f4dce9b98a43138576 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 22 Feb 2011 14:16:45 -0600 Subject: Handle the property being grabbed over dbus --- libdbusmenu-glib/server.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'libdbusmenu-glib') diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index d969a55..22aec70 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -754,6 +754,16 @@ bus_get_prop (GDBusConnection * connection, const gchar * sender, const gchar * return g_variant_new_uint32(DBUSMENU_VERSION_NUMBER); } else if (g_strcmp0(property, "text-direction") == 0) { return g_variant_new_string(dbusmenu_text_direction_get_nick(priv->text_direction)); + } else if (g_strcmp0(property, "icon-theme-path") == 0) { + GVariant * dirs = NULL; + + if (priv->icon_dirs != NULL) { + dirs = g_variant_new_strv((const gchar * const *)priv->icon_dirs, -1); + } else { + dirs = g_variant_new_array(G_VARIANT_TYPE_STRING, NULL, 0); + } + + return dirs; } else { g_warning("Unknown property '%s'", property); } -- cgit v1.2.3 From 4775fc7ebe2c4c536cfe71b9f1087474c7567d7a Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 25 Feb 2011 08:47:56 -0600 Subject: Use the library i18n instead of the standard one for apps. --- libdbusmenu-glib/defaults.c | 2 +- libdbusmenu-glib/server.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'libdbusmenu-glib') diff --git a/libdbusmenu-glib/defaults.c b/libdbusmenu-glib/defaults.c index c05ef38..9eaf9e5 100644 --- a/libdbusmenu-glib/defaults.c +++ b/libdbusmenu-glib/defaults.c @@ -30,7 +30,7 @@ License version 3 and version 2.1 along with this program. If not, see #include "config.h" #endif -#include +#include #include "defaults.h" #include "menuitem.h" diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index 056d6cb..3fe2422 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -30,7 +30,7 @@ License version 3 and version 2.1 along with this program. If not, see #include "config.h" #endif -#include +#include #include #include "menuitem-private.h" -- cgit v1.2.3 From f143a8c10adc126aa89a01f2b8f9fdb156fa0a44 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 25 Feb 2011 09:01:55 -0600 Subject: Switching so that the GIR file is built from our exported H files and objects. --- libdbusmenu-glib/Makefile.am | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'libdbusmenu-glib') diff --git a/libdbusmenu-glib/Makefile.am b/libdbusmenu-glib/Makefile.am index 8b523aa..a04e286 100644 --- a/libdbusmenu-glib/Makefile.am +++ b/libdbusmenu-glib/Makefile.am @@ -17,12 +17,16 @@ lib_LTLIBRARIES = \ libdbusmenu_glibincludedir=$(includedir)/libdbusmenu-0.4/libdbusmenu-glib/ -libdbusmenu_glibinclude_HEADERS = \ - dbusmenu-glib.h \ + +EXPORTED_OBJECTS = \ menuitem.h \ menuitem-proxy.h \ server.h \ - client.h \ + client.h + +libdbusmenu_glibinclude_HEADERS = \ + $(EXPORTED_OBJECTS) \ + dbusmenu-glib.h \ types.h libdbusmenu_glib_la_SOURCES = \ @@ -153,7 +157,9 @@ INTROSPECTION_COMPILER_ARGS = --includedir=$(builddir) if HAVE_INTROSPECTION -introspection_sources = $(libdbusmenu_glibinclude_HEADERS) $(libdbusmenu_glib_la_SOURCES) +introspection_sources = \ + $(libdbusmenu_glibinclude_HEADERS) \ + $(EXPORTED_OBJECTS:.h=.c) Dbusmenu-0.4.gir: libdbusmenu-glib.la Dbusmenu_0_4_gir_INCLUDES = \ -- cgit v1.2.3 From 6e69c09ed89fea101a214a257aaabdb5cc5abf5f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 25 Feb 2011 09:04:39 -0600 Subject: Add enum-types to the exported headers so that language bindings can use them. --- libdbusmenu-glib/Makefile.am | 1 + 1 file changed, 1 insertion(+) (limited to 'libdbusmenu-glib') diff --git a/libdbusmenu-glib/Makefile.am b/libdbusmenu-glib/Makefile.am index a04e286..5b04415 100644 --- a/libdbusmenu-glib/Makefile.am +++ b/libdbusmenu-glib/Makefile.am @@ -19,6 +19,7 @@ libdbusmenu_glibincludedir=$(includedir)/libdbusmenu-0.4/libdbusmenu-glib/ EXPORTED_OBJECTS = \ + enum-types.h \ menuitem.h \ menuitem-proxy.h \ server.h \ -- cgit v1.2.3 From 356ee2d0385f8fd22ec60d84620c0eb2df018384 Mon Sep 17 00:00:00 2001 From: Aurelien Gateau Date: Mon, 28 Feb 2011 10:57:36 +0100 Subject: Doc fixes: - Use "@a foo" for arguments, not "@foo" - Rename "recurse" (which sounds boolean) to "recursionDepth" - Removed dbusmenu-qt specific annotations --- libdbusmenu-glib/dbus-menu.xml | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'libdbusmenu-glib') diff --git a/libdbusmenu-glib/dbus-menu.xml b/libdbusmenu-glib/dbus-menu.xml index c0831e5..ffeca1e 100644 --- a/libdbusmenu-glib/dbus-menu.xml +++ b/libdbusmenu-glib/dbus-menu.xml @@ -177,21 +177,24 @@ License version 3 and version 2.1 along with this program. If not, see Provides the layout and propertiers that are attached to the entries that are in the layout. It only gives the items that are children - of the item that is specified in @parentId. It will return all of the - properties or specific ones depending of the value in @propertyNames. + of the item that is specified in @a parentId. It will return all of the + properties or specific ones depending of the value in @a propertyNames. The format is recursive, where the second 'v' is in the same format - as the original 'a(ia(sv)a(v))'. If the @recursive flag is set to - less than one then the second array will have zero entries. + as the original 'a(ia{sv}av)'. Its content depends on the value + of @a recursionDepth. The ID of the parent node for the layout. For grabbing the layout from the root node use zero. - + - The amount of levels of recursion to use. -1, as value would - deliver all the items under the @parentId. + The amount of levels of recursion to use. This affects the + content of the second variant array. + - -1: deliver all the items under the @a parentId. + - 0: no recursion, the array will be empty. + - n: array will contains items up to 'n' level depth. @@ -206,13 +209,11 @@ License version 3 and version 2.1 along with this program. If not, see with layoutUpdated signals. - The layout as an XML string of IDs. + The layout, as a recursive structure. - - Returns the list of items which are children of @a parentId. @@ -309,7 +310,7 @@ License version 3 and version 2.1 along with this program. If not, see properties. - + -- cgit v1.2.3 From 02582ed5c9b2504f7ac4e2c907970f1b2ab26e2b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 28 Feb 2011 12:37:31 -0600 Subject: These should be tuples, and now they are! --- libdbusmenu-glib/server.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libdbusmenu-glib') diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index 056d6cb..6b65638 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -499,7 +499,7 @@ set_property (GObject * obj, guint id, const GValue * value, GParamSpec * pspec) /* If the value has changed we need to signal that on DBus */ if (priv->text_direction != olddir && priv->bus != NULL && priv->dbusobject != NULL) { GVariantBuilder params; - g_variant_builder_init(¶ms, G_VARIANT_TYPE_ARRAY); + g_variant_builder_init(¶ms, G_VARIANT_TYPE_TUPLE); g_variant_builder_add_value(¶ms, g_variant_new_string(DBUSMENU_INTERFACE)); GVariant * dict = g_variant_new_dict_entry(g_variant_new_string("text-direction"), g_variant_new_string(dbusmenu_text_direction_get_nick(priv->text_direction))); g_variant_builder_add_value(¶ms, g_variant_new_array(NULL, &dict, 1)); @@ -523,7 +523,7 @@ set_property (GObject * obj, guint id, const GValue * value, GParamSpec * pspec) /* If the value has changed we need to signal that on DBus */ if (priv->status != instatus && priv->bus != NULL && priv->dbusobject != NULL) { GVariantBuilder params; - g_variant_builder_init(¶ms, G_VARIANT_TYPE_ARRAY); + g_variant_builder_init(¶ms, G_VARIANT_TYPE_TUPLE); g_variant_builder_add_value(¶ms, g_variant_new_string(DBUSMENU_INTERFACE)); GVariant * dict = g_variant_new_dict_entry(g_variant_new_string("status"), g_variant_new_string(dbusmenu_status_get_nick(instatus))); g_variant_builder_add_value(¶ms, g_variant_new_array(NULL, &dict, 1)); -- cgit v1.2.3 From 6fd3cb9d03b1418aaf550e4069f18e0dca8c7054 Mon Sep 17 00:00:00 2001 From: Chris Coulson Date: Mon, 28 Feb 2011 22:47:04 +0000 Subject: Fix LP: #723873 - when a menuitems property is restored to a default value, the new state is not updated correctly on the listening client. Make dbusmenu_menuitem_property_remove call dbusmenu_menuitem_property_set_variant with a NULL value rather than manipulating the properties directly. When removing a property that has a default value now, it will signal PROPERTY_CHANGED with the default value, which means that changing a property from non-default to default over the wire (which really just deletes the property) now works correctly. This is also now more aligned with how dbusmenu_menuitem_property_get* works, which will return the default value for a property after removing the property from the menuitem --- libdbusmenu-glib/menuitem.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'libdbusmenu-glib') diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 34147a3..61e59c3 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1150,9 +1150,9 @@ dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * pro DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi); GVariant * default_value = NULL; - if (value != NULL) { - const gchar * type = menuitem_get_type(mi); + const gchar * type = menuitem_get_type(mi); + if (value != NULL) { /* Check the expected type to see if we want to have a warning */ GVariantType * default_type = dbusmenu_defaults_default_get_type(priv->defaults, type, property); if (default_type != NULL) { @@ -1163,22 +1163,23 @@ dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * pro g_warning("Setting menuitem property '%s' with value of type '%s' when expecting '%s'", property, g_variant_get_type_string(value), g_variant_type_peek_string(default_type)); } } + } - /* Check the defaults database to see if we have a default - for this property. */ - default_value = dbusmenu_defaults_default_get(priv->defaults, type, property); - if (default_value != NULL) { - /* Now see if we're setting this to the same value as the - default. If we are then we just want to swallow this variant - and make the function behave like we're clearing it. */ - if (g_variant_equal(default_value, value)) { - g_variant_ref_sink(value); - g_variant_unref(value); - value = NULL; - } + /* Check the defaults database to see if we have a default + for this property. */ + default_value = dbusmenu_defaults_default_get(priv->defaults, type, property); + if (default_value != NULL && value != NULL) { + /* Now see if we're setting this to the same value as the + default. If we are then we just want to swallow this variant + and make the function behave like we're clearing it. */ + if (g_variant_equal(default_value, value)) { + g_variant_ref_sink(value); + g_variant_unref(value); + value = NULL; } } + gboolean replaced = FALSE; gpointer currentval = g_hash_table_lookup(priv->properties, property); @@ -1371,9 +1372,7 @@ dbusmenu_menuitem_property_remove (DbusmenuMenuitem * mi, const gchar * property g_return_if_fail(DBUSMENU_IS_MENUITEM(mi)); g_return_if_fail(property != NULL); - DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi); - - g_hash_table_remove(priv->properties, property); + dbusmenu_menuitem_property_set_variant(mi, property, NULL); return; } -- cgit v1.2.3 From b678e3199d416efe0dc55d7f46c4124b673a2ae6 Mon Sep 17 00:00:00 2001 From: Chris Coulson Date: Tue, 1 Mar 2011 11:15:19 +0000 Subject: The last commit causes the warning in dbusmenu_menuitem_property_is_default to be thrown when removing a property that has no default value. This warning seems bogus though, as any property that is not in the menuitems local property list is a default value (as that is what dbusmenu_menuitem_property_get* will return). Simplify this function to work like this and drop the warning --- libdbusmenu-glib/menuitem.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'libdbusmenu-glib') diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 61e59c3..855f4ee 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1752,13 +1752,8 @@ dbusmenu_menuitem_property_is_default (DbusmenuMenuitem * mi, const gchar * prop return FALSE; } - currentval = dbusmenu_defaults_default_get(priv->defaults, menuitem_get_type(mi), property); - if (currentval != NULL) { - return TRUE; - } - - g_warn_if_reached(); - return FALSE; + /* If we haven't stored it locally, then it's the default */ + return TRUE; } /* Check to see if this menu item has been sent into the bus yet or -- cgit v1.2.3 From 175bbbfbe11060d9029554732145f465062c792c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 1 Mar 2011 10:47:31 -0600 Subject: Actually looking up the parent menu item --- libdbusmenu-glib/server.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'libdbusmenu-glib') diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index 056d6cb..e268d1a 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -1180,7 +1180,11 @@ bus_get_layout (DbusmenuServer * server, GVariant * params, GDBusMethodInvocatio GVariant * items = NULL; if (priv->root != NULL) { - items = dbusmenu_menuitem_build_variant(priv->root, props, recurse); + DbusmenuMenuitem * mi = dbusmenu_menuitem_find_id(priv->root, parent); + + if (mi != NULL) { + items = dbusmenu_menuitem_build_variant(mi, props, recurse); + } } /* What happens if we don't have anything? */ -- cgit v1.2.3 From 7382073359ea7a103f53b05167214b0f10fd516c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 1 Mar 2011 21:01:59 -0600 Subject: Putting a protection in for bad key values. --- libdbusmenu-glib/menuitem.c | 1 + 1 file changed, 1 insertion(+) (limited to 'libdbusmenu-glib') diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 855f4ee..399b6f5 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1146,6 +1146,7 @@ dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * pro { g_return_val_if_fail(DBUSMENU_IS_MENUITEM(mi), FALSE); g_return_val_if_fail(property != NULL, FALSE); + g_return_val_if_fail(g_utf8_validate(property, -1, NULL), FALSE); DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi); GVariant * default_value = NULL; -- cgit v1.2.3 From 47b5514af1101a64fcf220056c7e4a81d89aeeb9 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 1 Mar 2011 21:12:03 -0600 Subject: Delaying the removal from the hashtable. --- libdbusmenu-glib/menuitem.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'libdbusmenu-glib') diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 399b6f5..f7867e4 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1182,6 +1182,7 @@ dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * pro gboolean replaced = FALSE; + gboolean remove = FALSE; gpointer currentval = g_hash_table_lookup(priv->properties, property); if (value != NULL) { @@ -1196,10 +1197,21 @@ dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * pro gchar * lprop = g_strdup(property); g_variant_ref_sink(value); - g_hash_table_replace(priv->properties, lprop, value); + /* Really important that this is _insert as that means the value + that we just created in the _strdup is free'd and not the one + currently in the hashtable. That could be the same as the one + being passed in and then the signal emit would be done with a + bad value */ + g_hash_table_insert(priv->properties, lprop, value); } else { if (currentval != NULL) { - g_hash_table_remove(priv->properties, property); + /* So the question you should be asking if you're paying attention + is "Why not just do the remove here?" It's a good question with + an interesting answer. Bascially it's the same reason as above, + in a couple cases the passed in properties is the value in the hash + table so we can avoid strdup'ing it by removing it (and thus free'ing + it) after the signal emition */ + remove = TRUE; replaced = TRUE; } } @@ -1220,6 +1232,10 @@ dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * pro g_signal_emit(G_OBJECT(mi), signals[PROPERTY_CHANGED], 0, property, signalval, TRUE); } + if (remove) { + g_hash_table_remove(priv->properties, property); + } + return TRUE; } -- cgit v1.2.3 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') 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 +++++----- libdbusmenu-glib/dbus-menu.xml | 6 +++--- libdbusmenu-glib/server.c | 10 +++++----- 3 files changed, 13 insertions(+), 13 deletions(-) (limited to 'libdbusmenu-glib') 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); diff --git a/libdbusmenu-glib/dbus-menu.xml b/libdbusmenu-glib/dbus-menu.xml index 2352712..b61b5ec 100644 --- a/libdbusmenu-glib/dbus-menu.xml +++ b/libdbusmenu-glib/dbus-menu.xml @@ -164,14 +164,14 @@ License version 3 and version 2.1 along with this program. If not, see ]]> - + Provides the version of the DBusmenu API that this API is implementing. - + Represents the way the text direction of the application. This allows the server to handle mismatches intelligently. For left- @@ -179,7 +179,7 @@ License version 3 and version 2.1 along with this program. If not, see - + Tells if the menus are in a normal state or they believe that they could use some attention. Cases for showing them would be if help diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index 7c943b2..ebd9193 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -501,7 +501,7 @@ set_property (GObject * obj, guint id, const GValue * value, GParamSpec * pspec) GVariantBuilder params; g_variant_builder_init(¶ms, G_VARIANT_TYPE_ARRAY); g_variant_builder_add_value(¶ms, g_variant_new_string(DBUSMENU_INTERFACE)); - GVariant * dict = g_variant_new_dict_entry(g_variant_new_string("text-direction"), g_variant_new_string(dbusmenu_text_direction_get_nick(priv->text_direction))); + GVariant * dict = g_variant_new_dict_entry(g_variant_new_string("TextDirection"), g_variant_new_string(dbusmenu_text_direction_get_nick(priv->text_direction))); g_variant_builder_add_value(¶ms, g_variant_new_array(NULL, &dict, 1)); g_variant_builder_add_value(¶ms, g_variant_new_array(G_VARIANT_TYPE_STRING, NULL, 0)); GVariant * vparams = g_variant_builder_end(¶ms); @@ -525,7 +525,7 @@ set_property (GObject * obj, guint id, const GValue * value, GParamSpec * pspec) GVariantBuilder params; g_variant_builder_init(¶ms, G_VARIANT_TYPE_ARRAY); g_variant_builder_add_value(¶ms, g_variant_new_string(DBUSMENU_INTERFACE)); - GVariant * dict = g_variant_new_dict_entry(g_variant_new_string("status"), g_variant_new_string(dbusmenu_status_get_nick(instatus))); + GVariant * dict = g_variant_new_dict_entry(g_variant_new_string("Status"), g_variant_new_string(dbusmenu_status_get_nick(instatus))); g_variant_builder_add_value(¶ms, g_variant_new_array(NULL, &dict, 1)); g_variant_builder_add_value(¶ms, g_variant_new_array(G_VARIANT_TYPE_STRING, NULL, 0)); GVariant * vparams = g_variant_builder_end(¶ms); @@ -740,11 +740,11 @@ bus_get_prop (GDBusConnection * connection, const gchar * sender, const gchar * g_return_val_if_fail(g_strcmp0(interface, DBUSMENU_INTERFACE) == 0, NULL); g_return_val_if_fail(g_strcmp0(path, priv->dbusobject) == 0, NULL); - if (g_strcmp0(property, "version") == 0) { + if (g_strcmp0(property, "Version") == 0) { return g_variant_new_uint32(DBUSMENU_VERSION_NUMBER); - } else if (g_strcmp0(property, "text-direction") == 0) { + } else if (g_strcmp0(property, "TextDirection") == 0) { return g_variant_new_string(dbusmenu_text_direction_get_nick(priv->text_direction)); - } else if (g_strcmp0(property, "status") == 0) { + } else if (g_strcmp0(property, "Status") == 0) { return g_variant_new_string(dbusmenu_status_get_nick(priv->status)); } else { g_warning("Unknown property '%s'", property); -- 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 +++++----- libdbusmenu-glib/client.h | 14 +------------- 2 files changed, 6 insertions(+), 18 deletions(-) (limited to 'libdbusmenu-glib') 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); diff --git a/libdbusmenu-glib/client.h b/libdbusmenu-glib/client.h index 28d4dd3..1deed56 100644 --- a/libdbusmenu-glib/client.h +++ b/libdbusmenu-glib/client.h @@ -198,18 +198,6 @@ struct _DbusmenuClient { */ typedef gboolean (*DbusmenuClientTypeHandler) (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client, gpointer user_data); -/** - DbusmenuClientTypeDestroyHandler: - @client: A pointer to the #DbusmenuClient - @type: The type that this handler was registered with - @user_data: The data you gave us - - This handler is called when the type becomes unregistered by the - client. This is usally caused by the #DbusmenuClient being destroyed - and should free memory or unref objects in @user_data. -*/ -typedef void (*DbusmenuClientTypeDestroyHandler) (DbusmenuClient * client, const gchar * type, gpointer user_data); - GType dbusmenu_client_get_type (void); DbusmenuClient * dbusmenu_client_new (const gchar * name, const gchar * object); @@ -221,7 +209,7 @@ gboolean dbusmenu_client_add_type_handler_full (DbusmenuClient * cli const gchar * type, DbusmenuClientTypeHandler newfunc, gpointer user_data, - DbusmenuClientTypeDestroyHandler destroy_func); + GDestroyNotify destroy_func); DbusmenuTextDirection dbusmenu_client_get_text_direction (DbusmenuClient * client); DbusmenuStatus dbusmenu_client_get_status (DbusmenuClient * client); -- cgit v1.2.3 From d693a90a23e498b50052040f90d761d0b57c5914 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 2 Mar 2011 22:41:48 -0600 Subject: Changing property name to match DBus recommendations --- libdbusmenu-glib/dbus-menu.xml | 2 +- libdbusmenu-glib/server.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'libdbusmenu-glib') diff --git a/libdbusmenu-glib/dbus-menu.xml b/libdbusmenu-glib/dbus-menu.xml index 956844e..efb55d4 100644 --- a/libdbusmenu-glib/dbus-menu.xml +++ b/libdbusmenu-glib/dbus-menu.xml @@ -189,7 +189,7 @@ License version 3 and version 2.1 along with this program. If not, see - + A list of directories that should be used for finding icons using the icon naming spec. Idealy there should only be one for the icon diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index 14c0c53..7421747 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -754,7 +754,7 @@ bus_get_prop (GDBusConnection * connection, const gchar * sender, const gchar * return g_variant_new_uint32(DBUSMENU_VERSION_NUMBER); } else if (g_strcmp0(property, "TextDirection") == 0) { return g_variant_new_string(dbusmenu_text_direction_get_nick(priv->text_direction)); - } else if (g_strcmp0(property, "icon-theme-path") == 0) { + } else if (g_strcmp0(property, "IconThemePath") == 0) { GVariant * dirs = NULL; if (priv->icon_dirs != NULL) { @@ -1773,7 +1773,7 @@ dbusmenu_server_set_icon_paths (DbusmenuServer * server, GStrv icon_paths) g_variant_builder_add_value(¶ms, g_variant_new_string(DBUSMENU_INTERFACE)); GVariant * items = NULL; if (priv->icon_dirs != NULL) { - GVariant * dict = g_variant_new_dict_entry(g_variant_new_string("icon-theme-path"), g_variant_new_strv((const gchar * const *)priv->icon_dirs, -1)); + GVariant * dict = g_variant_new_dict_entry(g_variant_new_string("IconThemePath"), g_variant_new_strv((const gchar * const *)priv->icon_dirs, -1)); items = g_variant_new_array(NULL, &dict, 1); } else { items = g_variant_new_array(G_VARIANT_TYPE("{sv}"), NULL, 0); -- 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') 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') 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-marshal.list | 1 + libdbusmenu-glib/client.c | 15 +++++++++++++++ libdbusmenu-glib/client.h | 10 +++++----- 3 files changed, 21 insertions(+), 5 deletions(-) (limited to 'libdbusmenu-glib') diff --git a/libdbusmenu-glib/client-marshal.list b/libdbusmenu-glib/client-marshal.list index 96f9302..980c5c3 100644 --- a/libdbusmenu-glib/client-marshal.list +++ b/libdbusmenu-glib/client-marshal.list @@ -1,3 +1,4 @@ VOID: OBJECT, UINT VOID: OBJECT, STRING, VARIANT, UINT, POINTER VOID: ENUM +VOID: POINTER 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", diff --git a/libdbusmenu-glib/client.h b/libdbusmenu-glib/client.h index 28d4dd3..f69270f 100644 --- a/libdbusmenu-glib/client.h +++ b/libdbusmenu-glib/client.h @@ -75,11 +75,11 @@ G_BEGIN_DECLS */ #define DBUSMENU_CLIENT_SIGNAL_EVENT_RESULT "event-result" /** - * DBUSMENU_CLIENT_SIGNAL_TEXT_DIRECTION_CHANGED: + * DBUSMENU_CLIENT_SIGNAL_ICON_THEME_DIRS_CHANGED: * - * String to attach to signal #DbusmenuClient::text-direction-changed + * String to attach to signal #DbusmenuClient::icon-theme-dirs-changed */ -#define DBUSMENU_CLIENT_SIGNAL_TEXT_DIRECTION_CHANGED "text-direction-changed" +#define DBUSMENU_CLIENT_SIGNAL_ICON_THEME_DIRS_CHANGED "icon-theme-dirs-changed" /** * DBUSMENU_CLIENT_PROP_DBUS_NAME: @@ -139,12 +139,12 @@ typedef struct _DbusmenuClientPrivate DbusmenuClientPrivate; @new_menuitem: Slot for #DbusmenuClient::new-menuitem. @item_activate: Slot for #DbusmenuClient::item-activate. @event_result: Slot for #DbusmenuClient::event-error. + @icon_theme_dirs: Slot for #DbusmenuClient::icon-theme-dirs-changed. @reserved1: Reserved for future use. @reserved2: Reserved for future use. @reserved3: Reserved for future use. @reserved4: Reserved for future use. @reserved5: Reserved for future use. - @reserved6: Reserved for future use. A simple class that takes all of the information from a #DbusmenuServer over DBus and makes the same set of @@ -159,6 +159,7 @@ struct _DbusmenuClientClass { void (*new_menuitem) (DbusmenuMenuitem * newitem); void (*item_activate) (DbusmenuMenuitem * item, guint timestamp); void (*event_result) (DbusmenuMenuitem * item, gchar * event, GVariant * data, guint timestamp, GError * error); + void (*icon_theme_dirs) (DbusmenuMenuitem * item, gpointer theme_dirs, GError * error); /*< Private >*/ void (*reserved1) (void); @@ -166,7 +167,6 @@ struct _DbusmenuClientClass { void (*reserved3) (void); void (*reserved4) (void); void (*reserved5) (void); - void (*reserved6) (void); }; /** -- 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') 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 baacc6da45b252e8c510a6e69fd7332f51dd961e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 3 Mar 2011 10:37:07 -0600 Subject: Changing comment so it can get some GIR lovin' --- libdbusmenu-glib/server.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'libdbusmenu-glib') diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index 7421747..810fc05 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -1728,15 +1728,15 @@ dbusmenu_server_set_status (DbusmenuServer * server, DbusmenuStatus status) } /** - dbusmenu_server_get_icon_paths: - @server: The #DbusmenuServer to get the icon paths from - - Gets the stored and exported icon paths from the server. - - Return value: A NULL-terminated list of icon paths with - memory managed by the server. Duplicate if you want - to keep them. -*/ + * dbusmenu_server_get_icon_paths: + * @server: The #DbusmenuServer to get the icon paths from + * + * Gets the stored and exported icon paths from the server. + * + * Return value: (transfer none): A NULL-terminated list of icon paths with + * memory managed by the server. Duplicate if you want + * to keep them. + */ const GStrv dbusmenu_server_get_icon_paths (DbusmenuServer * server) { -- 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 +++++++++++++++++ libdbusmenu-glib/client.h | 1 + 2 files changed, 18 insertions(+) (limited to 'libdbusmenu-glib') 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; +} diff --git a/libdbusmenu-glib/client.h b/libdbusmenu-glib/client.h index f69270f..93f4280 100644 --- a/libdbusmenu-glib/client.h +++ b/libdbusmenu-glib/client.h @@ -224,6 +224,7 @@ gboolean dbusmenu_client_add_type_handler_full (DbusmenuClient * cli DbusmenuClientTypeDestroyHandler destroy_func); DbusmenuTextDirection dbusmenu_client_get_text_direction (DbusmenuClient * client); DbusmenuStatus dbusmenu_client_get_status (DbusmenuClient * client); +const GStrv dbusmenu_client_get_icon_paths (DbusmenuClient * client); /** SECTION:client -- cgit v1.2.3 From a5f4f2898eec5e8dda5ec302c57ab9610ac9d1f3 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 3 Mar 2011 10:59:21 -0600 Subject: Should be a tuple --- libdbusmenu-glib/server.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libdbusmenu-glib') diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index 810fc05..fa517f5 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -1769,7 +1769,7 @@ dbusmenu_server_set_icon_paths (DbusmenuServer * server, GStrv icon_paths) if (priv->bus != NULL && priv->dbusobject != NULL) { GVariantBuilder params; - g_variant_builder_init(¶ms, G_VARIANT_TYPE_ARRAY); + g_variant_builder_init(¶ms, G_VARIANT_TYPE_TUPLE); g_variant_builder_add_value(¶ms, g_variant_new_string(DBUSMENU_INTERFACE)); GVariant * items = NULL; if (priv->icon_dirs != NULL) { -- cgit v1.2.3