From 74245583e9a26995efb83867dac524f7e8e5fb72 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 9 Jun 2010 21:44:35 -0500 Subject: Putting in doc checks --- docs/libdbusmenu-glib/reference/Makefile.am | 2 +- docs/libdbusmenu-gtk/reference/Makefile.am | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/libdbusmenu-glib/reference/Makefile.am b/docs/libdbusmenu-glib/reference/Makefile.am index 4f511bc..e87f226 100644 --- a/docs/libdbusmenu-glib/reference/Makefile.am +++ b/docs/libdbusmenu-glib/reference/Makefile.am @@ -83,5 +83,5 @@ EXTRA_DIST += version.xml.in #DISTCLEANFILES += # Comment this out if you want your docs-status tested during 'make check' -#TESTS = $(GTKDOC_CHECK) +TESTS = $(GTKDOC_CHECK) diff --git a/docs/libdbusmenu-gtk/reference/Makefile.am b/docs/libdbusmenu-gtk/reference/Makefile.am index ec1bd28..21d95bd 100644 --- a/docs/libdbusmenu-gtk/reference/Makefile.am +++ b/docs/libdbusmenu-gtk/reference/Makefile.am @@ -83,5 +83,5 @@ EXTRA_DIST += version.xml.in #DISTCLEANFILES += # Comment this out if you want your docs-status tested during 'make check' -#TESTS = $(GTKDOC_CHECK) +TESTS = $(GTKDOC_CHECK) -- cgit v1.2.3 From 36826dcea61c5bcf6be1fa50a80c205d58283e62 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 28 Jan 2011 14:14:13 -0600 Subject: Adding a signal for events --- libdbusmenu-glib/menuitem-marshal.list | 1 + libdbusmenu-glib/menuitem.c | 18 ++++++++++++++++++ libdbusmenu-glib/menuitem.h | 5 ++++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/libdbusmenu-glib/menuitem-marshal.list b/libdbusmenu-glib/menuitem-marshal.list index e3cb272..b2e02e5 100644 --- a/libdbusmenu-glib/menuitem-marshal.list +++ b/libdbusmenu-glib/menuitem-marshal.list @@ -4,3 +4,4 @@ VOID: OBJECT, UINT VOID: OBJECT VOID: VOID VOID: UINT +VOID: STRING, VARIANT, UINT diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index b40195c..83d98fa 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -71,6 +71,7 @@ enum { REALIZED, SHOW_TO_USER, ABOUT_TO_SHOW, + EVENT, LAST_SIGNAL }; @@ -244,6 +245,23 @@ dbusmenu_menuitem_class_init (DbusmenuMenuitemClass *klass) NULL, NULL, _dbusmenu_menuitem_marshal_VOID__VOID, G_TYPE_BOOLEAN, 0, G_TYPE_NONE); + /** + DbusmenuMenuitem::event: + @arg0: The #DbusmenuMenuitem object. + @arg1: Name of the event + @arg2: Information passed along with the event + @arg3: X11 timestamp of when the event happened + + Emitted when an event is passed through. The event is signalled + after handle_event is called. + */ + signals[EVENT] = g_signal_new(DBUSMENU_MENUITEM_SIGNAL_EVENT, + G_TYPE_FROM_CLASS(klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(DbusmenuMenuitemClass, event), + NULL, NULL, + _dbusmenu_menuitem_marshal_VOID__STRING_VARIANT_UINT, + G_TYPE_BOOLEAN, 3, G_TYPE_STRING, G_TYPE_VARIANT, G_TYPE_UINT); g_object_class_install_property (object_class, PROP_ID, g_param_spec_int(PROP_ID_S, "ID for the menu item", diff --git a/libdbusmenu-glib/menuitem.h b/libdbusmenu-glib/menuitem.h index a4c7611..dee7ee1 100644 --- a/libdbusmenu-glib/menuitem.h +++ b/libdbusmenu-glib/menuitem.h @@ -51,6 +51,7 @@ G_BEGIN_DECLS #define DBUSMENU_MENUITEM_SIGNAL_REALIZED_ID (g_signal_lookup(DBUSMENU_MENUITEM_SIGNAL_REALIZED, DBUSMENU_TYPE_MENUITEM)) #define DBUSMENU_MENUITEM_SIGNAL_SHOW_TO_USER "show-to-user" #define DBUSMENU_MENUITEM_SIGNAL_ABOUT_TO_SHOW "about-to-show" +#define DBUSMENU_MENUITEM_SIGNAL_EVENT "event" #define DBUSMENU_MENUITEM_PROP_TYPE "type" #define DBUSMENU_MENUITEM_PROP_VISIBLE "visible" @@ -133,6 +134,7 @@ typedef void (*dbusmenu_menuitem_buildxml_slot_t) (DbusmenuMenuitem * mi, GPtrAr * @handle_event: This function is to override how events are handled by subclasses. Look at #dbusmenu_menuitem_handle_event for lots of good information. * @send_about_to_show: Virtual function that notifies server that the client is about to show a menu. * @show_to_user: Slot for #DbusmenuMenuitem::show-to-user. + * @event: Slot for #DbsumenuMenuitem::event. * * @reserved1: Reserved for future use. * @reserved2: Reserved for future use. @@ -162,13 +164,14 @@ struct _DbusmenuMenuitemClass void (*show_to_user) (DbusmenuMenuitem * mi, guint timestamp, gpointer cb_data); gboolean (*about_to_show) (void); + void (*event) (const gchar * name, GVariant * value, guint timestamp); + /*< Private >*/ void (*reserved1) (void); void (*reserved2) (void); void (*reserved3) (void); void (*reserved4) (void); void (*reserved5) (void); - void (*reserved6) (void); }; GType dbusmenu_menuitem_get_type (void); -- cgit v1.2.3 From d7e867eebbd24717dcf6886555eec6fe5c8ba450 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 28 Jan 2011 14:18:29 -0600 Subject: Now emit that signal appropriately --- libdbusmenu-glib/menuitem.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 83d98fa..7a279b1 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1441,6 +1441,9 @@ dbusmenu_menuitem_handle_event (DbusmenuMenuitem * mi, const gchar * name, GVari if (class->handle_event != NULL) { return class->handle_event(mi, name, variant, timestamp); } + + g_signal_emit(G_OBJECT(mi), EVENT, g_quark_from_string(name), name, variant, timestamp, TRUE); + return; } -- cgit v1.2.3 From 2a68cd1f7c8a9e77cf2a33953cc75f45fab44f91 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 15 Feb 2011 17:07:56 -0600 Subject: Adding a property for text direction --- libdbusmenu-glib/dbus-menu.xml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libdbusmenu-glib/dbus-menu.xml b/libdbusmenu-glib/dbus-menu.xml index 042a24c..4ba2f0e 100644 --- a/libdbusmenu-glib/dbus-menu.xml +++ b/libdbusmenu-glib/dbus-menu.xml @@ -171,6 +171,14 @@ License version 3 and version 2.1 along with this program. If not, see + + + Represents the way the text direction of the application. This + allows the server to handle mismatches intelligently. For left- + to-right the string is "ltr" for right-to-left it is "rtl". + + + -- cgit v1.2.3 From 1847903e5d6eb97203ba77a9ee0a0648b5fdeb0c Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 16 Feb 2011 18:00:55 +0100 Subject: Fix g-ir-scanner file list As the annotations are in the .c files, g-ir-scanner actually needs to read them. --- libdbusmenu-glib/Makefile.am | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libdbusmenu-glib/Makefile.am b/libdbusmenu-glib/Makefile.am index e6877b6..92de502 100644 --- a/libdbusmenu-glib/Makefile.am +++ b/libdbusmenu-glib/Makefile.am @@ -122,21 +122,21 @@ if INTROSPECTION_TEN INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) \ --warn-all \ --add-include-path=$(srcdir) \ - $(addprefix --c-include=libdbusmenu-glib/, $(introspection_sources)) \ + $(addprefix --c-include=libdbusmenu-glib/, $(libdbusmenu_glibinclude_HEADERS)) \ --symbol-prefix=dbusmenu \ --identifier-prefix=Dbusmenu else INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) \ --warn-all \ --add-include-path=$(srcdir) \ - $(addprefix --c-include=libdbusmenu-glib/, $(introspection_sources)) + $(addprefix --c-include=libdbusmenu-glib/, $(libdbusmenu_glibinclude_HEADERS)) endif INTROSPECTION_COMPILER_ARGS = --includedir=$(builddir) if HAVE_INTROSPECTION -introspection_sources = $(libdbusmenu_glibinclude_HEADERS) +introspection_sources = $(libdbusmenu_glibinclude_HEADERS) $(libdbusmenu_glib_la_SOURCES) Dbusmenu-0.4.gir: libdbusmenu-glib.la Dbusmenu_0_4_gir_INCLUDES = \ -- 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/client.c | 136 +++---- libdbusmenu-glib/client.h | 2 +- libdbusmenu-glib/menuitem-proxy.c | 34 +- libdbusmenu-glib/menuitem.c | 723 +++++++++++++++++++------------------- libdbusmenu-glib/menuitem.h | 4 +- 5 files changed, 450 insertions(+), 449 deletions(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 5e492a3..8a1d213 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -1654,17 +1654,17 @@ update_layout (DbusmenuClient * client) /* Public API */ /** - dbusmenu_client_new: - @name: The DBus name for the server to connect to - @object: The object on the server to monitor - - This function creates a new client that connects to a specific - server on DBus. That server is at a specific location sharing - a known object. The interface is assumed by the code to be - the DBus menu interface. The newly created client will start - sending out events as it syncs up with the server. - - Return value: A brand new #DbusmenuClient + * dbusmenu_client_new: + * @name: The DBus name for the server to connect to + * @object: The object on the server to monitor + * + * This function creates a new client that connects to a specific + * server on DBus. That server is at a specific location sharing + * a known object. The interface is assumed by the code to be + * the DBus menu interface. The newly created client will start + * sending out events as it syncs up with the server. + * + * Return value: A brand new #DbusmenuClient */ DbusmenuClient * dbusmenu_client_new (const gchar * name, const gchar * object) @@ -1678,21 +1678,21 @@ dbusmenu_client_new (const gchar * name, const gchar * object) } /** - dbusmenu_client_get_root: - @client: The #DbusmenuClient to get the root node from - - Grabs the root node for the specified client @client. This - function may block. It will block if there is currently a - call to update the layout, it will block on that layout - updated and then return the newly updated layout. Chances - are that this update is in the queue for the mainloop as - it would have been requested some time ago, but in theory - it could block longer. - - Return value: A #DbusmenuMenuitem representing the root of - menu on the server. If there is no server or there is - an error receiving its layout it'll return #NULL. -*/ + * dbusmenu_client_get_root: + * @client: The #DbusmenuClient to get the root node from + * + * Grabs the root node for the specified client @client. This + * function may block. It will block if there is currently a + * call to update the layout, it will block on that layout + * updated and then return the newly updated layout. Chances + * are that this update is in the queue for the mainloop as + * it would have been requested some time ago, but in theory + * it could block longer. + * + * Return value: (transfer none): A #DbusmenuMenuitem representing the root of + * menu on the server. If there is no server or there is + * an error receiving its layout it'll return #NULL. + */ DbusmenuMenuitem * dbusmenu_client_get_root (DbusmenuClient * client) { @@ -1721,25 +1721,25 @@ type_handler_destroy (gpointer user_data) } /** - dbusmenu_client_add_type_handler: - @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 - items when they come in. - - This function connects into the type handling of the #DbusmenuClient. - Every new menuitem that comes in immediately gets asked for it's - properties. When we get those properties we check the 'type' - property and look to see if it matches a handler that is known - by the client. If so, the @newfunc function is executed on that - #DbusmenuMenuitem. If not, then the DbusmenuClient::new-menuitem - signal is sent. - - In the future the known types will be sent to the server so that it - can make choices about the menu item types availble. - - Return value: If registering the new type was successful. + * dbusmenu_client_add_type_handler: + * @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 + * items when they come in. + * + * This function connects into the type handling of the #DbusmenuClient. + * Every new menuitem that comes in immediately gets asked for it's + * properties. When we get those properties we check the 'type' + * property and look to see if it matches a handler that is known + * by the client. If so, the @newfunc function is executed on that + * #DbusmenuMenuitem. If not, then the DbusmenuClient::new-menuitem + * signal is sent. + * + * In the future the known types will be sent to the server so that it + * can make choices about the menu item types availble. + * + * Return value: If registering the new type was successful. */ gboolean dbusmenu_client_add_type_handler (DbusmenuClient * client, const gchar * type, DbusmenuClientTypeHandler newfunc) @@ -1748,29 +1748,29 @@ dbusmenu_client_add_type_handler (DbusmenuClient * client, const gchar * type, D } /** - dbusmenu_client_add_type_handler_full: - @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 - 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 - removed (usually on client destruction) which will free - the resources in @user_data. - - This function connects into the type handling of the #DbusmenuClient. - Every new menuitem that comes in immediately gets asked for it's - properties. When we get those properties we check the 'type' - property and look to see if it matches a handler that is known - by the client. If so, the @newfunc function is executed on that - #DbusmenuMenuitem. If not, then the DbusmenuClient::new-menuitem - signal is sent. - - In the future the known types will be sent to the server so that it - can make choices about the menu item types availble. - - Return value: If registering the new type was successful. + * dbusmenu_client_add_type_handler_full: + * @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 + * 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 + * removed (usually on client destruction) which will free + * the resources in @user_data. + * + * This function connects into the type handling of the #DbusmenuClient. + * Every new menuitem that comes in immediately gets asked for it's + * properties. When we get those properties we check the 'type' + * property and look to see if it matches a handler that is known + * by the client. If so, the @newfunc function is executed on that + * #DbusmenuMenuitem. If not, then the DbusmenuClient::new-menuitem + * signal is sent. + * + * In the future the known types will be sent to the server so that it + * can make choices about the menu item types availble. + * + * 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) diff --git a/libdbusmenu-glib/client.h b/libdbusmenu-glib/client.h index 6d78edf..79c0ee2 100644 --- a/libdbusmenu-glib/client.h +++ b/libdbusmenu-glib/client.h @@ -145,7 +145,7 @@ gboolean dbusmenu_client_add_type_handler_full (DbusmenuClient * cli const gchar * type, DbusmenuClientTypeHandler newfunc, gpointer user_data, - DbusmenuClientTypeDestroyHandler destory_func); + DbusmenuClientTypeDestroyHandler destroy_func); void dbusmenu_client_send_event (DbusmenuClient * client, gint id, const gchar * name, diff --git a/libdbusmenu-glib/menuitem-proxy.c b/libdbusmenu-glib/menuitem-proxy.c index 1d97c4c..ae6a334 100644 --- a/libdbusmenu-glib/menuitem-proxy.c +++ b/libdbusmenu-glib/menuitem-proxy.c @@ -325,14 +325,14 @@ remove_menuitem (DbusmenuMenuitemProxy * pmi) } /** - dbusmenu_menuitem_proxy_new: - @mi: The #DbusmenuMenuitem to proxy - - Builds a new #DbusmenuMenuitemProxy object that proxies - all of the values for @mi. - - Return value: A new #DbusmenuMenuitemProxy object. -*/ + * dbusmenu_menuitem_proxy_new: + * @mi: The #DbusmenuMenuitem to proxy + * + * Builds a new #DbusmenuMenuitemProxy object that proxies + * all of the values for @mi. + * + * Return value: A new #DbusmenuMenuitemProxy object. + */ DbusmenuMenuitemProxy * dbusmenu_menuitem_proxy_new (DbusmenuMenuitem * mi) { @@ -344,15 +344,15 @@ dbusmenu_menuitem_proxy_new (DbusmenuMenuitem * mi) } /** - dbusmenu_menuitem_proxy_get_wrapped: - @pmi: #DbusmenuMenuitemProxy to look into - - Accesses the private variable of which #DbusmenuMenuitem - we are doing the proxying for. - - Return value: A #DbusmenuMenuitem object or a #NULL if we - don't have one or there is an error. -*/ + * dbusmenu_menuitem_proxy_get_wrapped: + * @pmi: #DbusmenuMenuitemProxy to look into + * + * Accesses the private variable of which #DbusmenuMenuitem + * we are doing the proxying for. + * + * Return value: (transfer none): A #DbusmenuMenuitem object or a #NULL if we + * don't have one or there is an error. + */ DbusmenuMenuitem * dbusmenu_menuitem_proxy_get_wrapped (DbusmenuMenuitemProxy * pmi) { 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) { diff --git a/libdbusmenu-glib/menuitem.h b/libdbusmenu-glib/menuitem.h index a4c7611..9b538f6 100644 --- a/libdbusmenu-glib/menuitem.h +++ b/libdbusmenu-glib/menuitem.h @@ -156,7 +156,7 @@ struct _DbusmenuMenuitemClass /* Virtual functions */ dbusmenu_menuitem_buildxml_slot_t buildxml; - void (*handle_event) (DbusmenuMenuitem * mi, const gchar * name, GVariant * value, guint timestamp); + void (*handle_event) (DbusmenuMenuitem * mi, const gchar * name, GVariant * variant, guint timestamp); void (*send_about_to_show) (DbusmenuMenuitem * mi, void (*cb) (DbusmenuMenuitem * mi, gpointer user_data), gpointer cb_data); void (*show_to_user) (DbusmenuMenuitem * mi, guint timestamp, gpointer cb_data); @@ -207,7 +207,7 @@ void dbusmenu_menuitem_set_root (DbusmenuMenuitem * mi, gboolean root); gboolean dbusmenu_menuitem_get_root (DbusmenuMenuitem * mi); void dbusmenu_menuitem_foreach (DbusmenuMenuitem * mi, void (*func) (DbusmenuMenuitem * mi, gpointer data), gpointer data); -void dbusmenu_menuitem_handle_event (DbusmenuMenuitem * mi, const gchar * name, GVariant * value, guint timestamp); +void dbusmenu_menuitem_handle_event (DbusmenuMenuitem * mi, const gchar * name, GVariant * variant, guint timestamp); void dbusmenu_menuitem_send_about_to_show (DbusmenuMenuitem * mi, void (*cb) (DbusmenuMenuitem * mi, gpointer user_data), gpointer cb_data); void dbusmenu_menuitem_show_to_user (DbusmenuMenuitem * mi, guint timestamp); -- cgit v1.2.3 From 98e01df8406f305f8d232cf41e5facaf559afe0f Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 16 Feb 2011 20:56:38 +0100 Subject: Fix g-ir-scanner file list for gtk Analoguous to r211 for the GTK library. --- libdbusmenu-gtk/Makefile.am | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libdbusmenu-gtk/Makefile.am b/libdbusmenu-gtk/Makefile.am index f66f1f5..50a8f2c 100644 --- a/libdbusmenu-gtk/Makefile.am +++ b/libdbusmenu-gtk/Makefile.am @@ -78,21 +78,21 @@ if INTROSPECTION_TEN INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) \ --warn-all \ --add-include-path=$(top_builddir)/libdbusmenu-glib \ - $(addprefix --c-include=libdbusmenu-gtk/, $(introspection_sources)) \ + $(addprefix --c-include=libdbusmenu-gtk/, $(libdbusmenu_gtkinclude_HEADERS)) \ --symbol-prefix=dbusmenu \ --identifier-prefix=DbusmenuGtk else INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) \ --warn-all \ --add-include-path=$(top_builddir)/libdbusmenu-glib \ - $(addprefix --c-include=libdbusmenu-gtk/, $(introspection_sources)) + $(addprefix --c-include=libdbusmenu-gtk/, $(libdbusmenu_gtkinclude_HEADERS)) endif INTROSPECTION_COMPILER_ARGS = --includedir=$(builddir) --includedir=$(top_builddir)/libdbusmenu-glib if HAVE_INTROSPECTION -introspection_sources = $(libdbusmenu_gtkinclude_HEADERS) +introspection_sources = $(filter-out genericmenuitem.%, $(libdbusmenu_gtkinclude_HEADERS) $(libdbusmenu_gtk_la_SOURCES)) DbusmenuGtk$(VER)-0.4.gir: libdbusmenu-gtk$(VER).la DbusmenuGtk_0_4_gir_INCLUDES = \ -- cgit v1.2.3 From 558fa9265c05452de03ddd9f8543dfdce1b81e7b Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 16 Feb 2011 21:06:14 +0100 Subject: Fix GI annotations for DbusmenuGtk --- libdbusmenu-gtk/client.c | 110 +++++++++++++++--------------- libdbusmenu-gtk/genericmenuitem.c | 52 +++++++------- libdbusmenu-gtk/menu.c | 34 +++++----- libdbusmenu-gtk/menuitem.c | 120 ++++++++++++++++----------------- libdbusmenu-gtk/menuitem.h | 2 +- libdbusmenu-gtk/parser.c | 20 +++--- libdbusmenu-gtk/serializablemenuitem.c | 62 ++++++++--------- 7 files changed, 200 insertions(+), 200 deletions(-) diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c index 7ab2fe9..4128b02 100644 --- a/libdbusmenu-gtk/client.c +++ b/libdbusmenu-gtk/client.c @@ -219,13 +219,13 @@ refresh_shortcut (DbusmenuGtkClient * client, DbusmenuMenuitem * mi) /** - dbusmenu_gtkclient_set_accel_group: - @client: To set the group on - @agroup: The new acceleration group - - Sets the acceleration group for the menu items with accelerators - on this client. -*/ + * dbusmenu_gtkclient_set_accel_group: + * @client: To set the group on + * @agroup: The new acceleration group + * + * Sets the acceleration group for the menu items with accelerators + * on this client. + */ void dbusmenu_gtkclient_set_accel_group (DbusmenuGtkClient * client, GtkAccelGroup * agroup) { @@ -256,14 +256,14 @@ dbusmenu_gtkclient_set_accel_group (DbusmenuGtkClient * client, GtkAccelGroup * } /** - dbusmenu_gtkclient_get_accel_group: - @client: Client to query for an accelerator group - - Gets the accel group for this client. - - Return value: Either a valid group or #NULL on error or - none set. -*/ + * dbusmenu_gtkclient_get_accel_group: + * @client: Client to query for an accelerator group + * + * Gets the accel group for this client. + * + * Return value: (transfer none): Either a valid group or #NULL on error or + * none set. + */ GtkAccelGroup * dbusmenu_gtkclient_get_accel_group (DbusmenuGtkClient * client) { @@ -493,21 +493,21 @@ destroy_gmi (GtkMenuItem * gmi, DbusmenuMenuitem * mi) #endif /** - dbusmenu_gtkclient_newitem_base: - @client: The client handling everything on this connection - @item: The #DbusmenuMenuitem to attach the GTK-isms to - @gmi: A #GtkMenuItem representing the GTK world's view of this menuitem - @parent: The parent #DbusmenuMenuitem - - This function provides some of the basic connectivity for being in - the GTK world. Things like visibility and sensitivity of the item are - handled here so that the subclasses don't have to. If you're building - your on GTK menu item you can use this function to apply those basic - attributes so that you don't have to deal with them either. - - This also handles passing the "activate" signal back to the - #DbusmenuMenuitem side of thing. -*/ + * dbusmenu_gtkclient_newitem_base: + * @client: The client handling everything on this connection + * @item: The #DbusmenuMenuitem to attach the GTK-isms to + * @gmi: A #GtkMenuItem representing the GTK world's view of this menuitem + * @parent: The parent #DbusmenuMenuitem + * + * This function provides some of the basic connectivity for being in + * the GTK world. Things like visibility and sensitivity of the item are + * handled here so that the subclasses don't have to. If you're building + * your on GTK menu item you can use this function to apply those basic + * attributes so that you don't have to deal with them either. + * + * This also handles passing the "activate" signal back to the + * #DbusmenuMenuitem side of thing. + */ void dbusmenu_gtkclient_newitem_base (DbusmenuGtkClient * client, DbusmenuMenuitem * item, GtkMenuItem * gmi, DbusmenuMenuitem * parent) { @@ -617,15 +617,15 @@ move_child (DbusmenuMenuitem * mi, DbusmenuMenuitem * child, guint new, guint ol /* Public API */ /** - dbusmenu_gtkclient_new: - @dbus_name: Name of the #DbusmenuServer on DBus - @dbus_name: Name of the object on the #DbusmenuServer - - Creates a new #DbusmenuGtkClient object and creates a #DbusmenuClient - that connects across DBus to a #DbusmenuServer. - - Return value: A new #DbusmenuGtkClient sync'd with a server -*/ + * dbusmenu_gtkclient_new: + * @dbus_name: Name of the #DbusmenuServer on DBus + * @dbus_name: Name of the object on the #DbusmenuServer + * + * Creates a new #DbusmenuGtkClient object and creates a #DbusmenuClient + * that connects across DBus to a #DbusmenuServer. + * + * Return value: A new #DbusmenuGtkClient sync'd with a server + */ DbusmenuGtkClient * dbusmenu_gtkclient_new (gchar * dbus_name, gchar * dbus_object) { @@ -636,15 +636,15 @@ dbusmenu_gtkclient_new (gchar * dbus_name, gchar * dbus_object) } /** - dbusmenu_gtkclient_menuitem_get: - @client: A #DbusmenuGtkClient with the item in it. - @item: #DbusmenuMenuitem to get associated #GtkMenuItem on. - - This grabs the #GtkMenuItem that is associated with the - #DbusmenuMenuitem. - - Return value: The #GtkMenuItem that can be played with. -*/ + * dbusmenu_gtkclient_menuitem_get: + * @client: A #DbusmenuGtkClient with the item in it. + * @item: #DbusmenuMenuitem to get associated #GtkMenuItem on. + * + * This grabs the #GtkMenuItem that is associated with the + * #DbusmenuMenuitem. + * + * Return value: (transfer none): The #GtkMenuItem that can be played with. + */ GtkMenuItem * dbusmenu_gtkclient_menuitem_get (DbusmenuGtkClient * client, DbusmenuMenuitem * item) { @@ -660,13 +660,13 @@ dbusmenu_gtkclient_menuitem_get (DbusmenuGtkClient * client, DbusmenuMenuitem * } /** - dbusmenu_gtkclient_menuitem_get_submenu: - @client: A #DbusmenuGtkClient with the item in it. - @item: #DbusmenuMenuitem to get associated #GtkMenu on. - - This grabs the submenu associated with the menuitem. - - Return value: The #GtkMenu if there is one. + * dbusmenu_gtkclient_menuitem_get_submenu: + * @client: A #DbusmenuGtkClient with the item in it. + * @item: #DbusmenuMenuitem to get associated #GtkMenu on. + * + * This grabs the submenu associated with the menuitem. + * + * Return value: (transfer none): The #GtkMenu if there is one. */ GtkMenu * dbusmenu_gtkclient_menuitem_get_submenu (DbusmenuGtkClient * client, DbusmenuMenuitem * item) diff --git a/libdbusmenu-gtk/genericmenuitem.c b/libdbusmenu-gtk/genericmenuitem.c index 2af70f3..2fd6fba 100644 --- a/libdbusmenu-gtk/genericmenuitem.c +++ b/libdbusmenu-gtk/genericmenuitem.c @@ -278,12 +278,12 @@ activate (GtkMenuItem * menu_item) } /** - genericmenuitem_set_check_type: - @item: #Genericmenuitem to set the type on - @check_type: Which type of check should be displayed - - This function changes the type of the checkmark that - appears in the left hand gutter for the menuitem. + * genericmenuitem_set_check_type: + * @item: #Genericmenuitem to set the type on + * @check_type: Which type of check should be displayed + * + * This function changes the type of the checkmark that + * appears in the left hand gutter for the menuitem. */ void genericmenuitem_set_check_type (Genericmenuitem * item, GenericmenuitemCheckType check_type) @@ -317,14 +317,14 @@ genericmenuitem_set_check_type (Genericmenuitem * item, GenericmenuitemCheckType } /** - genericmenuitem_set_state: - @item: #Genericmenuitem to set the type on - @check_type: What is the state of the check - - Sets the state of the check in the menu item. It does - not require, but isn't really useful if the type of - check that the menuitem is set to #GENERICMENUITEM_CHECK_TYPE_NONE. -*/ + * genericmenuitem_set_state: + * @item: #Genericmenuitem to set the type on + * @check_type: What is the state of the check + * + * Sets the state of the check in the menu item. It does + * not require, but isn't really useful if the type of + * check that the menuitem is set to #GENERICMENUITEM_CHECK_TYPE_NONE. + */ void genericmenuitem_set_state (Genericmenuitem * item, GenericmenuitemState state) { @@ -377,11 +377,11 @@ set_image_helper (GtkWidget * widget, gpointer data) } /** - genericmenuitem_set_image: - @item: A #Genericmenuitem - @image: The image to set as the image of @item - - Sets the image of the menu item. + * genericmenuitem_set_image: + * @item: A #Genericmenuitem + * @image: The image to set as the image of @item + * + * Sets the image of the menu item. */ void genericmenuitem_set_image (Genericmenuitem * menu_item, GtkWidget * image) @@ -439,13 +439,13 @@ genericmenuitem_set_image (Genericmenuitem * menu_item, GtkWidget * image) } /** - genericmenuitem_get_image: - @item: A #Genericmenuitem - - Returns the image if there is one. - - Return value: A pointer to the image of the item or #NULL - if there isn't one. + * genericmenuitem_get_image: + * @item: A #Genericmenuitem + * + * Returns the image if there is one. + * + * Return value: (transfer none): A pointer to the image of the item or #NULL + * if there isn't one. */ GtkWidget * genericmenuitem_get_image (Genericmenuitem * menu_item) diff --git a/libdbusmenu-gtk/menu.c b/libdbusmenu-gtk/menu.c index 2a27fe2..9788ffc 100644 --- a/libdbusmenu-gtk/menu.c +++ b/libdbusmenu-gtk/menu.c @@ -398,15 +398,15 @@ build_client (DbusmenuGtkMenu * self) /* Public API */ /** - dbusmenu_gtkmenu_new: - @dbus_name: Name of the #DbusmenuServer on DBus - @dbus_name: Name of the object on the #DbusmenuServer - - Creates a new #DbusmenuGtkMenu object and creates a #DbusmenuClient - that connects across DBus to a #DbusmenuServer. - - Return value: A new #DbusmenuGtkMenu sync'd with a server -*/ + * dbusmenu_gtkmenu_new: + * @dbus_name: Name of the #DbusmenuServer on DBus + * @dbus_name: Name of the object on the #DbusmenuServer + * + * Creates a new #DbusmenuGtkMenu object and creates a #DbusmenuClient + * that connects across DBus to a #DbusmenuServer. + * + * Return value: A new #DbusmenuGtkMenu sync'd with a server + */ DbusmenuGtkMenu * dbusmenu_gtkmenu_new (gchar * dbus_name, gchar * dbus_object) { @@ -417,14 +417,14 @@ dbusmenu_gtkmenu_new (gchar * dbus_name, gchar * dbus_object) } /** - dbusmenu_gtkmenu_get_client: - @menu: The #DbusmenuGtkMenu to get the client from - - An accessor for the client that this menu is using to - communicate with the server. - - Return value: A valid #DbusmenuGtkClient or NULL on error. -*/ + * dbusmenu_gtkmenu_get_client: + * @menu: The #DbusmenuGtkMenu to get the client from + * + * An accessor for the client that this menu is using to + * communicate with the server. + * + * Return value: (transfer none): A valid #DbusmenuGtkClient or NULL on error. + */ DbusmenuGtkClient * dbusmenu_gtkmenu_get_client (DbusmenuGtkMenu * menu) { diff --git a/libdbusmenu-gtk/menuitem.c b/libdbusmenu-gtk/menuitem.c index fa5eb89..4e92961 100644 --- a/libdbusmenu-gtk/menuitem.c +++ b/libdbusmenu-gtk/menuitem.c @@ -31,17 +31,17 @@ License version 3 and version 2.1 along with this program. If not, see #include /** - dbusmenu_menuitem_property_set_image: - @menuitem: The #DbusmenuMenuitem to set the property on. - @property: Name of the property to set. - @data: The image to place on the property. - - This function takes the pixbuf that is stored in @data and - turns it into a base64 encoded PNG so that it can be placed - onto a standard #DbusmenuMenuitem property. - - Return value: Whether the function was able to set the property - or not. + * dbusmenu_menuitem_property_set_image: + * @menuitem: The #DbusmenuMenuitem to set the property on. + * @property: Name of the property to set. + * @data: The image to place on the property. + * + * This function takes the pixbuf that is stored in @data and + * turns it into a base64 encoded PNG so that it can be placed + * onto a standard #DbusmenuMenuitem property. + * + * Return value: Whether the function was able to set the property + * or not. */ gboolean dbusmenu_menuitem_property_set_image (DbusmenuMenuitem * menuitem, const gchar * property, const GdkPixbuf * data) @@ -77,17 +77,17 @@ dbusmenu_menuitem_property_set_image (DbusmenuMenuitem * menuitem, const gchar * } /** - dbusmenu_menuitem_property_get_image: - @menuitem: The #DbusmenuMenuite to look for the property on - @property: The name of the property to look for. - - This function looks on the menu item for a property by the - name of @property. If one exists it tries to turn it into - a #GdkPixbuf. It assumes that the property is a base64 encoded - PNG file like the one created by #dbusmenu_menuite_property_set_image. - - Return value: A pixbuf or #NULL to signal error. -*/ + * dbusmenu_menuitem_property_get_image: + * @menuitem: The #DbusmenuMenuite to look for the property on + * @property: The name of the property to look for. + * + * This function looks on the menu item for a property by the + * name of @property. If one exists it tries to turn it into + * a #GdkPixbuf. It assumes that the property is a base64 encoded + * PNG file like the one created by #dbusmenu_menuite_property_set_image. + * + * Return value: (transfer full): A pixbuf or #NULL to signal error. + */ GdkPixbuf * dbusmenu_menuitem_property_get_image (DbusmenuMenuitem * menuitem, const gchar * property) { @@ -131,16 +131,16 @@ dbusmenu_menuitem_property_get_image (DbusmenuMenuitem * menuitem, const gchar * } /** - dbusmenu_menuitem_property_set_shortcut_string: - @menuitem: The #DbusmenuMenuitem to set the shortcut on - @shortcut: String describing the shortcut - - This function takes a GTK shortcut string as defined in - #gtk_accelerator_parse and turns that into the information - required to send it over DBusmenu. - - Return value: Whether it was successful at setting the property. -*/ + * dbusmenu_menuitem_property_set_shortcut_string: + * @menuitem: The #DbusmenuMenuitem to set the shortcut on + * @shortcut: String describing the shortcut + * + * This function takes a GTK shortcut string as defined in + * #gtk_accelerator_parse and turns that into the information + * required to send it over DBusmenu. + * + * Return value: Whether it was successful at setting the property. + */ gboolean dbusmenu_menuitem_property_set_shortcut_string (DbusmenuMenuitem * menuitem, const gchar * shortcut) { @@ -161,16 +161,16 @@ dbusmenu_menuitem_property_set_shortcut_string (DbusmenuMenuitem * menuitem, con } /** - dbusmenu_menuitem_property_set_shortcut: - @menuitem: The #DbusmenuMenuitem to set the shortcut on - @key: The keycode of the key to send - @modifier: A bitmask of modifiers used to activate the item - - Takes the modifer described by @key and @modifier and places that into - the format sending across Dbus for shortcuts. - - Return value: Whether it was successful at setting the property. -*/ + * dbusmenu_menuitem_property_set_shortcut: + * @menuitem: The #DbusmenuMenuitem to set the shortcut on + * @key: The keycode of the key to send + * @modifier: A bitmask of modifiers used to activate the item + * + * Takes the modifer described by @key and @modifier and places that into + * the format sending across Dbus for shortcuts. + * + * Return value: Whether it was successful at setting the property. + */ gboolean dbusmenu_menuitem_property_set_shortcut (DbusmenuMenuitem * menuitem, guint key, GdkModifierType modifier) { @@ -213,16 +213,16 @@ find_closure (GtkAccelKey * key, GClosure * closure, gpointer user_data) } /** - dbusmenu_menuitem_property_set_shortcut_menuitem: - @menuitem: The #DbusmenuMenuitem to set the shortcut on - @gmi: A menu item to steal the shortcut off of - - Takes the shortcut that is installed on a menu item and calls - #dbusmenu_menuitem_property_set_shortcut with it. It also sets - up listeners to watch it change. - - Return value: Whether it was successful at setting the property. -*/ + * dbusmenu_menuitem_property_set_shortcut_menuitem: + * @menuitem: The #DbusmenuMenuitem to set the shortcut on + * @gmi: A menu item to steal the shortcut off of + * + * Takes the shortcut that is installed on a menu item and calls + * #dbusmenu_menuitem_property_set_shortcut with it. It also sets + * up listeners to watch it change. + * + * Return value: Whether it was successful at setting the property. + */ gboolean dbusmenu_menuitem_property_set_shortcut_menuitem (DbusmenuMenuitem * menuitem, const GtkMenuItem * gmi) { @@ -260,14 +260,14 @@ dbusmenu_menuitem_property_set_shortcut_menuitem (DbusmenuMenuitem * menuitem, c } /** - dbusmenu_menuitem_property_get_shortcut: - @menuitem: The #DbusmenuMenuitem to get the shortcut off - @key: Location to put the key value - @modifier: Location to put the modifier mask - - This function gets a GTK shortcut as a key and a mask - for use to set the accelerators. -*/ + * dbusmenu_menuitem_property_get_shortcut: + * @menuitem: The #DbusmenuMenuitem to get the shortcut off + * @key: (out): Location to put the key value + * @modifier: (out): Location to put the modifier mask + * + * This function gets a GTK shortcut as a key and a mask + * for use to set the accelerators. + */ void dbusmenu_menuitem_property_get_shortcut (DbusmenuMenuitem * menuitem, guint * key, GdkModifierType * modifier) { diff --git a/libdbusmenu-gtk/menuitem.h b/libdbusmenu-gtk/menuitem.h index 4fc42f9..6f009df 100644 --- a/libdbusmenu-gtk/menuitem.h +++ b/libdbusmenu-gtk/menuitem.h @@ -43,7 +43,7 @@ GdkPixbuf * dbusmenu_menuitem_property_get_image (DbusmenuMenuitem * menuitem, c gboolean dbusmenu_menuitem_property_set_shortcut (DbusmenuMenuitem * menuitem, guint key, GdkModifierType modifier); gboolean dbusmenu_menuitem_property_set_shortcut_string (DbusmenuMenuitem * menuitem, const gchar * shortcut); gboolean dbusmenu_menuitem_property_set_shortcut_menuitem (DbusmenuMenuitem * menuitem, const GtkMenuItem * gmi); -void dbusmenu_menuitem_property_get_shortcut (DbusmenuMenuitem * menuitem, guint * key, GdkModifierType * modifiers); +void dbusmenu_menuitem_property_get_shortcut (DbusmenuMenuitem * menuitem, guint * key, GdkModifierType * modifier); G_END_DECLS diff --git a/libdbusmenu-gtk/parser.c b/libdbusmenu-gtk/parser.c index 70cde53..d00870a 100644 --- a/libdbusmenu-gtk/parser.c +++ b/libdbusmenu-gtk/parser.c @@ -81,16 +81,16 @@ static void menuitem_notify_cb (GtkWidget * widget, gpointer data); /** - dbusmenu_gtk_parse_menu_structure: - @widget: A #GtkMenuItem or #GtkMenuShell to turn into a #DbusmenuMenuitem - - Goes through the GTK structures and turns them into the appropraite - Dbusmenu structures along with setting up all the relationships - between the objects. It also stores the dbusmenu items as a cache - on the GTK items so that they'll be reused if necissary. - - Return value: A dbusmenu item representing the menu structure -*/ + * dbusmenu_gtk_parse_menu_structure: + * @widget: A #GtkMenuItem or #GtkMenuShell to turn into a #DbusmenuMenuitem + * + * Goes through the GTK structures and turns them into the appropraite + * Dbusmenu structures along with setting up all the relationships + * between the objects. It also stores the dbusmenu items as a cache + * on the GTK items so that they'll be reused if necissary. + * + * Return value: (transfer none): A dbusmenu item representing the menu structure + */ DbusmenuMenuitem * dbusmenu_gtk_parse_menu_structure (GtkWidget * widget) { diff --git a/libdbusmenu-gtk/serializablemenuitem.c b/libdbusmenu-gtk/serializablemenuitem.c index cfd864d..f5dbbf1 100644 --- a/libdbusmenu-gtk/serializablemenuitem.c +++ b/libdbusmenu-gtk/serializablemenuitem.c @@ -166,18 +166,18 @@ get_property (GObject * obj, guint id, GValue * value, GParamSpec * pspec) } /** - dbusmenu_gtk_serializable_menu_item_build_menuitem: - @smi: #DbusmenuGtkSerializableMenuItem to build a #DbusmenuMenuitem mirroring - - This function is for menu items that are instanciated from - GTK and have their properites set using GTK functions. This - builds a #DbusmenuMenuitem that then has the properties that - should be sent over the bus to create a new item of this - type on the other side. - - Return value: (transfer full) A #DbusmenuMenuitem who's values will be - set by this object. -*/ + * dbusmenu_gtk_serializable_menu_item_build_menuitem: + * @smi: #DbusmenuGtkSerializableMenuItem to build a #DbusmenuMenuitem mirroring + * + * This function is for menu items that are instanciated from + * GTK and have their properites set using GTK functions. This + * builds a #DbusmenuMenuitem that then has the properties that + * should be sent over the bus to create a new item of this + * type on the other side. + * + * Return value: (transfer full): A #DbusmenuMenuitem who's values will be + * set by this object. + */ DbusmenuMenuitem * dbusmenu_gtk_serializable_menu_item_build_menuitem (DbusmenuGtkSerializableMenuItem * smi) { @@ -225,15 +225,15 @@ type_destroy_handler (DbusmenuClient * client, const gchar * type, gpointer user } /** - dbusmenu_gtk_serializable_menu_item_register_to_client: - @client: #DbusmenuClient that we should register a type at. - @item_type: The #GType of a class that is a subclass of #DbusmenuGtkSerializableMenuItem - - Registers a generic handler for dealing with all subclasses of - #DbusmenuGtkSerializableMenuItem. This handler responds to the callback, - creates a new object and attaches it to the appropriate #DbusmenuMenuitem - object. -*/ + * dbusmenu_gtk_serializable_menu_item_register_to_client: + * @client: #DbusmenuClient that we should register a type at. + * @item_type: The #GType of a class that is a subclass of #DbusmenuGtkSerializableMenuItem + * + * Registers a generic handler for dealing with all subclasses of + * #DbusmenuGtkSerializableMenuItem. This handler responds to the callback, + * creates a new object and attaches it to the appropriate #DbusmenuMenuitem + * object. + */ void dbusmenu_gtk_serializable_menu_item_register_to_client (DbusmenuClient * client, GType item_type) { @@ -265,16 +265,16 @@ dbusmenu_gtk_serializable_menu_item_register_to_client (DbusmenuClient * client, } /** - dbusmenu_gtk_serializable_menu_item_set_menuitem: - @smi: #DbusmenuGtkSerializableMenuItem to set the @DbusmenuGtkSerializableMenuItem::dbusmenu-menuitem of - @mi: Menuitem to get the properties from - - This function is used on the server side to signal to the object - that it should get its' property change events from @mi instead - of expecting calls to its' API. A call to this function sets the - property and subclasses should listen to the notify signal to - pick up this property being set. -*/ + * dbusmenu_gtk_serializable_menu_item_set_menuitem: + * @smi: #DbusmenuGtkSerializableMenuItem to set the @DbusmenuGtkSerializableMenuItem::dbusmenu-menuitem of + * @mi: Menuitem to get the properties from + * + * This function is used on the server side to signal to the object + * that it should get its' property change events from @mi instead + * of expecting calls to its' API. A call to this function sets the + * property and subclasses should listen to the notify signal to + * pick up this property being set. + */ void dbusmenu_gtk_serializable_menu_item_set_menuitem (DbusmenuGtkSerializableMenuItem * smi, DbusmenuMenuitem * mi) { -- cgit v1.2.3 From 999440cb9a577155258e31d625a0454ad7301952 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 16 Feb 2011 22:06:49 -0600 Subject: Adding a type for the text direction, putting it in a generic header for all --- libdbusmenu-glib/Makefile.am | 3 ++- libdbusmenu-glib/server.h | 1 + libdbusmenu-glib/types.h | 55 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 libdbusmenu-glib/types.h diff --git a/libdbusmenu-glib/Makefile.am b/libdbusmenu-glib/Makefile.am index e6877b6..5f8bd35 100644 --- a/libdbusmenu-glib/Makefile.am +++ b/libdbusmenu-glib/Makefile.am @@ -19,7 +19,8 @@ libdbusmenu_glibinclude_HEADERS = \ menuitem.h \ menuitem-proxy.h \ server.h \ - client.h + client.h \ + types.h libdbusmenu_glib_la_SOURCES = \ dbus-menu-clean.xml.h \ diff --git a/libdbusmenu-glib/server.h b/libdbusmenu-glib/server.h index 5668258..99216ea 100644 --- a/libdbusmenu-glib/server.h +++ b/libdbusmenu-glib/server.h @@ -33,6 +33,7 @@ License version 3 and version 2.1 along with this program. If not, see #include #include "menuitem.h" +#include "types.h" G_BEGIN_DECLS diff --git a/libdbusmenu-glib/types.h b/libdbusmenu-glib/types.h new file mode 100644 index 0000000..f8ec6a4 --- /dev/null +++ b/libdbusmenu-glib/types.h @@ -0,0 +1,55 @@ +/* +Types that are used in several objects. + +Copyright 2011 Canonical Ltd. + +Authors: + Ted Gould + +This program is free software: you can redistribute it and/or modify it +under the terms of either or both of the following licenses: + +1) the GNU Lesser General Public License version 3, as published by the +Free Software Foundation; and/or +2) the GNU Lesser General Public License version 2.1, as published by +the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR +PURPOSE. See the applicable version of the GNU Lesser General Public +License for more details. + +You should have received a copy of both the GNU Lesser General Public +License version 3 and version 2.1 along with this program. If not, see + +*/ + +#ifndef __DBUSMENU_TYPES_H__ +#define __DBUSMENU_TYPES_H__ + +#include + +G_BEGIN_DECLS + +/** + DbusmenuTextDirection: + @DBUSMENU_TEXT_DIRECTION_NONE: Unspecified text direction + @DBUSMENU_TEXT_DIRECTION_LTR: Left-to-right text direction + @DBUSMENU_TEXT_DIRECTION_RTL: Right-to-left text direction + + The direction of text that the strings that this server + will be sending strings as. +*/ +typedef enum _DbusmenuTextDirection DbusmenuTextDirection; +enum _DbusmenuServerTextDirection { /*< prefix=DBUSMENU >*/ + DBUSMENU_TEXT_DIRECTION_NONE, /*< nick=none >*/ + DBUSMENU_TEXT_DIRECTION_LTR, /*< nick=ltr >*/ + DBUSMENU_TEXT_DIRECTION_RTL /*< nick=rtl >*/ +}; + + +G_END_DECLS + +#endif /* __DBUSMENU_TYPES_H__ */ + -- cgit v1.2.3 From edcd67e602c43de358839b9d277d25e049e9951b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 16 Feb 2011 22:16:20 -0600 Subject: Some enum type templates --- libdbusmenu-glib/enum-types.c.in | 67 ++++++++++++++++++++++++++++++++++++++++ libdbusmenu-glib/enum-types.h.in | 53 +++++++++++++++++++++++++++++++ 2 files changed, 120 insertions(+) create mode 100644 libdbusmenu-glib/enum-types.c.in create mode 100644 libdbusmenu-glib/enum-types.h.in diff --git a/libdbusmenu-glib/enum-types.c.in b/libdbusmenu-glib/enum-types.c.in new file mode 100644 index 0000000..d572d44 --- /dev/null +++ b/libdbusmenu-glib/enum-types.c.in @@ -0,0 +1,67 @@ +/*** BEGIN file-header ***/ +/* +Enums from the dbusmenu headers + +Copyright 2011 Canonical Ltd. + +Authors: + Ted Gould + +This program is free software: you can redistribute it and/or modify it +under the terms of either or both of the following licenses: + +1) the GNU Lesser General Public License version 3, as published by the + Free Software Foundation; and/or +2) the GNU Lesser General Public License version 2.1, as published by + the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR +PURPOSE. See the applicable version of the GNU Lesser General Public +License for more details. + +You should have received a copy of both the GNU Lesser General Public +License version 3 and version 2.1 along with this program. If not, see + +*/ + +#include "enum-types.h" + +/*** END file-header ***/ + +/*** BEGIN file-production ***/ +#include "@filename@" +/*** END file-production ***/ + +/*** BEGIN value-header ***/ +/** + @enum_name@_get_type: + + Builds a GLib type for the #@EnumName@ enumeration. + + Return value: A unique #GType for the #@EnumName@ enum. +*/ +GType +@enum_name@_get_type (void) +{ + static GType etype = 0; + if (G_UNLIKELY(etype == 0)) { + static const G@Type@Value values[] = { +/*** END value-header ***/ + +/*** BEGIN value-production ***/ + { @VALUENAME@, "@VALUENAME@", "@valuenick@" }, +/*** END value-production ***/ + +/*** BEGIN value-tail ***/ + { 0, NULL, NULL} + }; + + etype = g_@type@_register_static (g_intern_static_string("@EnumName@"), values); + } + + return etype; +} + +/*** END value-tail ***/ diff --git a/libdbusmenu-glib/enum-types.h.in b/libdbusmenu-glib/enum-types.h.in new file mode 100644 index 0000000..83b4bd2 --- /dev/null +++ b/libdbusmenu-glib/enum-types.h.in @@ -0,0 +1,53 @@ +/*** BEGIN file-header ***/ +/* +Enums from the dbusmenu headers + +Copyright 2011 Canonical Ltd. + +Authors: + Ted Gould + +This program is free software: you can redistribute it and/or modify it +under the terms of either or both of the following licenses: + +1) the GNU Lesser General Public License version 3, as published by the + Free Software Foundation; and/or +2) the GNU Lesser General Public License version 2.1, as published by + the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR +PURPOSE. See the applicable version of the GNU Lesser General Public +License for more details. + +You should have received a copy of both the GNU Lesser General Public +License version 3 and version 2.1 along with this program. If not, see + +*/ + +#ifndef __DBUSMENU_ENUM_TYPES_H__ +#define __DBUSMENU_ENUM_TYPES_H__ + +#include + +G_BEGIN_DECLS + +/*** END file-header ***/ + +/*** BEGIN file-tail ***/ + +G_END_DECLS + +#endif /* __DBUSMENU_ENUM_TYPES_H__ */ +/*** END file-tail ***/ + +/*** BEGIN file-production ***/ +/* Enumerations from file: "@filename@" */ +/*** END file-production ***/ + +/*** BEGIN value-header ***/ +GType @enum_name@_get_type (void) G_GNUC_CONST; +#define DBUSMENU_TYPE_@ENUMSHORT@ (@enum_name@_get_type()) + +/*** END value-header ***/ -- cgit v1.2.3 From c4dc796cc3fa9905db875e021ccc29763fda616e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 16 Feb 2011 22:22:56 -0600 Subject: Add the enum helper make file from Clutter --- Makefile.am.enum | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 Makefile.am.enum diff --git a/Makefile.am.enum b/Makefile.am.enum new file mode 100644 index 0000000..0503de0 --- /dev/null +++ b/Makefile.am.enum @@ -0,0 +1,45 @@ +# Rules for generating enumeration types using glib-mkenums +# +# Define: +# glib_enum_h = header template file +# glib_enum_c = source template file +# glib_enum_headers = list of headers to parse +# +# before including Makefile.am.enums. You will also need to have +# the following targets already defined: +# +# CLEANFILES +# DISTCLEANFILES +# BUILT_SOURCES +# EXTRA_DIST +# +# Author: Emmanuele Bassi + +enum_tmpl_h=$(glib_enum_h:.h=.h.in) +enum_tmpl_c=$(glib_enum_c:.c=.c.in) + +CLEANFILES += stamp-enum-types +DISTCLEANFILES += $(glib_enum_h) $(glib_enum_c) +BUILT_SOURCES += $(glib_enum_h) $(glib_enum_c) +EXTRA_DIST += $(enum_tmpl_h) $(enum_tmpl_c) + +stamp-enum-types: $(glib_enum_headers) + $(QUIET_GEN)mkdir -p `dirname $(builddir)/$(glib_enum_h)` + $(QUIET_GEN)$(GLIB_MKENUMS) \ + --template $(srcdir)/$(enum_tmpl_h) \ + $(glib_enum_headers) > xgen-eh \ + && (cmp -s xgen-eh $(builddir)/$(glib_enum_h) || cp -f xgen-eh $(builddir)/$(glib_enum_h)) \ + && rm -f xgen-eh \ + && echo timestamp > $(@F) + +$(glib_enum_h): stamp-enum-types + @true + +$(glib_enum_c): $(glib_enum_h) + $(QUIET_GEN)mkdir -p `dirname $(builddir)/$(glib_enum_c)` + $(QUIET_GEN)$(GLIB_MKENUMS) \ + --template $(srcdir)/$(enum_tmpl_c) \ + $(glib_enum_headers) > xgen-ec \ + && cp -f xgen-ec $(builddir)/$(glib_enum_c) \ + && rm -f xgen-ec + -- cgit v1.2.3 From b7835fe50f382dccbab670033d2ce6e3ed4218c3 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 16 Feb 2011 22:43:07 -0600 Subject: Adding building the enums untilthe build system --- configure.ac | 2 ++ libdbusmenu-glib/Makefile.am | 19 ++++++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 4510b6d..f1c275f 100644 --- a/configure.ac +++ b/configure.ac @@ -21,6 +21,8 @@ AC_CONFIG_MACRO_DIR([m4]) m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) +AC_PATH_PROG([GLIB_MKENUMS], [glib-mkenums]) + AC_ARG_ENABLE([deprecations], [AS_HELP_STRING([--enable-deprecations], [allow deprecated API usage @<:@default=yes@:>@])], diff --git a/libdbusmenu-glib/Makefile.am b/libdbusmenu-glib/Makefile.am index 5f8bd35..cc4a6b0 100644 --- a/libdbusmenu-glib/Makefile.am +++ b/libdbusmenu-glib/Makefile.am @@ -1,6 +1,7 @@ -CLEANFILES = - +BUILT_SOURCES = +CLEANFILES = +DISTCLEANFILES = EXTRA_DIST = \ clean-namespaces.xslt \ dbusmenu-glib-0.4.pc.in \ @@ -9,6 +10,8 @@ EXTRA_DIST = \ menuitem-marshal.list \ server-marshal.list +include $(top_srcdir)/Makefile.am.enum + lib_LTLIBRARIES = \ libdbusmenu-glib.la @@ -25,6 +28,8 @@ libdbusmenu_glibinclude_HEADERS = \ libdbusmenu_glib_la_SOURCES = \ dbus-menu-clean.xml.h \ dbus-menu-clean.xml.c \ + enum-types.h \ + enum-types.c \ menuitem.h \ menuitem.c \ menuitem-marshal.h \ @@ -57,6 +62,14 @@ libdbusmenu_glib_la_LIBADD = \ pkgconfig_DATA = dbusmenu-glib-0.4.pc pkgconfigdir = $(libdir)/pkgconfig +glib_enum_h = enum-types.h +glib_enum_c = enum-types.c +glib_enum_headers = $(addprefix $(srcdir)/, $(libdbusmenu_glibinclude_HEADERS)) + +DISTCLEANFILES += \ + enum-types.c \ + enum-types.h + %.xml.h: %.xml echo "extern const char * $(subst -,_,$(subst .,_,$(basename $(notdir $@))));" > $@ @@ -70,7 +83,7 @@ dbus-menu-clean.xml: dbus-menu.xml CLEANFILES += dbus-menu-clean.xml -BUILT_SOURCES = \ +BUILT_SOURCES += \ dbus-menu-clean.xml.c \ dbus-menu-clean.xml.h \ client-marshal.h \ -- cgit v1.2.3 From 52a86fa21af7177cd4adb71a1d5d034d30f91eaa Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 16 Feb 2011 22:51:33 -0600 Subject: Make sure the text direction isn't in the server --- libdbusmenu-glib/types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdbusmenu-glib/types.h b/libdbusmenu-glib/types.h index f8ec6a4..aec8573 100644 --- a/libdbusmenu-glib/types.h +++ b/libdbusmenu-glib/types.h @@ -42,7 +42,7 @@ G_BEGIN_DECLS will be sending strings as. */ typedef enum _DbusmenuTextDirection DbusmenuTextDirection; -enum _DbusmenuServerTextDirection { /*< prefix=DBUSMENU >*/ +enum _DbusmenuTextDirection { /*< prefix=DBUSMENU >*/ DBUSMENU_TEXT_DIRECTION_NONE, /*< nick=none >*/ DBUSMENU_TEXT_DIRECTION_LTR, /*< nick=ltr >*/ DBUSMENU_TEXT_DIRECTION_RTL /*< nick=rtl >*/ -- cgit v1.2.3 From 093bb7435efaf19668a194d4fda5eae691e784eb Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 16 Feb 2011 22:55:41 -0600 Subject: Changing the definition style to make mkenums happy. --- libdbusmenu-glib/types.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libdbusmenu-glib/types.h b/libdbusmenu-glib/types.h index aec8573..f6d8daf 100644 --- a/libdbusmenu-glib/types.h +++ b/libdbusmenu-glib/types.h @@ -41,12 +41,11 @@ G_BEGIN_DECLS The direction of text that the strings that this server will be sending strings as. */ -typedef enum _DbusmenuTextDirection DbusmenuTextDirection; -enum _DbusmenuTextDirection { /*< prefix=DBUSMENU >*/ +typedef enum { /*< prefix=DBUSMENU_TEXT_DIRECTION >*/ DBUSMENU_TEXT_DIRECTION_NONE, /*< nick=none >*/ DBUSMENU_TEXT_DIRECTION_LTR, /*< nick=ltr >*/ DBUSMENU_TEXT_DIRECTION_RTL /*< nick=rtl >*/ -}; +} DbusmenuTextDirection; G_END_DECLS -- cgit v1.2.3 From 80845fd8f04b15f2932fadcd372523ca21365f83 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 16 Feb 2011 22:56:18 -0600 Subject: Ignoring the enum built files --- .bzrignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.bzrignore b/.bzrignore index 39be2d5..29ec5a8 100644 --- a/.bzrignore +++ b/.bzrignore @@ -227,3 +227,7 @@ libdbusmenu-gtk/libdbusmenu_gtk_la-parser.lo test-gtk-parser test-gtk-parser-test test-gtk-parser.xml +enum-types.c +enum-types.h +libdbusmenu_glib_la-enum-types.lo +stamp-enum-types -- cgit v1.2.3 From 15d2b9c0957d1ad2c45c6361866fbb5ea66ec0df Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 16 Feb 2011 23:03:27 -0600 Subject: Adding a property for text direction --- libdbusmenu-glib/server.c | 9 ++++++++- libdbusmenu-glib/server.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index 777e4ef..5946db1 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -35,6 +35,7 @@ License version 3 and version 2.1 along with this program. If not, see #include "menuitem-private.h" #include "server.h" #include "server-marshal.h" +#include "enum-types.h" #include "dbus-menu-clean.xml.h" @@ -74,7 +75,8 @@ enum { PROP_0, PROP_DBUS_OBJECT, PROP_ROOT_NODE, - PROP_VERSION + PROP_VERSION, + PROP_TEXT_DIRECTION }; /* Errors */ @@ -285,6 +287,11 @@ dbusmenu_server_class_init (DbusmenuServerClass *class) "The version of the DBusmenu API that we're implementing.", DBUSMENU_VERSION_NUMBER, DBUSMENU_VERSION_NUMBER, DBUSMENU_VERSION_NUMBER, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property (object_class, PROP_TEXT_DIRECTION, + g_param_spec_enum(DBUSMENU_SERVER_PROP_TEXT_DIRECTION, "The default direction of text", + "The object that represents this set of menus on DBus", + DBUSMENU_TYPE_TEXT_DIRECTION, DBUSMENU_TEXT_DIRECTION_NONE, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); if (dbusmenu_node_info == NULL) { GError * error = NULL; diff --git a/libdbusmenu-glib/server.h b/libdbusmenu-glib/server.h index 99216ea..d7a0281 100644 --- a/libdbusmenu-glib/server.h +++ b/libdbusmenu-glib/server.h @@ -53,6 +53,7 @@ G_BEGIN_DECLS #define DBUSMENU_SERVER_PROP_DBUS_OBJECT "dbus-object" #define DBUSMENU_SERVER_PROP_ROOT_NODE "root-node" #define DBUSMENU_SERVER_PROP_VERSION "version" +#define DBUSMENU_SERVER_PROP_TEXT_DIRECTION "text-direction" typedef struct _DbusmenuServerPrivate DbusmenuServerPrivate; -- cgit v1.2.3 From de1f7af764f47b39e505adb996be4ec174b54825 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 17 Feb 2011 20:46:56 -0600 Subject: Adding prototypes for the text direction --- libdbusmenu-glib/server.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libdbusmenu-glib/server.h b/libdbusmenu-glib/server.h index d7a0281..da76a49 100644 --- a/libdbusmenu-glib/server.h +++ b/libdbusmenu-glib/server.h @@ -111,6 +111,8 @@ struct _DbusmenuServer { GType dbusmenu_server_get_type (void); DbusmenuServer * dbusmenu_server_new (const gchar * object); void dbusmenu_server_set_root (DbusmenuServer * server, DbusmenuMenuitem * root); +DbusmenuTextDirection dbusmenu_server_get_text_direction (DbusmenuServer * server); +void dbusmenu_server_set_text_direction (DbusmenuServer * server, DbusmenuTextDirection dir); /** SECIONT:server -- cgit v1.2.3 From 02d6bd3f749237e4361845368eb96a0250212a93 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 17 Feb 2011 20:48:38 -0600 Subject: Whitespace --- libdbusmenu-glib/server.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/libdbusmenu-glib/server.h b/libdbusmenu-glib/server.h index da76a49..7923b45 100644 --- a/libdbusmenu-glib/server.h +++ b/libdbusmenu-glib/server.h @@ -108,11 +108,13 @@ struct _DbusmenuServer { DbusmenuServerPrivate * priv; }; -GType dbusmenu_server_get_type (void); -DbusmenuServer * dbusmenu_server_new (const gchar * object); -void dbusmenu_server_set_root (DbusmenuServer * server, DbusmenuMenuitem * root); -DbusmenuTextDirection dbusmenu_server_get_text_direction (DbusmenuServer * server); -void dbusmenu_server_set_text_direction (DbusmenuServer * server, DbusmenuTextDirection dir); +GType dbusmenu_server_get_type (void); +DbusmenuServer * dbusmenu_server_new (const gchar * object); +void dbusmenu_server_set_root (DbusmenuServer * server, + DbusmenuMenuitem * root); +DbusmenuTextDirection dbusmenu_server_get_text_direction (DbusmenuServer * server); +void dbusmenu_server_set_text_direction (DbusmenuServer * server, + DbusmenuTextDirection dir); /** SECIONT:server -- cgit v1.2.3 From 3d8b8738f8f8b757132d442cbca57aae0c871eb3 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 17 Feb 2011 21:09:13 -0600 Subject: Adding a the text direction stub functions in. --- libdbusmenu-glib/server.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index 5946db1..a2a4557 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -1204,5 +1204,39 @@ dbusmenu_server_set_root (DbusmenuServer * self, DbusmenuMenuitem * root) return; } +/** + dbusmenu_server_get_text_direction: + @server: The #DbusmenuServer object to get the text direction from + + Returns the value of the text direction that is being exported + over DBus for this server. It should relate to the direction + of the labels and other text fields that are being exported by + this server. + + Return value: Text direction exported for this server. +*/ +DbusmenuTextDirection +dbusmenu_server_get_text_direction (DbusmenuServer * server) +{ + return DBUSMENU_TEXT_DIRECTION_NONE; +} + +/** + dbusmenu_server_set_text_direction: + @server: The #DbusmenuServer object to set the text direction on + + Sets the text direction that should be exported over DBus for + this server. If the value is set to #DBUSMENU_TEXT_DIRECTION_NONE + the default detection will be used for setting the value and + exported over DBus. +*/ +void +dbusmenu_server_set_text_direction (DbusmenuServer * server, DbusmenuTextDirection dir) +{ + + + return; +} + -- cgit v1.2.3 From b30759981718e0806418a55c6ea128127d1343d4 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 17 Feb 2011 21:19:15 -0600 Subject: Fleshing out the accessors for the text direction --- libdbusmenu-glib/server.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index a2a4557..9784c1d 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -1218,9 +1218,16 @@ dbusmenu_server_set_root (DbusmenuServer * self, DbusmenuMenuitem * root) DbusmenuTextDirection dbusmenu_server_get_text_direction (DbusmenuServer * server) { + g_return_val_if_fail(DBUSMENU_IS_SERVER(server), DBUSMENU_TEXT_DIRECTION_NONE); + GValue val = {0}; + g_value_init(&val, DBUSMENU_TYPE_TEXT_DIRECTION); + g_object_get_property(G_OBJECT(server), DBUSMENU_SERVER_PROP_TEXT_DIRECTION, &val); - return DBUSMENU_TEXT_DIRECTION_NONE; + DbusmenuTextDirection retval = g_value_get_enum(&val); + g_value_unset(&val); + + return retval; } /** @@ -1235,8 +1242,14 @@ dbusmenu_server_get_text_direction (DbusmenuServer * server) void dbusmenu_server_set_text_direction (DbusmenuServer * server, DbusmenuTextDirection dir) { - - + g_return_if_fail(DBUSMENU_IS_SERVER(server)); + g_return_if_fail(dir == DBUSMENU_TEXT_DIRECTION_NONE || dir == DBUSMENU_TEXT_DIRECTION_LTR || dir == DBUSMENU_TEXT_DIRECTION_RTL); + + GValue newval = {0}; + g_value_init(&newval, DBUSMENU_TYPE_TEXT_DIRECTION); + g_value_set_enum(&newval, dir); + g_object_set_property(G_OBJECT(server), DBUSMENU_SERVER_PROP_TEXT_DIRECTION, &newval); + g_value_unset(&newval); return; } -- cgit v1.2.3 From b376a0aeaecd0928f3222e36aad7f3faea1fffa7 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 17 Feb 2011 21:46:20 -0600 Subject: Adding code to determine the default text direction --- libdbusmenu-glib/server.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index 9784c1d..a1f805e 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -30,6 +30,7 @@ License version 3 and version 2.1 along with this program. If not, see #include "config.h" #endif +#include #include #include "menuitem-private.h" @@ -55,6 +56,8 @@ struct _DbusmenuServerPrivate GDBusConnection * bus; GCancellable * bus_lookup; guint dbus_registration; + + DbusmenuTextDirection text_direction; }; #define DBUSMENU_SERVER_GET_PRIVATE(o) (DBUSMENU_SERVER(o)->priv) @@ -123,6 +126,7 @@ static void get_property (GObject * obj, guint id, GValue * value, GParamSpec * pspec); +static void default_text_direction (DbusmenuServer * server); static void register_object (DbusmenuServer * server); static void bus_got_cb (GObject * obj, GAsyncResult * result, @@ -351,6 +355,8 @@ dbusmenu_server_init (DbusmenuServer *self) priv->bus_lookup = NULL; priv->dbus_registration = 0; + default_text_direction(self); + return; } @@ -480,6 +486,49 @@ get_property (GObject * obj, guint id, GValue * value, GParamSpec * pspec) return; } +/* Determines the default text direction */ +static void +default_text_direction (DbusmenuServer * server) +{ + DbusmenuTextDirection dir = DBUSMENU_TEXT_DIRECTION_NONE; + DbusmenuServerPrivate * priv = DBUSMENU_SERVER_GET_PRIVATE(server); + + const gchar * env = g_getenv("DBUSMENU_TEXT_DIRECTION"); + if (env != NULL) { + if (g_strcmp0(env, "ltr") == 0) { + dir = DBUSMENU_TEXT_DIRECTION_LTR; + } else if (g_strcmp0(env, "rtl") == 0) { + dir = DBUSMENU_TEXT_DIRECTION_RTL; + } else { + g_warning("Value of 'DBUSMENU_TEXT_DIRECTION' is '%s' which is not one of 'rtl' or 'ltr'", env); + } + } + + if (dir == DBUSMENU_TEXT_DIRECTION_NONE) { + /* TRANSLATORS: This is the direction of the text and can + either be the value 'ltr' for left-to-right text (English) + or 'rtl' for right-to-left (Arabic). */ + const gchar * default_dir = C_("default text direction", "ltr"); + + if (g_strcmp0(default_dir, "ltr") == 0) { + dir = DBUSMENU_TEXT_DIRECTION_LTR; + } else if (g_strcmp0(default_dir, "rtl") == 0) { + dir = DBUSMENU_TEXT_DIRECTION_RTL; + } else { + g_warning("Translation has an invalid value '%s' for default text direction. Defaulting to left-to-right.", default_dir); + dir = DBUSMENU_TEXT_DIRECTION_LTR; + } + } + + /* Shouldn't happen, but incase future patches make a mistake + this'll catch them */ + g_return_if_fail(dir != DBUSMENU_TEXT_DIRECTION_NONE); + + priv->text_direction = dir; + + return; +} + /* Register the object on the dbus bus */ static void register_object (DbusmenuServer * server) -- cgit v1.2.3 From 8905d4a0b3964e12e484423c1883535c70014a17 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 17 Feb 2011 21:47:58 -0600 Subject: Adding in the server.c file to POTFILES.in to get the default text direction --- po/POTFILES.in | 1 + 1 file changed, 1 insertion(+) diff --git a/po/POTFILES.in b/po/POTFILES.in index e69de29..3536e22 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -0,0 +1 @@ +libdbusmenu-glib/server.c -- cgit v1.2.3 From f80eb0bcc21a8e1917b290b50ef400e2c8fb090f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 17 Feb 2011 23:00:38 -0600 Subject: Handling set and get of the property. --- libdbusmenu-glib/server.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index a1f805e..3a7255c 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -444,6 +444,39 @@ set_property (GObject * obj, guint id, const GValue * value, GParamSpec * pspec) } layout_update_signal(DBUSMENU_SERVER(obj)); break; + case PROP_TEXT_DIRECTION: { + DbusmenuTextDirection indir = g_value_get_enum(value); + DbusmenuTextDirection olddir = priv->text_direction; + + /* If being set to none we need to go back to default, otherwise + we'll set things the way that we've been told */ + if (indir == DBUSMENU_TEXT_DIRECTION_NONE) { + default_text_direction(DBUSMENU_SERVER(obj)); + } else { + priv->text_direction = indir; + } + + /* 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_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("ltr")); + 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); + + g_dbus_connection_emit_signal(priv->bus, + NULL, + priv->dbusobject, + "org.freedesktop.DBus.Properties", + "PropertiesChanged", + vparams, + NULL); + } + + break; + } default: g_return_if_reached(); break; @@ -478,6 +511,9 @@ get_property (GObject * obj, guint id, GValue * value, GParamSpec * pspec) case PROP_VERSION: g_value_set_uint(value, DBUSMENU_VERSION_NUMBER); break; + case PROP_TEXT_DIRECTION: + g_value_set_enum(value, priv->text_direction); + break; default: g_return_if_reached(); break; -- cgit v1.2.3 From 5c0f6f04e9be75e273049bf5b4134185c12d32c1 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 17 Feb 2011 23:24:41 -0600 Subject: Adding a get_nick function for our enums --- libdbusmenu-glib/enum-types.c.in | 25 +++++++++++++++++++++++++ libdbusmenu-glib/enum-types.h.in | 2 ++ 2 files changed, 27 insertions(+) diff --git a/libdbusmenu-glib/enum-types.c.in b/libdbusmenu-glib/enum-types.c.in index d572d44..b0756d9 100644 --- a/libdbusmenu-glib/enum-types.c.in +++ b/libdbusmenu-glib/enum-types.c.in @@ -64,4 +64,29 @@ GType return etype; } +/** + @enum_name@_get_nick: + @value: The value of @EnumName@ to get the nick of + + Looks up in the enum table for the nick of @value. + + Return value: The nick for the given value or #NULL on error +*/ +const gchar * +@enum_name@_get_nick (@EnumName@ value) +{ + GEnumClass * class = G_ENUM_CLASS(g_type_class_ref(@enum_name@_get_type())); + g_return_val_if_fail(class != NULL, NULL); + + const gchar * ret = NULL; + GEnumValue * val = g_enum_get_value(class, value); + if (val != NULL) { + ret = val->value_nick; + } + + g_type_class_unref(class); + return ret; +} + + /*** END value-tail ***/ diff --git a/libdbusmenu-glib/enum-types.h.in b/libdbusmenu-glib/enum-types.h.in index 83b4bd2..eb24453 100644 --- a/libdbusmenu-glib/enum-types.h.in +++ b/libdbusmenu-glib/enum-types.h.in @@ -44,10 +44,12 @@ G_END_DECLS /*** BEGIN file-production ***/ /* Enumerations from file: "@filename@" */ +#include "@filename@" /*** END file-production ***/ /*** BEGIN value-header ***/ GType @enum_name@_get_type (void) G_GNUC_CONST; +const gchar * @enum_name@_get_nick (@EnumName@ value) G_GNUC_CONST; #define DBUSMENU_TYPE_@ENUMSHORT@ (@enum_name@_get_type()) /*** END value-header ***/ -- cgit v1.2.3 From 8b29014f8cff75f937f49f07d3dcd6a86591bdc0 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 17 Feb 2011 23:26:01 -0600 Subject: Use the get_nick function to get the value for the signal --- libdbusmenu-glib/server.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index 3a7255c..5cc04c6 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -461,7 +461,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("ltr")); + 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)); g_variant_builder_add_value(¶ms, g_variant_new_array(G_VARIANT_TYPE_STRING, NULL, 0)); GVariant * vparams = g_variant_builder_end(¶ms); -- cgit v1.2.3 From b5f10bb47ad432a6344bca52c352f42eb96290fb Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 17 Feb 2011 23:28:25 -0600 Subject: Making it so that the dbus properties can have more than one. --- libdbusmenu-glib/server.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index 5cc04c6..c89b49e 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -682,9 +682,16 @@ bus_get_prop (GDBusConnection * connection, const gchar * sender, const gchar * /* None of these should happen */ g_return_val_if_fail(g_strcmp0(interface, DBUSMENU_INTERFACE) == 0, NULL); g_return_val_if_fail(g_strcmp0(path, priv->dbusobject) == 0, NULL); - g_return_val_if_fail(g_strcmp0(property, "version") == 0, NULL); - return g_variant_new_uint32(DBUSMENU_VERSION_NUMBER); + if (g_strcmp0(property, "version") == 0) { + 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 { + g_warning("Unknown property '%s'", property); + } + + return NULL; } /* Handle actually signalling in the idle loop. This way we collect all -- cgit v1.2.3 From 28aed4b5a7b7ee69e7f6368e4deeb2836d7655d8 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 18 Feb 2011 10:57:33 -0600 Subject: Adding in the function prototypes for text direction in the client. --- libdbusmenu-glib/client.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libdbusmenu-glib/client.h b/libdbusmenu-glib/client.h index 6d78edf..3bab503 100644 --- a/libdbusmenu-glib/client.h +++ b/libdbusmenu-glib/client.h @@ -33,6 +33,7 @@ License version 3 and version 2.1 along with this program. If not, see #include #include "menuitem.h" +#include "types.h" G_BEGIN_DECLS @@ -48,6 +49,7 @@ G_BEGIN_DECLS #define DBUSMENU_CLIENT_SIGNAL_NEW_MENUITEM "new-menuitem" #define DBUSMENU_CLIENT_SIGNAL_ITEM_ACTIVATE "item-activate" #define DBUSMENU_CLIENT_SIGNAL_EVENT_RESULT "event-result" +#define DBUSMENU_CLIENT_SIGNAL_TEXT_DIRECTION_CHANGED "text-direction-changed" #define DBUSMENU_CLIENT_PROP_DBUS_NAME "dbus-name" #define DBUSMENU_CLIENT_PROP_DBUS_OBJECT "dbus-object" @@ -65,6 +67,7 @@ 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. + @text_direction_changed: Slot for #DbusmenuClient::text-direction-changed. @reserved1: Reserved for future use. @reserved2: Reserved for future use. @reserved3: Reserved for future use. @@ -85,6 +88,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 (*text_direction_changed) (DbusmenuTextDirection newdirection); /*< Private >*/ void (*reserved1) (void); @@ -92,7 +96,6 @@ struct _DbusmenuClientClass { void (*reserved3) (void); void (*reserved4) (void); void (*reserved5) (void); - void (*reserved6) (void); }; /** @@ -155,6 +158,7 @@ void dbusmenu_client_send_about_to_show(DbusmenuClient * client, gint id, void (*cb) (gpointer user_data), gpointer cb_data); +DbusmenuTextDirection dbusmenu_client_get_text_direction (DbusmenuClient * client); /** SECTION:client -- cgit v1.2.3 From b36db6b1b5c8e92fe73bb31d34f8838da622c340 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 18 Feb 2011 11:45:57 -0600 Subject: Adding the signal for text direction changing. --- libdbusmenu-glib/client-marshal.list | 1 + libdbusmenu-glib/client.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/libdbusmenu-glib/client-marshal.list b/libdbusmenu-glib/client-marshal.list index 866dfa8..96f9302 100644 --- a/libdbusmenu-glib/client-marshal.list +++ b/libdbusmenu-glib/client-marshal.list @@ -1,2 +1,3 @@ VOID: OBJECT, UINT VOID: OBJECT, STRING, VARIANT, UINT, POINTER +VOID: ENUM diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 5e492a3..c643551 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -42,6 +42,7 @@ License version 3 and version 2.1 along with this program. If not, see #include "server-marshal.h" #include "client-marshal.h" #include "dbus-menu-clean.xml.h" +#include "enum-types.h" /* How many property requests should we queue before sending the message on dbus */ @@ -61,6 +62,7 @@ enum { NEW_MENUITEM, ITEM_ACTIVATE, EVENT_RESULT, + TEXT_DIRECTION_CHANGED, LAST_SIGNAL }; @@ -248,6 +250,21 @@ dbusmenu_client_class_init (DbusmenuClientClass *klass) NULL, NULL, _dbusmenu_client_marshal_VOID__OBJECT_UINT, G_TYPE_NONE, 2, G_TYPE_OBJECT, G_TYPE_UINT); + /** + DbusmenuClient::text-direction-changed: + @arg0: The #DbusmenuClient object + @arg1: The new text direction + + Signal sent to show that there was an error in sending the event + to the server. + */ + signals[TEXT_DIRECTION_CHANGED] = g_signal_new(DBUSMENU_CLIENT_SIGNAL_TEXT_DIRECTION_CHANGED, + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (DbusmenuClientClass, text_direction_changed), + NULL, NULL, + _dbusmenu_client_marshal_VOID__ENUM, + G_TYPE_NONE, 1, DBUSMENU_TYPE_TEXT_DIRECTION); /** DbusmenuClient::event-error: @arg0: The #DbusmenuClient object -- cgit v1.2.3 From 796c5d6a0a13c7429b32607625eb0cde2503c50f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 18 Feb 2011 11:49:25 -0600 Subject: Adding a stub for getting the text direction --- libdbusmenu-glib/client.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index c643551..d74d627 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -1823,3 +1823,20 @@ dbusmenu_client_add_type_handler_full (DbusmenuClient * client, const gchar * ty return TRUE; } +/** + dbusmenu_client_get_text_direction: + @client: #DbusmenuClient to check the text direction on + + Gets the text direction that the server is exporting. If + the server is not exporting a direction then the value + #DBUSMENU_TEXT_DIRECTION_NONE will be returned. + + Return value: Text direction being exported. +*/ +DbusmenuTextDirection +dbusmenu_client_get_text_direction (DbusmenuClient * client) +{ + + + return DBUSMENU_TEXT_DIRECTION_NONE; +} -- cgit v1.2.3 From b7434b48401a4049facc3eb455bb1075e1ad78ca Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 18 Feb 2011 12:48:23 -0600 Subject: Adding a nick to value translator --- libdbusmenu-glib/enum-types.c.in | 24 ++++++++++++++++++++++++ libdbusmenu-glib/enum-types.h.in | 1 + 2 files changed, 25 insertions(+) diff --git a/libdbusmenu-glib/enum-types.c.in b/libdbusmenu-glib/enum-types.c.in index b0756d9..9395f5f 100644 --- a/libdbusmenu-glib/enum-types.c.in +++ b/libdbusmenu-glib/enum-types.c.in @@ -88,5 +88,29 @@ const gchar * return ret; } +/** + @enum_name@_get_value_from_nick: + @nick: The enum nick to lookup + + Looks up in the enum table for the value of @nick. + + Return value: The value for the given @nick +*/ +@EnumName@ +@enum_name@_get_value_from_nick (const gchar * nick) +{ + GEnumClass * class = G_ENUM_CLASS(g_type_class_ref(@enum_name@_get_type())); + g_return_val_if_fail(class != NULL, 0); + + @EnumName@ ret = 0; + GEnumValue * val = g_enum_get_value_by_nick(class, nick); + if (val != NULL) { + ret = val->value; + } + + g_type_class_unref(class); + return ret; +} + /*** END value-tail ***/ diff --git a/libdbusmenu-glib/enum-types.h.in b/libdbusmenu-glib/enum-types.h.in index eb24453..8c5f463 100644 --- a/libdbusmenu-glib/enum-types.h.in +++ b/libdbusmenu-glib/enum-types.h.in @@ -50,6 +50,7 @@ G_END_DECLS /*** BEGIN value-header ***/ GType @enum_name@_get_type (void) G_GNUC_CONST; const gchar * @enum_name@_get_nick (@EnumName@ value) G_GNUC_CONST; +@EnumName@ @enum_name@_get_value_from_nick (const gchar * nick) G_GNUC_CONST; #define DBUSMENU_TYPE_@ENUMSHORT@ (@enum_name@_get_type()) /*** END value-header ***/ -- cgit v1.2.3 From bcedc26848a0fe4f2f67a129d34976f69eb03fdf Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 18 Feb 2011 12:49:43 -0600 Subject: Start handling text direction and signal when it changes --- libdbusmenu-glib/client.c | 66 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 63 insertions(+), 3 deletions(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index d74d627..b285c91 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -95,6 +95,8 @@ struct _DbusmenuClientPrivate GArray * delayed_property_list; GArray * delayed_property_listeners; gint delayed_idle; + + DbusmenuTextDirection text_direction; }; typedef struct _newItemPropData newItemPropData; @@ -163,6 +165,7 @@ static void get_properties_globber (DbusmenuClient * client, gint id, const gcha static GQuark error_domain (void); static void item_activated (GDBusProxy * proxy, gint id, guint timestamp, DbusmenuClient * client); static void menuproxy_build_cb (GObject * object, GAsyncResult * res, gpointer user_data); +static void menuproxy_prop_changed_cb (GDBusProxy * proxy, GVariant * properties, GStrv invalidated, gpointer user_data); static void menuproxy_name_changed_cb (GObject * object, GParamSpec * pspec, gpointer user_data); static void menuproxy_signal_cb (GDBusProxy * proxy, gchar * sender, gchar * signal, GVariant * params, gpointer user_data); static void type_handler_destroy (gpointer user_data); @@ -349,6 +352,8 @@ dbusmenu_client_init (DbusmenuClient *self) priv->delayed_property_list = g_array_new(TRUE, FALSE, sizeof(gchar *)); priv->delayed_property_listeners = g_array_new(FALSE, FALSE, sizeof(properties_listener_t)); + priv->text_direction = DBUSMENU_TEXT_DIRECTION_NONE; + return; } @@ -1004,6 +1009,19 @@ menuproxy_build_cb (GObject * object, GAsyncResult * res, gpointer user_data) priv->menuproxy_cancel = NULL; } + /* Check the text direction if available */ + GVariant * textdir = g_dbus_proxy_get_cached_property(priv->menuproxy, "text-direction"); + if (textdir != NULL) { + GVariant * str = textdir; + if (g_variant_is_of_type(str, G_VARIANT_TYPE_VARIANT)) { + str = g_variant_get_variant(str); + } + + priv->text_direction = dbusmenu_text_direction_get_value_from_nick(g_variant_get_string(str, NULL)); + + g_variant_unref(textdir); + } + /* If we get here, we don't need the DBus proxy */ if (priv->dbusproxy != 0) { g_bus_unwatch_name(priv->dbusproxy); @@ -1012,6 +1030,7 @@ menuproxy_build_cb (GObject * object, GAsyncResult * res, gpointer user_data) g_signal_connect(priv->menuproxy, "g-signal", G_CALLBACK(menuproxy_signal_cb), client); g_signal_connect(priv->menuproxy, "notify::g-name-owner", G_CALLBACK(menuproxy_name_changed_cb), client); + g_signal_connect(priv->menuproxy, "g-properties-changed", G_CALLBACK(menuproxy_prop_changed_cb), client); gchar * name_owner = g_dbus_proxy_get_name_owner(priv->menuproxy); if (name_owner != NULL) { @@ -1022,6 +1041,47 @@ menuproxy_build_cb (GObject * object, GAsyncResult * res, gpointer user_data) return; } +/* Handle the properites changing */ +static void +menuproxy_prop_changed_cb (GDBusProxy * proxy, GVariant * properties, GStrv invalidated, gpointer user_data) +{ + DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(user_data); + DbusmenuTextDirection olddir = priv->text_direction; + + /* Invalidate first */ + gchar * invalid = *invalidated; + while (invalid != NULL) { + if (g_strcmp0(invalid, "text-direction") == 0) { + priv->text_direction = DBUSMENU_TEXT_DIRECTION_NONE; + } + invalid++; + } + + /* Check updates */ + GVariantIter iters; + 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) { + GVariant * str = value; + if (g_variant_is_of_type(str, G_VARIANT_TYPE_VARIANT)) { + str = g_variant_get_variant(str); + } + + priv->text_direction = dbusmenu_text_direction_get_value_from_nick(g_variant_get_string(str, NULL)); + } + + g_variant_unref(value); + g_free(key); + } + + if (olddir != priv->text_direction) { + g_signal_emit(G_OBJECT(user_data), TEXT_DIRECTION_CHANGED, 0, priv->text_direction, TRUE); + } + + return; +} + /* Handle the case where we change owners */ static void menuproxy_name_changed_cb (GObject * object, GParamSpec * pspec, gpointer user_data) @@ -1836,7 +1896,7 @@ dbusmenu_client_add_type_handler_full (DbusmenuClient * client, const gchar * ty DbusmenuTextDirection dbusmenu_client_get_text_direction (DbusmenuClient * client) { - - - return DBUSMENU_TEXT_DIRECTION_NONE; + g_return_val_if_fail(DBUSMENU_IS_CLIENT(client), DBUSMENU_TEXT_DIRECTION_NONE); + DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); + return priv->text_direction; } -- cgit v1.2.3 From 8a50abe36f57629c1f1e38842c8ed3bbef602213 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 18 Feb 2011 13:04:12 -0600 Subject: Use a for loop for looking at invalidated properties --- libdbusmenu-glib/client.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 5aae5d6..c86ebf1 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -1045,12 +1045,12 @@ menuproxy_prop_changed_cb (GDBusProxy * proxy, GVariant * properties, GStrv inva DbusmenuTextDirection olddir = priv->text_direction; /* Invalidate first */ - gchar * invalid = *invalidated; - while (invalid != NULL) { + gchar * invalid; + gint i = 0; + for (invalid = invalidated[i]; invalid != NULL; invalid = invalidated[++i]) { if (g_strcmp0(invalid, "text-direction") == 0) { priv->text_direction = DBUSMENU_TEXT_DIRECTION_NONE; } - invalid++; } /* Check updates */ -- cgit v1.2.3 From 0c9a1f185b2e95466741afd61feaf6b57e0740d3 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 18 Feb 2011 13:08:04 -0600 Subject: Using the proper signal value. Oops --- libdbusmenu-glib/client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index c86ebf1..5f967d0 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -1072,7 +1072,7 @@ menuproxy_prop_changed_cb (GDBusProxy * proxy, GVariant * properties, GStrv inva } if (olddir != priv->text_direction) { - g_signal_emit(G_OBJECT(user_data), TEXT_DIRECTION_CHANGED, 0, priv->text_direction, TRUE); + g_signal_emit(G_OBJECT(user_data), signals[TEXT_DIRECTION_CHANGED], 0, priv->text_direction, TRUE); } return; -- cgit v1.2.3 From 9a4a97ad2363328818d5a7983ab2a5e3f7c46b72 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 18 Feb 2011 13:21:14 -0600 Subject: Adding a stub for exposed checking --- libdbusmenu-glib/menuitem-private.h | 1 + libdbusmenu-glib/menuitem.c | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/libdbusmenu-glib/menuitem-private.h b/libdbusmenu-glib/menuitem-private.h index 89319dc..336769d 100644 --- a/libdbusmenu-glib/menuitem-private.h +++ b/libdbusmenu-glib/menuitem-private.h @@ -38,6 +38,7 @@ gboolean dbusmenu_menuitem_realized (DbusmenuMenuitem * mi); void dbusmenu_menuitem_set_realized (DbusmenuMenuitem * mi); GVariant * dbusmenu_menuitem_properties_variant (DbusmenuMenuitem * mi, const gchar ** properties); gboolean dbusmenu_menuitem_property_is_default (DbusmenuMenuitem * mi, const gchar * property); +gboolean dbusmenu_menuitem_exposed (DbusmenuMenuitem * mi); G_END_DECLS diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 54d2540..cca20a4 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1507,3 +1507,12 @@ dbusmenu_menuitem_property_is_default (DbusmenuMenuitem * mi, const gchar * prop /* No defaults system yet */ return FALSE; } + +/* Check to see if this menu item has been sent into the bus yet or + not. If no one cares we can give less info */ +gboolean +dbusmenu_menuitem_exposed (DbusmenuMenuitem * mi) +{ + + return TRUE; +} -- cgit v1.2.3 From 18fad06951c3293c268eb910d421960e15bcc371 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 18 Feb 2011 13:25:50 -0600 Subject: Tracking whether we've been exposed --- libdbusmenu-glib/menuitem.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index cca20a4..23f3783 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -59,6 +59,7 @@ struct _DbusmenuMenuitemPrivate GHashTable * properties; gboolean root; gboolean realized; + gboolean exposed; }; /* Signals */ @@ -312,6 +313,7 @@ dbusmenu_menuitem_init (DbusmenuMenuitem *self) priv->root = FALSE; priv->realized = FALSE; + priv->exposed = FALSE; return; } @@ -1338,6 +1340,8 @@ GVariant * dbusmenu_menuitem_build_variant (DbusmenuMenuitem * mi, const gchar ** properties, gint recurse) { g_return_val_if_fail(DBUSMENU_IS_MENUITEM(mi), NULL); + DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi); + priv->exposed = TRUE; gint id = 0; if (!dbusmenu_menuitem_get_root(mi)) { @@ -1513,6 +1517,7 @@ dbusmenu_menuitem_property_is_default (DbusmenuMenuitem * mi, const gchar * prop gboolean dbusmenu_menuitem_exposed (DbusmenuMenuitem * mi) { - - return TRUE; + g_return_val_if_fail(DBUSMENU_IS_MENUITEM(mi), FALSE); + DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi); + return priv->exposed; } -- cgit v1.2.3 From 9c4d38ce605a99616d83918eb6ee7e200090b06d Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 18 Feb 2011 13:36:19 -0600 Subject: Adjusting so that we can check to see if the menu item has been exposed before sending the message. If it hasn't been we'll remove it from the signal, and perhaps not signal at all. --- libdbusmenu-glib/server.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index aa39991..09fb356 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -656,7 +656,7 @@ layout_update_signal (DbusmenuServer * server) typedef struct _prop_idle_item_t prop_idle_item_t; struct _prop_idle_item_t { - gint id; + DbusmenuMenuitem * mi; GArray * array; }; @@ -686,6 +686,7 @@ prop_array_teardown (GArray * prop_array) } } + g_object_unref(G_OBJECT(iitem->mi)); g_array_free(iitem->array, TRUE); } @@ -719,6 +720,12 @@ menuitem_property_idle (gpointer user_data) for (i = 0; i < priv->prop_array->len; i++) { prop_idle_item_t * iitem = &g_array_index(priv->prop_array, prop_idle_item_t, i); + /* if it's not exposed we're going to block it's properties + from getting into the dbus message */ + if (dbusmenu_menuitem_exposed(iitem->mi) == FALSE) { + continue; + } + GVariantBuilder dictbuilder; gboolean dictinit = FALSE; @@ -756,7 +763,7 @@ menuitem_property_idle (gpointer user_data) GVariantBuilder tuplebuilder; g_variant_builder_init(&tuplebuilder, G_VARIANT_TYPE_TUPLE); - g_variant_builder_add_value(&tuplebuilder, g_variant_new_int32(iitem->id)); + g_variant_builder_add_value(&tuplebuilder, g_variant_new_int32(dbusmenu_menuitem_get_id(iitem->mi))); g_variant_builder_add_value(&tuplebuilder, g_variant_builder_end(&dictbuilder)); if (!item_init) { @@ -773,7 +780,7 @@ menuitem_property_idle (gpointer user_data) GVariantBuilder tuplebuilder; g_variant_builder_init(&tuplebuilder, G_VARIANT_TYPE_TUPLE); - g_variant_builder_add_value(&tuplebuilder, g_variant_new_int32(iitem->id)); + g_variant_builder_add_value(&tuplebuilder, g_variant_new_int32(dbusmenu_menuitem_get_id(iitem->mi))); g_variant_builder_add_value(&tuplebuilder, g_variant_builder_end(&removedictbuilder)); if (!removeitem_init) { @@ -786,9 +793,11 @@ menuitem_property_idle (gpointer user_data) } GVariant * megadata[2]; + gboolean gotsomething = FALSE; if (item_init) { megadata[0] = g_variant_builder_end(&itembuilder); + gotsomething = TRUE; } else { GError * error = NULL; megadata[0] = g_variant_parse(G_VARIANT_TYPE("a(ia{sv})"), "[ ]", NULL, NULL, &error); @@ -801,6 +810,7 @@ menuitem_property_idle (gpointer user_data) if (removeitem_init) { megadata[1] = g_variant_builder_end(&removeitembuilder); + gotsomething = TRUE; } else { GError * error = NULL; megadata[1] = g_variant_parse(G_VARIANT_TYPE("a(ia(s))"), "[ ]", NULL, NULL, &error); @@ -811,7 +821,7 @@ menuitem_property_idle (gpointer user_data) } } - if (priv->dbusobject != NULL && priv->bus != NULL) { + if (gotsomething && priv->dbusobject != NULL && priv->bus != NULL) { g_dbus_connection_emit_signal(priv->bus, NULL, priv->dbusobject, @@ -854,7 +864,7 @@ menuitem_property_changed (DbusmenuMenuitem * mi, gchar * property, GVariant * v prop_idle_item_t * item = NULL; for (i = 0; i < priv->prop_array->len; i++) { prop_idle_item_t * iitem = &g_array_index(priv->prop_array, prop_idle_item_t, i); - if (iitem->id == item_id) { + if (iitem->mi == mi) { item = iitem; break; } @@ -864,7 +874,8 @@ menuitem_property_changed (DbusmenuMenuitem * mi, gchar * property, GVariant * v /* If not, we'll need to build ourselves one */ if (item == NULL) { prop_idle_item_t myitem; - myitem.id = item_id; + myitem.mi = mi; + g_object_ref(G_OBJECT(mi)); myitem.array = g_array_new(FALSE, FALSE, sizeof(prop_idle_prop_t)); g_array_append_val(priv->prop_array, myitem); -- cgit v1.2.3 From a128fd2e85e2f442522c280a6d1d22663e8cdfea Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 18 Feb 2011 13:53:45 -0600 Subject: Handle a request for selective properties and give less data back --- libdbusmenu-glib/menuitem.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 54d2540..bc38e24 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1274,7 +1274,7 @@ dbusmenu_menuitem_properties_variant (DbusmenuMenuitem * mi, const gchar ** prop GVariant * final_variant = NULL; - if (g_hash_table_size(priv->properties) > 0) { + if (properties == NULL && g_hash_table_size(priv->properties) > 0) { GVariantBuilder builder; g_variant_builder_init(&builder, G_VARIANT_TYPE_ARRAY); @@ -1283,6 +1283,33 @@ dbusmenu_menuitem_properties_variant (DbusmenuMenuitem * mi, const gchar ** prop final_variant = g_variant_builder_end(&builder); } + if (properties != NULL) { + GVariantBuilder builder; + gboolean builder_init = FALSE; + int i = 0; const gchar * prop; + + for (prop = properties[i]; prop != NULL; prop = properties[++i]) { + GVariant * propvalue = dbusmenu_menuitem_property_get_variant(mi, prop); + + if (propvalue == NULL) { + continue; + } + + if (!builder_init) { + builder_init = TRUE; + g_variant_builder_init(&builder, G_VARIANT_TYPE_ARRAY); + } + + GVariant * dict = g_variant_new_dict_entry(g_variant_new_string((gchar *)prop), + g_variant_new_variant((GVariant *)propvalue)); + g_variant_builder_add_value(&builder, dict); + } + + if (builder_init) { + final_variant = g_variant_builder_end(&builder); + } + } + return final_variant; } -- cgit v1.2.3 From b19de3c3c90df6420200c6ba45ba45060382cca2 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 18 Feb 2011 14:07:18 -0600 Subject: Set a fixed set of properties that we ask for when requesting the layout --- libdbusmenu-glib/client.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index ba4ae7e..ca32d48 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -79,6 +79,7 @@ struct _DbusmenuClientPrivate GCancellable * menuproxy_cancel; GCancellable * layoutcall; + GVariant * layout_props; gint current_revision; gint my_revision; @@ -316,6 +317,13 @@ dbusmenu_client_init (DbusmenuClient *self) priv->layoutcall = NULL; + gchar * layout_props[3]; + layout_props[0] = DBUSMENU_MENUITEM_PROP_TYPE; + layout_props[1] = DBUSMENU_MENUITEM_PROP_LABEL; + layout_props[2] = NULL; + priv->layout_props = g_variant_new_strv((const gchar * const *)layout_props, 2); + g_variant_ref_sink(priv->layout_props); + priv->current_revision = 0; priv->my_revision = 0; @@ -380,6 +388,11 @@ dbusmenu_client_dispose (GObject *object) priv->layoutcall = NULL; } + if (priv->layout_props != NULL) { + g_variant_unref(priv->layout_props); + priv->layout_props = NULL; + } + /* Bring down the menu proxy, ensure we're not looking for one at the same time. */ if (priv->menuproxy_cancel != NULL) { @@ -1662,7 +1675,7 @@ update_layout (DbusmenuClient * client) g_variant_builder_add_value(&tupleb, g_variant_new_int32(0)); // root g_variant_builder_add_value(&tupleb, g_variant_new_int32(-1)); // recurse - g_variant_builder_add_value(&tupleb, g_variant_new_array(G_VARIANT_TYPE_STRING, NULL, 0)); // props + g_variant_builder_add_value(&tupleb, priv->layout_props); // props GVariant * args = g_variant_builder_end(&tupleb); // g_debug("Args (type: %s): %s", g_variant_get_type_string(args), g_variant_print(args, TRUE)); -- cgit v1.2.3 From 895343f4aa0c8c0a58e26a7de8c74e49fd9da292 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 18 Feb 2011 14:40:04 -0600 Subject: Use the property structures that are from the GetLayout properties --- libdbusmenu-glib/client.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index ca32d48..d990b93 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -1486,6 +1486,21 @@ parse_layout_xml(DbusmenuClient * client, GVariant * layout, DbusmenuMenuitem * parse_layout_update(childmi, client); } + /* Apply known properties sent in the structure to the + menu item. Sometimes they may just be copies */ + if (childmi != NULL) { + GVariantIter iter; + g_variant_iter_init(&iter, g_variant_get_child_value(child, 1)); + gchar * prop; + GVariant * value; + + while (g_variant_iter_next(&iter, "{sv}", &prop, &value)) { + dbusmenu_menuitem_property_set_variant(childmi, prop, value); + g_free(prop); + g_variant_unref(value); + } + } + position++; } -- cgit v1.2.3 From f1263378cd61a113cdcc485c3a20e913f19f2631 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 18 Feb 2011 15:11:23 -0600 Subject: Adding the 'state' property to the XML --- libdbusmenu-glib/dbus-menu.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libdbusmenu-glib/dbus-menu.xml b/libdbusmenu-glib/dbus-menu.xml index 82bad03..3b42f7d 100644 --- a/libdbusmenu-glib/dbus-menu.xml +++ b/libdbusmenu-glib/dbus-menu.xml @@ -179,6 +179,16 @@ 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 + were referring to them or they accessors were being highlighted. + This property can have two values: "normal" in almost all cases and + "notice" when they should have a higher priority to be shown. + + + -- cgit v1.2.3 From cf9662c5be75f9e7fe16e4fe9513ee3e4223fba0 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 18 Feb 2011 15:16:54 -0600 Subject: Adding in a status enum for tracking the status --- libdbusmenu-glib/types.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libdbusmenu-glib/types.h b/libdbusmenu-glib/types.h index f6d8daf..e573476 100644 --- a/libdbusmenu-glib/types.h +++ b/libdbusmenu-glib/types.h @@ -47,6 +47,17 @@ typedef enum { /*< prefix=DBUSMENU_TEXT_DIRECTION >*/ DBUSMENU_TEXT_DIRECTION_RTL /*< nick=rtl >*/ } DbusmenuTextDirection; +/** + DbusmenuStatus: + @DBUSMENU_STATUS_NORMAL: Everything is normal + @DBUSMENU_STATUS_NOTICE: The menus should be shown at a higher priority + + Tracks how the menus should be presented to the user. +*/ +typedef enum { /*< prefix=DBUSMENU_STATUS >*/ + DBUSMENU_STATUS_NORMAL, /*< nick=normal >*/ + DBUSMENU_STATUS_NOTICE /*< nick=notice >*/ +} DbusmenuStatus; G_END_DECLS -- cgit v1.2.3 From 6401d13aa0455b609b9f3b8c67c1d985c4c0fd8d Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 18 Feb 2011 15:28:00 -0600 Subject: Adding in some stub functions for the status --- libdbusmenu-glib/server.c | 28 ++++++++++++++++++++++++++++ libdbusmenu-glib/server.h | 3 +++ 2 files changed, 31 insertions(+) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index baae3ce..57e4c79 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -1606,3 +1606,31 @@ dbusmenu_server_set_text_direction (DbusmenuServer * server, DbusmenuTextDirecti return; } +/** + dbusmenu_server_get_status: + @server: The #DbusmenuServer to get the status from + + Gets the current statust hat the server is sending out over + DBus. + + Return value: The current status the server is sending +*/ +DbusmenuStatus +dbusmenu_server_get_status (DbusmenuServer * server) +{ + + return DBUSMENU_STATUS_NORMAL; +} + +/** + dbusmenu_server_set_status: + @server: The #DbusmenuServer to set the status on + + Changes the status of the server. +*/ +void +dbusmenu_server_set_status (DbusmenuServer * server, DbusmenuStatus status) +{ + + return; +} diff --git a/libdbusmenu-glib/server.h b/libdbusmenu-glib/server.h index 7923b45..6441570 100644 --- a/libdbusmenu-glib/server.h +++ b/libdbusmenu-glib/server.h @@ -115,6 +115,9 @@ void dbusmenu_server_set_root (DbusmenuServer * DbusmenuTextDirection dbusmenu_server_get_text_direction (DbusmenuServer * server); void dbusmenu_server_set_text_direction (DbusmenuServer * server, DbusmenuTextDirection dir); +DbusmenuStatus dbusmenu_server_get_status (DbusmenuServer * server); +void dbusmenu_server_set_status (DbusmenuServer * server, + DbusmenuStatus status); /** SECIONT:server -- cgit v1.2.3 From 84f77e8815f2747b4f76818d6f168cdd3e2f67c5 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 18 Feb 2011 15:31:58 -0600 Subject: Fleshing out the getter and setter --- libdbusmenu-glib/server.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index 57e4c79..3515896 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -1618,8 +1618,16 @@ dbusmenu_server_set_text_direction (DbusmenuServer * server, DbusmenuTextDirecti DbusmenuStatus dbusmenu_server_get_status (DbusmenuServer * server) { + g_return_val_if_fail(DBUSMENU_IS_SERVER(server), DBUSMENU_STATUS_NORMAL); - return DBUSMENU_STATUS_NORMAL; + GValue val = {0}; + g_value_init(&val, DBUSMENU_TYPE_STATUS); + g_object_get_property(G_OBJECT(server), DBUSMENU_SERVER_PROP_STATUS, &val); + + DbusmenuStatus retval = g_value_get_enum(&val); + g_value_unset(&val); + + return retval; } /** @@ -1631,6 +1639,13 @@ dbusmenu_server_get_status (DbusmenuServer * server) void dbusmenu_server_set_status (DbusmenuServer * server, DbusmenuStatus status) { + g_return_if_fail(DBUSMENU_IS_SERVER(server)); + + GValue val = {0}; + g_value_init(&val, DBUSMENU_TYPE_STATUS); + g_value_set_enum(&val, status); + g_object_set_property(G_OBJECT(server), DBUSMENU_SERVER_PROP_STATUS, &val); + g_value_unset(&val); return; } -- cgit v1.2.3 From 948372f3a709d729524d6977ff49361fa06d80ac Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 18 Feb 2011 15:33:51 -0600 Subject: Adding in the status property --- libdbusmenu-glib/server.c | 8 +++++++- libdbusmenu-glib/server.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index 3515896..fe9e07c 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -82,7 +82,8 @@ enum { PROP_DBUS_OBJECT, PROP_ROOT_NODE, PROP_VERSION, - PROP_TEXT_DIRECTION + PROP_TEXT_DIRECTION, + PROP_STATUS }; /* Errors */ @@ -300,6 +301,11 @@ dbusmenu_server_class_init (DbusmenuServerClass *class) "The object that represents this set of menus on DBus", DBUSMENU_TYPE_TEXT_DIRECTION, DBUSMENU_TEXT_DIRECTION_NONE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property (object_class, PROP_STATUS, + g_param_spec_enum(DBUSMENU_SERVER_PROP_STATUS, "Status of viewing the menus", + "Exports over DBus whether the menus should be given special visuals", + DBUSMENU_TYPE_STATUS, DBUSMENU_STATUS_NORMAL, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); if (dbusmenu_node_info == NULL) { GError * error = NULL; diff --git a/libdbusmenu-glib/server.h b/libdbusmenu-glib/server.h index 6441570..54cf5fc 100644 --- a/libdbusmenu-glib/server.h +++ b/libdbusmenu-glib/server.h @@ -54,6 +54,7 @@ G_BEGIN_DECLS #define DBUSMENU_SERVER_PROP_ROOT_NODE "root-node" #define DBUSMENU_SERVER_PROP_VERSION "version" #define DBUSMENU_SERVER_PROP_TEXT_DIRECTION "text-direction" +#define DBUSMENU_SERVER_PROP_STATUS "status" typedef struct _DbusmenuServerPrivate DbusmenuServerPrivate; -- cgit v1.2.3 From 1393edc283ac4b62f0e29612f77e7a95fbe7e7bc Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 18 Feb 2011 15:39:30 -0600 Subject: Tracking the status and signaling on DBus if it changes --- libdbusmenu-glib/server.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index fe9e07c..91e7a25 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -58,6 +58,7 @@ struct _DbusmenuServerPrivate guint dbus_registration; DbusmenuTextDirection text_direction; + DbusmenuStatus status; GArray * prop_array; guint property_idle; @@ -366,6 +367,7 @@ dbusmenu_server_init (DbusmenuServer *self) priv->dbus_registration = 0; default_text_direction(self); + priv->status = DBUSMENU_STATUS_NORMAL; return; } @@ -515,6 +517,31 @@ set_property (GObject * obj, guint id, const GValue * value, GParamSpec * pspec) break; } + case PROP_STATUS: { + DbusmenuStatus instatus = g_value_get_enum(value); + + /* 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_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)); + 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); + } + + priv->status = instatus; + break; + } default: g_return_if_reached(); break; @@ -541,6 +568,9 @@ get_property (GObject * obj, guint id, GValue * value, GParamSpec * pspec) case PROP_TEXT_DIRECTION: g_value_set_enum(value, priv->text_direction); break; + case PROP_STATUS: + g_value_set_enum(value, priv->status); + break; default: g_return_if_reached(); break; -- cgit v1.2.3 From b6b89c9b74e0e2a90d8af7749d817a512bde95d8 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 18 Feb 2011 16:05:09 -0600 Subject: Adds a status property that is gotten over DBus --- libdbusmenu-glib/client.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++- libdbusmenu-glib/client.h | 2 ++ 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 5f967d0..61ea91d 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -49,7 +49,8 @@ License version 3 and version 2.1 along with this program. If not, see enum { PROP_0, PROP_DBUSOBJECT, - PROP_DBUSNAME + PROP_DBUSNAME, + PROP_STATUS }; /* Signals */ @@ -94,6 +95,7 @@ struct _DbusmenuClientPrivate gint delayed_idle; DbusmenuTextDirection text_direction; + DbusmenuStatus status; }; typedef struct _newItemPropData newItemPropData; @@ -294,6 +296,11 @@ dbusmenu_client_class_init (DbusmenuClientClass *klass) "Name of the DBus client we're connecting to.", NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property (object_class, PROP_STATUS, + g_param_spec_enum(DBUSMENU_CLIENT_PROP_STATUS, "Status of viewing the menus", + "Whether the menus should be given special visuals", + DBUSMENU_TYPE_STATUS, DBUSMENU_STATUS_NORMAL, + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); if (dbusmenu_node_info == NULL) { GError * error = NULL; @@ -349,6 +356,7 @@ dbusmenu_client_init (DbusmenuClient *self) priv->delayed_property_listeners = g_array_new(FALSE, FALSE, sizeof(properties_listener_t)); priv->text_direction = DBUSMENU_TEXT_DIRECTION_NONE; + priv->status = DBUSMENU_STATUS_NORMAL; return; } @@ -494,6 +502,9 @@ get_property (GObject * obj, guint id, GValue * value, GParamSpec * pspec) case PROP_DBUSOBJECT: g_value_set_string(value, priv->dbus_object); break; + case PROP_STATUS: + g_value_set_enum(value, priv->status); + break; default: g_warning("Unknown property %d.", id); return; @@ -1043,6 +1054,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; /* Invalidate first */ gchar * invalid; @@ -1051,6 +1063,9 @@ menuproxy_prop_changed_cb (GDBusProxy * proxy, GVariant * properties, GStrv inva if (g_strcmp0(invalid, "text-direction") == 0) { priv->text_direction = DBUSMENU_TEXT_DIRECTION_NONE; } + if (g_strcmp0(invalid, "status") == 0) { + priv->status = DBUSMENU_STATUS_NORMAL; + } } /* Check updates */ @@ -1066,6 +1081,14 @@ 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) { + GVariant * str = value; + if (g_variant_is_of_type(str, G_VARIANT_TYPE_VARIANT)) { + str = g_variant_get_variant(str); + } + + priv->status = dbusmenu_status_get_value_from_nick(g_variant_get_string(str, NULL)); + } g_variant_unref(value); g_free(key); @@ -1075,6 +1098,10 @@ menuproxy_prop_changed_cb (GDBusProxy * proxy, GVariant * properties, GStrv inva g_signal_emit(G_OBJECT(user_data), signals[TEXT_DIRECTION_CHANGED], 0, priv->text_direction, TRUE); } + if (oldstatus != priv->status) { + g_object_notify(G_OBJECT(user_data), DBUSMENU_CLIENT_PROP_STATUS); + } + return; } @@ -1928,3 +1955,25 @@ dbusmenu_client_get_text_direction (DbusmenuClient * client) DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); return priv->text_direction; } + +/** + dbusmenu_client_get_status: + @client: #DbusmenuClient to check the status on + + Gets the recommended current status that the server + is exporting for the menus. In situtations where the + value is #DBUSMENU_STATUS_NOTICE it is recommended that + the client show the menus to the user an a more noticible + way. + + Return value: Status being exported. +*/ +DbusmenuStatus +dbusmenu_client_get_status (DbusmenuClient * client) +{ + g_return_val_if_fail(DBUSMENU_IS_CLIENT(client), DBUSMENU_STATUS_NORMAL); + DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); + return priv->status; +} + + diff --git a/libdbusmenu-glib/client.h b/libdbusmenu-glib/client.h index 3bab503..e812aa2 100644 --- a/libdbusmenu-glib/client.h +++ b/libdbusmenu-glib/client.h @@ -53,6 +53,7 @@ G_BEGIN_DECLS #define DBUSMENU_CLIENT_PROP_DBUS_NAME "dbus-name" #define DBUSMENU_CLIENT_PROP_DBUS_OBJECT "dbus-object" +#define DBUSMENU_CLIENT_PROP_STATUS "status" #define DBUSMENU_CLIENT_TYPES_DEFAULT "standard" #define DBUSMENU_CLIENT_TYPES_SEPARATOR "separator" @@ -159,6 +160,7 @@ void dbusmenu_client_send_about_to_show(DbusmenuClient * client, void (*cb) (gpointer user_data), gpointer cb_data); DbusmenuTextDirection dbusmenu_client_get_text_direction (DbusmenuClient * client); +DbusmenuStatus dbusmenu_client_get_status (DbusmenuClient * client); /** SECTION:client -- cgit v1.2.3 From 5ab75937ec4ba21f9542fbe71dbf8ceb5b28e2ef Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 18 Feb 2011 16:11:29 -0600 Subject: Instead of defining a signal let's make this a property and use 'notify' --- libdbusmenu-glib/client.c | 29 +++++++++++------------------ libdbusmenu-glib/client.h | 4 ++-- 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 5f967d0..828129a 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -49,7 +49,8 @@ License version 3 and version 2.1 along with this program. If not, see enum { PROP_0, PROP_DBUSOBJECT, - PROP_DBUSNAME + PROP_DBUSNAME, + PROP_TEXT_DIRECTION }; /* Signals */ @@ -59,7 +60,6 @@ enum { NEW_MENUITEM, ITEM_ACTIVATE, EVENT_RESULT, - TEXT_DIRECTION_CHANGED, LAST_SIGNAL }; @@ -249,21 +249,6 @@ dbusmenu_client_class_init (DbusmenuClientClass *klass) NULL, NULL, _dbusmenu_client_marshal_VOID__OBJECT_UINT, G_TYPE_NONE, 2, G_TYPE_OBJECT, G_TYPE_UINT); - /** - DbusmenuClient::text-direction-changed: - @arg0: The #DbusmenuClient object - @arg1: The new text direction - - Signal sent to show that there was an error in sending the event - to the server. - */ - signals[TEXT_DIRECTION_CHANGED] = g_signal_new(DBUSMENU_CLIENT_SIGNAL_TEXT_DIRECTION_CHANGED, - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (DbusmenuClientClass, text_direction_changed), - NULL, NULL, - _dbusmenu_client_marshal_VOID__ENUM, - G_TYPE_NONE, 1, DBUSMENU_TYPE_TEXT_DIRECTION); /** DbusmenuClient::event-error: @arg0: The #DbusmenuClient object @@ -294,6 +279,11 @@ dbusmenu_client_class_init (DbusmenuClientClass *klass) "Name of the DBus client we're connecting to.", NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property (object_class, PROP_TEXT_DIRECTION, + g_param_spec_enum(DBUSMENU_CLIENT_PROP_TEXT_DIRECTION, "Direction text values have", + "Signals which direction the default text direction is for the menus", + DBUSMENU_TYPE_TEXT_DIRECTION, DBUSMENU_TEXT_DIRECTION_NONE, + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); if (dbusmenu_node_info == NULL) { GError * error = NULL; @@ -494,6 +484,9 @@ get_property (GObject * obj, guint id, GValue * value, GParamSpec * pspec) case PROP_DBUSOBJECT: g_value_set_string(value, priv->dbus_object); break; + case PROP_TEXT_DIRECTION: + g_value_set_enum(value, priv->text_direction); + break; default: g_warning("Unknown property %d.", id); return; @@ -1072,7 +1065,7 @@ menuproxy_prop_changed_cb (GDBusProxy * proxy, GVariant * properties, GStrv inva } if (olddir != priv->text_direction) { - g_signal_emit(G_OBJECT(user_data), signals[TEXT_DIRECTION_CHANGED], 0, priv->text_direction, TRUE); + g_object_notify(G_OBJECT(user_data), DBUSMENU_CLIENT_PROP_TEXT_DIRECTION); } return; diff --git a/libdbusmenu-glib/client.h b/libdbusmenu-glib/client.h index 3bab503..c11a285 100644 --- a/libdbusmenu-glib/client.h +++ b/libdbusmenu-glib/client.h @@ -53,6 +53,7 @@ G_BEGIN_DECLS #define DBUSMENU_CLIENT_PROP_DBUS_NAME "dbus-name" #define DBUSMENU_CLIENT_PROP_DBUS_OBJECT "dbus-object" +#define DBUSMENU_CLIENT_PROP_TEXT_DIRECTION "text-direction" #define DBUSMENU_CLIENT_TYPES_DEFAULT "standard" #define DBUSMENU_CLIENT_TYPES_SEPARATOR "separator" @@ -67,7 +68,6 @@ 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. - @text_direction_changed: Slot for #DbusmenuClient::text-direction-changed. @reserved1: Reserved for future use. @reserved2: Reserved for future use. @reserved3: Reserved for future use. @@ -88,7 +88,6 @@ 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 (*text_direction_changed) (DbusmenuTextDirection newdirection); /*< Private >*/ void (*reserved1) (void); @@ -96,6 +95,7 @@ struct _DbusmenuClientClass { void (*reserved3) (void); void (*reserved4) (void); void (*reserved5) (void); + void (*reserved6) (void); }; /** -- cgit v1.2.3 From 52e9e4c8125943abc8d7513501aad1698ab4d7f6 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Mon, 21 Feb 2011 11:30:50 +0100 Subject: add test-glib-simple-items.py Python GI test This replicates tests/test-glib-simple-items.c using Python and GI. Update the Makefile to use the locally generated GI typelibs for the tests. --- tests/Makefile.am | 8 ++++++-- tests/test-glib-simple-items.py | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 2 deletions(-) create mode 100755 tests/test-glib-simple-items.py diff --git a/tests/Makefile.am b/tests/Makefile.am index 62142dc..9259ed1 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -17,7 +17,8 @@ TESTS = \ test-gtk-shortcut \ test-gtk-reorder \ test-gtk-submenu \ - test-gtk-parser-test + test-gtk-parser-test \ + test-glib-simple-items.py check_PROGRAMS = \ glib-server-nomenu \ @@ -48,6 +49,9 @@ check_PROGRAMS = \ XVFB_RUN=". $(srcdir)/run-xvfb.sh" +# for the GI tests, prefer/use the typelibs from the local build tree +TESTS_ENVIRONMENT = env GI_TYPELIB_PATH=$(top_builddir)/libdbusmenu-glib:$(top_builddir)/libdbusmenu-gtk:$(GI_TYPELIB_PATH) + ###################### # JSON Loader lib ###################### @@ -623,7 +627,7 @@ distclean-local: -rm -rf $(builddir)/mago.results DISTCLEANFILES = \ - $(TESTS) \ + $(filter-out %.py, $(TESTS)) \ $(OBJECT_XML_REPORT) \ $(GTK_OBJECT_XML_REPORT) diff --git a/tests/test-glib-simple-items.py b/tests/test-glib-simple-items.py new file mode 100755 index 0000000..d7ad7d7 --- /dev/null +++ b/tests/test-glib-simple-items.py @@ -0,0 +1,35 @@ +#!/usr/bin/python +# This is the Python GI version of test-glib-simple-items.c + +import gobject +from gi.repository import Dbusmenu + +dummies = ['Bob', 'Jim', 'Alvin', 'Mary'] + +def dummy_users(root): + count = 0 + for user in dummies: + mi = Dbusmenu.Menuitem() + print 'Creating item: %d %s' % (mi.get_id(), user) + print '\tRoot ID:', root.get_id() + mi.property_set('label', user) + root.child_add_position(mi, count) + assert mi.property_get('label') == user + count += 1 + +def quititall(mainloop): + mainloop.quit() + return False + +# main + +server = Dbusmenu.Server.new('/test/object') +root_menuitem = Dbusmenu.Menuitem() +server.set_root(root_menuitem) +print 'Root ID:', root_menuitem.get_id() + +dummy_users(root_menuitem) + +mainloop = gobject.MainLoop() +gobject.timeout_add_seconds(1, quititall, mainloop) +mainloop.run() -- cgit v1.2.3 From 3f3db4e1ea5e5b2321a7266edf018bb510fcdfb4 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Mon, 21 Feb 2011 12:43:43 +0100 Subject: fix typo in annotation --- libdbusmenu-gtk/menu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdbusmenu-gtk/menu.c b/libdbusmenu-gtk/menu.c index 9788ffc..c2720ac 100644 --- a/libdbusmenu-gtk/menu.c +++ b/libdbusmenu-gtk/menu.c @@ -400,7 +400,7 @@ build_client (DbusmenuGtkMenu * self) /** * dbusmenu_gtkmenu_new: * @dbus_name: Name of the #DbusmenuServer on DBus - * @dbus_name: Name of the object on the #DbusmenuServer + * @dbus_object: Name of the object on the #DbusmenuServer * * Creates a new #DbusmenuGtkMenu object and creates a #DbusmenuClient * that connects across DBus to a #DbusmenuServer. -- cgit v1.2.3 From 83a270fd9db6cda2dbff19335c97361aa4ad6781 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Mon, 21 Feb 2011 14:06:43 +0100 Subject: add test-gtk-shortcut-client.py Python GI test This replicates tests/test-gtk-shortcut-client.c using Python and GI. --- tests/Makefile.am | 7 ++++++ tests/test-gtk-shortcut-client.py | 52 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100755 tests/test-gtk-shortcut-client.py diff --git a/tests/Makefile.am b/tests/Makefile.am index c0081b0..f9102ed 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -16,6 +16,7 @@ TESTS = \ test-gtk-objects-test \ test-gtk-label \ test-gtk-shortcut \ + test-gtk-shortcut-python \ test-gtk-reorder \ test-gtk-submenu \ test-gtk-parser-test \ @@ -476,6 +477,12 @@ test-gtk-shortcut: test-gtk-shortcut-client test-gtk-shortcut-server Makefile.am @echo $(DBUS_RUNNER) --task ./test-gtk-shortcut-client --task-name Client --task ./test-gtk-shortcut-server --task-name Server --ignore-return >> $@ @chmod +x $@ +test-gtk-shortcut-python: test-gtk-shortcut-server Makefile.am + @echo "#!/bin/bash" > $@ + @echo $(XVFB_RUN) >> $@ + @echo $(DBUS_RUNNER) --task ./test-gtk-shortcut-client.py --task-name Client --task ./test-gtk-shortcut-server --task-name Server --ignore-return >> $@ + @chmod +x $@ + test_gtk_shortcut_server_SOURCES = \ test-gtk-shortcut-server.c diff --git a/tests/test-gtk-shortcut-client.py b/tests/test-gtk-shortcut-client.py new file mode 100755 index 0000000..885d227 --- /dev/null +++ b/tests/test-gtk-shortcut-client.py @@ -0,0 +1,52 @@ +#!/usr/bin/python + +# A test for libdbusmenu to ensure its quality. This is the Python GI version +# of test-gtk-shortcut-client.c +# +# Copyright 2011 Canonical Ltd. +# Authors: +# Martin Pitt + +import sys +import gobject +from gi.repository import Gtk, DbusmenuGtk +Gtk.require_version('2.0') + +passed = True +main_loop = gobject.MainLoop() + +def timer_func(data): + passed = True + main_loop.quit() + return False + +# main +print 'Building Window' +window = Gtk.Window(type=Gtk.WindowType.TOPLEVEL) +menubar = Gtk.MenuBar() +menuitem = Gtk.MenuItem(label='Test') + +dmenu = DbusmenuGtk.Menu(dbus_name='glib.label.test', dbus_object='/org/test') +dclient = dmenu.get_client() +agroup = Gtk.AccelGroup() +dclient.set_accel_group(agroup) + +menuitem.set_submenu(dmenu) +menuitem.show() +menubar.append(menuitem) +menubar.show() +window.add(menubar) +window.set_title('libdbusmenu-gtk test') +window.add_accel_group(agroup) +window.show_all() + +gobject.timeout_add_seconds(10, timer_func, window) + +print 'Entering Mainloop' +main_loop.run() + +if passed: + print 'Quiting' +else: + print "Quiting as we're a failure" + sys.exit(1) -- cgit v1.2.3 From fec6317262d94b29c41fa0632236910b4bd11244 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 09:54:31 -0600 Subject: Fixing transfer from the parser to be full --- libdbusmenu-gtk/parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdbusmenu-gtk/parser.c b/libdbusmenu-gtk/parser.c index 180b66e..f516dde 100644 --- a/libdbusmenu-gtk/parser.c +++ b/libdbusmenu-gtk/parser.c @@ -93,7 +93,7 @@ static void menuitem_notify_cb (GtkWidget * widget, * between the objects. It also stores the dbusmenu items as a cache * on the GTK items so that they'll be reused if necissary. * - * Return value: (transfer none): A dbusmenu item representing the menu structure + * Return value: (transfer full): A dbusmenu item representing the menu structure */ DbusmenuMenuitem * dbusmenu_gtk_parse_menu_structure (GtkWidget * widget) -- cgit v1.2.3 From f7c526d16a75a6f2dd606cb80093ac2b54f537cb Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 10:04:27 -0600 Subject: Fixing the variable name --- libdbusmenu-gtk/client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c index 4128b02..50978ff 100644 --- a/libdbusmenu-gtk/client.c +++ b/libdbusmenu-gtk/client.c @@ -619,7 +619,7 @@ move_child (DbusmenuMenuitem * mi, DbusmenuMenuitem * child, guint new, guint ol /** * dbusmenu_gtkclient_new: * @dbus_name: Name of the #DbusmenuServer on DBus - * @dbus_name: Name of the object on the #DbusmenuServer + * @dbus_object: Name of the object on the #DbusmenuServer * * Creates a new #DbusmenuGtkClient object and creates a #DbusmenuClient * that connects across DBus to a #DbusmenuServer. -- cgit v1.2.3 From d436a1866030bc9720c49c696753afd65b08bf12 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 10:04:44 -0600 Subject: Typo in reference --- libdbusmenu-gtk/menuitem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdbusmenu-gtk/menuitem.c b/libdbusmenu-gtk/menuitem.c index 4e92961..508b43f 100644 --- a/libdbusmenu-gtk/menuitem.c +++ b/libdbusmenu-gtk/menuitem.c @@ -78,7 +78,7 @@ dbusmenu_menuitem_property_set_image (DbusmenuMenuitem * menuitem, const gchar * /** * dbusmenu_menuitem_property_get_image: - * @menuitem: The #DbusmenuMenuite to look for the property on + * @menuitem: The #DbusmenuMenuitem to look for the property on * @property: The name of the property to look for. * * This function looks on the menu item for a property by the -- cgit v1.2.3 From 18c5f32b393ada7a3a7507b0a83bbd98f88a1722 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 10:05:04 -0600 Subject: Removing parsing of unneeded comment block --- libdbusmenu-gtk/serializablemenuitem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdbusmenu-gtk/serializablemenuitem.c b/libdbusmenu-gtk/serializablemenuitem.c index f5dbbf1..29f83a8 100644 --- a/libdbusmenu-gtk/serializablemenuitem.c +++ b/libdbusmenu-gtk/serializablemenuitem.c @@ -33,7 +33,7 @@ License version 3 and version 2.1 along with this program. If not, see #include "client.h" #include "serializablemenuitem.h" -/** +/* DbusmenuGtkSerializableMenuItemPrivate: @mi: Menuitem to watch the property changes from */ -- cgit v1.2.3 From f3eb3cbb4623b9e996d2cc62a21b6fcc4a2331c7 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 10:18:48 -0600 Subject: Fixing distcheck by including py file and cleaning up it's pyc --- tests/Makefile.am | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index f9102ed..1f8faec 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -3,6 +3,7 @@ DBUS_RUNNER=dbus-test-runner CLEANFILES= DISTCLEANFILES= +EXTRA_DIST = TESTS = \ test-glib-objects-test \ @@ -477,12 +478,6 @@ test-gtk-shortcut: test-gtk-shortcut-client test-gtk-shortcut-server Makefile.am @echo $(DBUS_RUNNER) --task ./test-gtk-shortcut-client --task-name Client --task ./test-gtk-shortcut-server --task-name Server --ignore-return >> $@ @chmod +x $@ -test-gtk-shortcut-python: test-gtk-shortcut-server Makefile.am - @echo "#!/bin/bash" > $@ - @echo $(XVFB_RUN) >> $@ - @echo $(DBUS_RUNNER) --task ./test-gtk-shortcut-client.py --task-name Client --task ./test-gtk-shortcut-server --task-name Server --ignore-return >> $@ - @chmod +x $@ - test_gtk_shortcut_server_SOURCES = \ test-gtk-shortcut-server.c @@ -513,6 +508,19 @@ test_gtk_shortcut_client_LDADD = \ $(DBUSMENUGTK_LIBS) \ $(DBUSMENUTESTS_LIBS) +######################### +# Test GTK Shortcut Python +######################### + +test-gtk-shortcut-python: test-gtk-shortcut-server test-gtk-shortcut-client.py Makefile.am + @echo "#!/bin/bash" > $@ + @echo $(XVFB_RUN) >> $@ + @echo $(DBUS_RUNNER) --task ./test-gtk-shortcut-client.py --task-name Client --task ./test-gtk-shortcut-server --task-name Server --ignore-return >> $@ + @chmod +x $@ + +EXTRA_DIST += test-gtk-shortcut-client.py +CLEANFILES += test-gtk-shortcut-client.pyc + ######################### # Test GTK Reorder ######################### @@ -607,7 +615,7 @@ jsondir = $(datadir)/${PACKAGE}/json/ json_DATA = \ test-gtk-label.json -EXTRA_DIST = \ +EXTRA_DIST += \ $(examples_DATA) \ run-xvfb.sh \ $(json_DATA) \ -- cgit v1.2.3 From dcf34291bd1cc3f58652c96bd37de3162497b269 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 10:22:35 -0600 Subject: Bringing along the simple items test as well --- tests/Makefile.am | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/Makefile.am b/tests/Makefile.am index 1f8faec..09bc4c5 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -367,6 +367,8 @@ test_glib_simple_items_LDADD = \ ../libdbusmenu-glib/libdbusmenu-glib.la \ $(DBUSMENUGLIB_LIBS) +EXTRA_DIST += test-glib-simple-items.py + ###################### # Test GTK Object ###################### -- cgit v1.2.3 From 5b9418cb4be5823df8eb7c01f854eed0a13a2c9f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 10:50:34 -0600 Subject: Fixing the path of the python in the test --- tests/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 09bc4c5..61b3e69 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -517,7 +517,7 @@ test_gtk_shortcut_client_LDADD = \ test-gtk-shortcut-python: test-gtk-shortcut-server test-gtk-shortcut-client.py Makefile.am @echo "#!/bin/bash" > $@ @echo $(XVFB_RUN) >> $@ - @echo $(DBUS_RUNNER) --task ./test-gtk-shortcut-client.py --task-name Client --task ./test-gtk-shortcut-server --task-name Server --ignore-return >> $@ + @echo $(DBUS_RUNNER) --task $(srcdir)/test-gtk-shortcut-client.py --task-name Client --task ./test-gtk-shortcut-server --task-name Server --ignore-return >> $@ @chmod +x $@ EXTRA_DIST += test-gtk-shortcut-client.py -- cgit v1.2.3 From cf81beab111e5d324f601d69a71e92e81306ae5e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 11:42:55 -0600 Subject: Making sure the client menu item isn't parsed and remove some oldies. --- docs/libdbusmenu-glib/reference/Makefile.am | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/libdbusmenu-glib/reference/Makefile.am b/docs/libdbusmenu-glib/reference/Makefile.am index 8018da2..f86eb09 100644 --- a/docs/libdbusmenu-glib/reference/Makefile.am +++ b/docs/libdbusmenu-glib/reference/Makefile.am @@ -48,11 +48,10 @@ CFILE_GLOB=$(top_srcdir)/libdbusmenu-glib/*.c # Header files to ignore when scanning. # e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h IGNORE_HFILES= \ + client-menuitem.h \ menuitem-marshal.h \ server-marshal.h \ - menuitem-private.h \ - dbusmenu-client.h \ - dbusmenu-server.h + menuitem-private.h # Images to copy into HTML directory. # e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png -- cgit v1.2.3 From f938b05924b073e2fa348bcb336e05e55f0f8a89 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 11:43:31 -0600 Subject: Changing the naming of the CLIENT MENUITEM macro to be standard --- libdbusmenu-glib/client-menuitem.c | 4 ++-- libdbusmenu-glib/client-menuitem.h | 16 ++++++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/libdbusmenu-glib/client-menuitem.c b/libdbusmenu-glib/client-menuitem.c index 0f14b85..b9e799f 100644 --- a/libdbusmenu-glib/client-menuitem.c +++ b/libdbusmenu-glib/client-menuitem.c @@ -39,7 +39,7 @@ struct _DbusmenuClientMenuitemPrivate }; #define DBUSMENU_CLIENT_MENUITEM_GET_PRIVATE(o) \ -(G_TYPE_INSTANCE_GET_PRIVATE ((o), DBUSMENU_CLIENT_MENUITEM_TYPE, DbusmenuClientMenuitemPrivate)) +(G_TYPE_INSTANCE_GET_PRIVATE ((o), DBUSMENU_TYPE_CLIENT_MENUITEM, DbusmenuClientMenuitemPrivate)) static void dbusmenu_client_menuitem_class_init (DbusmenuClientMenuitemClass *klass); static void dbusmenu_client_menuitem_init (DbusmenuClientMenuitem *self); @@ -94,7 +94,7 @@ dbusmenu_client_menuitem_finalize (GObject *object) DbusmenuClientMenuitem * dbusmenu_client_menuitem_new (gint id, DbusmenuClient * client) { - DbusmenuClientMenuitem * mi = g_object_new(DBUSMENU_CLIENT_MENUITEM_TYPE, "id", id, NULL); + DbusmenuClientMenuitem * mi = g_object_new(DBUSMENU_TYPE_CLIENT_MENUITEM, "id", id, NULL); DbusmenuClientMenuitemPrivate * priv = DBUSMENU_CLIENT_MENUITEM_GET_PRIVATE(mi); priv->client = client; return mi; diff --git a/libdbusmenu-glib/client-menuitem.h b/libdbusmenu-glib/client-menuitem.h index ef61213..2692192 100644 --- a/libdbusmenu-glib/client-menuitem.h +++ b/libdbusmenu-glib/client-menuitem.h @@ -35,12 +35,16 @@ License version 3 and version 2.1 along with this program. If not, see G_BEGIN_DECLS -#define DBUSMENU_CLIENT_MENUITEM_TYPE (dbusmenu_client_menuitem_get_type ()) -#define DBUSMENU_CLIENT_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DBUSMENU_CLIENT_MENUITEM_TYPE, DbusmenuClientMenuitem)) -#define DBUSMENU_CLIENT_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DBUSMENU_CLIENT_MENUITEM_TYPE, DbusmenuClientMenuitemClass)) -#define DBUSMENU_IS_CLIENT_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DBUSMENU_CLIENT_MENUITEM_TYPE)) -#define DBUSMENU_IS_CLIENT_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DBUSMENU_CLIENT_MENUITEM_TYPE)) -#define DBUSMENU_CLIENT_MENUITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DBUSMENU_CLIENT_MENUITEM_TYPE, DbusmenuClientMenuitemClass)) +/** + * DBUSMENU_TYPE_CLIENT_MENUITEM: + * Macro to get the #GType value for #DbusmenuClientMenuitem object + */ +#define DBUSMENU_TYPE_CLIENT_MENUITEM (dbusmenu_client_menuitem_get_type ()) +#define DBUSMENU_CLIENT_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DBUSMENU_TYPE_CLIENT_MENUITEM, DbusmenuClientMenuitem)) +#define DBUSMENU_CLIENT_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DBUSMENU_TYPE_CLIENT_MENUITEM, DbusmenuClientMenuitemClass)) +#define DBUSMENU_IS_CLIENT_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DBUSMENU_TYPE_CLIENT_MENUITEM)) +#define DBUSMENU_IS_CLIENT_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DBUSMENU_TYPE_CLIENT_MENUITEM)) +#define DBUSMENU_CLIENT_MENUITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DBUSMENU_TYPE_CLIENT_MENUITEM, DbusmenuClientMenuitemClass)) typedef struct _DbusmenuClientMenuitem DbusmenuClientMenuitem; typedef struct _DbusmenuClientMenuitemClass DbusmenuClientMenuitemClass; -- cgit v1.2.3 From 7efc369be309e8d12438d32fc601288fd6c07ee3 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 11:46:57 -0600 Subject: Remove outdated symbols that we don't want in the docs --- .../reference/libdbusmenu-glib-sections.txt | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt b/docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt index 0186049..6b9ffa6 100644 --- a/docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt +++ b/docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt @@ -55,7 +55,6 @@ DBUSMENU_MENUITEM_ICON_NAME_BLANK DBUSMENU_MENUITEM_CHILD_DISPLAY_SUBMENU DbusmenuMenuitem dbusmenu_menuitem_about_to_show_cb -dbusmenu_menuitem_buildxml_slot_t DbusmenuMenuitemClass dbusmenu_menuitem_new dbusmenu_menuitem_new_with_id @@ -72,13 +71,13 @@ dbusmenu_menuitem_child_reorder dbusmenu_menuitem_child_find dbusmenu_menuitem_find_id dbusmenu_menuitem_property_set -dbusmenu_menuitem_property_set_value dbusmenu_menuitem_property_set_bool dbusmenu_menuitem_property_set_int +dbusmenu_menuitem_property_set_variant dbusmenu_menuitem_property_get -dbusmenu_menuitem_property_get_value dbusmenu_menuitem_property_get_bool dbusmenu_menuitem_property_get_int +dbusmenu_menuitem_property_get_variant dbusmenu_menuitem_property_exist dbusmenu_menuitem_properties_list dbusmenu_menuitem_properties_copy @@ -122,22 +121,6 @@ DBUSMENU_IS_SERVER_CLASS DBUSMENU_SERVER_GET_CLASS -
-client-menuitem -DbusmenuClientMenuitem -DBUSMENU_CLIENT_MENUITEM_TYPE -DbusmenuClientMenuitem -DbusmenuClientMenuitemClass -dbusmenu_client_menuitem_new - -DBUSMENU_CLIENT_MENUITEM -DBUSMENU_IS_CLIENT_MENUITEM -dbusmenu_client_menuitem_get_type -DBUSMENU_CLIENT_MENUITEM_CLASS -DBUSMENU_IS_CLIENT_MENUITEM_CLASS -DBUSMENU_CLIENT_MENUITEM_GET_CLASS -
-
menuitem-proxy DbusmenuMenuitemProxy -- cgit v1.2.3 From 0da6e4e700074aeda4f73651e06ba4f57857bb34 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 11:50:45 -0600 Subject: Adding in new symbols to the appropriate sections --- .../reference/libdbusmenu-glib-sections.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt b/docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt index 6b9ffa6..8fa6c2a 100644 --- a/docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt +++ b/docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt @@ -4,6 +4,8 @@ DBUSMENU_CLIENT_SIGNAL_LAYOUT_UPDATED DBUSMENU_CLIENT_SIGNAL_ROOT_CHANGED DBUSMENU_CLIENT_SIGNAL_NEW_MENUITEM +DBUSMENU_CLIENT_SIGNAL_EVENT_RESULT +DBUSMENU_CLIENT_SIGNAL_ITEM_ACTIVATE DBUSMENU_CLIENT_PROP_DBUS_NAME DBUSMENU_CLIENT_PROP_DBUS_OBJECT DBUSMENU_CLIENT_TYPES_DEFAULT @@ -12,9 +14,11 @@ DBUSMENU_CLIENT_TYPES_IMAGE DbusmenuClient DbusmenuClientClass DbusmenuClientTypeHandler +DbusmenuClientTypeDestroyHandler dbusmenu_client_new dbusmenu_client_get_root dbusmenu_client_add_type_handler +dbusmenu_client_add_type_handler_full dbusmenu_client_send_event dbusmenu_client_send_about_to_show @@ -37,6 +41,8 @@ DBUSMENU_MENUITEM_SIGNAL_CHILD_REMOVED DBUSMENU_MENUITEM_SIGNAL_CHILD_MOVED DBUSMENU_MENUITEM_SIGNAL_REALIZED DBUSMENU_MENUITEM_SIGNAL_REALIZED_ID +DBUSMENU_MENUITEM_SIGNAL_ABOUT_TO_SHOW +DBUSMENU_MENUITEM_SIGNAL_SHOW_TO_USER DBUSMENU_MENUITEM_PROP_TYPE DBUSMENU_MENUITEM_PROP_VISIBLE DBUSMENU_MENUITEM_PROP_ENABLED @@ -46,6 +52,7 @@ DBUSMENU_MENUITEM_PROP_ICON_DATA DBUSMENU_MENUITEM_PROP_TOGGLE_TYPE DBUSMENU_MENUITEM_PROP_TOGGLE_STATE DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY +DBUSMENU_MENUITEM_PROP_SHORTCUT DBUSMENU_MENUITEM_TOGGLE_CHECK DBUSMENU_MENUITEM_TOGGLE_RADIO DBUSMENU_MENUITEM_TOGGLE_STATE_UNCHECKED @@ -53,6 +60,10 @@ DBUSMENU_MENUITEM_TOGGLE_STATE_CHECKED DBUSMENU_MENUITEM_TOGGLE_STATE_UNKNOWN DBUSMENU_MENUITEM_ICON_NAME_BLANK DBUSMENU_MENUITEM_CHILD_DISPLAY_SUBMENU +DBUSMENU_MENUITEM_SHORTCUT_ALT +DBUSMENU_MENUITEM_SHORTCUT_CONTROL +DBUSMENU_MENUITEM_SHORTCUT_SHIFT +DBUSMENU_MENUITEM_SHORTCUT_SUPER DbusmenuMenuitem dbusmenu_menuitem_about_to_show_cb DbusmenuMenuitemClass @@ -87,6 +98,7 @@ dbusmenu_menuitem_get_root dbusmenu_menuitem_foreach dbusmenu_menuitem_handle_event dbusmenu_menuitem_send_about_to_show +dbusmenu_menuitem_show_to_user DBUSMENU_MENUITEM DBUSMENU_IS_MENUITEM @@ -104,6 +116,7 @@ DBUSMENU_SERVER_SIGNAL_ID_PROP_UPDATE DBUSMENU_SERVER_SIGNAL_ID_UPDATE DBUSMENU_SERVER_SIGNAL_LAYOUT_UPDATED DBUSMENU_SERVER_SIGNAL_LAYOUT_UPDATE +DBUSMENU_SERVER_SIGNAL_ITEM_ACTIVATION DBUSMENU_SERVER_PROP_DBUS_OBJECT DBUSMENU_SERVER_PROP_ROOT_NODE DBUSMENU_SERVER_PROP_VERSION -- cgit v1.2.3 From 907f54e3f0bc79fe69382600474b8a492c3223e4 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 11:59:00 -0600 Subject: Not parsing the generated XML header as well --- docs/libdbusmenu-glib/reference/Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/libdbusmenu-glib/reference/Makefile.am b/docs/libdbusmenu-glib/reference/Makefile.am index f86eb09..9ced07c 100644 --- a/docs/libdbusmenu-glib/reference/Makefile.am +++ b/docs/libdbusmenu-glib/reference/Makefile.am @@ -48,6 +48,7 @@ CFILE_GLOB=$(top_srcdir)/libdbusmenu-glib/*.c # Header files to ignore when scanning. # e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h IGNORE_HFILES= \ + dbus-menu-clean.xml.h \ client-menuitem.h \ menuitem-marshal.h \ server-marshal.h \ -- cgit v1.2.3 From 1a80d862c6ad5629e69893de3f27c42c9c8363f3 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 12:06:31 -0600 Subject: Dropping parents that are unused by gtk-doc --- libdbusmenu-glib/client.h | 1 - libdbusmenu-glib/server.h | 1 - 2 files changed, 2 deletions(-) diff --git a/libdbusmenu-glib/client.h b/libdbusmenu-glib/client.h index 79c0ee2..a8e0899 100644 --- a/libdbusmenu-glib/client.h +++ b/libdbusmenu-glib/client.h @@ -97,7 +97,6 @@ struct _DbusmenuClientClass { /** DbusmenuClient: - @parent: #GObject. The client for a #DbusmenuServer creating a shared object set of #DbusmenuMenuitem objects. diff --git a/libdbusmenu-glib/server.h b/libdbusmenu-glib/server.h index 5668258..d407ce4 100644 --- a/libdbusmenu-glib/server.h +++ b/libdbusmenu-glib/server.h @@ -93,7 +93,6 @@ struct _DbusmenuServerClass { /** DbusmenuServer: - @parent: #GObject A server which represents a sharing of a set of #DbusmenuMenuitems across DBus to a #DbusmenuClient. -- cgit v1.2.3 From e5b5c3a774b230e3c1175260f45d13625d50159b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 12:06:49 -0600 Subject: Making private subsections for private structures --- .../reference/libdbusmenu-glib-sections.txt | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt b/docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt index 8fa6c2a..5667075 100644 --- a/docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt +++ b/docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt @@ -25,10 +25,12 @@ dbusmenu_client_send_about_to_show DBUSMENU_CLIENT DBUSMENU_IS_CLIENT DBUSMENU_TYPE_CLIENT -dbusmenu_client_get_type DBUSMENU_CLIENT_CLASS DBUSMENU_IS_CLIENT_CLASS DBUSMENU_CLIENT_GET_CLASS + +DbusmenuClientPrivate +dbusmenu_client_get_type
@@ -66,6 +68,7 @@ DBUSMENU_MENUITEM_SHORTCUT_SHIFT DBUSMENU_MENUITEM_SHORTCUT_SUPER DbusmenuMenuitem dbusmenu_menuitem_about_to_show_cb +dbusmenu_menuitem_buildvariant_slot_t DbusmenuMenuitemClass dbusmenu_menuitem_new dbusmenu_menuitem_new_with_id @@ -103,10 +106,12 @@ dbusmenu_menuitem_show_to_user DBUSMENU_MENUITEM DBUSMENU_IS_MENUITEM DBUSMENU_TYPE_MENUITEM -dbusmenu_menuitem_get_type DBUSMENU_MENUITEM_CLASS DBUSMENU_IS_MENUITEM_CLASS DBUSMENU_MENUITEM_GET_CLASS + +DbusmenuMenuitemPrivate +dbusmenu_menuitem_get_type
@@ -128,10 +133,12 @@ dbusmenu_server_set_root DBUSMENU_SERVER DBUSMENU_IS_SERVER DBUSMENU_TYPE_SERVER -dbusmenu_server_get_type DBUSMENU_SERVER_CLASS DBUSMENU_IS_SERVER_CLASS DBUSMENU_SERVER_GET_CLASS + +DbusmenuServerPrivate +dbusmenu_server_get_type
@@ -145,9 +152,11 @@ dbusmenu_menuitem_proxy_get_wrapped DBUSMENU_MENUITEM_PROXY DBUSMENU_IS_MENUITEM_PROXY DBUSMENU_TYPE_MENUITEM_PROXY -dbusmenu_menuitem_proxy_get_type DBUSMENU_MENUITEM_PROXY_CLASS DBUSMENU_IS_MENUITEM_PROXY_CLASS DBUSMENU_MENUITEM_PROXY_GET_CLASS + +DbusmenuMenuitemProxyPrivate +dbusmenu_menuitem_proxy_get_type
-- cgit v1.2.3 From 75b874cd7464fc706e640be3f7d985f1da77a91a Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 12:36:56 -0600 Subject: Fixing all of the server docs --- libdbusmenu-glib/server.h | 47 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 4 deletions(-) diff --git a/libdbusmenu-glib/server.h b/libdbusmenu-glib/server.h index d407ce4..11ce085 100644 --- a/libdbusmenu-glib/server.h +++ b/libdbusmenu-glib/server.h @@ -43,14 +43,54 @@ G_BEGIN_DECLS #define DBUSMENU_IS_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DBUSMENU_TYPE_SERVER)) #define DBUSMENU_SERVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DBUSMENU_TYPE_SERVER, DbusmenuServerClass)) +/** + * DBUSMENU_SERVER_SIGNAL_ID_PROP_UPDATE: + * + * String to attach to signal #DbusmenuServer::item-property-updated + */ #define DBUSMENU_SERVER_SIGNAL_ID_PROP_UPDATE "item-property-updated" +/** + * DBUSMENU_SERVER_SIGNAL_ID_UPDATE: + * + * String to attach to signal #DbusmenuServer::item-updated + */ #define DBUSMENU_SERVER_SIGNAL_ID_UPDATE "item-updated" +/** + * DBUSMENU_SERVER_SIGNAL_LAYOUT_UPDATED: + * + * String to attach to signal #DbusmenuServer::layout-updated + */ #define DBUSMENU_SERVER_SIGNAL_LAYOUT_UPDATED "layout-updated" +/** + * DBUSMENU_SERVER_SIGNAL_ITEM_ACTIVATION: + * + * String to attach to signal #DbusmenuServer::item-activation-requested + */ #define DBUSMENU_SERVER_SIGNAL_ITEM_ACTIVATION "item-activation-requested" +/** + * DBUSMENU_SERVER_SIGNAL_LAYOUT_UPDATE: + * + * String to attach to signal #DbusmenuServer::layout-updated + */ #define DBUSMENU_SERVER_SIGNAL_LAYOUT_UPDATE DBUSMENU_SERVER_SIGNAL_LAYOUT_UPDATED +/** + * DBUSMENU_SERVER_PROP_DBUS_OBJECT: + * + * String to access property #DbusmenuServer:dbus-object + */ #define DBUSMENU_SERVER_PROP_DBUS_OBJECT "dbus-object" +/** + * DBUSMENU_SERVER_PROP_ROOT_NODE: + * + * String to access property #DbusmenuServer:root-node + */ #define DBUSMENU_SERVER_PROP_ROOT_NODE "root-node" +/** + * DBUSMENU_SERVER_PROP_VERSION: + * + * String to access property #DbusmenuServer:version + */ #define DBUSMENU_SERVER_PROP_VERSION "version" typedef struct _DbusmenuServerPrivate DbusmenuServerPrivate; @@ -61,8 +101,7 @@ typedef struct _DbusmenuServerPrivate DbusmenuServerPrivate; @id_prop_update: Slot for #DbusmenuServer::id-prop-update. @id_update: Slot for #DbusmenuServer::id-update. @layout_updated: Slot for #DbusmenuServer::layout-update. - @item_activation_requested: Slot for #DbusmenuServer::item-activation-requested. - + @item_activation: Slot for #DbusmenuServer::item-activation-requested. @reserved1: Reserved for future use. @reserved2: Reserved for future use. @reserved3: Reserved for future use. @@ -107,10 +146,10 @@ struct _DbusmenuServer { GType dbusmenu_server_get_type (void); DbusmenuServer * dbusmenu_server_new (const gchar * object); -void dbusmenu_server_set_root (DbusmenuServer * server, DbusmenuMenuitem * root); +void dbusmenu_server_set_root (DbusmenuServer * self, DbusmenuMenuitem * root); /** - SECIONT:server + SECTION:server @short_description: The server signals changed and updates on a tree of #DbusmenuMenuitem objecs. @stability: Unstable -- cgit v1.2.3 From c780c27de91ff7b36c25e50f11ccb051c6e8ac1d Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 12:55:10 -0600 Subject: Fixup documentation and move the private functions to a private header file --- libdbusmenu-glib/Makefile.am | 1 + libdbusmenu-glib/client-menuitem.c | 1 + libdbusmenu-glib/client-private.h | 48 +++++++++++++++++++++++++++ libdbusmenu-glib/client.c | 1 + libdbusmenu-glib/client.h | 67 +++++++++++++++++++++++++++++++++----- 5 files changed, 109 insertions(+), 9 deletions(-) create mode 100644 libdbusmenu-glib/client-private.h diff --git a/libdbusmenu-glib/Makefile.am b/libdbusmenu-glib/Makefile.am index 92de502..8c177f7 100644 --- a/libdbusmenu-glib/Makefile.am +++ b/libdbusmenu-glib/Makefile.am @@ -39,6 +39,7 @@ libdbusmenu_glib_la_SOURCES = \ client-marshal.c \ client-menuitem.h \ client-menuitem.c \ + client-private.h \ client.h \ client.c diff --git a/libdbusmenu-glib/client-menuitem.c b/libdbusmenu-glib/client-menuitem.c index b9e799f..60f8637 100644 --- a/libdbusmenu-glib/client-menuitem.c +++ b/libdbusmenu-glib/client-menuitem.c @@ -30,6 +30,7 @@ License version 3 and version 2.1 along with this program. If not, see #endif #include "client-menuitem.h" +#include "client-private.h" typedef struct _DbusmenuClientMenuitemPrivate DbusmenuClientMenuitemPrivate; diff --git a/libdbusmenu-glib/client-private.h b/libdbusmenu-glib/client-private.h new file mode 100644 index 0000000..f6df372 --- /dev/null +++ b/libdbusmenu-glib/client-private.h @@ -0,0 +1,48 @@ +/* +A library to communicate a menu object set accross DBus and +track updates and maintain consistency. + +Copyright 2011 Canonical Ltd. + +Authors: + Ted Gould + +This program is free software: you can redistribute it and/or modify it +under the terms of either or both of the following licenses: + +1) the GNU Lesser General Public License version 3, as published by the +Free Software Foundation; and/or +2) the GNU Lesser General Public License version 2.1, as published by +the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR +PURPOSE. See the applicable version of the GNU Lesser General Public +License for more details. + +You should have received a copy of both the GNU Lesser General Public +License version 3 and version 2.1 along with this program. If not, see + +*/ + +#ifndef __DBUSMENU_CLIENT_PRIVATE_H__ +#define __DBUSMENU_CLIENT_PRIVATE_H__ + +#include "client.h" + +G_BEGIN_DECLS + +void dbusmenu_client_send_event (DbusmenuClient * client, + gint id, + const gchar * name, + GVariant * variant, + guint timestamp); +void dbusmenu_client_send_about_to_show(DbusmenuClient * client, + gint id, + void (*cb) (gpointer user_data), + gpointer cb_data); + +G_END_DECLS + +#endif diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 0848294..ee1186b 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -33,6 +33,7 @@ License version 3 and version 2.1 along with this program. If not, see #include #include "client.h" +#include "client-private.h" #include "menuitem.h" #include "menuitem-private.h" #include "client-menuitem.h" diff --git a/libdbusmenu-glib/client.h b/libdbusmenu-glib/client.h index a8e0899..7bb0e6a 100644 --- a/libdbusmenu-glib/client.h +++ b/libdbusmenu-glib/client.h @@ -43,17 +43,71 @@ G_BEGIN_DECLS #define DBUSMENU_IS_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DBUSMENU_TYPE_CLIENT)) #define DBUSMENU_CLIENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DBUSMENU_TYPE_CLIENT, DbusmenuClientClass)) +/** + * DBUSMENU_CLIENT_SIGNAL_LAYOUT_UPDATED: + * + * String to attach to signal #DbusmenuClient::layout-updated + */ #define DBUSMENU_CLIENT_SIGNAL_LAYOUT_UPDATED "layout-updated" +/** + * DBUSMENU_CLIENT_SIGNAL_ROOT_CHANGED: + * + * String to attach to signal #DbusmenuClient::root-changed + */ #define DBUSMENU_CLIENT_SIGNAL_ROOT_CHANGED "root-changed" +/** + * DBUSMENU_CLIENT_SIGNAL_NEW_MENUITEM: + * + * String to attach to signal #DbusmenuClient::new-menuitem + */ #define DBUSMENU_CLIENT_SIGNAL_NEW_MENUITEM "new-menuitem" +/** + * DBUSMENU_CLIENT_SIGNAL_ITEM_ACTIVATE: + * + * String to attach to signal #DbusmenuClient::item-activate + */ #define DBUSMENU_CLIENT_SIGNAL_ITEM_ACTIVATE "item-activate" +/** + * DBUSMENU_CLIENT_SIGNAL_EVENT_RESULT: + * + * String to attach to signal #DbusmenuClient::event-result + */ #define DBUSMENU_CLIENT_SIGNAL_EVENT_RESULT "event-result" +/** + * DBUSMENU_CLIENT_PROP_DBUS_NAME: + * + * String to access property #DbusmenuClient:dbus-name + */ #define DBUSMENU_CLIENT_PROP_DBUS_NAME "dbus-name" +/** + * DBUSMENU_CLIENT_PROP_DBUS_OBJECT: + * + * String to access property #DbusmenuClient:dbus-object + */ #define DBUSMENU_CLIENT_PROP_DBUS_OBJECT "dbus-object" +/** + * DBUSMENU_CLIENT_TYPES_DEFAULT: + * + * Used to set the 'type' property on a menu item to create + * a standard menu item. + */ #define DBUSMENU_CLIENT_TYPES_DEFAULT "standard" +/** + * DBUSMENU_CLIENT_TYPES_SEPARATOR: + * + * Used to set the 'type' property on a menu item to create + * a separator menu item. + */ #define DBUSMENU_CLIENT_TYPES_SEPARATOR "separator" +/** + * DBUSMENU_CLIENT_TYPES_IMAGE: + * + * Used to set the 'type' property on a menu item to create + * an image menu item. Deprecated as standard menu items now + * support images as well. + */ #define DBUSMENU_CLIENT_TYPES_IMAGE "standard" typedef struct _DbusmenuClientPrivate DbusmenuClientPrivate; @@ -62,6 +116,7 @@ typedef struct _DbusmenuClientPrivate DbusmenuClientPrivate; DbusmenuClientClass: @parent_class: #GObjectClass @layout_updated: Slot for #DbusmenuClient::layout-updated. + @root_changed: Slot for #DbusmenuClient::root-changed. @new_menuitem: Slot for #DbusmenuClient::new-menuitem. @item_activate: Slot for #DbusmenuClient::item-activate. @event_result: Slot for #DbusmenuClient::event-error. @@ -118,6 +173,9 @@ struct _DbusmenuClient { The type handler is called when a dbusmenu item is created with a matching type as setup in #dbusmenu_client_add_type_handler + + Return value: #TRUE if the type has been handled. #FALSE if this + function was somehow unable to handle it. */ typedef gboolean (*DbusmenuClientTypeHandler) (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client, gpointer user_data); @@ -145,15 +203,6 @@ gboolean dbusmenu_client_add_type_handler_full (DbusmenuClient * cli DbusmenuClientTypeHandler newfunc, gpointer user_data, DbusmenuClientTypeDestroyHandler destroy_func); -void dbusmenu_client_send_event (DbusmenuClient * client, - gint id, - const gchar * name, - GVariant * variant, - guint timestamp); -void dbusmenu_client_send_about_to_show(DbusmenuClient * client, - gint id, - void (*cb) (gpointer user_data), - gpointer cb_data); /** SECTION:client -- cgit v1.2.3 From 8dd7c078b49bde9740eef51543e59392be8ceb31 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 12:55:27 -0600 Subject: Block client-private.h from the docs --- docs/libdbusmenu-glib/reference/Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/libdbusmenu-glib/reference/Makefile.am b/docs/libdbusmenu-glib/reference/Makefile.am index 9ced07c..76fdfb5 100644 --- a/docs/libdbusmenu-glib/reference/Makefile.am +++ b/docs/libdbusmenu-glib/reference/Makefile.am @@ -50,6 +50,7 @@ CFILE_GLOB=$(top_srcdir)/libdbusmenu-glib/*.c IGNORE_HFILES= \ dbus-menu-clean.xml.h \ client-menuitem.h \ + client-private.h \ menuitem-marshal.h \ server-marshal.h \ menuitem-private.h -- cgit v1.2.3 From 2b1ff29007f59ddebc9c00234ad1267894970365 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 13:10:37 -0600 Subject: Fixing menuitem proxy docs --- libdbusmenu-glib/menuitem-proxy.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/libdbusmenu-glib/menuitem-proxy.h b/libdbusmenu-glib/menuitem-proxy.h index 2a22efe..97d2741 100644 --- a/libdbusmenu-glib/menuitem-proxy.h +++ b/libdbusmenu-glib/menuitem-proxy.h @@ -67,7 +67,7 @@ struct _DbusmenuMenuitemProxyClass { }; /** - DbusmeneMenuitemProxy: + DbusmenuMenuitemProxy: @parent: The instance of #DbusmenuMenuitem Public instance data for a #DbusmenuMenuitemProxy. @@ -83,6 +83,17 @@ GType dbusmenu_menuitem_proxy_get_type (void); DbusmenuMenuitemProxy * dbusmenu_menuitem_proxy_new (DbusmenuMenuitem * mi); DbusmenuMenuitem * dbusmenu_menuitem_proxy_get_wrapped (DbusmenuMenuitemProxy * pmi); +/** + * SECTION:menuitem-proxy + * @short_description: A menuitem that proxies from another menuitem + * @stability: Unstable + * @include: libdbusmenu-glib/menuitem-proxy.h + * + * This small object allows for proxying all the properties from a remote + * menuitem to a new object that can be moved around appropriately within + * the new menu structure. + */ + G_END_DECLS #endif -- cgit v1.2.3 From 52380a969c8fcb140c35826a3bf55e8e835d65da Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 13:47:29 -0600 Subject: Fixing all the menuitem documentation --- libdbusmenu-glib/menuitem.c | 2 +- libdbusmenu-glib/menuitem.h | 194 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 192 insertions(+), 4 deletions(-) diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index c994130..919552e 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1142,7 +1142,7 @@ dbusmenu_menuitem_property_get_int (DbusmenuMenuitem * mi, const gchar * propert /** - * dbusmenu_menuitem_property_exit: + * dbusmenu_menuitem_property_exist: * @mi: The #DbusmenuMenuitem to look for the property on. * @property: The property to look for. * diff --git a/libdbusmenu-glib/menuitem.h b/libdbusmenu-glib/menuitem.h index afd6084..580c452 100644 --- a/libdbusmenu-glib/menuitem.h +++ b/libdbusmenu-glib/menuitem.h @@ -42,47 +42,231 @@ G_BEGIN_DECLS #define DBUSMENU_MENUITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DBUSMENU_TYPE_MENUITEM, DbusmenuMenuitemClass)) +/** + * DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED: + * + * String to attach to signal #DbusmenuServer::property-changed + */ #define DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED "property-changed" +/** + * DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED: + * + * String to attach to signal #DbusmenuServer::item-activated + */ #define DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED "item-activated" +/** + * DBUSMENU_MENUITEM_SIGNAL_CHILD_ADDED: + * + * String to attach to signal #DbusmenuServer::child-added + */ #define DBUSMENU_MENUITEM_SIGNAL_CHILD_ADDED "child-added" +/** + * DBUSMENU_MENUITEM_SIGNAL_CHILD_REMOVED: + * + * String to attach to signal #DbusmenuServer::child-removed + */ #define DBUSMENU_MENUITEM_SIGNAL_CHILD_REMOVED "child-removed" +/** + * DBUSMENU_MENUITEM_SIGNAL_CHILD_MOVED: + * + * String to attach to signal #DbusmenuServer::child-moved + */ #define DBUSMENU_MENUITEM_SIGNAL_CHILD_MOVED "child-moved" +/** + * DBUSMENU_MENUITEM_SIGNAL_REALIZED: + * + * String to attach to signal #DbusmenuServer::realized + */ #define DBUSMENU_MENUITEM_SIGNAL_REALIZED "realized" +/** + * DBUSMENU_MENUITEM_SIGNAL_REALIZED_ID: + * + * ID to attach to signal #DbusmenuServer::realized + */ #define DBUSMENU_MENUITEM_SIGNAL_REALIZED_ID (g_signal_lookup(DBUSMENU_MENUITEM_SIGNAL_REALIZED, DBUSMENU_TYPE_MENUITEM)) +/** + * DBUSMENU_MENUITEM_SIGNAL_SHOW_TO_USER: + * + * String to attach to signal #DbusmenuServer::show-to-user + */ #define DBUSMENU_MENUITEM_SIGNAL_SHOW_TO_USER "show-to-user" +/** + * DBUSMENU_MENUITEM_SIGNAL_ABOUT_TO_SHOW: + * + * String to attach to signal #DbusmenuServer::about-to-show + */ #define DBUSMENU_MENUITEM_SIGNAL_ABOUT_TO_SHOW "about-to-show" +/** + * DBUSMENU_MENUITEM_PROP_TYPE: + * + * #DbusmenuMenuitem property used to represent what type of menuitem + * this object represents. Type: #G_VARIANT_TYPE_STRING. + */ #define DBUSMENU_MENUITEM_PROP_TYPE "type" +/** + * DBUSMENU_MENUITEM_PROP_VISIBLE: + * + * #DbusmenuMenuitem property used to represent whether the menuitem + * should be shown or not. Type: #G_VARIANT_TYPE_BOOLEAN. + */ #define DBUSMENU_MENUITEM_PROP_VISIBLE "visible" +/** + * DBUSMENU_MENUITEM_PROP_ENABLED: + * + * #DbusmenuMenuitem property used to represent whether the menuitem + * is clickable or not. Type: #G_VARIANT_TYPE_BOOLEAN. + */ #define DBUSMENU_MENUITEM_PROP_ENABLED "enabled" +/** + * DBUSMENU_MENUITEM_PROP_LABEL: + * + * #DbusmenuMenuitem property used for the text on the menu item. + * Type: #G_VARIANT_TYPE_STRING + */ #define DBUSMENU_MENUITEM_PROP_LABEL "label" +/** + * DBUSMENU_MENUITEM_PROP_ICON_NAME: + * + * #DbusmenuMenuitem property that is the name of the icon under the + * Freedesktop.org icon naming spec. Type: #G_VARIANT_TYPE_STRING + */ #define DBUSMENU_MENUITEM_PROP_ICON_NAME "icon-name" +/** + * DBUSMENU_MENUITEM_PROP_ICON_DATA: + * + * #DbusmenuMenuitem property that is the raw data of a custom icon + * used in the application. Type: #G_VARIANT_TYPE_VARIANT + * + * It is recommended that this is not set directly but instead the + * libdbusmenu-gtk library is used with the function dbusmenu_menuitem_property_set_image() + */ #define DBUSMENU_MENUITEM_PROP_ICON_DATA "icon-data" +/** + * DBUSMENU_MENUITEM_PROP_TOGGLE_TYPE: + * + * #DbusmenuMenuitem property that says what type of toggle entry should + * be shown in the menu. Should be either #DBUSMENU_MENUITEM_TOGGLE_CHECK + * or #DBUSMENU_MENUITEM_TOGGLE_RADIO. Type: #G_VARIANT_TYPE_STRING + */ #define DBUSMENU_MENUITEM_PROP_TOGGLE_TYPE "toggle-type" +/** + * DBUSMENU_MENUITEM_PROP_TOGGLE_STATE: + * + * #DbusmenuMenuitem property that says what state a toggle entry should + * be shown as the menu. Should be either #DBUSMENU_MENUITEM_TOGGLE_STATE_UNCHECKED + * #DBUSMENU_MENUITEM_TOGGLE_STATE_CHECKED or #DBUSMENU_MENUITEM_TOGGLE_STATUE_UNKNOWN. + * Type: #G_VARIANT_TYPE_INT32 + */ #define DBUSMENU_MENUITEM_PROP_TOGGLE_STATE "toggle-state" +/** + * DBUSMENU_MENUITEM_PROP_SHORTCUT: + * + * #DbusmenuMenuitem property that is the entries that represent a shortcut + * to activate the menuitem. It is an array of arrays of strings. + * Type: #G_VARIANT_TYPE_ARRAY + * + * It is recommended that this is not set directly but instead the + * libdbusmenu-gtk library is used with the function dbusmenu_menuitem_property_set_shortcut() + */ #define DBUSMENU_MENUITEM_PROP_SHORTCUT "shortcut" +/** + * DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY: + * + * #DbusmenuMenuitem property that tells how the children of this menuitem + * should be displayed. Most likely this will be unset or of the value + * #DBUSMENU_MENUITEM_CHILD_DISPLAY_SUBMENU. Type: #G_VARIANT_TYPE_STRING + */ #define DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY "children-display" +/** + * DBUSMENU_MENUITEM_TOGGLE_CHECK: + * + * Used to set #DBUSMENU_MENUITEM_PROP_TOGGLE_TYPE to be a standard + * check mark item. + */ #define DBUSMENU_MENUITEM_TOGGLE_CHECK "checkmark" +/** + * DBUSMENU_MENUITEM_TOGGLE_RADIO: + * + * Used to set #DBUSMENU_MENUITEM_PROP_TOGGLE_TYPE to be a standard + * radio item. + */ #define DBUSMENU_MENUITEM_TOGGLE_RADIO "radio" +/** + * DBUSMENU_MENUITEM_TOGGLE_STATE_UNCHECKED: + * + * Used to set #DBUSMENU_MENUITEM_PROP_TOGGLE_STATE so that the menu's + * toggle item is empty. + */ #define DBUSMENU_MENUITEM_TOGGLE_STATE_UNCHECKED 0 +/** + * DBUSMENU_MENUITEM_TOGGLE_STATE_CHECKED: + * + * Used to set #DBUSMENU_MENUITEM_PROP_TOGGLE_STATE so that the menu's + * toggle item is filled. + */ #define DBUSMENU_MENUITEM_TOGGLE_STATE_CHECKED 1 +/** + * DBUSMENU_MENUITEM_TOGGLE_STATE_UNKNOWN: + * + * Used to set #DBUSMENU_MENUITEM_PROP_TOGGLE_STATE so that the menu's + * toggle item is undecided. + */ #define DBUSMENU_MENUITEM_TOGGLE_STATE_UNKNOWN -1 +/** + * DBUSMENU_MENUITEM_ICON_NAME_BLANK: + * + * Used to set #DBUSMENU_MENUITEM_PROP_TOGGLE_STATE so that the menu's + * toggle item is undecided. + */ #define DBUSMENU_MENUITEM_ICON_NAME_BLANK "blank-icon" +/** + * DBUSMENU_MENUITEM_SHORTCUT_CONTROL: + * + * Used in #DBUSMENU_MENUITEM_PROP_SHORTCUT to represent the + * control key. + */ #define DBUSMENU_MENUITEM_SHORTCUT_CONTROL "Control" +/** + * DBUSMENU_MENUITEM_SHORTCUT_ALT: + * + * Used in #DBUSMENU_MENUITEM_PROP_SHORTCUT to represent the + * alternate key. + */ #define DBUSMENU_MENUITEM_SHORTCUT_ALT "Alt" +/** + * DBUSMENU_MENUITEM_SHORTCUT_SHIFT: + * + * Used in #DBUSMENU_MENUITEM_PROP_SHORTCUT to represent the + * shift key. + */ #define DBUSMENU_MENUITEM_SHORTCUT_SHIFT "Shift" +/** + * DBUSMENU_MENUITEM_SHORTCUT_SUPER: + * + * Used in #DBUSMENU_MENUITEM_PROP_SHORTCUT to represent the + * super key. + */ #define DBUSMENU_MENUITEM_SHORTCUT_SUPER "Super" +/** + * DBUSMENU_MENUITEM_CHILD_DISPLAY_SUBMENU: + * + * Used in #DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY to have the + * subitems displayed as a submenu. + */ #define DBUSMENU_MENUITEM_CHILD_DISPLAY_SUBMENU "submenu" typedef struct _DbusmenuMenuitemPrivate DbusmenuMenuitemPrivate; /** * DbusmenuMenuitem: + * @parent: Parent object + * @priv: Private data * * This is the #GObject based object that represents a menu * item. It gets created the same on both the client and @@ -113,16 +297,18 @@ typedef void (*dbusmenu_menuitem_about_to_show_cb) (DbusmenuMenuitem * mi, gpoin /** * dbusmenu_menuitem_buildvariant_slot_t: * @mi: (in): Menu item that should be built from + * @properties: (allow none): A list of properties that should be the only ones in the resulting variant structure * * This is the function that is called to represent this menu item * as a variant. Should call it's own children. * - * Return value: (transfer full) A variant representing this item and it's children + * Return value: (transfer full): A variant representing this item and it's children */ typedef GVariant * (*dbusmenu_menuitem_buildvariant_slot_t) (DbusmenuMenuitem * mi, gchar ** properties); /** * DbusmenuMenuitemClass: + * @parent_class: Functions and signals from our parent * @property_changed: Slot for #DbusmenuMenuitem::property-changed. * @item_activated: Slot for #DbusmenuMenuitem::item-activated. * @child_added: Slot for #DbusmenuMenuitem::child-added. @@ -130,17 +316,19 @@ typedef GVariant * (*dbusmenu_menuitem_buildvariant_slot_t) (DbusmenuMenuitem * * @child_moved: Slot for #DbusmenuMenuitem::child-moved. * @realized: Slot for #DbusmenuMenuitem::realized. * @about_to_show: Slot for #DbusmenuMenuitem::about-to-show. - * @buildxml: Virtual function that appends the strings required to represent this menu item in the menu XML file. + * @buildvariant: Virtual function that appends the strings required to represent this menu item in the menu variant. * @handle_event: This function is to override how events are handled by subclasses. Look at #dbusmenu_menuitem_handle_event for lots of good information. * @send_about_to_show: Virtual function that notifies server that the client is about to show a menu. * @show_to_user: Slot for #DbusmenuMenuitem::show-to-user. - * * @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. + * + * Functions and signals that every menuitem should know something + * about. */ typedef struct _DbusmenuMenuitemClass DbusmenuMenuitemClass; struct _DbusmenuMenuitemClass -- cgit v1.2.3 From 59a57d84ef6e61976e2971a010f2b37405dad32f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 14:05:19 -0600 Subject: Removing the functions moved to the private header --- docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt b/docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt index 5667075..b6a6902 100644 --- a/docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt +++ b/docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt @@ -19,8 +19,6 @@ dbusmenu_client_new dbusmenu_client_get_root dbusmenu_client_add_type_handler dbusmenu_client_add_type_handler_full -dbusmenu_client_send_event -dbusmenu_client_send_about_to_show DBUSMENU_CLIENT DBUSMENU_IS_CLIENT -- cgit v1.2.3 From 2a43ac2e5df3272f8db2a4a4c6878e10a0011c57 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 14:07:39 -0600 Subject: Removing some items that it said I needed before... I swear, constantly. --- libdbusmenu-glib/client-menuitem.h | 4 ---- libdbusmenu-glib/menuitem-proxy.h | 1 - 2 files changed, 5 deletions(-) diff --git a/libdbusmenu-glib/client-menuitem.h b/libdbusmenu-glib/client-menuitem.h index 2692192..a89cb11 100644 --- a/libdbusmenu-glib/client-menuitem.h +++ b/libdbusmenu-glib/client-menuitem.h @@ -35,10 +35,6 @@ License version 3 and version 2.1 along with this program. If not, see G_BEGIN_DECLS -/** - * DBUSMENU_TYPE_CLIENT_MENUITEM: - * Macro to get the #GType value for #DbusmenuClientMenuitem object - */ #define DBUSMENU_TYPE_CLIENT_MENUITEM (dbusmenu_client_menuitem_get_type ()) #define DBUSMENU_CLIENT_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DBUSMENU_TYPE_CLIENT_MENUITEM, DbusmenuClientMenuitem)) #define DBUSMENU_CLIENT_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DBUSMENU_TYPE_CLIENT_MENUITEM, DbusmenuClientMenuitemClass)) diff --git a/libdbusmenu-glib/menuitem-proxy.h b/libdbusmenu-glib/menuitem-proxy.h index 97d2741..ee988d8 100644 --- a/libdbusmenu-glib/menuitem-proxy.h +++ b/libdbusmenu-glib/menuitem-proxy.h @@ -68,7 +68,6 @@ struct _DbusmenuMenuitemProxyClass { /** DbusmenuMenuitemProxy: - @parent: The instance of #DbusmenuMenuitem Public instance data for a #DbusmenuMenuitemProxy. */ -- cgit v1.2.3 From 66c6983d3f810c65b90483bfa736cef53e8b50af Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 14:09:33 -0600 Subject: Adding in a deprecated section --- docs/libdbusmenu-glib/reference/libdbusmenu-glib-docs.sgml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/libdbusmenu-glib/reference/libdbusmenu-glib-docs.sgml b/docs/libdbusmenu-glib/reference/libdbusmenu-glib-docs.sgml index ecc25a3..16ed624 100644 --- a/docs/libdbusmenu-glib/reference/libdbusmenu-glib-docs.sgml +++ b/docs/libdbusmenu-glib/reference/libdbusmenu-glib-docs.sgml @@ -28,6 +28,10 @@ API Index + + Deprecated API Index + + -- cgit v1.2.3 From df0a25db8fe93989c3175b4c05e1febc14da5baa Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 14:13:29 -0600 Subject: Use the documented API here --- libdbusmenu-gtk/menu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdbusmenu-gtk/menu.c b/libdbusmenu-gtk/menu.c index c2720ac..0b31069 100644 --- a/libdbusmenu-gtk/menu.c +++ b/libdbusmenu-gtk/menu.c @@ -103,7 +103,7 @@ menu_focus_cb(DbusmenuGtkMenu * menu, gpointer userdata) if (priv->client != NULL) { /* TODO: We should stop the display of the menu until the about to show call returns. */ - dbusmenu_client_send_about_to_show(DBUSMENU_CLIENT(priv->client), 0, NULL, NULL); + dbusmenu_menuitem_send_about_to_show(priv->root, NULL, NULL); } return; } -- cgit v1.2.3 From e1c6f6e1ff157b43e1f07db384880749daa278c0 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 14:14:56 -0600 Subject: Fixing allow annotation --- libdbusmenu-glib/menuitem.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdbusmenu-glib/menuitem.h b/libdbusmenu-glib/menuitem.h index 580c452..4a1c156 100644 --- a/libdbusmenu-glib/menuitem.h +++ b/libdbusmenu-glib/menuitem.h @@ -297,7 +297,7 @@ typedef void (*dbusmenu_menuitem_about_to_show_cb) (DbusmenuMenuitem * mi, gpoin /** * dbusmenu_menuitem_buildvariant_slot_t: * @mi: (in): Menu item that should be built from - * @properties: (allow none): A list of properties that should be the only ones in the resulting variant structure + * @properties: (allow-none): A list of properties that should be the only ones in the resulting variant structure * * This is the function that is called to represent this menu item * as a variant. Should call it's own children. -- cgit v1.2.3 From 00149bf958d0e4d05710eb261a22461905f651fc Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 14:19:51 -0600 Subject: Ensuring we don't have an GenericMenuItem in the docs --- libdbusmenu-gtk/genericmenuitem.c | 2 +- libdbusmenu-gtk/genericmenuitem.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libdbusmenu-gtk/genericmenuitem.c b/libdbusmenu-gtk/genericmenuitem.c index 2fd6fba..3652ceb 100644 --- a/libdbusmenu-gtk/genericmenuitem.c +++ b/libdbusmenu-gtk/genericmenuitem.c @@ -32,7 +32,7 @@ License version 3 and version 2.1 along with this program. If not, see #include "genericmenuitem.h" -/** +/* GenericmenuitemPrivate: @check_type: What type of check we have, or none at all. @state: What the state of our check is. diff --git a/libdbusmenu-gtk/genericmenuitem.h b/libdbusmenu-gtk/genericmenuitem.h index 3c4af0c..5e3c640 100644 --- a/libdbusmenu-gtk/genericmenuitem.h +++ b/libdbusmenu-gtk/genericmenuitem.h @@ -48,7 +48,7 @@ typedef struct _GenericmenuitemPrivate GenericmenuitemPrivate; typedef enum _GenericmenuitemCheckType GenericmenuitemCheckType; typedef enum _GenericmenuitemState GenericmenuitemState; -/** +/* GenericmenuitemClass: @parent_class: Our parent #GtkCheckMenuItemClass */ @@ -56,7 +56,7 @@ struct _GenericmenuitemClass { GtkCheckMenuItemClass parent_class; }; -/** +/* Genericmenuitem: @parent: Our parent #GtkCheckMenuItem */ -- cgit v1.2.3 From a37c964968ca691112578450fa8c9884ff425ac9 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 14:20:05 -0600 Subject: Only one version of the docs, just two builds. --- docs/libdbusmenu-gtk/reference/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/libdbusmenu-gtk/reference/Makefile.am b/docs/libdbusmenu-gtk/reference/Makefile.am index be9f69c..e06dc17 100644 --- a/docs/libdbusmenu-gtk/reference/Makefile.am +++ b/docs/libdbusmenu-gtk/reference/Makefile.am @@ -16,7 +16,7 @@ AUTOMAKE_OPTIONS = 1.6 # of using the various options. # The name of the module, e.g. 'glib'. -DOC_MODULE=libdbusmenu-gtk$(VER) +DOC_MODULE=libdbusmenu-gtk # The top-level SGML file. You can change this if you want to. DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml -- cgit v1.2.3 From d5a31aa00e8647970c8a8e07646cf593f4d991f3 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 14:25:43 -0600 Subject: Adding a sections file that's all cleaned up. --- .../reference/libdbusmenu-gtk-sections.txt | 76 ++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 docs/libdbusmenu-gtk/reference/libdbusmenu-gtk-sections.txt diff --git a/docs/libdbusmenu-gtk/reference/libdbusmenu-gtk-sections.txt b/docs/libdbusmenu-gtk/reference/libdbusmenu-gtk-sections.txt new file mode 100644 index 0000000..5530c07 --- /dev/null +++ b/docs/libdbusmenu-gtk/reference/libdbusmenu-gtk-sections.txt @@ -0,0 +1,76 @@ +
+client +DbusmenuGtkClient +DBUSMENU_GTKCLIENT_SIGNAL_ROOT_CHANGED +DbusmenuGtkClientClass +dbusmenu_gtkclient_new +dbusmenu_gtkclient_menuitem_get +dbusmenu_gtkclient_menuitem_get_submenu +dbusmenu_gtkclient_set_accel_group +dbusmenu_gtkclient_get_accel_group +dbusmenu_gtkclient_newitem_base + +DBUSMENU_GTKCLIENT +DBUSMENU_IS_GTKCLIENT +DBUSMENU_GTKCLIENT_CLASS +DBUSMENU_IS_GTKCLIENT_CLASS +DBUSMENU_GTKCLIENT_GET_CLASS + +DBUSMENU_GTKCLIENT_TYPE +dbusmenu_gtkclient_get_type +DbusmenuGtkClientPrivate +
+ +
+serializablemenuitem +DbusmenuGtkSerializableMenuItem +DBUSMENU_GTK_SERIALIZABLE_MENU_ITEM_PROP_MENUITEM +DbusmenuGtkSerializableMenuItemClass +dbusmenu_gtk_serializable_menu_item_build_menuitem +dbusmenu_gtk_serializable_menu_item_register_to_client +dbusmenu_gtk_serializable_menu_item_set_menuitem + +DBUSMENU_GTK_SERIALIZABLE_MENU_ITEM +DBUSMENU_IS_GTK_SERIALIZABLE_MENU_ITEM +DBUSMENU_GTK_SERIALIZABLE_MENU_ITEM_CLASS +DBUSMENU_IS_GTK_SERIALIZABLE_MENU_ITEM_CLASS +DBUSMENU_GTK_SERIALIZABLE_MENU_ITEM_GET_CLASS + +DBUSMENU_TYPE_GTK_SERIALIZABLE_MENU_ITEM +dbusmenu_gtk_serializable_menu_item_get_type +DbusmenuGtkSerializableMenuItemPrivate +
+ +
+menu +DbusmenuGtkMenu +DbusmenuGtkMenuClass +dbusmenu_gtkmenu_new +dbusmenu_gtkmenu_get_client + +DBUSMENU_GTKMENU +DBUSMENU_IS_GTKMENU +DBUSMENU_GTKMENU_CLASS +DBUSMENU_IS_GTKMENU_CLASS +DBUSMENU_GTKMENU_GET_CLASS + +dbusmenu_gtkmenu_get_type +DBUSMENU_GTKMENU_TYPE +DbusmenuGtkMenuPrivate +
+ +
+menuitem +dbusmenu_menuitem_property_set_image +dbusmenu_menuitem_property_get_image +dbusmenu_menuitem_property_set_shortcut +dbusmenu_menuitem_property_set_shortcut_string +dbusmenu_menuitem_property_set_shortcut_menuitem +dbusmenu_menuitem_property_get_shortcut +
+ +
+parser +dbusmenu_gtk_parse_menu_structure +
+ -- cgit v1.2.3 From ed667bade52f8f4f4e388931eaa6b41a11cf7692 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 14:36:22 -0600 Subject: Fixing up the client documentation --- libdbusmenu-gtk/client.h | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/libdbusmenu-gtk/client.h b/libdbusmenu-gtk/client.h index c986a5d..75b59a0 100644 --- a/libdbusmenu-gtk/client.h +++ b/libdbusmenu-gtk/client.h @@ -41,20 +41,28 @@ G_BEGIN_DECLS #define DBUSMENU_IS_GTKCLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DBUSMENU_GTKCLIENT_TYPE)) #define DBUSMENU_GTKCLIENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DBUSMENU_GTKCLIENT_TYPE, DbusmenuGtkClientClass)) +/** + * DBUSMENU_GTKCLIENT_SIGNAL_ROOT_CHANGED: + * + * String to attach to signal #DbusmenuClient::root-changed + */ #define DBUSMENU_GTKCLIENT_SIGNAL_ROOT_CHANGED DBUSMENU_CLIENT_SIGNAL_ROOT_CHANGED typedef struct _DbusmenuGtkClientPrivate DbusmenuGtkClientPrivate; /** - DbusmenuGtkClientClass: - @parent_class: #GtkMenuClass - @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. -*/ + * DbusmenuGtkClientClass: + * @parent_class: #GtkMenuClass + * @root_changed: Slot for signal #DbusmenuGtkClient::root-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. + * + * Functions and signal slots for using a #DbusmenuGtkClient + */ typedef struct _DbusmenuGtkClientClass DbusmenuGtkClientClass; struct _DbusmenuGtkClientClass { DbusmenuClientClass parent_class; @@ -72,9 +80,11 @@ struct _DbusmenuGtkClientClass { }; /** - DbusmenuGtkClient: - @parent: #GtkMenu -*/ + * DbusmenuGtkClient: + * + * A subclass of #DbusmenuClient to add functionality with regarding + * building GTK items out of the abstract tree. + */ typedef struct _DbusmenuGtkClient DbusmenuGtkClient; struct _DbusmenuGtkClient { DbusmenuClient parent; @@ -94,10 +104,10 @@ GtkAccelGroup * dbusmenu_gtkclient_get_accel_group (DbusmenuGtkClient * client); void dbusmenu_gtkclient_newitem_base (DbusmenuGtkClient * client, DbusmenuMenuitem * item, GtkMenuItem * gmi, DbusmenuMenuitem * parent); /** - SECTION:gtkmenu - @short_description: A GTK Menu Object that syncronizes over DBus + SECTION:client + @short_description: A subclass of #DbusmenuClient adding GTK level features @stability: Unstable - @include: libdbusmenu-gtk/menu.h + @include: libdbusmenu-gtk/client.h In general, this is just a #GtkMenu, why else would you care? Oh, because this menu is created by someone else on a server that exists @@ -115,8 +125,6 @@ void dbusmenu_gtkclient_newitem_base (DbusmenuGtkClient * client, DbusmenuMenuit number of entries change, the menus change, if they change thier properties change, they update in the items. All of this should be handled transparently to the user of this object. - - TODO: Document properties. */ G_END_DECLS -- cgit v1.2.3 From 78af8e0d32774fe921711c149d2c83c210054e2d Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 14:36:34 -0600 Subject: Adding the root structure to the sections docs --- docs/libdbusmenu-gtk/reference/libdbusmenu-gtk-sections.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/libdbusmenu-gtk/reference/libdbusmenu-gtk-sections.txt b/docs/libdbusmenu-gtk/reference/libdbusmenu-gtk-sections.txt index 5530c07..77101f7 100644 --- a/docs/libdbusmenu-gtk/reference/libdbusmenu-gtk-sections.txt +++ b/docs/libdbusmenu-gtk/reference/libdbusmenu-gtk-sections.txt @@ -2,6 +2,7 @@ client DbusmenuGtkClient DBUSMENU_GTKCLIENT_SIGNAL_ROOT_CHANGED +DbusmenuGtkClient DbusmenuGtkClientClass dbusmenu_gtkclient_new dbusmenu_gtkclient_menuitem_get -- cgit v1.2.3 From f946dbac76e5f4fd1cc9a4a9ed8b4712aaf3e935 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 14:40:44 -0600 Subject: Fixing the dbusmenu gtk menu docs --- libdbusmenu-gtk/menu.h | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/libdbusmenu-gtk/menu.h b/libdbusmenu-gtk/menu.h index 896e466..c413ab8 100644 --- a/libdbusmenu-gtk/menu.h +++ b/libdbusmenu-gtk/menu.h @@ -45,15 +45,18 @@ G_BEGIN_DECLS typedef struct _DbusmenuGtkMenuPrivate DbusmenuGtkMenuPrivate; /** - DbusmenuGtkMenuClass: - @parent_class: #GtkMenuClass - @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. -*/ + * DbusmenuGtkMenuClass: + * @parent_class: #GtkMenuClass + * @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. + * + * All of the subclassable functions and signal slots for a + * #DbusmenuGtkMenu. + */ typedef struct _DbusmenuGtkMenuClass DbusmenuGtkMenuClass; struct _DbusmenuGtkMenuClass { GtkMenuClass parent_class; @@ -68,9 +71,11 @@ struct _DbusmenuGtkMenuClass { }; /** - DbusmenuGtkMenu: - @parent: #GtkMenu -*/ + * DbusmenuGtkMenu: + * + * A #GtkMenu that is built using an abstract tree built from + * a #DbusmenuGtkClient. + */ typedef struct _DbusmenuGtkMenu DbusmenuGtkMenu; struct _DbusmenuGtkMenu { GtkMenu parent; @@ -84,7 +89,7 @@ DbusmenuGtkMenu * dbusmenu_gtkmenu_new (gchar * dbus_name, gchar * dbus_object); DbusmenuGtkClient * dbusmenu_gtkmenu_get_client (DbusmenuGtkMenu * menu); /** - SECTION:gtkmenu + SECTION:menu @short_description: A GTK Menu Object that syncronizes over DBus @stability: Unstable @include: libdbusmenu-gtk/menu.h @@ -105,8 +110,6 @@ DbusmenuGtkClient * dbusmenu_gtkmenu_get_client (DbusmenuGtkMenu * menu); number of entries change, the menus change, if they change thier properties change, they update in the items. All of this should be handled transparently to the user of this object. - - TODO: Document properties. */ G_END_DECLS -- cgit v1.2.3 From 33fa8790605ea379ccfad8fa940f92af6810feb3 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 14:52:13 -0600 Subject: Adding sections and a little bit of docs to get everything up-to-date. --- libdbusmenu-gtk/menuitem.h | 11 +++++++++++ libdbusmenu-gtk/parser.h | 14 ++++++++++++++ libdbusmenu-gtk/serializablemenuitem.h | 18 ++++++++++++++++++ 3 files changed, 43 insertions(+) diff --git a/libdbusmenu-gtk/menuitem.h b/libdbusmenu-gtk/menuitem.h index 6f009df..41f2187 100644 --- a/libdbusmenu-gtk/menuitem.h +++ b/libdbusmenu-gtk/menuitem.h @@ -45,6 +45,17 @@ gboolean dbusmenu_menuitem_property_set_shortcut_string (DbusmenuMenuitem * menu gboolean dbusmenu_menuitem_property_set_shortcut_menuitem (DbusmenuMenuitem * menuitem, const GtkMenuItem * gmi); void dbusmenu_menuitem_property_get_shortcut (DbusmenuMenuitem * menuitem, guint * key, GdkModifierType * modifier); +/** + SECTION:menuitem + @short_description: Helpers for #DbusmenuMenuitem properties that require a GTK dependency + @stability: Unstable + @include: libdbusmenu-gtk/menuitem.h + + Some property helpers can't be done without picking up a GTK+ + dependency. So those sit in libdbusmenu-gtk but have very similar + prototypes to the code in libdbusmenu-glib so your code will + look consistent, just with the extra depedency. +*/ G_END_DECLS #endif diff --git a/libdbusmenu-gtk/parser.h b/libdbusmenu-gtk/parser.h index a40d709..8187a8e 100644 --- a/libdbusmenu-gtk/parser.h +++ b/libdbusmenu-gtk/parser.h @@ -32,6 +32,20 @@ License version 3 and version 2.1 along with this program. If not, see #include #include +G_BEGIN_DECLS + DbusmenuMenuitem * dbusmenu_gtk_parse_menu_structure (GtkWidget * widget); +/** + SECTION:parser + @short_description: A parser of in-memory GTK menu trees + @stability: Unstable + @include: libdbusmenu-gtk/parser.h + + The parser will take a GTK menu tree and attach it to a Dbusmenu menu + tree. Along with setting up all the signals for updates and destruction. + The returned item would be the root item of the given tree. +*/ +G_END_DECLS + #endif /* DBUSMENU_GTK_PARSER_H__ */ diff --git a/libdbusmenu-gtk/serializablemenuitem.h b/libdbusmenu-gtk/serializablemenuitem.h index db28a24..9bea89f 100644 --- a/libdbusmenu-gtk/serializablemenuitem.h +++ b/libdbusmenu-gtk/serializablemenuitem.h @@ -44,6 +44,11 @@ G_BEGIN_DECLS #define DBUSMENU_IS_GTK_SERIALIZABLE_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DBUSMENU_TYPE_GTK_SERIALIZABLE_MENU_ITEM)) #define DBUSMENU_GTK_SERIALIZABLE_MENU_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DBUSMENU_TYPE_GTK_SERIALIZABLE_MENU_ITEM, DbusmenuGtkSerializableMenuItemClass)) +/** + * DBUSMENU_GTK_SERIALIZABLE_MENU_ITEM_PROP_MENUITEM: + * + * String to access property #DbusmenuGtkSerializableMenuItem:dbusmenu-menuitem + */ #define DBUSMENU_GTK_SERIALIZABLE_MENU_ITEM_PROP_MENUITEM "dbusmenu-menuitem" typedef struct _DbusmenuGtkSerializableMenuItem DbusmenuGtkSerializableMenuItem; @@ -62,6 +67,8 @@ typedef struct _DbusmenuGtkSerializableMenuItemPrivate DbusmenuGtkSerializableMe @_dbusmenu_gtk_serializable_menu_item_reserved4: Reserved for future use. @_dbusmenu_gtk_serializable_menu_item_reserved5: Reserved for future use. @_dbusmenu_gtk_serializable_menu_item_reserved6: Reserved for future use. + + Signals and functions for #DbusmenuGtkSerializableMenuItem. */ struct _DbusmenuGtkSerializableMenuItemClass { GtkMenuItemClass parent_class; @@ -110,6 +117,17 @@ DbusmenuMenuitem * dbusmenu_gtk_serializable_menu_item_build_menuitem (Dbusmenu void dbusmenu_gtk_serializable_menu_item_register_to_client (DbusmenuClient * client, GType item_type); void dbusmenu_gtk_serializable_menu_item_set_menuitem (DbusmenuGtkSerializableMenuItem * smi, DbusmenuMenuitem * mi); +/** + SECTION:serializablemenuitem + @short_description: A way to build #GtkMenuItems that can be sent over Dbusmenu + @stability: Unstable + @include: libdbusmenu-gtk/serializablemenuitem.h + + Menuitems can subclass from this instead of #GtkMenuItem and + by providing the appropriate functions Dbusmenu will be able + to parse them and send them over the bus. +*/ + G_END_DECLS #endif -- cgit v1.2.3 From 5081c0995ec364ef685af221dab871d4bd7e04e9 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 14:55:01 -0600 Subject: Fixing the sections in the base doc --- docs/libdbusmenu-gtk/reference/libdbusmenu-gtk-docs.sgml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/libdbusmenu-gtk/reference/libdbusmenu-gtk-docs.sgml b/docs/libdbusmenu-gtk/reference/libdbusmenu-gtk-docs.sgml index ec6b82f..e9020de 100644 --- a/docs/libdbusmenu-gtk/reference/libdbusmenu-gtk-docs.sgml +++ b/docs/libdbusmenu-gtk/reference/libdbusmenu-gtk-docs.sgml @@ -11,9 +11,10 @@ API - - + + + @@ -25,6 +26,10 @@ API Index + + Deprecated API Index + + -- cgit v1.2.3 From c1506b101d22d01dad63da90683e9a13a4e2dac0 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 15:11:49 -0600 Subject: Make sure to run the check in the source directory. --- docs/libdbusmenu-glib/reference/Makefile.am | 10 +++++++++- docs/libdbusmenu-gtk/reference/Makefile.am | 9 ++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/docs/libdbusmenu-glib/reference/Makefile.am b/docs/libdbusmenu-glib/reference/Makefile.am index 76fdfb5..1c8dfa8 100644 --- a/docs/libdbusmenu-glib/reference/Makefile.am +++ b/docs/libdbusmenu-glib/reference/Makefile.am @@ -89,5 +89,13 @@ EXTRA_DIST += version.xml.in #DISTCLEANFILES += # Comment this out if you want your docs-status tested during 'make check' -TESTS = $(GTKDOC_CHECK) +TESTS = gtkdoc-in-srcdir + +gtkdoc-in-srcdir: Makefile.am + @echo "#!/bin/sh" > $@ + @echo "cd \"$(srcdir)\"" >> $@ + @echo "$(GTKDOC_CHECK)" >> $@ + @chmod +x $@ + +DISTCLEANFILES = gtkdoc-in-srcdir diff --git a/docs/libdbusmenu-gtk/reference/Makefile.am b/docs/libdbusmenu-gtk/reference/Makefile.am index e06dc17..06d0009 100644 --- a/docs/libdbusmenu-gtk/reference/Makefile.am +++ b/docs/libdbusmenu-gtk/reference/Makefile.am @@ -90,5 +90,12 @@ EXTRA_DIST += version.xml.in #DISTCLEANFILES += # Comment this out if you want your docs-status tested during 'make check' -TESTS = $(GTKDOC_CHECK) +TESTS = gtkdoc-in-srcdir +gtkdoc-in-srcdir: Makefile.am + @echo "#!/bin/sh" > $@ + @echo "cd \"$(srcdir)\"" >> $@ + @echo "$(GTKDOC_CHECK)" >> $@ + @chmod +x $@ + +DISTCLEANFILES = gtkdoc-in-srcdir -- cgit v1.2.3 From e9e03b2d8a92adf458dc7b0dd849d99c36e77492 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 15:34:51 -0600 Subject: Adding in a defaults object --- .bzrignore | 1 + libdbusmenu-glib/Makefile.am | 2 ++ libdbusmenu-glib/defaults.c | 49 ++++++++++++++++++++++++++++++++++++++++++++ libdbusmenu-glib/defaults.h | 31 ++++++++++++++++++++++++++++ 4 files changed, 83 insertions(+) create mode 100644 libdbusmenu-glib/defaults.c create mode 100644 libdbusmenu-glib/defaults.h diff --git a/.bzrignore b/.bzrignore index 39be2d5..c5cc6ff 100644 --- a/.bzrignore +++ b/.bzrignore @@ -227,3 +227,4 @@ libdbusmenu-gtk/libdbusmenu_gtk_la-parser.lo test-gtk-parser test-gtk-parser-test test-gtk-parser.xml +libdbusmenu-glib/libdbusmenu_glib_la-defaults.lo diff --git a/libdbusmenu-glib/Makefile.am b/libdbusmenu-glib/Makefile.am index 92de502..5ddbeb8 100644 --- a/libdbusmenu-glib/Makefile.am +++ b/libdbusmenu-glib/Makefile.am @@ -24,6 +24,8 @@ libdbusmenu_glibinclude_HEADERS = \ libdbusmenu_glib_la_SOURCES = \ dbus-menu-clean.xml.h \ dbus-menu-clean.xml.c \ + defaults.h \ + defaults.c \ menuitem.h \ menuitem.c \ menuitem-marshal.h \ diff --git a/libdbusmenu-glib/defaults.c b/libdbusmenu-glib/defaults.c new file mode 100644 index 0000000..cbd9bfa --- /dev/null +++ b/libdbusmenu-glib/defaults.c @@ -0,0 +1,49 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "defaults.h" + +typedef struct _DbusmenuDefaultsPrivate DbusmenuDefaultsPrivate; + +struct _DbusmenuDefaultsPrivate +{ +}; + +#define DBUSMENU_DEFAULTS_GET_PRIVATE(o) \ +(G_TYPE_INSTANCE_GET_PRIVATE ((o), DBUSMENU_DEFAULTS_TYPE, DbusmenuDefaultsPrivate)) + +static void dbusmenu_defaults_class_init (DbusmenuDefaultsClass *klass); +static void dbusmenu_defaults_init (DbusmenuDefaults *self); +static void dbusmenu_defaults_dispose (GObject *object); +static void dbusmenu_defaults_finalize (GObject *object); + +G_DEFINE_TYPE (DbusmenuDefaults, dbusmenu_defaults, G_TYPE_OBJECT); + +static void +dbusmenu_defaults_class_init (DbusmenuDefaultsClass *klass) +{ +GObjectClass *object_class = G_OBJECT_CLASS (klass); + +g_type_class_add_private (klass, sizeof (DbusmenuDefaultsPrivate)); + +object_class->dispose = dbusmenu_defaults_dispose; +object_class->finalize = dbusmenu_defaults_finalize; +} + +static void +dbusmenu_defaults_init (DbusmenuDefaults *self) +{ +} + +static void +dbusmenu_defaults_dispose (GObject *object) +{ +G_OBJECT_CLASS (dbusmenu_defaults_parent_class)->dispose (object); +} + +static void +dbusmenu_defaults_finalize (GObject *object) +{ +G_OBJECT_CLASS (dbusmenu_defaults_parent_class)->finalize (object); +} diff --git a/libdbusmenu-glib/defaults.h b/libdbusmenu-glib/defaults.h new file mode 100644 index 0000000..a440371 --- /dev/null +++ b/libdbusmenu-glib/defaults.h @@ -0,0 +1,31 @@ +#ifndef __DBUSMENU_DEFAULTS_H__ +#define __DBUSMENU_DEFAULTS_H__ + +#include +#include + +G_BEGIN_DECLS + +#define DBUSMENU_TYPE_DEFAULTS (dbusmenu_defaults_get_type ()) +#define DBUSMENU_DEFAULTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DBUSMENU_TYPE_DEFAULTS, DbusmenuDefaults)) +#define DBUSMENU_DEFAULTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DBUSMENU_TYPE_DEFAULTS, DbusmenuDefaultsClass)) +#define IS_DBUSMENU_DEFAULTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DBUSMENU_TYPE_DEFAULTS)) +#define IS_DBUSMENU_DEFAULTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DBUSMENU_TYPE_DEFAULTS)) +#define DBUSMENU_DEFAULTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DBUSMENU_TYPE_DEFAULTS, DbusmenuDefaultsClass)) + +typedef struct _DbusmenuDefaults DbusmenuDefaults; +typedef struct _DbusmenuDefaultsClass DbusmenuDefaultsClass; + +struct _DbusmenuDefaultsClass { + GObjectClass parent_class; +}; + +struct _DbusmenuDefaults { + GObject parent; +}; + +GType dbusmenu_defaults_get_type (void); + +G_END_DECLS + +#endif -- cgit v1.2.3 From cb9011e136912751fb01d2107435e3422863cbdc Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 15:42:08 -0600 Subject: Setting up the private and some base documentation --- libdbusmenu-glib/defaults.h | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/libdbusmenu-glib/defaults.h b/libdbusmenu-glib/defaults.h index a440371..9cd03fa 100644 --- a/libdbusmenu-glib/defaults.h +++ b/libdbusmenu-glib/defaults.h @@ -13,18 +13,34 @@ G_BEGIN_DECLS #define IS_DBUSMENU_DEFAULTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DBUSMENU_TYPE_DEFAULTS)) #define DBUSMENU_DEFAULTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DBUSMENU_TYPE_DEFAULTS, DbusmenuDefaultsClass)) -typedef struct _DbusmenuDefaults DbusmenuDefaults; -typedef struct _DbusmenuDefaultsClass DbusmenuDefaultsClass; - +typedef struct _DbusmenuDefaults DbusmenuDefaults; +typedef struct _DbusmenuDefaultsClass DbusmenuDefaultsClass; +typedef struct _DbusmenuDefaultsPrivate DbusmenuDefaultsPrivate; + +/** + * DbusmenuDefaultsClass: + * + * All of the signals and functions for #DbusmenuDefaults + */ struct _DbusmenuDefaultsClass { GObjectClass parent_class; }; +/** + * DbusmenuDefaults: + * + * A singleton to hold all of the defaults for the menuitems + * so they can use those easily. + */ struct _DbusmenuDefaults { GObject parent; + + /*< Private >*/ + DbusmenuDefaultsPrivate * priv; }; -GType dbusmenu_defaults_get_type (void); +GType dbusmenu_defaults_get_type (void); +DbusmenuDefaults * dbusmenu_defaults_ref_default (void); G_END_DECLS -- cgit v1.2.3 From 4f8113b14cbba9ef88b46be5545f3bb235060b10 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 15:42:18 -0600 Subject: License headers --- libdbusmenu-glib/defaults.c | 28 ++++++++++++++++++++++++++++ libdbusmenu-glib/defaults.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/libdbusmenu-glib/defaults.c b/libdbusmenu-glib/defaults.c index cbd9bfa..450707f 100644 --- a/libdbusmenu-glib/defaults.c +++ b/libdbusmenu-glib/defaults.c @@ -1,3 +1,31 @@ +/* +A library to communicate a menu object set accross DBus and +track updates and maintain consistency. + +Copyright 2011 Canonical Ltd. + +Authors: + Ted Gould + +This program is free software: you can redistribute it and/or modify it +under the terms of either or both of the following licenses: + +1) the GNU Lesser General Public License version 3, as published by the +Free Software Foundation; and/or +2) the GNU Lesser General Public License version 2.1, as published by +the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR +PURPOSE. See the applicable version of the GNU Lesser General Public +License for more details. + +You should have received a copy of both the GNU Lesser General Public +License version 3 and version 2.1 along with this program. If not, see + +*/ + #ifdef HAVE_CONFIG_H #include "config.h" #endif diff --git a/libdbusmenu-glib/defaults.h b/libdbusmenu-glib/defaults.h index 9cd03fa..842b58b 100644 --- a/libdbusmenu-glib/defaults.h +++ b/libdbusmenu-glib/defaults.h @@ -1,3 +1,31 @@ +/* +A library to communicate a menu object set accross DBus and +track updates and maintain consistency. + +Copyright 2011 Canonical Ltd. + +Authors: + Ted Gould + +This program is free software: you can redistribute it and/or modify it +under the terms of either or both of the following licenses: + +1) the GNU Lesser General Public License version 3, as published by the +Free Software Foundation; and/or +2) the GNU Lesser General Public License version 2.1, as published by +the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR +PURPOSE. See the applicable version of the GNU Lesser General Public +License for more details. + +You should have received a copy of both the GNU Lesser General Public +License version 3 and version 2.1 along with this program. If not, see + +*/ + #ifndef __DBUSMENU_DEFAULTS_H__ #define __DBUSMENU_DEFAULTS_H__ -- cgit v1.2.3 From 0d6f893deda7eebefab68be2b7566e8033f2be48 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 15:43:11 -0600 Subject: Format sanely --- libdbusmenu-glib/defaults.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/libdbusmenu-glib/defaults.c b/libdbusmenu-glib/defaults.c index 450707f..af86a90 100644 --- a/libdbusmenu-glib/defaults.c +++ b/libdbusmenu-glib/defaults.c @@ -34,8 +34,8 @@ License version 3 and version 2.1 along with this program. If not, see typedef struct _DbusmenuDefaultsPrivate DbusmenuDefaultsPrivate; -struct _DbusmenuDefaultsPrivate -{ +struct _DbusmenuDefaultsPrivate { + GHashTable * types; }; #define DBUSMENU_DEFAULTS_GET_PRIVATE(o) \ @@ -51,27 +51,34 @@ G_DEFINE_TYPE (DbusmenuDefaults, dbusmenu_defaults, G_TYPE_OBJECT); static void dbusmenu_defaults_class_init (DbusmenuDefaultsClass *klass) { -GObjectClass *object_class = G_OBJECT_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); -g_type_class_add_private (klass, sizeof (DbusmenuDefaultsPrivate)); + g_type_class_add_private (klass, sizeof (DbusmenuDefaultsPrivate)); -object_class->dispose = dbusmenu_defaults_dispose; -object_class->finalize = dbusmenu_defaults_finalize; + object_class->dispose = dbusmenu_defaults_dispose; + object_class->finalize = dbusmenu_defaults_finalize; + return; } static void dbusmenu_defaults_init (DbusmenuDefaults *self) { + + return; } static void dbusmenu_defaults_dispose (GObject *object) { -G_OBJECT_CLASS (dbusmenu_defaults_parent_class)->dispose (object); + + G_OBJECT_CLASS (dbusmenu_defaults_parent_class)->dispose (object); + return; } static void dbusmenu_defaults_finalize (GObject *object) { -G_OBJECT_CLASS (dbusmenu_defaults_parent_class)->finalize (object); + + G_OBJECT_CLASS (dbusmenu_defaults_parent_class)->finalize (object); + return; } -- cgit v1.2.3 From 1c1171f7a84e37dd96385cea1600465350217ae0 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 15:47:40 -0600 Subject: Fleshing out the ref_default --- libdbusmenu-glib/defaults.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/libdbusmenu-glib/defaults.c b/libdbusmenu-glib/defaults.c index af86a90..a6dd4a2 100644 --- a/libdbusmenu-glib/defaults.c +++ b/libdbusmenu-glib/defaults.c @@ -32,8 +32,6 @@ License version 3 and version 2.1 along with this program. If not, see #include "defaults.h" -typedef struct _DbusmenuDefaultsPrivate DbusmenuDefaultsPrivate; - struct _DbusmenuDefaultsPrivate { GHashTable * types; }; @@ -82,3 +80,23 @@ dbusmenu_defaults_finalize (GObject *object) G_OBJECT_CLASS (dbusmenu_defaults_parent_class)->finalize (object); return; } + +static DbusmenuDefaults * default_defaults = NULL; + +/** + * dbusmenu_defaults_ref_default: + * + * Get a reference to the default instance. If it doesn't exist this + * function will create it. + * + * Return value: (transfer full): A reference to the defaults + */ +DbusmenuDefaults * +dbusmenu_defaults_ref_default (void) +{ + if (default_defaults == NULL) { + default_defaults = DBUSMENU_DEFAULTS(g_object_new(DBUSMENU_TYPE_DEFAULTS, NULL)); + } + + return default_defaults; +} -- cgit v1.2.3 From a4a9e45e12ebfc45306f986953b04e2409f9cc7e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 16:13:44 -0600 Subject: Putting in stubs for our get/set functions --- libdbusmenu-glib/defaults.c | 57 +++++++++++++++++++++++++++++++++++++++++++++ libdbusmenu-glib/defaults.h | 11 +++++++++ 2 files changed, 68 insertions(+) diff --git a/libdbusmenu-glib/defaults.c b/libdbusmenu-glib/defaults.c index a6dd4a2..ec70ce1 100644 --- a/libdbusmenu-glib/defaults.c +++ b/libdbusmenu-glib/defaults.c @@ -100,3 +100,60 @@ dbusmenu_defaults_ref_default (void) return default_defaults; } + +/** + * dbusmenu_defaults_default_set: + * @default: The #DbusmenuDefaults object to add to + * @type: (allow-none): The #DbusmenuMenuitem type for this default if #NULL will default to #DBUSMENU_CLIENT_TYPE_DEFAULT + * @property: Property name for the default + * @prop_type: (allow-none): Type of the property for runtime checking. To disable checking set to #NULL. + * @value: (allow-none): Default value for @property. #NULL if by default it is unset, but you want type checking from @prop_type. + * + * Sets up an entry in the defaults database for a given @property + * and menuitem type @type. @prop_type and @value can both be #NULL + * but both of them can not. + */ +void +dbusmenu_defaults_default_set (DbusmenuDefaults * defaults, const gchar * type, const gchar * property, const GVariantType * prop_type, GVariant * value) +{ + + return; +} + +/** + * dbusmenu_defaults_default_get: + * @defaults: The default database to use + * @type: (allow-none): The #DbusmenuMenuitem type for this default if #NULL will default to #DBUSMENU_CLIENT_TYPE_DEFAULT + * @property: Property name to lookup + * + * Gets an entry in the database for a give @property and @type. + * + * Return value: (transfer none): Returns a variant that does not + * have it's ref count increased. If you want to keep it, you should + * do that. + */ +GVariant * +dbusmenu_defaults_default_get (DbusmenuDefaults * defaults, const gchar * type, const gchar * property) +{ + + return NULL; +} + +/** + * dbusmenu_defaults_default_get_type: + * @defaults: The default database to use + * @type: (allow-none): The #DbusmenuMenuitem type for this default if #NULL will default to #DBUSMENU_CLIENT_TYPE_DEFAULT + * @property: Property name to lookup + * + * Gets the type for an entry in the database for a give @property and @type. + * + * Return value: (transfer none): Returns a type for the given + * @property value. + */ +GVariantType * +dbusmenu_defaults_default_get_type (DbusmenuDefaults * defaults, const gchar * type, const gchar * property) +{ + + return NULL; +} + diff --git a/libdbusmenu-glib/defaults.h b/libdbusmenu-glib/defaults.h index 842b58b..9668206 100644 --- a/libdbusmenu-glib/defaults.h +++ b/libdbusmenu-glib/defaults.h @@ -69,6 +69,17 @@ struct _DbusmenuDefaults { GType dbusmenu_defaults_get_type (void); DbusmenuDefaults * dbusmenu_defaults_ref_default (void); +void dbusmenu_defaults_default_set (DbusmenuDefaults * defaults, + const gchar * type, + const gchar * property, + const GVariantType * prop_type, + GVariant * value); +GVariant * dbusmenu_defaults_default_get (DbusmenuDefaults * defaults, + const gchar * type, + const gchar * property); +GVariantType * dbusmenu_defaults_default_get_type (DbusmenuDefaults * defaults, + const gchar * type, + const gchar * property); G_END_DECLS -- cgit v1.2.3 From 69951e51941d1122b58119f52b072aa9863fc3c2 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 17:01:02 -0600 Subject: Setting the core defaults up in a handy table. --- libdbusmenu-glib/defaults.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/libdbusmenu-glib/defaults.c b/libdbusmenu-glib/defaults.c index ec70ce1..c225612 100644 --- a/libdbusmenu-glib/defaults.c +++ b/libdbusmenu-glib/defaults.c @@ -30,7 +30,11 @@ License version 3 and version 2.1 along with this program. If not, see #include "config.h" #endif +#include + #include "defaults.h" +#include "menuitem.h" +#include "client.h" struct _DbusmenuDefaultsPrivate { GHashTable * types; @@ -62,6 +66,19 @@ static void dbusmenu_defaults_init (DbusmenuDefaults *self) { + /* Standard defaults */ + dbusmenu_defaults_default_set(self, DBUSMENU_CLIENT_TYPES_DEFAULT, DBUSMENU_MENUITEM_PROP_VISIBLE, G_VARIANT_TYPE_BOOLEAN, g_variant_new_boolean(TRUE)); + dbusmenu_defaults_default_set(self, DBUSMENU_CLIENT_TYPES_DEFAULT, DBUSMENU_MENUITEM_PROP_ENABLED, G_VARIANT_TYPE_BOOLEAN, g_variant_new_boolean(TRUE)); + dbusmenu_defaults_default_set(self, DBUSMENU_CLIENT_TYPES_DEFAULT, DBUSMENU_MENUITEM_PROP_LABEL, G_VARIANT_TYPE_STRING, g_variant_new_string(_("Label Empty"))); + dbusmenu_defaults_default_set(self, DBUSMENU_CLIENT_TYPES_DEFAULT, DBUSMENU_MENUITEM_PROP_ICON_NAME, G_VARIANT_TYPE_STRING, NULL); + dbusmenu_defaults_default_set(self, DBUSMENU_CLIENT_TYPES_DEFAULT, DBUSMENU_MENUITEM_PROP_TOGGLE_TYPE, G_VARIANT_TYPE_STRING, NULL); + dbusmenu_defaults_default_set(self, DBUSMENU_CLIENT_TYPES_DEFAULT, DBUSMENU_MENUITEM_PROP_TOGGLE_STATE, G_VARIANT_TYPE_INT32, NULL); + dbusmenu_defaults_default_set(self, DBUSMENU_CLIENT_TYPES_DEFAULT, DBUSMENU_MENUITEM_PROP_SHORTCUT, G_VARIANT_TYPE_ARRAY, NULL); + dbusmenu_defaults_default_set(self, DBUSMENU_CLIENT_TYPES_DEFAULT, DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY, G_VARIANT_TYPE_STRING, NULL); + + /* Separator defaults */ + dbusmenu_defaults_default_set(self, DBUSMENU_CLIENT_TYPES_SEPARATOR, DBUSMENU_MENUITEM_PROP_VISIBLE, G_VARIANT_TYPE_BOOLEAN, g_variant_new_boolean(TRUE)); + return; } @@ -103,7 +120,7 @@ dbusmenu_defaults_ref_default (void) /** * dbusmenu_defaults_default_set: - * @default: The #DbusmenuDefaults object to add to + * @defaults: The #DbusmenuDefaults object to add to * @type: (allow-none): The #DbusmenuMenuitem type for this default if #NULL will default to #DBUSMENU_CLIENT_TYPE_DEFAULT * @property: Property name for the default * @prop_type: (allow-none): Type of the property for runtime checking. To disable checking set to #NULL. -- cgit v1.2.3 From 6d298a977a906aa9029b8f82b19fae71562db5fe Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 17:15:14 -0600 Subject: Create an entry structure and functions for creating and destroying it --- libdbusmenu-glib/defaults.c | 47 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/libdbusmenu-glib/defaults.c b/libdbusmenu-glib/defaults.c index c225612..3a98923 100644 --- a/libdbusmenu-glib/defaults.c +++ b/libdbusmenu-glib/defaults.c @@ -40,6 +40,12 @@ struct _DbusmenuDefaultsPrivate { GHashTable * types; }; +typedef struct _DefaultEntry DefaultEntry; +struct _DefaultEntry { + GVariantType * type; + GVariant * value; +}; + #define DBUSMENU_DEFAULTS_GET_PRIVATE(o) \ (G_TYPE_INSTANCE_GET_PRIVATE ((o), DBUSMENU_DEFAULTS_TYPE, DbusmenuDefaultsPrivate)) @@ -48,6 +54,9 @@ static void dbusmenu_defaults_init (DbusmenuDefaults *self); static void dbusmenu_defaults_dispose (GObject *object); static void dbusmenu_defaults_finalize (GObject *object); +static DefaultEntry * entry_create (GVariantType * type, GVariant * variant); +static void entry_destroy (gpointer entry); + G_DEFINE_TYPE (DbusmenuDefaults, dbusmenu_defaults, G_TYPE_OBJECT); static void @@ -98,6 +107,44 @@ dbusmenu_defaults_finalize (GObject *object) return; } +/* Create a new entry based on the info provided */ +static DefaultEntry * +entry_create (GVariantType * type, GVariant * variant) +{ + DefaultEntry * defentry = g_new0(DefaultEntry, 1); + + if (type != NULL) { + defentry->type = g_variant_type_copy(type); + } + + if (variant != NULL) { + defentry->value = variant; + g_variant_ref_sink(variant); + } + + return defentry; +} + +/* Destroy an entry */ +static void +entry_destroy (gpointer entry) +{ + DefaultEntry * defentry = (DefaultEntry *)entry; + + if (defentry->type != NULL) { + g_variant_type_free(defentry->type); + defentry->type = NULL; + } + + if (defentry->value != NULL) { + g_variant_unref(defentry->value); + defentry->value = NULL; + } + + g_free(defentry); + return; +} + static DbusmenuDefaults * default_defaults = NULL; /** -- cgit v1.2.3 From 6c544a4f41d713878667418cd14411e5fc6c1f3f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 17:18:58 -0600 Subject: Building our hash table and making sure it gets cleaned up --- libdbusmenu-glib/defaults.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libdbusmenu-glib/defaults.c b/libdbusmenu-glib/defaults.c index 3a98923..53ef09d 100644 --- a/libdbusmenu-glib/defaults.c +++ b/libdbusmenu-glib/defaults.c @@ -47,7 +47,7 @@ struct _DefaultEntry { }; #define DBUSMENU_DEFAULTS_GET_PRIVATE(o) \ -(G_TYPE_INSTANCE_GET_PRIVATE ((o), DBUSMENU_DEFAULTS_TYPE, DbusmenuDefaultsPrivate)) +(G_TYPE_INSTANCE_GET_PRIVATE ((o), DBUSMENU_TYPE_DEFAULTS, DbusmenuDefaultsPrivate)) static void dbusmenu_defaults_class_init (DbusmenuDefaultsClass *klass); static void dbusmenu_defaults_init (DbusmenuDefaults *self); @@ -74,6 +74,9 @@ dbusmenu_defaults_class_init (DbusmenuDefaultsClass *klass) static void dbusmenu_defaults_init (DbusmenuDefaults *self) { + self->priv = DBUSMENU_DEFAULTS_GET_PRIVATE(self); + + self->priv->types = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, entry_destroy); /* Standard defaults */ dbusmenu_defaults_default_set(self, DBUSMENU_CLIENT_TYPES_DEFAULT, DBUSMENU_MENUITEM_PROP_VISIBLE, G_VARIANT_TYPE_BOOLEAN, g_variant_new_boolean(TRUE)); @@ -94,6 +97,12 @@ dbusmenu_defaults_init (DbusmenuDefaults *self) static void dbusmenu_defaults_dispose (GObject *object) { + DbusmenuDefaults * self = DBUSMENU_DEFAULTS(object); + + if (self->priv->types != NULL) { + g_hash_table_destroy(self->priv->types); + self->priv->types = NULL; + } G_OBJECT_CLASS (dbusmenu_defaults_parent_class)->dispose (object); return; -- cgit v1.2.3 From c89e30d70bcd342837af4633f393a26c7fb3bdc9 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 17:29:13 -0600 Subject: Create a basic setter function and fix our hashtables so they work with it. --- libdbusmenu-glib/defaults.c | 26 +++++++++++++++++++++++--- libdbusmenu-glib/defaults.h | 4 ++-- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/libdbusmenu-glib/defaults.c b/libdbusmenu-glib/defaults.c index 53ef09d..9fde682 100644 --- a/libdbusmenu-glib/defaults.c +++ b/libdbusmenu-glib/defaults.c @@ -54,7 +54,7 @@ static void dbusmenu_defaults_init (DbusmenuDefaults *self); static void dbusmenu_defaults_dispose (GObject *object); static void dbusmenu_defaults_finalize (GObject *object); -static DefaultEntry * entry_create (GVariantType * type, GVariant * variant); +static DefaultEntry * entry_create (const GVariantType * type, GVariant * variant); static void entry_destroy (gpointer entry); G_DEFINE_TYPE (DbusmenuDefaults, dbusmenu_defaults, G_TYPE_OBJECT); @@ -76,7 +76,7 @@ dbusmenu_defaults_init (DbusmenuDefaults *self) { self->priv = DBUSMENU_DEFAULTS_GET_PRIVATE(self); - self->priv->types = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, entry_destroy); + self->priv->types = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify)g_hash_table_destroy); /* Standard defaults */ dbusmenu_defaults_default_set(self, DBUSMENU_CLIENT_TYPES_DEFAULT, DBUSMENU_MENUITEM_PROP_VISIBLE, G_VARIANT_TYPE_BOOLEAN, g_variant_new_boolean(TRUE)); @@ -118,7 +118,7 @@ dbusmenu_defaults_finalize (GObject *object) /* Create a new entry based on the info provided */ static DefaultEntry * -entry_create (GVariantType * type, GVariant * variant) +entry_create (const GVariantType * type, GVariant * variant) { DefaultEntry * defentry = g_new0(DefaultEntry, 1); @@ -189,6 +189,26 @@ dbusmenu_defaults_ref_default (void) void dbusmenu_defaults_default_set (DbusmenuDefaults * defaults, const gchar * type, const gchar * property, const GVariantType * prop_type, GVariant * value) { + g_return_if_fail(DBUSMENU_IS_DEFAULTS(defaults)); + g_return_if_fail(property != NULL); + g_return_if_fail(prop_type != NULL || value != NULL); + + if (type == NULL) { + type = DBUSMENU_CLIENT_TYPES_DEFAULT; + } + + GHashTable * prop_table = (GHashTable *)g_hash_table_lookup(defaults->priv->types, type); + + /* We've never had a default for this type, so we need + to create a table for it. */ + if (prop_table == NULL) { + prop_table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, entry_destroy); + + g_hash_table_insert(prop_table, g_strdup(property), entry_create(prop_type, value)); + g_hash_table_insert(defaults->priv->types, g_strdup(type), prop_table); + } else { + g_hash_table_replace(prop_table, g_strdup(property), entry_create(prop_type, value)); + } return; } diff --git a/libdbusmenu-glib/defaults.h b/libdbusmenu-glib/defaults.h index 9668206..ab377f7 100644 --- a/libdbusmenu-glib/defaults.h +++ b/libdbusmenu-glib/defaults.h @@ -37,8 +37,8 @@ G_BEGIN_DECLS #define DBUSMENU_TYPE_DEFAULTS (dbusmenu_defaults_get_type ()) #define DBUSMENU_DEFAULTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DBUSMENU_TYPE_DEFAULTS, DbusmenuDefaults)) #define DBUSMENU_DEFAULTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DBUSMENU_TYPE_DEFAULTS, DbusmenuDefaultsClass)) -#define IS_DBUSMENU_DEFAULTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DBUSMENU_TYPE_DEFAULTS)) -#define IS_DBUSMENU_DEFAULTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DBUSMENU_TYPE_DEFAULTS)) +#define DBUSMENU_IS_DEFAULTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DBUSMENU_TYPE_DEFAULTS)) +#define DBUSMENU_IS_DEFAULTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DBUSMENU_TYPE_DEFAULTS)) #define DBUSMENU_DEFAULTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DBUSMENU_TYPE_DEFAULTS, DbusmenuDefaultsClass)) typedef struct _DbusmenuDefaults DbusmenuDefaults; -- cgit v1.2.3 From 543691a8c404735cc6f5bfbe24dc8bbe57908ff0 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 17:32:53 -0600 Subject: Flesh out the getters as well --- libdbusmenu-glib/defaults.c | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/libdbusmenu-glib/defaults.c b/libdbusmenu-glib/defaults.c index 9fde682..e8cdea0 100644 --- a/libdbusmenu-glib/defaults.c +++ b/libdbusmenu-glib/defaults.c @@ -228,8 +228,26 @@ dbusmenu_defaults_default_set (DbusmenuDefaults * defaults, const gchar * type, GVariant * dbusmenu_defaults_default_get (DbusmenuDefaults * defaults, const gchar * type, const gchar * property) { + g_return_val_if_fail(DBUSMENU_IS_DEFAULTS(defaults), NULL); + g_return_val_if_fail(property != NULL, NULL); - return NULL; + if (type == NULL) { + type = DBUSMENU_CLIENT_TYPES_DEFAULT; + } + + GHashTable * prop_table = (GHashTable *)g_hash_table_lookup(defaults->priv->types, type); + + if (prop_table == NULL) { + return NULL; + } + + DefaultEntry * entry = (DefaultEntry *)g_hash_table_lookup(prop_table, property); + + if (entry == NULL) { + return NULL; + } + + return entry->value; } /** @@ -246,7 +264,25 @@ dbusmenu_defaults_default_get (DbusmenuDefaults * defaults, const gchar * type, GVariantType * dbusmenu_defaults_default_get_type (DbusmenuDefaults * defaults, const gchar * type, const gchar * property) { + g_return_val_if_fail(DBUSMENU_IS_DEFAULTS(defaults), NULL); + g_return_val_if_fail(property != NULL, NULL); + + if (type == NULL) { + type = DBUSMENU_CLIENT_TYPES_DEFAULT; + } + + GHashTable * prop_table = (GHashTable *)g_hash_table_lookup(defaults->priv->types, type); + + if (prop_table == NULL) { + return NULL; + } + + DefaultEntry * entry = (DefaultEntry *)g_hash_table_lookup(prop_table, property); + + if (entry == NULL) { + return NULL; + } - return NULL; + return entry->type; } -- cgit v1.2.3 From 8dd5384336a88c076429c621f8080bad947a9d23 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 17:35:19 -0600 Subject: Finally getting our very own reference for the defaults --- libdbusmenu-glib/menuitem.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index c994130..b6c5712 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -33,6 +33,7 @@ License version 3 and version 2.1 along with this program. If not, see #include "menuitem.h" #include "menuitem-marshal.h" #include "menuitem-private.h" +#include "defaults.h" #ifdef MASSIVEDEBUGGING #define LABEL(x) dbusmenu_menuitem_property_get(DBUSMENU_MENUITEM(x), DBUSMENU_MENUITEM_PROP_LABEL) @@ -59,6 +60,7 @@ struct _DbusmenuMenuitemPrivate GHashTable * properties; gboolean root; gboolean realized; + DbusmenuDefaults * defaults; }; /* Signals */ @@ -312,6 +314,8 @@ dbusmenu_menuitem_init (DbusmenuMenuitem *self) priv->root = FALSE; priv->realized = FALSE; + + priv->defaults = dbusmenu_defaults_ref_default(); return; } @@ -328,6 +332,11 @@ dbusmenu_menuitem_dispose (GObject *object) g_list_free(priv->children); priv->children = NULL; + if (priv->defaults != NULL) { + g_object_unref(priv->defaults); + priv->defaults = NULL; + } + G_OBJECT_CLASS (dbusmenu_menuitem_parent_class)->dispose (object); return; } -- cgit v1.2.3 From c704e7e82e57f2ac6ca9e058459d600c0bbed6ab Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 17:37:45 -0600 Subject: Making sure to have weak pointer support incase we do drop all the refs --- libdbusmenu-glib/defaults.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libdbusmenu-glib/defaults.c b/libdbusmenu-glib/defaults.c index e8cdea0..9031d20 100644 --- a/libdbusmenu-glib/defaults.c +++ b/libdbusmenu-glib/defaults.c @@ -169,6 +169,7 @@ dbusmenu_defaults_ref_default (void) { if (default_defaults == NULL) { default_defaults = DBUSMENU_DEFAULTS(g_object_new(DBUSMENU_TYPE_DEFAULTS, NULL)); + g_object_add_weak_pointer(G_OBJECT(default_defaults), (gpointer *)&default_defaults); } return default_defaults; -- cgit v1.2.3 From 494adf9835825c711fd9f05b44143d6331bcab63 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 21:06:41 -0600 Subject: When we're setting a value check to see if it's the same as the default and clear it if so. --- libdbusmenu-glib/menuitem.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index b6c5712..c744435 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -434,6 +434,14 @@ send_about_to_show (DbusmenuMenuitem * mi, void (*cb) (DbusmenuMenuitem * mi, gp return; } +/* A helper function to get the type of the menuitem, this might + be a candidate for optimization in the future. */ +static const gchar * +menuitem_get_type (DbusmenuMenuitem * mi) +{ + return dbusmenu_menuitem_property_get(mi, DBUSMENU_MENUITEM_PROP_TYPE); +} + /* Public interface */ /** @@ -1013,6 +1021,35 @@ dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * pro DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi); + const gchar * type = menuitem_get_type(mi); + if (type != NULL) { + /* Check the defaults database to see if we have a default + for this property. */ + GVariant * default_value = dbusmenu_defaults_default_get(priv->defaults, type, property); + if (default_value != NULL) { + /* If we have a default we might also have an expected type */ + GVariantType * default_type = dbusmenu_defaults_default_get_type(priv->defaults, type, property); + + if (default_type != NULL) { + /* If we have an expected type we should check to see if + the value we've been given is of the same type and generate + a warning if it isn't */ + if (!g_variant_is_of_type(value, default_type)) { + 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)); + } + } + + /* 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); -- cgit v1.2.3 From 507b6ec86e0e6c4eacd41863f8900a90c023f915 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 21:09:31 -0600 Subject: Allow for signaling the default value if it makes sense --- libdbusmenu-glib/menuitem.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index c744435..d25e80d 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1022,10 +1022,11 @@ dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * pro DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi); const gchar * type = menuitem_get_type(mi); + GVariant * default_value = NULL; if (type != NULL) { /* Check the defaults database to see if we have a default for this property. */ - GVariant * default_value = dbusmenu_defaults_default_get(priv->defaults, type, property); + default_value = dbusmenu_defaults_default_get(priv->defaults, type, property); if (default_value != NULL) { /* If we have a default we might also have an expected type */ GVariantType * default_type = dbusmenu_defaults_default_get_type(priv->defaults, type, property); @@ -1073,7 +1074,15 @@ 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, property, value, TRUE); + GVariant * signalval = value; + + if (signalval == NULL) { + /* Might also be NULL, but if it is we're definitely + clearing this thing. */ + signalval = default_value; + } + + g_signal_emit(G_OBJECT(mi), signals[PROPERTY_CHANGED], 0, property, signalval, TRUE); } return TRUE; -- cgit v1.2.3 From 32f2fccc8b40dc5ccea70acff83a5b6f0302ffea Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 21:11:48 -0600 Subject: Always check the type even if we don't have a value. --- libdbusmenu-glib/menuitem.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index d25e80d..a773755 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1024,22 +1024,21 @@ dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * pro const gchar * type = menuitem_get_type(mi); GVariant * default_value = NULL; if (type != 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) { + /* If we have an expected type we should check to see if + the value we've been given is of the same type and generate + a warning if it isn't */ + if (!g_variant_is_of_type(value, default_type)) { + 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) { - /* If we have a default we might also have an expected type */ - GVariantType * default_type = dbusmenu_defaults_default_get_type(priv->defaults, type, property); - - if (default_type != NULL) { - /* If we have an expected type we should check to see if - the value we've been given is of the same type and generate - a warning if it isn't */ - if (!g_variant_is_of_type(value, default_type)) { - 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)); - } - } - /* 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. */ -- cgit v1.2.3 From db5438c7f8721ca3b32df9be5b3cd980aebc6784 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 21:17:29 -0600 Subject: Always replace to ensure we don't leak references. --- libdbusmenu-glib/menuitem.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index a773755..2e3b8f0 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1054,13 +1054,18 @@ dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * pro gpointer currentval = g_hash_table_lookup(priv->properties, property); if (value != NULL) { - gchar * lprop = g_strdup(property); - g_variant_ref_sink(value); - + /* NOTE: We're only marking this as replaced if this is true + but we're actually replacing it no matter. This is so that + the variant passed in sticks around which the caller may + expect. They shouldn't, but it's low cost to remove bugs. */ if (currentval == NULL || !g_variant_equal((GVariant*)currentval, value)) { - g_hash_table_replace(priv->properties, lprop, value); replaced = TRUE; } + + gchar * lprop = g_strdup(property); + g_variant_ref_sink(value); + + g_hash_table_replace(priv->properties, lprop, value); } else { if (currentval != NULL) { g_hash_table_remove(priv->properties, property); -- cgit v1.2.3 From f1fb82edb2ebcd07af0efbbf7ed98509ae297576 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 21:19:48 -0600 Subject: If we can't get the value from our database, let's check the defaults. --- libdbusmenu-glib/menuitem.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 2e3b8f0..a3369af 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1133,7 +1133,13 @@ dbusmenu_menuitem_property_get_variant (DbusmenuMenuitem * mi, const gchar * pro DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi); - return (GVariant *)g_hash_table_lookup(priv->properties, property); + GVariant * currentval = (GVariant *)g_hash_table_lookup(priv->properties, property); + + if (currentval == NULL) { + currentval = dbusmenu_defaults_default_get(priv->defaults, menuitem_get_type(mi), property); + } + + return currentval; } /** -- cgit v1.2.3 From 5192d305b96683f10567f961913e74bbe23f6e37 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 21:22:37 -0600 Subject: The defaults database can, and should, handle NULL types with fallbacks. --- libdbusmenu-glib/menuitem.c | 44 +++++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index a3369af..862cf63 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1022,31 +1022,29 @@ dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * pro DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi); const gchar * type = menuitem_get_type(mi); - GVariant * default_value = NULL; - if (type != 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) { - /* If we have an expected type we should check to see if - the value we've been given is of the same type and generate - a warning if it isn't */ - if (!g_variant_is_of_type(value, default_type)) { - 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 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) { + /* If we have an expected type we should check to see if + the value we've been given is of the same type and generate + a warning if it isn't */ + if (!g_variant_is_of_type(value, default_type)) { + 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. */ + GVariant * 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; } } -- cgit v1.2.3 From ac9229802235759397ce6fffc4d89f27be64ad3d Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 21:27:13 -0600 Subject: Fleshing out the check for if a property is a default value. --- libdbusmenu-glib/menuitem.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 862cf63..bc2daf5 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1566,10 +1566,23 @@ dbusmenu_menuitem_show_to_user (DbusmenuMenuitem * mi, guint timestamp) /* 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 */ + g_return_val_if_fail(DBUSMENU_IS_MENUITEM(mi), FALSE); + DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi); + + GVariant * currentval = (GVariant *)g_hash_table_lookup(priv->properties, property); + if (currentval != NULL) { + /* If we're storing it locally, then it shouldn't be a default */ + 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; } -- cgit v1.2.3 From 75ecaddcbeb02eaa40d11bb8c3f858062a14471b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 21:41:54 -0600 Subject: Ensure that we check the local db for the type and don't go all recursive. --- libdbusmenu-glib/menuitem.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index bc2daf5..ee18fab 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -439,7 +439,12 @@ send_about_to_show (DbusmenuMenuitem * mi, void (*cb) (DbusmenuMenuitem * mi, gp static const gchar * menuitem_get_type (DbusmenuMenuitem * mi) { - return dbusmenu_menuitem_property_get(mi, DBUSMENU_MENUITEM_PROP_TYPE); + DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi); + GVariant * currentval = (GVariant *)g_hash_table_lookup(priv->properties, DBUSMENU_MENUITEM_PROP_TYPE); + if (currentval != NULL) { + return g_variant_get_string(currentval, NULL); + } + return NULL; } /* Public interface */ -- cgit v1.2.3 From 47b42d7d4679cab52b6b9871fc15e2fb4d12297a Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 21:51:35 -0600 Subject: Make sure to either ref or allocate --- libdbusmenu-glib/defaults.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libdbusmenu-glib/defaults.c b/libdbusmenu-glib/defaults.c index 9031d20..3ad5d76 100644 --- a/libdbusmenu-glib/defaults.c +++ b/libdbusmenu-glib/defaults.c @@ -170,6 +170,8 @@ dbusmenu_defaults_ref_default (void) if (default_defaults == NULL) { default_defaults = DBUSMENU_DEFAULTS(g_object_new(DBUSMENU_TYPE_DEFAULTS, NULL)); g_object_add_weak_pointer(G_OBJECT(default_defaults), (gpointer *)&default_defaults); + } else { + g_object_ref(default_defaults); } return default_defaults; -- cgit v1.2.3 From bb744f4a3a0059148f6615853dc7b6f80451f99a Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 21:52:36 -0600 Subject: Fixing test data to not include default data, saving 40K of data. --- tests/test-json-01.json | 2111 ++++++++++++----------------------------------- 1 file changed, 508 insertions(+), 1603 deletions(-) diff --git a/tests/test-json-01.json b/tests/test-json-01.json index b626d20..e3b1e17 100644 --- a/tests/test-json-01.json +++ b/tests/test-json-01.json @@ -5,30 +5,22 @@ { "id": 5, "children-display": 'submenu', - "enabled": true, "label": 'File', - "visible": true, "submenu": [ { "id": 6, - "enabled": true, "label": 'Quit', - "shortcut": [['Control', 'q']], - "visible": true + "shortcut": [['Control', 'q']] }, { "id": 7, - "enabled": true, "label": 'Close all', - "shortcut": [['Control', 'Shift', 'w']], - "visible": true + "shortcut": [['Control', 'Shift', 'w']] }, { "id": 8, - "enabled": true, "label": 'Close', - "shortcut": [['Control', 'w']], - "visible": true + "shortcut": [['Control', 'w']] }, { "id": 9, @@ -36,22 +28,16 @@ }, { "id": 10, - "enabled": true, - "label": 'Send by Email...', - "visible": true + "label": 'Send by Email...' }, { "id": 11, - "enabled": true, "label": 'Print...', - "shortcut": [['Control', 'p']], - "visible": true + "shortcut": [['Control', 'p']] }, { "id": 12, - "enabled": true, - "label": 'Page Setup', - "visible": true + "label": 'Page Setup' }, { "id": 13, @@ -59,35 +45,25 @@ }, { "id": 14, - "enabled": true, - "label": 'Revert', - "visible": true + "label": 'Revert' }, { "id": 15, - "enabled": true, - "label": 'Save as Template...', - "visible": true + "label": 'Save as Template...' }, { "id": 16, - "enabled": true, - "label": 'Save a Copy...', - "visible": true + "label": 'Save a Copy...' }, { "id": 17, - "enabled": true, "label": 'Save As...', - "shortcut": [['Control', 'Shift', 's']], - "visible": true + "shortcut": [['Control', 'Shift', 's']] }, { "id": 18, - "enabled": true, "label": 'Save', - "shortcut": [['Control', 's']], - "visible": true + "shortcut": [['Control', 's']] }, { "id": 19, @@ -96,15 +72,11 @@ { "id": 20, "children-display": 'submenu', - "enabled": true, "label": 'Open Recent', - "visible": true, "submenu": [ { "id": 21, - "enabled": true, - "label": 'Document History', - "visible": true + "label": 'Document History' }, { "id": 22, @@ -112,168 +84,118 @@ }, { "id": 23, - "enabled": true, "label": 'giggity.jpg', - "shortcut": [['Control', '2']], - "visible": true + "shortcut": [['Control', '2']] }, { "id": 24, - "enabled": true, "label": 'Icon Height.svg', - "shortcut": [['Control', '1']], - "visible": true + "shortcut": [['Control', '1']] } ] }, { "id": 25, - "enabled": true, - "label": 'Open Location...', - "visible": true + "label": 'Open Location...' }, { "id": 26, - "enabled": true, "label": 'Open as Layers...', - "shortcut": [['Control', 'Alt', 'o']], - "visible": true + "shortcut": [['Control', 'Alt', 'o']] }, { "id": 27, - "enabled": true, "label": 'Open...', - "shortcut": [['Control', 'o']], - "visible": true + "shortcut": [['Control', 'o']] }, { "id": 28, "children-display": 'submenu', - "enabled": true, "label": 'Create', - "visible": true, "submenu": [ { "id": 29, "children-display": 'submenu', - "enabled": true, "label": 'Web Page Themes', - "visible": true, "submenu": [ { "id": 30, "children-display": 'submenu', - "enabled": true, "label": 'Classic.Gimp.Org', - "visible": true, "submenu": [ { "id": 31, - "enabled": true, - "label": 'Tube Sub-Sub-Button Label...', - "visible": true + "label": 'Tube Sub-Sub-Button Label...' }, { "id": 32, - "enabled": true, - "label": 'Tube Sub-Button Label...', - "visible": true + "label": 'Tube Sub-Button Label...' }, { "id": 33, - "enabled": true, - "label": 'Tube Button Label...', - "visible": true + "label": 'Tube Button Label...' }, { "id": 34, - "enabled": true, - "label": 'Small Header...', - "visible": true + "label": 'Small Header...' }, { "id": 35, - "enabled": true, - "label": 'General Tube Labels...', - "visible": true + "label": 'General Tube Labels...' }, { "id": 36, - "enabled": true, - "label": 'Big Header...', - "visible": true + "label": 'Big Header...' } ] }, { "id": 37, "children-display": 'submenu', - "enabled": true, "label": 'Beveled Pattern', - "visible": true, "submenu": [ { "id": 38, - "enabled": true, - "label": 'Hrule...', - "visible": true + "label": 'Hrule...' }, { "id": 39, - "enabled": true, - "label": 'Heading...', - "visible": true + "label": 'Heading...' }, { "id": 40, - "enabled": true, - "label": 'Button...', - "visible": true + "label": 'Button...' }, { "id": 41, - "enabled": true, - "label": 'Bullet...', - "visible": true + "label": 'Bullet...' }, { "id": 42, - "enabled": true, - "label": 'Arrow...', - "visible": true + "label": 'Arrow...' } ] }, { "id": 43, "children-display": 'submenu', - "enabled": true, "label": 'Alien Glow', - "visible": true, "submenu": [ { "id": 44, - "enabled": true, - "label": 'Hrule...', - "visible": true + "label": 'Hrule...' }, { "id": 45, - "enabled": true, - "label": 'Button...', - "visible": true + "label": 'Button...' }, { "id": 46, - "enabled": true, - "label": 'Bullet...', - "visible": true + "label": 'Bullet...' }, { "id": 47, - "enabled": true, - "label": 'Arrow...', - "visible": true + "label": 'Arrow...' } ] } @@ -282,255 +204,173 @@ { "id": 48, "children-display": 'submenu', - "enabled": true, "label": 'Patterns', - "visible": true, "submenu": [ { "id": 49, - "enabled": true, - "label": 'Truchet...', - "visible": true + "label": 'Truchet...' }, { "id": 50, - "enabled": true, - "label": 'Swirly...', - "visible": true + "label": 'Swirly...' }, { "id": 51, - "enabled": true, - "label": 'Swirl-Tile...', - "visible": true + "label": 'Swirl-Tile...' }, { "id": 52, - "enabled": true, - "label": 'Render Map...', - "visible": true + "label": 'Render Map...' }, { "id": 53, - "enabled": true, - "label": 'Land...', - "visible": true + "label": 'Land...' }, { "id": 54, - "enabled": true, - "label": 'Flatland...', - "visible": true + "label": 'Flatland...' }, { "id": 55, - "enabled": true, - "label": 'Camouflage...', - "visible": true + "label": 'Camouflage...' }, { "id": 56, - "enabled": true, - "label": '3D Truchet...', - "visible": true + "label": '3D Truchet...' } ] }, { "id": 57, "children-display": 'submenu', - "enabled": true, "label": 'Logos', - "visible": true, "submenu": [ { "id": 58, - "enabled": true, - "label": 'Web Title Header...', - "visible": true + "label": 'Web Title Header...' }, { "id": 59, - "enabled": true, - "label": 'Textured...', - "visible": true + "label": 'Textured...' }, { "id": 60, - "enabled": true, - "label": 'Text Circle...', - "visible": true + "label": 'Text Circle...' }, { "id": 61, - "enabled": true, - "label": 'Starscape...', - "visible": true + "label": 'Starscape...' }, { "id": 62, - "enabled": true, - "label": 'Speed Text...', - "visible": true + "label": 'Speed Text...' }, { "id": 63, - "enabled": true, - "label": 'SOTA Chrome...', - "visible": true + "label": 'SOTA Chrome...' }, { "id": 64, - "enabled": true, - "label": 'Particle Trace...', - "visible": true + "label": 'Particle Trace...' }, { "id": 65, - "enabled": true, - "label": 'Newsprint Text...', - "visible": true + "label": 'Newsprint Text...' }, { "id": 66, - "enabled": true, - "label": 'Neon...', - "visible": true + "label": 'Neon...' }, { "id": 67, - "enabled": true, - "label": 'Imigre-26...', - "visible": true + "label": 'Imigre-26...' }, { "id": 68, - "enabled": true, - "label": 'Gradient Bevel...', - "visible": true + "label": 'Gradient Bevel...' }, { "id": 69, - "enabled": true, - "label": 'Glowing Hot...', - "visible": true + "label": 'Glowing Hot...' }, { "id": 70, - "enabled": true, - "label": 'Glossy...', - "visible": true + "label": 'Glossy...' }, { "id": 71, - "enabled": true, - "label": 'Frosty...', - "visible": true + "label": 'Frosty...' }, { "id": 72, - "enabled": true, - "label": 'Crystal...', - "visible": true + "label": 'Crystal...' }, { "id": 73, - "enabled": true, - "label": 'Cool Metal...', - "visible": true + "label": 'Cool Metal...' }, { "id": 74, - "enabled": true, - "label": 'Comic Book...', - "visible": true + "label": 'Comic Book...' }, { "id": 75, - "enabled": true, - "label": 'Chrome...', - "visible": true + "label": 'Chrome...' }, { "id": 76, - "enabled": true, - "label": 'Chip Away...', - "visible": true + "label": 'Chip Away...' }, { "id": 77, - "enabled": true, - "label": 'Chalk...', - "visible": true + "label": 'Chalk...' }, { "id": 78, - "enabled": true, - "label": 'Carved...', - "visible": true + "label": 'Carved...' }, { "id": 79, - "enabled": true, - "label": 'Bovination...', - "visible": true + "label": 'Bovination...' }, { "id": 80, - "enabled": true, - "label": 'Blended...', - "visible": true + "label": 'Blended...' }, { "id": 81, - "enabled": true, - "label": 'Basic I...', - "visible": true + "label": 'Basic I...' }, { "id": 82, - "enabled": true, - "label": 'Basic II...', - "visible": true + "label": 'Basic II...' }, { "id": 83, - "enabled": true, - "label": 'Alien Neon...', - "visible": true + "label": 'Alien Neon...' }, { "id": 84, - "enabled": true, - "label": 'Alien Glow...', - "visible": true + "label": 'Alien Glow...' }, { "id": 85, - "enabled": true, - "label": '3D Outline...', - "visible": true + "label": '3D Outline...' } ] }, { "id": 86, "children-display": 'submenu', - "enabled": true, "label": 'Buttons', - "visible": true, "submenu": [ { "id": 87, - "enabled": true, - "label": 'Simple Beveled Button...', - "visible": true + "label": 'Simple Beveled Button...' }, { "id": 88, - "enabled": true, - "label": 'Round Button...', - "visible": true + "label": 'Round Button...' } ] }, @@ -541,72 +381,53 @@ { "id": 90, "children-display": 'submenu', - "enabled": true, "label": 'xscanimage', - "visible": true, "submenu": [ { "id": 91, "enabled": false, - "label": 'Device dialog...', - "visible": true + "label": 'Device dialog...' } ] }, { "id": 92, - "enabled": true, - "label": 'Screenshot...', - "visible": true + "label": 'Screenshot...' }, { "id": 93, - "enabled": true, "label": 'From Clipboard', - "shortcut": [['Control', 'Shift', 'v']], - "visible": true + "shortcut": [['Control', 'Shift', 'v']] } ] }, { "id": 94, - "enabled": true, "label": 'New...', - "shortcut": [['Control', 'n']], - "visible": true + "shortcut": [['Control', 'n']] } ] }, { "id": 95, "children-display": 'submenu', - "enabled": true, "label": 'Edit', - "visible": true, "submenu": [ { "id": 96, - "enabled": true, - "label": 'Units', - "visible": true + "label": 'Units' }, { "id": 97, - "enabled": true, - "label": 'Modules', - "visible": true + "label": 'Modules' }, { "id": 98, - "enabled": true, - "label": 'Keyboard Shortcuts', - "visible": true + "label": 'Keyboard Shortcuts' }, { "id": 99, - "enabled": true, - "label": 'Preferences', - "visible": true + "label": 'Preferences' }, { "id": 100, @@ -615,42 +436,32 @@ { "id": 101, "enabled": false, - "label": 'Stroke Path...', - "visible": true + "label": 'Stroke Path...' }, { "id": 102, "enabled": false, - "label": 'Stroke Selection...', - "visible": true + "label": 'Stroke Selection...' }, { "id": 103, - "enabled": true, "label": 'Fill with Pattern', - "shortcut": [['Control', 'semicolon']], - "visible": true + "shortcut": [['Control', 'semicolon']] }, { "id": 104, - "enabled": true, "label": 'Fill with BG Color', - "shortcut": [['Control', 'period']], - "visible": true + "shortcut": [['Control', 'period']] }, { "id": 105, - "enabled": true, "label": 'Fill with FG Color', - "shortcut": [['Control', 'comma']], - "visible": true + "shortcut": [['Control', 'comma']] }, { "id": 106, - "enabled": true, "label": 'Clear', - "shortcut": [['Delete']], - "visible": true + "shortcut": [['Delete']] }, { "id": 107, @@ -659,103 +470,73 @@ { "id": 108, "children-display": 'submenu', - "enabled": true, "label": 'Buffer', - "visible": true, "submenu": [ { "id": 109, - "enabled": true, - "label": 'Paste Named...', - "visible": true + "label": 'Paste Named...' }, { "id": 110, - "enabled": true, - "label": 'Copy Visible Named...', - "visible": true + "label": 'Copy Visible Named...' }, { "id": 111, - "enabled": true, - "label": 'Copy Named...', - "visible": true + "label": 'Copy Named...' }, { "id": 112, - "enabled": true, - "label": 'Cut Named...', - "visible": true + "label": 'Cut Named...' } ] }, { "id": 113, "children-display": 'submenu', - "enabled": true, "label": 'Paste as', - "visible": true, "submenu": [ { "id": 114, - "enabled": true, - "label": 'New Pattern...', - "visible": true + "label": 'New Pattern...' }, { "id": 115, - "enabled": true, - "label": 'New Brush...', - "visible": true + "label": 'New Brush...' }, { "id": 116, - "enabled": true, - "label": 'New Layer', - "visible": true + "label": 'New Layer' }, { "id": 117, - "enabled": true, "label": 'New Image', - "shortcut": [['Control', 'Shift', 'v']], - "visible": true + "shortcut": [['Control', 'Shift', 'v']] } ] }, { "id": 118, - "enabled": true, - "label": 'Paste Into', - "visible": true + "label": 'Paste Into' }, { "id": 119, - "enabled": true, "label": 'Paste', - "shortcut": [['Control', 'v']], - "visible": true + "shortcut": [['Control', 'v']] }, { "id": 120, - "enabled": true, "label": 'Copy Visible', - "shortcut": [['Control', 'Shift', 'c']], - "visible": true + "shortcut": [['Control', 'Shift', 'c']] }, { "id": 121, - "enabled": true, "label": 'Copy', - "shortcut": [['Control', 'c']], - "visible": true + "shortcut": [['Control', 'c']] }, { "id": 122, - "enabled": true, "label": 'Cut', - "shortcut": [['Control', 'x']], - "visible": true + "shortcut": [['Control', 'x']] }, { "id": 123, @@ -763,59 +544,47 @@ }, { "id": 124, - "enabled": true, - "label": 'Undo History', - "visible": true + "label": 'Undo History' }, { "id": 3, "enabled": false, - "label": '_Fade...', - "visible": true + "label": '_Fade...' }, { "id": 2, "enabled": false, "label": '_Redo', - "shortcut": [['Control', 'y']], - "visible": true + "shortcut": [['Control', 'y']] }, { "id": 1, "enabled": false, "label": '_Undo', - "shortcut": [['Control', 'z']], - "visible": true + "shortcut": [['Control', 'z']] } ] }, { "id": 125, "children-display": 'submenu', - "enabled": true, "label": 'Select', - "visible": true, "submenu": [ { "id": 126, "enabled": false, - "label": 'To Path', - "visible": true + "label": 'To Path' }, { "id": 127, - "enabled": true, - "label": 'Save to Channel', - "visible": true + "label": 'Save to Channel' }, { "id": 128, - "enabled": true, "label": 'Toggle Quick Mask', "shortcut": [['Shift', 'q']], "toggle-state": 0, - "toggle-type": 'checkmark', - "visible": true + "toggle-type": 'checkmark' }, { "id": 129, @@ -823,39 +592,32 @@ }, { "id": 130, - "enabled": true, - "label": 'Distort...', - "visible": true + "label": 'Distort...' }, { "id": 131, "enabled": false, - "label": 'Border...', - "visible": true + "label": 'Border...' }, { "id": 132, "enabled": false, - "label": 'Grow...', - "visible": true + "label": 'Grow...' }, { "id": 133, "enabled": false, - "label": 'Shrink...', - "visible": true + "label": 'Shrink...' }, { "id": 134, "enabled": false, - "label": 'Sharpen', - "visible": true + "label": 'Sharpen' }, { "id": 135, "enabled": false, - "label": 'Feather...', - "visible": true + "label": 'Feather...' }, { "id": 136, @@ -863,106 +625,81 @@ }, { "id": 137, - "enabled": true, - "label": 'Selection Editor', - "visible": true + "label": 'Selection Editor' }, { "id": 138, "enabled": false, "label": 'From Path', - "shortcut": [['Shift', 'v']], - "visible": true + "shortcut": [['Shift', 'v']] }, { "id": 139, - "enabled": true, "label": 'By Color', - "shortcut": [['Shift', 'o']], - "visible": true + "shortcut": [['Shift', 'o']] }, { "id": 140, "enabled": false, "label": 'Float', - "shortcut": [['Control', 'Shift', 'l']], - "visible": true + "shortcut": [['Control', 'Shift', 'l']] }, { "id": 141, - "enabled": true, "label": 'Invert', - "shortcut": [['Control', 'i']], - "visible": true + "shortcut": [['Control', 'i']] }, { "id": 142, "enabled": false, "label": 'None', - "shortcut": [['Control', 'Shift', 'a']], - "visible": true + "shortcut": [['Control', 'Shift', 'a']] }, { "id": 143, - "enabled": true, "label": 'All', - "shortcut": [['Control', 'a']], - "visible": true + "shortcut": [['Control', 'a']] } ] }, { "id": 144, "children-display": 'submenu', - "enabled": true, "label": 'View', - "visible": true, "submenu": [ { "id": 145, - "enabled": true, "label": 'Show Statusbar', "toggle-state": 1, - "toggle-type": 'checkmark', - "visible": true + "toggle-type": 'checkmark' }, { "id": 146, - "enabled": true, "label": 'Show Scrollbars', "toggle-state": 0, - "toggle-type": 'checkmark', - "visible": true + "toggle-type": 'checkmark' }, { "id": 147, - "enabled": true, "label": 'Show Rulers', "shortcut": [['Control', 'Shift', 'r']], "toggle-state": 0, - "toggle-type": 'checkmark', - "visible": true + "toggle-type": 'checkmark' }, { "id": 148, - "enabled": true, "label": 'Show Menubar', "toggle-state": 1, - "toggle-type": 'checkmark', - "visible": true + "toggle-type": 'checkmark' }, { "id": 149, "children-display": 'submenu', - "enabled": true, "label": 'Padding Color', - "visible": true, "submenu": [ { "id": 150, - "enabled": true, - "label": 'As in Preferences', - "visible": true + "label": 'As in Preferences' }, { "id": 151, @@ -970,27 +707,19 @@ }, { "id": 152, - "enabled": true, - "label": 'Select Custom Color...', - "visible": true + "label": 'Select Custom Color...' }, { "id": 153, - "enabled": true, - "label": 'Dark Check Color', - "visible": true + "label": 'Dark Check Color' }, { "id": 154, - "enabled": true, - "label": 'Light Check Color', - "visible": true + "label": 'Light Check Color' }, { "id": 155, - "enabled": true, - "label": 'From Theme', - "visible": true + "label": 'From Theme' } ] }, @@ -1000,35 +729,27 @@ }, { "id": 157, - "enabled": true, "label": 'Snap to Active Path', "toggle-state": 0, - "toggle-type": 'checkmark', - "visible": true + "toggle-type": 'checkmark' }, { "id": 158, - "enabled": true, "label": 'Snap to Canvas Edges', "toggle-state": 0, - "toggle-type": 'checkmark', - "visible": true + "toggle-type": 'checkmark' }, { "id": 159, - "enabled": true, "label": 'Snap to Grid', "toggle-state": 0, - "toggle-type": 'checkmark', - "visible": true + "toggle-type": 'checkmark' }, { "id": 160, - "enabled": true, "label": 'Snap to Guides', "toggle-state": 1, - "toggle-type": 'checkmark', - "visible": true + "toggle-type": 'checkmark' }, { "id": 161, @@ -1036,45 +757,35 @@ }, { "id": 162, - "enabled": true, "label": 'Show Sample Points', "toggle-state": 0, - "toggle-type": 'checkmark', - "visible": true + "toggle-type": 'checkmark' }, { "id": 163, - "enabled": true, "label": 'Show Grid', "toggle-state": 0, - "toggle-type": 'checkmark', - "visible": true + "toggle-type": 'checkmark' }, { "id": 164, - "enabled": true, "label": 'Show Guides', "shortcut": [['Control', 'Shift', 't']], "toggle-state": 0, - "toggle-type": 'checkmark', - "visible": true + "toggle-type": 'checkmark' }, { "id": 165, - "enabled": true, "label": 'Show Layer Boundary', "toggle-state": 0, - "toggle-type": 'checkmark', - "visible": true + "toggle-type": 'checkmark' }, { "id": 166, - "enabled": true, "label": 'Show Selection', "shortcut": [['Control', 't']], "toggle-state": 0, - "toggle-type": 'checkmark', - "visible": true + "toggle-type": 'checkmark' }, { "id": 167, @@ -1082,15 +793,11 @@ }, { "id": 168, - "enabled": true, - "label": 'Display Filters...', - "visible": true + "label": 'Display Filters...' }, { "id": 169, - "enabled": true, - "label": 'Navigation Window', - "visible": true + "label": 'Navigation Window' }, { "id": 170, @@ -1099,27 +806,21 @@ { "id": 171, "children-display": 'submenu', - "enabled": true, "label": 'Fullscreen', "shortcut": [['F11']], "toggle-state": 0, "toggle-type": 'checkmark', - "visible": true, "submenu": [ { "id": 172, - "enabled": true, - "label": 'Open Display...', - "visible": true + "label": 'Open Display...' } ] }, { "id": 173, - "enabled": true, "label": 'Shrink Wrap', - "shortcut": [['Control', 'e']], - "visible": true + "shortcut": [['Control', 'e']] }, { "id": 174, @@ -1128,17 +829,13 @@ { "id": 175, "children-display": 'submenu', - "enabled": true, "label": '_Zoom (67%)', - "visible": true, "submenu": [ { "id": 176, - "enabled": true, "label": 'Othe_r (67%)...', "toggle-state": 0, - "toggle-type": 'checkmark', - "visible": true + "toggle-type": 'checkmark' }, { "id": 177, @@ -1146,76 +843,58 @@ }, { "id": 178, - "enabled": true, "label": '1:16 (6.25%)', "toggle-state": 0, - "toggle-type": 'checkmark', - "visible": true + "toggle-type": 'checkmark' }, { "id": 179, - "enabled": true, "label": '1:8 (12.5%)', "toggle-state": 0, - "toggle-type": 'checkmark', - "visible": true + "toggle-type": 'checkmark' }, { "id": 180, - "enabled": true, "label": '1:4 (25%)', "toggle-state": 0, - "toggle-type": 'checkmark', - "visible": true + "toggle-type": 'checkmark' }, { "id": 181, - "enabled": true, "label": '1:2 (50%)', "toggle-state": 0, - "toggle-type": 'checkmark', - "visible": true + "toggle-type": 'checkmark' }, { "id": 182, - "enabled": true, "label": '1:1 (100%)', "shortcut": [['1']], "toggle-state": 1, - "toggle-type": 'checkmark', - "visible": true + "toggle-type": 'checkmark' }, { "id": 183, - "enabled": true, "label": '2:1 (200%)', "toggle-state": 0, - "toggle-type": 'checkmark', - "visible": true + "toggle-type": 'checkmark' }, { "id": 184, - "enabled": true, "label": '4:1 (400%)', "toggle-state": 0, - "toggle-type": 'checkmark', - "visible": true + "toggle-type": 'checkmark' }, { "id": 185, - "enabled": true, "label": '8:1 (800%)', "toggle-state": 0, - "toggle-type": 'checkmark', - "visible": true + "toggle-type": 'checkmark' }, { "id": 186, - "enabled": true, "label": '16:1 (1600%)', "toggle-state": 0, - "toggle-type": 'checkmark', - "visible": true + "toggle-type": 'checkmark' }, { "id": 187, @@ -1223,106 +902,76 @@ }, { "id": 188, - "enabled": true, - "label": 'Fill Window', - "visible": true + "label": 'Fill Window' }, { "id": 189, - "enabled": true, "label": 'Fit Image in Window', - "shortcut": [['Control', 'Shift', 'e']], - "visible": true + "shortcut": [['Control', 'Shift', 'e']] }, { "id": 190, - "enabled": true, "label": 'Zoom In', - "shortcut": [['plus']], - "visible": true + "shortcut": [['plus']] }, { "id": 191, - "enabled": true, "label": 'Zoom Out', - "shortcut": [['minus']], - "visible": true + "shortcut": [['minus']] }, { "id": 4, - "enabled": true, "label": 'Re_vert Zoom (67%)', - "shortcut": [['grave']], - "visible": true + "shortcut": [['grave']] } ] }, { "id": 192, - "enabled": true, "label": 'Dot for Dot', "toggle-state": 1, - "toggle-type": 'checkmark', - "visible": true + "toggle-type": 'checkmark' }, { "id": 193, - "enabled": true, - "label": 'New View', - "visible": true + "label": 'New View' } ] }, { "id": 194, "children-display": 'submenu', - "enabled": true, "label": 'Image', - "visible": true, "submenu": [ { "id": 195, - "enabled": true, "label": 'Image Properties', - "shortcut": [['Alt', 'Return']], - "visible": true + "shortcut": [['Alt', 'Return']] }, { "id": 196, - "enabled": true, - "label": 'Configure Grid...', - "visible": true + "label": 'Configure Grid...' }, { "id": 197, "children-display": 'submenu', - "enabled": true, "label": 'Guides', - "visible": true, "submenu": [ { "id": 198, - "enabled": true, - "label": 'Remove all Guides', - "visible": true + "label": 'Remove all Guides' }, { "id": 199, - "enabled": true, - "label": 'New Guides from Selection', - "visible": true + "label": 'New Guides from Selection' }, { "id": 200, - "enabled": true, - "label": 'New Guide...', - "visible": true + "label": 'New Guide...' }, { "id": 201, - "enabled": true, - "label": 'New Guide (by Percent)...', - "visible": true + "label": 'New Guide (by Percent)...' } ] }, @@ -1332,22 +981,16 @@ }, { "id": 203, - "enabled": true, - "label": 'Align Visible Layers...', - "visible": true + "label": 'Align Visible Layers...' }, { "id": 204, - "enabled": true, - "label": 'Flatten Image', - "visible": true + "label": 'Flatten Image' }, { "id": 205, - "enabled": true, "label": 'Merge Visible Layers...', - "shortcut": [['Control', 'm']], - "visible": true + "shortcut": [['Control', 'm']] }, { "id": 206, @@ -1355,21 +998,16 @@ }, { "id": 207, - "enabled": true, - "label": 'Zealous Crop', - "visible": true + "label": 'Zealous Crop' }, { "id": 208, - "enabled": true, - "label": 'Autocrop Image', - "visible": true + "label": 'Autocrop Image' }, { "id": 209, "enabled": false, - "label": 'Crop to Selection', - "visible": true + "label": 'Crop to Selection' }, { "id": 210, @@ -1377,33 +1015,24 @@ }, { "id": 211, - "enabled": true, - "label": 'Scale Image...', - "visible": true + "label": 'Scale Image...' }, { "id": 212, - "enabled": true, - "label": 'Print Size...', - "visible": true + "label": 'Print Size...' }, { "id": 213, "enabled": false, - "label": 'Fit Canvas to Selection', - "visible": true + "label": 'Fit Canvas to Selection' }, { "id": 214, - "enabled": true, - "label": 'Fit Canvas to Layers', - "visible": true + "label": 'Fit Canvas to Layers' }, { "id": 215, - "enabled": true, - "label": 'Canvas Size...', - "visible": true + "label": 'Canvas Size...' }, { "id": 216, @@ -1412,15 +1041,11 @@ { "id": 217, "children-display": 'submenu', - "enabled": true, "label": 'Transform', - "visible": true, "submenu": [ { "id": 218, - "enabled": true, - "label": 'Guillotine', - "visible": true + "label": 'Guillotine' }, { "id": 219, @@ -1428,21 +1053,15 @@ }, { "id": 220, - "enabled": true, - "label": 'Rotate 180?', - "visible": true + "label": 'Rotate 180?' }, { "id": 221, - "enabled": true, - "label": 'Rotate 90? counter-clockwise', - "visible": true + "label": 'Rotate 90? counter-clockwise' }, { "id": 222, - "enabled": true, - "label": 'Rotate 90? clockwise', - "visible": true + "label": 'Rotate 90? clockwise' }, { "id": 223, @@ -1450,36 +1069,26 @@ }, { "id": 224, - "enabled": true, - "label": 'Flip Vertically', - "visible": true + "label": 'Flip Vertically' }, { "id": 225, - "enabled": true, - "label": 'Flip Horizontally', - "visible": true + "label": 'Flip Horizontally' } ] }, { "id": 226, "children-display": 'submenu', - "enabled": true, "label": 'Mode', - "visible": true, "submenu": [ { "id": 227, - "enabled": true, - "label": 'Convert to Color Profile...', - "visible": true + "label": 'Convert to Color Profile...' }, { "id": 228, - "enabled": true, - "label": 'Assign Color Profile...', - "visible": true + "label": 'Assign Color Profile...' }, { "id": 229, @@ -1487,75 +1096,56 @@ }, { "id": 230, - "enabled": true, "label": 'Indexed...', "toggle-state": 0, - "toggle-type": 'checkmark', - "visible": true + "toggle-type": 'checkmark' }, { "id": 231, - "enabled": true, "label": 'Grayscale', "toggle-state": 0, - "toggle-type": 'checkmark', - "visible": true + "toggle-type": 'checkmark' }, { "id": 232, - "enabled": true, "label": 'RGB', "toggle-state": 1, - "toggle-type": 'checkmark', - "visible": true + "toggle-type": 'checkmark' } ] }, { "id": 233, - "enabled": true, "label": 'Duplicate', - "shortcut": [['Control', 'd']], - "visible": true + "shortcut": [['Control', 'd']] } ] }, { "id": 234, "children-display": 'submenu', - "enabled": true, "label": 'Layer', - "visible": true, "submenu": [ { "id": 235, - "enabled": true, - "label": 'Autocrop Layer', - "visible": true + "label": 'Autocrop Layer' }, { "id": 236, "enabled": false, - "label": 'Crop to Selection', - "visible": true + "label": 'Crop to Selection' }, { "id": 237, - "enabled": true, - "label": 'Scale Layer...', - "visible": true + "label": 'Scale Layer...' }, { "id": 238, - "enabled": true, - "label": 'Layer to Image Size', - "visible": true + "label": 'Layer to Image Size' }, { "id": 239, - "enabled": true, - "label": 'Layer Boundary Size...', - "visible": true + "label": 'Layer Boundary Size...' }, { "id": 240, @@ -1564,16 +1154,12 @@ { "id": 241, "children-display": 'submenu', - "enabled": true, "label": 'Transform', - "visible": true, "submenu": [ { "id": 242, - "enabled": true, "label": 'Offset...', - "shortcut": [['Control', 'Shift', 'o']], - "visible": true + "shortcut": [['Control', 'Shift', 'o']] }, { "id": 243, @@ -1581,27 +1167,19 @@ }, { "id": 244, - "enabled": true, - "label": 'Arbitrary Rotation...', - "visible": true + "label": 'Arbitrary Rotation...' }, { "id": 245, - "enabled": true, - "label": 'Rotate 180?', - "visible": true + "label": 'Rotate 180?' }, { "id": 246, - "enabled": true, - "label": 'Rotate 90? counter-clockwise', - "visible": true + "label": 'Rotate 90? counter-clockwise' }, { "id": 247, - "enabled": true, - "label": 'Rotate 90? clockwise', - "visible": true + "label": 'Rotate 90? clockwise' }, { "id": 248, @@ -1609,48 +1187,34 @@ }, { "id": 249, - "enabled": true, - "label": 'Flip Vertically', - "visible": true + "label": 'Flip Vertically' }, { "id": 250, - "enabled": true, - "label": 'Flip Horizontally', - "visible": true + "label": 'Flip Horizontally' } ] }, { "id": 251, "children-display": 'submenu', - "enabled": true, "label": 'Transparency', - "visible": true, "submenu": [ { "id": 252, - "enabled": true, - "label": 'Intersect with Selection', - "visible": true + "label": 'Intersect with Selection' }, { "id": 253, - "enabled": true, - "label": 'Subtract from Selection', - "visible": true + "label": 'Subtract from Selection' }, { "id": 254, - "enabled": true, - "label": 'Add to Selection', - "visible": true + "label": 'Add to Selection' }, { "id": 255, - "enabled": true, - "label": 'Alpha to Selection', - "visible": true + "label": 'Alpha to Selection' }, { "id": 256, @@ -1658,66 +1222,51 @@ }, { "id": 257, - "enabled": true, - "label": 'Threshold Alpha...', - "visible": true + "label": 'Threshold Alpha...' }, { "id": 258, - "enabled": true, - "label": 'Semi-Flatten', - "visible": true + "label": 'Semi-Flatten' }, { "id": 259, - "enabled": true, - "label": 'Color to Alpha...', - "visible": true + "label": 'Color to Alpha...' }, { "id": 260, - "enabled": true, - "label": 'Remove Alpha Channel', - "visible": true + "label": 'Remove Alpha Channel' }, { "id": 261, "enabled": false, - "label": 'Add Alpha Channel', - "visible": true + "label": 'Add Alpha Channel' } ] }, { "id": 262, "children-display": 'submenu', - "enabled": true, "label": 'Mask', - "visible": true, "submenu": [ { "id": 263, "enabled": false, - "label": 'Intersect with Selection', - "visible": true + "label": 'Intersect with Selection' }, { "id": 264, "enabled": false, - "label": 'Subtract from Selection', - "visible": true + "label": 'Subtract from Selection' }, { "id": 265, "enabled": false, - "label": 'Add to Selection', - "visible": true + "label": 'Add to Selection' }, { "id": 266, "enabled": false, - "label": 'Mask to Selection', - "visible": true + "label": 'Mask to Selection' }, { "id": 267, @@ -1728,24 +1277,21 @@ "enabled": false, "label": 'Disable Layer Mask', "toggle-state": 0, - "toggle-type": 'checkmark', - "visible": true + "toggle-type": 'checkmark' }, { "id": 269, "enabled": false, "label": 'Edit Layer Mask', "toggle-state": 0, - "toggle-type": 'checkmark', - "visible": true + "toggle-type": 'checkmark' }, { "id": 270, "enabled": false, "label": 'Show Layer Mask', "toggle-state": 0, - "toggle-type": 'checkmark', - "visible": true + "toggle-type": 'checkmark' }, { "id": 271, @@ -1754,35 +1300,27 @@ { "id": 272, "enabled": false, - "label": 'Delete Layer Mask', - "visible": true + "label": 'Delete Layer Mask' }, { "id": 273, "enabled": false, - "label": 'Apply Layer Mask', - "visible": true + "label": 'Apply Layer Mask' }, { "id": 274, - "enabled": true, - "label": 'Add Layer Mask...', - "visible": true + "label": 'Add Layer Mask...' } ] }, { "id": 275, "children-display": 'submenu', - "enabled": true, "label": 'Stack', - "visible": true, "submenu": [ { "id": 276, - "enabled": true, - "label": 'Reverse Layer Order', - "visible": true + "label": 'Reverse Layer Order' }, { "id": 277, @@ -1791,26 +1329,22 @@ { "id": 278, "enabled": false, - "label": 'Layer to Bottom', - "visible": true + "label": 'Layer to Bottom' }, { "id": 279, "enabled": false, - "label": 'Layer to Top', - "visible": true + "label": 'Layer to Top' }, { "id": 280, "enabled": false, - "label": 'Lower Layer', - "visible": true + "label": 'Lower Layer' }, { "id": 281, "enabled": false, - "label": 'Raise Layer', - "visible": true + "label": 'Raise Layer' }, { "id": 282, @@ -1820,29 +1354,25 @@ "id": 283, "enabled": false, "label": 'Select Bottom Layer', - "shortcut": [['End']], - "visible": true + "shortcut": [['End']] }, { "id": 284, "enabled": false, "label": 'Select Top Layer', - "shortcut": [['Home']], - "visible": true + "shortcut": [['Home']] }, { "id": 285, "enabled": false, "label": 'Select Next Layer', - "shortcut": [['Page_Down']], - "visible": true + "shortcut": [['Page_Down']] }, { "id": 286, "enabled": false, "label": 'Select Previous Layer', - "shortcut": [['Page_Up']], - "visible": true + "shortcut": [['Page_Up']] } ] }, @@ -1854,94 +1384,70 @@ { "id": 288, "enabled": false, - "label": 'Empty', - "visible": true + "label": 'Empty' } ] }, { "id": 289, - "enabled": true, - "label": 'Delete Layer', - "visible": true + "label": 'Delete Layer' }, { "id": 290, "enabled": false, - "label": 'Merge Down', - "visible": true + "label": 'Merge Down' }, { "id": 291, "enabled": false, "label": 'Anchor Layer', - "shortcut": [['Control', 'h']], - "visible": true + "shortcut": [['Control', 'h']] }, { "id": 292, - "enabled": true, "label": 'Duplicate Layer', - "shortcut": [['Control', 'Shift', 'd']], - "visible": true + "shortcut": [['Control', 'Shift', 'd']] }, { "id": 293, - "enabled": true, - "label": 'New from Visible', - "visible": true + "label": 'New from Visible' }, { "id": 294, - "enabled": true, "label": 'New Layer...', - "shortcut": [['Control', 'Shift', 'n']], - "visible": true + "shortcut": [['Control', 'Shift', 'n']] } ] }, { "id": 295, "children-display": 'submenu', - "enabled": true, "label": 'Colors', - "visible": true, "submenu": [ { "id": 296, - "enabled": true, - "label": 'Retinex...', - "visible": true + "label": 'Retinex...' }, { "id": 297, - "enabled": true, - "label": 'Maximum RGB...', - "visible": true + "label": 'Maximum RGB...' }, { "id": 298, "enabled": false, - "label": 'Hot...', - "visible": true + "label": 'Hot...' }, { "id": 299, - "enabled": true, - "label": 'Filter Pack...', - "visible": true + "label": 'Filter Pack...' }, { "id": 300, - "enabled": true, - "label": 'Color to Alpha...', - "visible": true + "label": 'Color to Alpha...' }, { "id": 301, - "enabled": true, - "label": 'Colorify...', - "visible": true + "label": 'Colorify...' }, { "id": 302, @@ -1950,78 +1456,54 @@ { "id": 303, "children-display": 'submenu', - "enabled": true, "label": 'Info', - "visible": true, "submenu": [ { "id": 304, - "enabled": true, - "label": 'Smooth Palette...', - "visible": true + "label": 'Smooth Palette...' }, { "id": 305, - "enabled": true, - "label": 'Colorcube Analysis...', - "visible": true + "label": 'Colorcube Analysis...' }, { "id": 306, - "enabled": true, - "label": 'Border Average...', - "visible": true + "label": 'Border Average...' }, { "id": 307, - "enabled": true, - "label": 'Histogram', - "visible": true + "label": 'Histogram' } ] }, { "id": 308, "children-display": 'submenu', - "enabled": true, "label": 'Map', - "visible": true, "submenu": [ { "id": 309, - "enabled": true, - "label": 'Sample Colorize...', - "visible": true + "label": 'Sample Colorize...' }, { "id": 310, - "enabled": true, - "label": 'Rotate Colors...', - "visible": true + "label": 'Rotate Colors...' }, { "id": 311, - "enabled": true, - "label": 'Palette Map', - "visible": true + "label": 'Palette Map' }, { "id": 312, - "enabled": true, - "label": 'Gradient Map', - "visible": true + "label": 'Gradient Map' }, { "id": 313, - "enabled": true, - "label": 'Color Exchange...', - "visible": true + "label": 'Color Exchange...' }, { "id": 314, - "enabled": true, - "label": 'Alien Map...', - "visible": true + "label": 'Alien Map...' }, { "id": 315, @@ -2030,92 +1512,68 @@ { "id": 316, "enabled": false, - "label": 'Set Colormap...', - "visible": true + "label": 'Set Colormap...' }, { "id": 317, "enabled": false, - "label": 'Rearrange Colormap...', - "visible": true + "label": 'Rearrange Colormap...' } ] }, { "id": 318, "children-display": 'submenu', - "enabled": true, "label": 'Components', - "visible": true, "submenu": [ { "id": 319, "enabled": false, - "label": 'Recompose', - "visible": true + "label": 'Recompose' }, { "id": 320, - "enabled": true, - "label": 'Decompose...', - "visible": true + "label": 'Decompose...' }, { "id": 321, "enabled": false, - "label": 'Compose...', - "visible": true + "label": 'Compose...' }, { "id": 322, - "enabled": true, - "label": 'Channel Mixer...', - "visible": true + "label": 'Channel Mixer...' } ] }, { "id": 323, "children-display": 'submenu', - "enabled": true, "label": 'Auto', - "visible": true, "submenu": [ { "id": 324, - "enabled": true, - "label": 'Stretch HSV', - "visible": true + "label": 'Stretch HSV' }, { "id": 325, - "enabled": true, - "label": 'Stretch Contrast', - "visible": true + "label": 'Stretch Contrast' }, { "id": 326, - "enabled": true, - "label": 'Normalize', - "visible": true + "label": 'Normalize' }, { "id": 327, - "enabled": true, - "label": 'Color Enhance', - "visible": true + "label": 'Color Enhance' }, { "id": 328, - "enabled": true, - "label": 'White Balance', - "visible": true + "label": 'White Balance' }, { "id": 329, - "enabled": true, - "label": 'Equalize', - "visible": true + "label": 'Equalize' } ] }, @@ -2125,11 +1583,9 @@ }, { "id": 331, - "enabled": true, "label": 'Use GEGL', "toggle-state": 0, - "toggle-type": 'checkmark', - "visible": true + "toggle-type": 'checkmark' }, { "id": 332, @@ -2137,15 +1593,11 @@ }, { "id": 333, - "enabled": true, - "label": 'Value Invert', - "visible": true + "label": 'Value Invert' }, { "id": 334, - "enabled": true, - "label": 'Invert', - "visible": true + "label": 'Invert' }, { "id": 335, @@ -2153,87 +1605,61 @@ }, { "id": 336, - "enabled": true, - "label": 'Desaturate...', - "visible": true + "label": 'Desaturate...' }, { "id": 337, - "enabled": true, - "label": 'Posterize...', - "visible": true + "label": 'Posterize...' }, { "id": 338, - "enabled": true, - "label": 'Curves...', - "visible": true + "label": 'Curves...' }, { "id": 339, - "enabled": true, - "label": 'Levels...', - "visible": true + "label": 'Levels...' }, { "id": 340, - "enabled": true, - "label": 'Threshold...', - "visible": true + "label": 'Threshold...' }, { "id": 341, - "enabled": true, - "label": 'Brightness-Contrast...', - "visible": true + "label": 'Brightness-Contrast...' }, { "id": 342, - "enabled": true, - "label": 'Colorize...', - "visible": true + "label": 'Colorize...' }, { "id": 343, - "enabled": true, - "label": 'Hue-Saturation...', - "visible": true + "label": 'Hue-Saturation...' }, { "id": 344, - "enabled": true, - "label": 'Color Balance...', - "visible": true + "label": 'Color Balance...' } ] }, { "id": 345, "children-display": 'submenu', - "enabled": true, "label": 'Tools', - "visible": true, "submenu": [ { "id": 346, - "enabled": true, "label": 'Swap Colors', - "shortcut": [['x']], - "visible": true + "shortcut": [['x']] }, { "id": 347, - "enabled": true, "label": 'Default Colors', - "shortcut": [['d']], - "visible": true + "shortcut": [['d']] }, { "id": 348, - "enabled": true, "label": 'Toolbox', - "shortcut": [['Control', 'b']], - "visible": true + "shortcut": [['Control', 'b']] }, { "id": 349, @@ -2241,326 +1667,232 @@ }, { "id": 350, - "enabled": true, - "label": 'GEGL Operation...', - "visible": true + "label": 'GEGL Operation...' }, { "id": 351, - "enabled": true, "label": 'Text', - "shortcut": [['t']], - "visible": true + "shortcut": [['t']] }, { "id": 352, - "enabled": true, "label": 'Measure', - "shortcut": [['Shift', 'm']], - "visible": true + "shortcut": [['Shift', 'm']] }, { "id": 353, - "enabled": true, "label": 'Zoom', - "shortcut": [['z']], - "visible": true + "shortcut": [['z']] }, { "id": 354, - "enabled": true, "label": 'Color Picker', - "shortcut": [['o']], - "visible": true + "shortcut": [['o']] }, { "id": 355, - "enabled": true, "label": 'Paths', - "shortcut": [['b']], - "visible": true + "shortcut": [['b']] }, { "id": 356, "children-display": 'submenu', - "enabled": true, "label": 'Color Tools', - "visible": true, "submenu": [ { "id": 357, - "enabled": true, - "label": 'Desaturate...', - "visible": true + "label": 'Desaturate...' }, { "id": 358, - "enabled": true, - "label": 'Posterize...', - "visible": true + "label": 'Posterize...' }, { "id": 359, - "enabled": true, - "label": 'Curves...', - "visible": true + "label": 'Curves...' }, { "id": 360, - "enabled": true, - "label": 'Levels...', - "visible": true + "label": 'Levels...' }, { "id": 361, - "enabled": true, - "label": 'Threshold...', - "visible": true + "label": 'Threshold...' }, { "id": 362, - "enabled": true, - "label": 'Brightness-Contrast...', - "visible": true + "label": 'Brightness-Contrast...' }, { "id": 363, - "enabled": true, - "label": 'Colorize...', - "visible": true + "label": 'Colorize...' }, { "id": 364, - "enabled": true, - "label": 'Hue-Saturation...', - "visible": true + "label": 'Hue-Saturation...' }, { "id": 365, - "enabled": true, - "label": 'Color Balance...', - "visible": true + "label": 'Color Balance...' } ] }, { "id": 366, "children-display": 'submenu', - "enabled": true, "label": 'Transform Tools', - "visible": true, "submenu": [ { "id": 367, - "enabled": true, "label": 'Flip', - "shortcut": [['Shift', 'f']], - "visible": true + "shortcut": [['Shift', 'f']] }, { "id": 368, - "enabled": true, "label": 'Perspective', - "shortcut": [['Shift', 'p']], - "visible": true + "shortcut": [['Shift', 'p']] }, { "id": 369, - "enabled": true, "label": 'Shear', - "shortcut": [['Shift', 's']], - "visible": true + "shortcut": [['Shift', 's']] }, { "id": 370, - "enabled": true, "label": 'Scale', - "shortcut": [['Shift', 't']], - "visible": true + "shortcut": [['Shift', 't']] }, { "id": 371, - "enabled": true, "label": 'Rotate', - "shortcut": [['Shift', 'r']], - "visible": true + "shortcut": [['Shift', 'r']] }, { "id": 372, - "enabled": true, "label": 'Crop', - "shortcut": [['Shift', 'c']], - "visible": true + "shortcut": [['Shift', 'c']] }, { "id": 373, - "enabled": true, "label": 'Move', - "shortcut": [['m']], - "visible": true + "shortcut": [['m']] }, { "id": 374, - "enabled": true, "label": 'Align', - "shortcut": [['q']], - "visible": true + "shortcut": [['q']] } ] }, { "id": 375, "children-display": 'submenu', - "enabled": true, "label": 'Paint Tools', - "visible": true, "submenu": [ { "id": 376, - "enabled": true, "label": 'Dodge / Burn', - "shortcut": [['Shift', 'd']], - "visible": true + "shortcut": [['Shift', 'd']] }, { "id": 377, - "enabled": true, "label": 'Smudge', - "shortcut": [['s']], - "visible": true + "shortcut": [['s']] }, { "id": 378, - "enabled": true, "label": 'Blur / Sharpen', - "shortcut": [['Shift', 'u']], - "visible": true + "shortcut": [['Shift', 'u']] }, { "id": 379, - "enabled": true, - "label": 'Perspective Clone', - "visible": true + "label": 'Perspective Clone' }, { "id": 380, - "enabled": true, "label": 'Heal', - "shortcut": [['h']], - "visible": true + "shortcut": [['h']] }, { "id": 381, - "enabled": true, "label": 'Clone', - "shortcut": [['c']], - "visible": true + "shortcut": [['c']] }, { "id": 382, - "enabled": true, "label": 'Ink', - "shortcut": [['k']], - "visible": true + "shortcut": [['k']] }, { "id": 383, - "enabled": true, "label": 'Airbrush', - "shortcut": [['a']], - "visible": true + "shortcut": [['a']] }, { "id": 384, - "enabled": true, "label": 'Eraser', - "shortcut": [['Shift', 'e']], - "visible": true + "shortcut": [['Shift', 'e']] }, { "id": 385, - "enabled": true, "label": 'Paintbrush', - "shortcut": [['p']], - "visible": true + "shortcut": [['p']] }, { "id": 386, - "enabled": true, "label": 'Pencil', - "shortcut": [['n']], - "visible": true + "shortcut": [['n']] }, { "id": 387, - "enabled": true, "label": 'Blend', - "shortcut": [['l']], - "visible": true + "shortcut": [['l']] }, { "id": 388, - "enabled": true, "label": 'Bucket Fill', - "shortcut": [['Shift', 'b']], - "visible": true + "shortcut": [['Shift', 'b']] } ] }, { "id": 389, "children-display": 'submenu', - "enabled": true, "label": 'Selection Tools', - "visible": true, "submenu": [ { "id": 390, - "enabled": true, "label": 'Intelligent Scissors', - "shortcut": [['i']], - "visible": true + "shortcut": [['i']] }, { "id": 391, - "enabled": true, "label": 'By Color Select', - "shortcut": [['Shift', 'o']], - "visible": true + "shortcut": [['Shift', 'o']] }, { "id": 392, - "enabled": true, "label": 'Fuzzy Select', - "shortcut": [['u']], - "visible": true + "shortcut": [['u']] }, { "id": 393, - "enabled": true, - "label": 'Foreground Select', - "visible": true + "label": 'Foreground Select' }, { "id": 394, - "enabled": true, "label": 'Free Select', - "shortcut": [['f']], - "visible": true + "shortcut": [['f']] }, { "id": 395, - "enabled": true, "label": 'Ellipse Select', - "shortcut": [['e']], - "visible": true + "shortcut": [['e']] }, { "id": 396, - "enabled": true, "label": 'Rectangle Select', - "shortcut": [['r']], - "visible": true + "shortcut": [['r']] } ] } @@ -2569,49 +1901,35 @@ { "id": 397, "children-display": 'submenu', - "enabled": true, "label": 'Filters', - "visible": true, "submenu": [ { "id": 398, "children-display": 'submenu', - "enabled": true, "label": 'Script-Fu', - "visible": true, "submenu": [ { "id": 399, - "enabled": true, - "label": 'Start Server...', - "visible": true + "label": 'Start Server...' }, { "id": 400, - "enabled": true, - "label": 'Refresh Scripts', - "visible": true + "label": 'Refresh Scripts' }, { "id": 401, - "enabled": true, - "label": 'Console', - "visible": true + "label": 'Console' } ] }, { "id": 402, "children-display": 'submenu', - "enabled": true, "label": 'Python-Fu', - "visible": true, "submenu": [ { "id": 403, - "enabled": true, - "label": 'Console', - "visible": true + "label": 'Console' } ] }, @@ -2622,123 +1940,83 @@ { "id": 405, "children-display": 'submenu', - "enabled": true, "label": 'Alpha to Logo', - "visible": true, "submenu": [ { "id": 406, - "enabled": true, - "label": 'Textured...', - "visible": true + "label": 'Textured...' }, { "id": 407, - "enabled": true, - "label": 'Particle Trace...', - "visible": true + "label": 'Particle Trace...' }, { "id": 408, - "enabled": true, - "label": 'Neon...', - "visible": true + "label": 'Neon...' }, { "id": 409, - "enabled": true, - "label": 'Gradient Bevel...', - "visible": true + "label": 'Gradient Bevel...' }, { "id": 410, - "enabled": true, - "label": 'Glowing Hot...', - "visible": true + "label": 'Glowing Hot...' }, { "id": 411, - "enabled": true, - "label": 'Glossy...', - "visible": true + "label": 'Glossy...' }, { "id": 412, - "enabled": true, - "label": 'Frosty...', - "visible": true + "label": 'Frosty...' }, { "id": 413, - "enabled": true, - "label": 'Cool Metal...', - "visible": true + "label": 'Cool Metal...' }, { "id": 414, - "enabled": true, - "label": 'Comic Book...', - "visible": true + "label": 'Comic Book...' }, { "id": 415, - "enabled": true, - "label": 'Chrome...', - "visible": true + "label": 'Chrome...' }, { "id": 416, - "enabled": true, - "label": 'Chip Away...', - "visible": true + "label": 'Chip Away...' }, { "id": 417, - "enabled": true, - "label": 'Chalk...', - "visible": true + "label": 'Chalk...' }, { "id": 418, - "enabled": true, - "label": 'Bovination...', - "visible": true + "label": 'Bovination...' }, { "id": 419, - "enabled": true, - "label": 'Blended...', - "visible": true + "label": 'Blended...' }, { "id": 420, - "enabled": true, - "label": 'Basic I...', - "visible": true + "label": 'Basic I...' }, { "id": 421, - "enabled": true, - "label": 'Basic II...', - "visible": true + "label": 'Basic II...' }, { "id": 422, - "enabled": true, - "label": 'Alien Neon...', - "visible": true + "label": 'Alien Neon...' }, { "id": 423, - "enabled": true, - "label": 'Alien Glow...', - "visible": true + "label": 'Alien Glow...' }, { "id": 424, - "enabled": true, - "label": '3D Outline...', - "visible": true + "label": '3D Outline...' } ] }, @@ -2749,33 +2027,23 @@ { "id": 426, "children-display": 'submenu', - "enabled": true, "label": 'Animation', - "visible": true, "submenu": [ { "id": 427, - "enabled": true, - "label": 'Unoptimize', - "visible": true + "label": 'Unoptimize' }, { "id": 428, - "enabled": true, - "label": 'Playback...', - "visible": true + "label": 'Playback...' }, { "id": 429, - "enabled": true, - "label": 'Optimize (for GIF)', - "visible": true + "label": 'Optimize (for GIF)' }, { "id": 430, - "enabled": true, - "label": 'Optimize (Difference)', - "visible": true + "label": 'Optimize (Difference)' }, { "id": 431, @@ -2783,111 +2051,77 @@ }, { "id": 432, - "enabled": true, - "label": 'Waves...', - "visible": true + "label": 'Waves...' }, { "id": 433, - "enabled": true, - "label": 'Spinning Globe...', - "visible": true + "label": 'Spinning Globe...' }, { "id": 434, - "enabled": true, - "label": 'Rippling...', - "visible": true + "label": 'Rippling...' }, { "id": 435, - "enabled": true, - "label": 'Burn-In...', - "visible": true + "label": 'Burn-In...' }, { "id": 436, - "enabled": true, - "label": 'Blend...', - "visible": true + "label": 'Blend...' } ] }, { "id": 437, "children-display": 'submenu', - "enabled": true, "label": 'Web', - "visible": true, "submenu": [ { "id": 438, - "enabled": true, - "label": 'Slice...', - "visible": true + "label": 'Slice...' }, { "id": 439, - "enabled": true, - "label": 'Semi-Flatten', - "visible": true + "label": 'Semi-Flatten' }, { "id": 440, - "enabled": true, - "label": 'Image Map...', - "visible": true + "label": 'Image Map...' } ] }, { "id": 441, "children-display": 'submenu', - "enabled": true, "label": 'Render', - "visible": true, "submenu": [ { "id": 442, - "enabled": true, - "label": 'Spyrogimp...', - "visible": true + "label": 'Spyrogimp...' }, { "id": 443, - "enabled": true, - "label": 'Sphere Designer...', - "visible": true + "label": 'Sphere Designer...' }, { "id": 444, - "enabled": true, - "label": 'Line Nova...', - "visible": true + "label": 'Line Nova...' }, { "id": 445, - "enabled": true, - "label": 'Lava...', - "visible": true + "label": 'Lava...' }, { "id": 446, - "enabled": true, - "label": 'Gfig...', - "visible": true + "label": 'Gfig...' }, { "id": 447, - "enabled": true, - "label": 'Fractal Explorer...', - "visible": true + "label": 'Fractal Explorer...' }, { "id": 448, - "enabled": true, - "label": 'Circuit...', - "visible": true + "label": 'Circuit...' }, { "id": 449, @@ -2896,111 +2130,77 @@ { "id": 450, "children-display": 'submenu', - "enabled": true, "label": 'Pattern', - "visible": true, "submenu": [ { "id": 451, - "enabled": true, - "label": 'Sinus...', - "visible": true + "label": 'Sinus...' }, { "id": 452, - "enabled": true, - "label": 'Qbist...', - "visible": true + "label": 'Qbist...' }, { "id": 453, - "enabled": true, - "label": 'Maze...', - "visible": true + "label": 'Maze...' }, { "id": 454, - "enabled": true, - "label": 'Jigsaw...', - "visible": true + "label": 'Jigsaw...' }, { "id": 455, - "enabled": true, - "label": 'Grid...', - "visible": true + "label": 'Grid...' }, { "id": 456, - "enabled": true, - "label": 'Diffraction Patterns...', - "visible": true + "label": 'Diffraction Patterns...' }, { "id": 457, - "enabled": true, - "label": 'CML Explorer...', - "visible": true + "label": 'CML Explorer...' }, { "id": 458, - "enabled": true, - "label": 'Checkerboard...', - "visible": true + "label": 'Checkerboard...' } ] }, { "id": 459, "children-display": 'submenu', - "enabled": true, "label": 'Nature', - "visible": true, "submenu": [ { "id": 460, - "enabled": true, - "label": 'IFS Fractal...', - "visible": true + "label": 'IFS Fractal...' }, { "id": 461, - "enabled": true, - "label": 'Flame...', - "visible": true + "label": 'Flame...' } ] }, { "id": 462, "children-display": 'submenu', - "enabled": true, "label": 'Clouds', - "visible": true, "submenu": [ { "id": 463, - "enabled": true, - "label": 'Solid Noise...', - "visible": true + "label": 'Solid Noise...' }, { "id": 464, - "enabled": true, - "label": 'Plasma...', - "visible": true + "label": 'Plasma...' }, { "id": 465, - "enabled": true, - "label": 'Fog...', - "visible": true + "label": 'Fog...' }, { "id": 466, - "enabled": true, - "label": 'Difference Clouds...', - "visible": true + "label": 'Difference Clouds...' } ] } @@ -3009,360 +2209,252 @@ { "id": 467, "children-display": 'submenu', - "enabled": true, "label": 'Map', - "visible": true, "submenu": [ { "id": 468, - "enabled": true, - "label": 'Warp...', - "visible": true + "label": 'Warp...' }, { "id": 469, - "enabled": true, - "label": 'Tile...', - "visible": true + "label": 'Tile...' }, { "id": 470, - "enabled": true, - "label": 'Small Tiles...', - "visible": true + "label": 'Small Tiles...' }, { "id": 471, - "enabled": true, - "label": 'Paper Tile...', - "visible": true + "label": 'Paper Tile...' }, { "id": 472, - "enabled": true, - "label": 'Map Object...', - "visible": true + "label": 'Map Object...' }, { "id": 473, - "enabled": true, - "label": 'Make Seamless', - "visible": true + "label": 'Make Seamless' }, { "id": 474, - "enabled": true, - "label": 'Illusion...', - "visible": true + "label": 'Illusion...' }, { "id": 475, - "enabled": true, - "label": 'Fractal Trace...', - "visible": true + "label": 'Fractal Trace...' }, { "id": 476, - "enabled": true, - "label": 'Displace...', - "visible": true + "label": 'Displace...' }, { "id": 477, - "enabled": true, - "label": 'Bump Map...', - "visible": true + "label": 'Bump Map...' } ] }, { "id": 478, "children-display": 'submenu', - "enabled": true, "label": 'Decor', - "visible": true, "submenu": [ { "id": 479, "enabled": false, - "label": 'Stencil Chrome...', - "visible": true + "label": 'Stencil Chrome...' }, { "id": 480, "enabled": false, - "label": 'Stencil Carve...', - "visible": true + "label": 'Stencil Carve...' }, { "id": 481, "enabled": false, - "label": 'Slide...', - "visible": true + "label": 'Slide...' }, { "id": 482, "enabled": false, - "label": 'Round Corners...', - "visible": true + "label": 'Round Corners...' }, { "id": 483, - "enabled": true, - "label": 'Old Photo...', - "visible": true + "label": 'Old Photo...' }, { "id": 484, - "enabled": true, - "label": 'Fuzzy Border...', - "visible": true + "label": 'Fuzzy Border...' }, { "id": 485, - "enabled": true, - "label": 'Coffee Stain...', - "visible": true + "label": 'Coffee Stain...' }, { "id": 486, - "enabled": true, - "label": 'Add Border...', - "visible": true + "label": 'Add Border...' }, { "id": 487, - "enabled": true, - "label": 'Add Bevel...', - "visible": true + "label": 'Add Bevel...' } ] }, { "id": 488, "children-display": 'submenu', - "enabled": true, "label": 'Artistic', - "visible": true, "submenu": [ { "id": 489, - "enabled": true, - "label": 'Weave...', - "visible": true + "label": 'Weave...' }, { "id": 490, - "enabled": true, - "label": 'Van Gogh (LIC)...', - "visible": true + "label": 'Van Gogh (LIC)...' }, { "id": 491, - "enabled": true, - "label": 'Softglow...', - "visible": true + "label": 'Softglow...' }, { "id": 492, - "enabled": true, - "label": 'Predator...', - "visible": true + "label": 'Predator...' }, { "id": 493, - "enabled": true, - "label": 'Photocopy...', - "visible": true + "label": 'Photocopy...' }, { "id": 494, - "enabled": true, - "label": 'Oilify...', - "visible": true + "label": 'Oilify...' }, { "id": 495, - "enabled": true, - "label": 'GIMPressionist...', - "visible": true + "label": 'GIMPressionist...' }, { "id": 496, - "enabled": true, - "label": 'Cubism...', - "visible": true + "label": 'Cubism...' }, { "id": 497, - "enabled": true, - "label": 'Clothify...', - "visible": true + "label": 'Clothify...' }, { "id": 498, - "enabled": true, - "label": 'Cartoon...', - "visible": true + "label": 'Cartoon...' }, { "id": 499, - "enabled": true, - "label": 'Apply Canvas...', - "visible": true + "label": 'Apply Canvas...' } ] }, { "id": 500, "children-display": 'submenu', - "enabled": true, "label": 'Combine', - "visible": true, "submenu": [ { "id": 501, - "enabled": true, - "label": 'Filmstrip...', - "visible": true + "label": 'Filmstrip...' }, { "id": 502, - "enabled": true, - "label": 'Depth Merge...', - "visible": true + "label": 'Depth Merge...' } ] }, { "id": 503, "children-display": 'submenu', - "enabled": true, "label": 'Generic', - "visible": true, "submenu": [ { "id": 504, - "enabled": true, - "label": 'Erode', - "visible": true + "label": 'Erode' }, { "id": 505, - "enabled": true, - "label": 'Dilate', - "visible": true + "label": 'Dilate' }, { "id": 506, - "enabled": true, - "label": 'Convolution Matrix...', - "visible": true + "label": 'Convolution Matrix...' } ] }, { "id": 507, "children-display": 'submenu', - "enabled": true, "label": 'Edge-Detect', - "visible": true, "submenu": [ { "id": 508, - "enabled": true, - "label": 'Sobel...', - "visible": true + "label": 'Sobel...' }, { "id": 509, - "enabled": true, - "label": 'Neon...', - "visible": true + "label": 'Neon...' }, { "id": 510, - "enabled": true, - "label": 'Laplace', - "visible": true + "label": 'Laplace' }, { "id": 511, - "enabled": true, - "label": 'Edge...', - "visible": true + "label": 'Edge...' }, { "id": 512, - "enabled": true, - "label": 'Difference of Gaussians...', - "visible": true + "label": 'Difference of Gaussians...' } ] }, { "id": 513, "children-display": 'submenu', - "enabled": true, "label": 'Noise', - "visible": true, "submenu": [ { "id": 514, - "enabled": true, - "label": 'Spread...', - "visible": true + "label": 'Spread...' }, { "id": 515, - "enabled": true, - "label": 'Slur...', - "visible": true + "label": 'Slur...' }, { "id": 516, - "enabled": true, - "label": 'RGB Noise...', - "visible": true + "label": 'RGB Noise...' }, { "id": 517, - "enabled": true, - "label": 'Pick...', - "visible": true + "label": 'Pick...' }, { "id": 518, - "enabled": true, - "label": 'Hurl...', - "visible": true + "label": 'Hurl...' }, { "id": 519, - "enabled": true, - "label": 'HSV Noise...', - "visible": true + "label": 'HSV Noise...' } ] }, { "id": 520, "children-display": 'submenu', - "enabled": true, "label": 'Light and Shadow', - "visible": true, "submenu": [ { "id": 521, - "enabled": true, - "label": 'Glass Tile...', - "visible": true + "label": 'Glass Tile...' }, { "id": 522, - "enabled": true, - "label": 'Apply Lens...', - "visible": true + "label": 'Apply Lens...' }, { "id": 523, @@ -3370,21 +2462,15 @@ }, { "id": 524, - "enabled": true, - "label": 'Xach-Effect...', - "visible": true + "label": 'Xach-Effect...' }, { "id": 525, - "enabled": true, - "label": 'Perspective...', - "visible": true + "label": 'Perspective...' }, { "id": 526, - "enabled": true, - "label": 'Drop Shadow...', - "visible": true + "label": 'Drop Shadow...' }, { "id": 527, @@ -3392,252 +2478,173 @@ }, { "id": 528, - "enabled": true, - "label": 'Supernova...', - "visible": true + "label": 'Supernova...' }, { "id": 529, - "enabled": true, - "label": 'Sparkle...', - "visible": true + "label": 'Sparkle...' }, { "id": 530, - "enabled": true, - "label": 'Lighting Effects...', - "visible": true + "label": 'Lighting Effects...' }, { "id": 531, - "enabled": true, - "label": 'Lens Flare...', - "visible": true + "label": 'Lens Flare...' }, { "id": 532, - "enabled": true, - "label": 'Gradient Flare...', - "visible": true + "label": 'Gradient Flare...' } ] }, { "id": 533, "children-display": 'submenu', - "enabled": true, "label": 'Distorts', - "visible": true, "submenu": [ { "id": 534, - "enabled": true, - "label": 'Wind...', - "visible": true + "label": 'Wind...' }, { "id": 535, - "enabled": true, - "label": 'Whirl and Pinch...', - "visible": true + "label": 'Whirl and Pinch...' }, { "id": 536, - "enabled": true, - "label": 'Waves...', - "visible": true + "label": 'Waves...' }, { "id": 537, - "enabled": true, - "label": 'Video...', - "visible": true + "label": 'Video...' }, { "id": 538, - "enabled": true, - "label": 'Value Propagate...', - "visible": true + "label": 'Value Propagate...' }, { "id": 539, - "enabled": true, - "label": 'Shift...', - "visible": true + "label": 'Shift...' }, { "id": 540, - "enabled": true, - "label": 'Ripple...', - "visible": true + "label": 'Ripple...' }, { "id": 541, - "enabled": true, - "label": 'Polar Coordinates...', - "visible": true + "label": 'Polar Coordinates...' }, { "id": 542, - "enabled": true, - "label": 'Pagecurl...', - "visible": true + "label": 'Pagecurl...' }, { "id": 543, - "enabled": true, - "label": 'Newsprint...', - "visible": true + "label": 'Newsprint...' }, { "id": 544, - "enabled": true, - "label": 'Mosaic...', - "visible": true + "label": 'Mosaic...' }, { "id": 545, - "enabled": true, - "label": 'Lens Distortion...', - "visible": true + "label": 'Lens Distortion...' }, { "id": 546, - "enabled": true, - "label": 'IWarp...', - "visible": true + "label": 'IWarp...' }, { "id": 547, - "enabled": true, - "label": 'Erase Every Other Row...', - "visible": true + "label": 'Erase Every Other Row...' }, { "id": 548, - "enabled": true, - "label": 'Engrave...', - "visible": true + "label": 'Engrave...' }, { "id": 549, - "enabled": true, - "label": 'Emboss...', - "visible": true + "label": 'Emboss...' }, { "id": 550, - "enabled": true, - "label": 'Curve Bend...', - "visible": true + "label": 'Curve Bend...' }, { "id": 551, - "enabled": true, - "label": 'Blinds...', - "visible": true + "label": 'Blinds...' } ] }, { "id": 552, "children-display": 'submenu', - "enabled": true, "label": 'Enhance', - "visible": true, "submenu": [ { "id": 553, - "enabled": true, - "label": 'Unsharp Mask...', - "visible": true + "label": 'Unsharp Mask...' }, { "id": 554, - "enabled": true, - "label": 'Sharpen...', - "visible": true + "label": 'Sharpen...' }, { "id": 555, - "enabled": true, - "label": 'Red Eye Removal...', - "visible": true + "label": 'Red Eye Removal...' }, { "id": 556, "enabled": false, - "label": 'NL Filter...', - "visible": true + "label": 'NL Filter...' }, { "id": 557, - "enabled": true, - "label": 'Destripe...', - "visible": true + "label": 'Destripe...' }, { "id": 558, - "enabled": true, - "label": 'Despeckle...', - "visible": true + "label": 'Despeckle...' }, { "id": 559, - "enabled": true, - "label": 'Deinterlace...', - "visible": true + "label": 'Deinterlace...' }, { "id": 560, - "enabled": true, - "label": 'Antialias', - "visible": true + "label": 'Antialias' } ] }, { "id": 561, "children-display": 'submenu', - "enabled": true, "label": 'Blur', - "visible": true, "submenu": [ { "id": 562, - "enabled": true, - "label": 'Tileable Blur...', - "visible": true + "label": 'Tileable Blur...' }, { "id": 563, - "enabled": true, - "label": 'Selective Gaussian Blur...', - "visible": true + "label": 'Selective Gaussian Blur...' }, { "id": 564, - "enabled": true, - "label": 'Pixelize...', - "visible": true + "label": 'Pixelize...' }, { "id": 565, - "enabled": true, - "label": 'Motion Blur...', - "visible": true + "label": 'Motion Blur...' }, { "id": 566, - "enabled": true, - "label": 'Gaussian Blur...', - "visible": true + "label": 'Gaussian Blur...' }, { "id": 567, - "enabled": true, - "label": 'Blur', - "visible": true + "label": 'Blur' } ] }, @@ -3647,9 +2654,7 @@ }, { "id": 569, - "enabled": true, - "label": 'Reset all Filters', - "visible": true + "label": 'Reset all Filters' }, { "id": 570, @@ -3657,13 +2662,11 @@ "enabled": false, "label": 'Re-Show Last', "shortcut": [['Control', 'Shift', 'f']], - "visible": true, "submenu": [ { "id": 571, "enabled": false, - "label": 'Empty', - "visible": true + "label": 'Empty' } ] }, @@ -3671,24 +2674,19 @@ "id": 572, "enabled": false, "label": 'Repeat Last', - "shortcut": [['Control', 'f']], - "visible": true + "shortcut": [['Control', 'f']] } ] }, { "id": 573, "children-display": 'submenu', - "enabled": true, "label": 'Windows', - "visible": true, "submenu": [ { "id": 574, - "enabled": true, "label": 'Toolbox', - "shortcut": [['Control', 'b']], - "visible": true + "shortcut": [['Control', 'b']] }, { "id": 575, @@ -3697,39 +2695,27 @@ { "id": 576, "children-display": 'submenu', - "enabled": true, "label": 'Dockable Dialogs', - "visible": true, "submenu": [ { "id": 577, - "enabled": true, - "label": 'Error Console', - "visible": true + "label": 'Error Console' }, { "id": 578, - "enabled": true, - "label": 'Tools', - "visible": true + "label": 'Tools' }, { "id": 579, - "enabled": true, - "label": 'Templates', - "visible": true + "label": 'Templates' }, { "id": 580, - "enabled": true, - "label": 'Document History', - "visible": true + "label": 'Document History' }, { "id": 581, - "enabled": true, - "label": 'Images', - "visible": true + "label": 'Images' }, { "id": 582, @@ -3737,48 +2723,34 @@ }, { "id": 583, - "enabled": true, - "label": 'Buffers', - "visible": true + "label": 'Buffers' }, { "id": 584, - "enabled": true, - "label": 'Fonts', - "visible": true + "label": 'Fonts' }, { "id": 585, - "enabled": true, - "label": 'Palettes', - "visible": true + "label": 'Palettes' }, { "id": 586, - "enabled": true, "label": 'Gradients', - "shortcut": [['Control', 'g']], - "visible": true + "shortcut": [['Control', 'g']] }, { "id": 587, - "enabled": true, "label": 'Patterns', - "shortcut": [['Control', 'Shift', 'p']], - "visible": true + "shortcut": [['Control', 'Shift', 'p']] }, { "id": 588, - "enabled": true, "label": 'Brushes', - "shortcut": [['Control', 'Shift', 'b']], - "visible": true + "shortcut": [['Control', 'Shift', 'b']] }, { "id": 589, - "enabled": true, - "label": 'Colors', - "visible": true + "label": 'Colors' }, { "id": 590, @@ -3786,64 +2758,44 @@ }, { "id": 591, - "enabled": true, - "label": 'Sample Points', - "visible": true + "label": 'Sample Points' }, { "id": 592, - "enabled": true, - "label": 'Pointer', - "visible": true + "label": 'Pointer' }, { "id": 593, - "enabled": true, - "label": 'Undo History', - "visible": true + "label": 'Undo History' }, { "id": 594, - "enabled": true, - "label": 'Navigation', - "visible": true + "label": 'Navigation' }, { "id": 595, - "enabled": true, - "label": 'Selection Editor', - "visible": true + "label": 'Selection Editor' }, { "id": 596, - "enabled": true, - "label": 'Histogram', - "visible": true + "label": 'Histogram' }, { "id": 597, - "enabled": true, - "label": 'Colormap', - "visible": true + "label": 'Colormap' }, { "id": 598, - "enabled": true, - "label": 'Paths', - "visible": true + "label": 'Paths' }, { "id": 599, - "enabled": true, - "label": 'Channels', - "visible": true + "label": 'Channels' }, { "id": 600, - "enabled": true, "label": 'Layers', - "shortcut": [['Control', 'l']], - "visible": true + "shortcut": [['Control', 'l']] }, { "id": 601, @@ -3851,30 +2803,23 @@ }, { "id": 602, - "enabled": true, - "label": 'Device Status', - "visible": true + "label": 'Device Status' }, { "id": 603, - "enabled": true, - "label": 'Tool Options', - "visible": true + "label": 'Tool Options' } ] }, { "id": 604, "children-display": 'submenu', - "enabled": true, "label": 'Recently Closed Docks', - "visible": true, "submenu": [ { "id": 605, "enabled": false, - "label": 'Empty', - "visible": true + "label": 'Empty' } ] } @@ -3883,91 +2828,63 @@ { "id": 606, "children-display": 'submenu', - "enabled": true, "label": 'Help', - "visible": true, "submenu": [ { "id": 607, "children-display": 'submenu', - "enabled": true, "label": 'User Manual', - "visible": true, "submenu": [ { "id": 608, - "enabled": true, - "label": 'Working with Digital Camera Photos', - "visible": true + "label": 'Working with Digital Camera Photos' }, { "id": 609, - "enabled": true, - "label": 'Using Paths', - "visible": true + "label": 'Using Paths' }, { "id": 610, - "enabled": true, - "label": 'Preparing your Images for the Web', - "visible": true + "label": 'Preparing your Images for the Web' }, { "id": 611, - "enabled": true, - "label": 'How to Use Dialogs', - "visible": true + "label": 'How to Use Dialogs' }, { "id": 612, - "enabled": true, - "label": 'Drawing Simple Objects', - "visible": true + "label": 'Drawing Simple Objects' }, { "id": 613, - "enabled": true, - "label": 'Create, Open and Save Files', - "visible": true + "label": 'Create, Open and Save Files' }, { "id": 614, - "enabled": true, - "label": 'Basic Concepts', - "visible": true + "label": 'Basic Concepts' } ] }, { "id": 615, "children-display": 'submenu', - "enabled": true, "label": 'GIMP Online', - "visible": true, "submenu": [ { "id": 616, - "enabled": true, - "label": 'User Manual Web Site', - "visible": true + "label": 'User Manual Web Site' }, { "id": 617, - "enabled": true, - "label": 'Plug-in Registry', - "visible": true + "label": 'Plug-in Registry' }, { "id": 618, - "enabled": true, - "label": 'Main Web Site', - "visible": true + "label": 'Main Web Site' }, { "id": 619, - "enabled": true, - "label": 'Developer Web Site', - "visible": true + "label": 'Developer Web Site' } ] }, @@ -3977,15 +2894,11 @@ }, { "id": 621, - "enabled": true, - "label": 'Procedure Browser', - "visible": true + "label": 'Procedure Browser' }, { "id": 622, - "enabled": true, - "label": 'Plug-In Browser', - "visible": true + "label": 'Plug-In Browser' }, { "id": 623, @@ -3993,29 +2906,21 @@ }, { "id": 624, - "enabled": true, - "label": 'About', - "visible": true + "label": 'About' }, { "id": 625, - "enabled": true, - "label": 'Tip of the Day', - "visible": true + "label": 'Tip of the Day' }, { "id": 626, - "enabled": true, "label": 'Context Help', - "shortcut": [['Shift', 'F1']], - "visible": true + "shortcut": [['Shift', 'F1']] }, { "id": 627, - "enabled": true, "label": 'Help', - "shortcut": [['F1']], - "visible": true + "shortcut": [['F1']] } ] } -- cgit v1.2.3 From d6a7a584a891989b87f966f7e58775423d894b76 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 21:59:34 -0600 Subject: Changing values to be booleans instead of strings to remove warnings. --- tests/test-gtk-label.json | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/test-gtk-label.json b/tests/test-gtk-label.json index 755bd44..0189fbe 100644 --- a/tests/test-gtk-label.json +++ b/tests/test-gtk-label.json @@ -45,7 +45,7 @@ "label": "value27"}, {"id": 28, "type": "standard", "label": "value28"}, - {"id": 29, "type": "standard", "visible": "false", + {"id": 29, "type": "standard", "visible": false, "label": "value29"} ] }, @@ -54,45 +54,45 @@ "submenu": [ {"id": 40, "type": "standard", - "enabled": "true", + "enabled": true, "label": "value40"}, {"id": 41, "type": "standard", - "enabled": "false", + "enabled": false, "label": "value41"}, {"id": 42, "type": "standard", - "enabled": "true", + "enabled": true, "label": "value42"}, {"id": 43, "type": "standard", - "enabled": "false", + "enabled": false, "label": "value43"}, {"id": 44, "type": "standard", - "enabled": "true", + "enabled": true, "label": "value44"}, {"id": 45, "type": "standard", - "enabled": "false", + "enabled": false, "label": "value45"}, {"id": 46, "type": "standard", - "enabled": "true", + "enabled": true, "label": "value46"}, {"id": 47, "type": "standard", - "enabled": "false", + "enabled": false, "label": "value47"}, {"id": 48, "type": "standard", - "enabled": "true", + "enabled": true, "label": "value48"}, {"id": 49, "type": "standard", - "visible": "false", - "enabled": "false", - "label": "value49"} + "visible": false, + "enabled": false, + "label": "value49 - hidden"} ] }, {"id": 3, "type": "standard", -- cgit v1.2.3 From 5eda2e026654bb7d79c30053f60cc2f67171be75 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 23:02:01 -0600 Subject: When we're being selective we need to ensure we don't unref too boldly. --- libdbusmenu-glib/server.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index aa39991..de8a9b9 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -892,7 +892,9 @@ menuitem_property_changed (DbusmenuMenuitem * mi, gchar * property, GVariant * v /* If so, we need to swap the value */ if (prop != NULL) { - g_variant_unref(prop->variant); + if (prop->variant != NULL) { + g_variant_unref(prop->variant); + } prop->variant = variant; } else { /* else we need to add it */ -- cgit v1.2.3 From 90cbc15aa0ddb2a37a812c0ac182143a26acdb1c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 22 Feb 2011 09:13:22 -0600 Subject: Changing signature to make more sense, comments by agateau --- libdbusmenu-glib/dbus-menu.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libdbusmenu-glib/dbus-menu.xml b/libdbusmenu-glib/dbus-menu.xml index da14c63..3856219 100644 --- a/libdbusmenu-glib/dbus-menu.xml +++ b/libdbusmenu-glib/dbus-menu.xml @@ -308,8 +308,8 @@ License version 3 and version 2.1 along with this program. If not, see the ID of the item with a hashtable of names and values for those properties. - - + + -- cgit v1.2.3 From 1f87678080488a467b04164a6a701ed4abcf92ae Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 22 Feb 2011 09:31:14 -0600 Subject: Changing parameter names to be more descriptive --- libdbusmenu-glib/dbus-menu.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libdbusmenu-glib/dbus-menu.xml b/libdbusmenu-glib/dbus-menu.xml index 3856219..c0831e5 100644 --- a/libdbusmenu-glib/dbus-menu.xml +++ b/libdbusmenu-glib/dbus-menu.xml @@ -308,8 +308,8 @@ License version 3 and version 2.1 along with this program. If not, see the ID of the item with a hashtable of names and values for those properties. - - + + -- cgit v1.2.3 From b4fcda58ac462d058d589524c7a68592cf60b56e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 22 Feb 2011 10:57:56 -0600 Subject: Should return VOID --- libdbusmenu-glib/menuitem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 7a279b1..b153900 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -261,7 +261,7 @@ dbusmenu_menuitem_class_init (DbusmenuMenuitemClass *klass) G_STRUCT_OFFSET(DbusmenuMenuitemClass, event), NULL, NULL, _dbusmenu_menuitem_marshal_VOID__STRING_VARIANT_UINT, - G_TYPE_BOOLEAN, 3, G_TYPE_STRING, G_TYPE_VARIANT, G_TYPE_UINT); + G_TYPE_NONE, 3, G_TYPE_STRING, G_TYPE_VARIANT, G_TYPE_UINT); g_object_class_install_property (object_class, PROP_ID, g_param_spec_int(PROP_ID_S, "ID for the menu item", -- cgit v1.2.3 From 0514fc7146fcf258e95949afe108cb0859343f4d Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 22 Feb 2011 11:14:05 -0600 Subject: Adding defaults to translatable files --- po/POTFILES.in | 1 + 1 file changed, 1 insertion(+) diff --git a/po/POTFILES.in b/po/POTFILES.in index e69de29..a386915 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -0,0 +1 @@ +libdbusmenu-glib/defaults.c -- cgit v1.2.3 From af36a127d3a0e69cf941e6a78ac0bb662d2c0401 Mon Sep 17 00:00:00 2001 From: Chris Coulson Date: Wed, 23 Feb 2011 14:34:36 +0000 Subject: Various memory error fixes: - Don't call g_object_add_weak_pointer multiple times on GtkMenuShell's - Ensure we always clean up weak pointers to avoid invalid writes when objects are destroyed - If a GtkWidget is destroyed before it's DbusmenuMenuitem, don't try to access it with g_object_steal_data --- libdbusmenu-gtk/parser.c | 64 +++++++++++++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 25 deletions(-) diff --git a/libdbusmenu-gtk/parser.c b/libdbusmenu-gtk/parser.c index f516dde..f2fcb58 100644 --- a/libdbusmenu-gtk/parser.c +++ b/libdbusmenu-gtk/parser.c @@ -109,45 +109,58 @@ dbusmenu_gtk_parse_menu_structure (GtkWidget * widget) return recurse.parent; } -/* Called when the dbusmenu item that we're keeping around - is finalized */ static void -dbusmenu_cache_freed (gpointer data, GObject * obj) +parse_data_free (gpointer data) { - /* If the dbusmenu item is killed we don't need to remove - the weak ref as well. */ - g_object_steal_data(G_OBJECT(data), CACHED_MENUITEM); - - ParserData *pdata = (ParserData *)g_object_get_data(G_OBJECT(obj), PARSER_DATA); + ParserData *pdata = (ParserData *)data; if (pdata != NULL && pdata->label != NULL) { - g_signal_handlers_disconnect_by_func(pdata->label, G_CALLBACK(label_notify_cb), obj); + g_signal_handlers_disconnect_matched(pdata->label, (GSignalMatchType)G_SIGNAL_MATCH_FUNC, + 0, 0, NULL, G_CALLBACK(label_notify_cb), NULL); g_object_remove_weak_pointer(G_OBJECT(pdata->label), (gpointer*)&pdata->label); } if (pdata != NULL && pdata->action != NULL) { - g_signal_handlers_disconnect_by_func(pdata->action, G_CALLBACK(action_notify_cb), obj); + g_signal_handlers_disconnect_matched(pdata->action, (GSignalMatchType)G_SIGNAL_MATCH_FUNC, + 0, 0, NULL, G_CALLBACK(action_notify_cb), NULL); g_object_remove_weak_pointer(G_OBJECT(pdata->action), (gpointer*)&pdata->action); } if (pdata != NULL && pdata->widget != NULL) { - g_signal_handlers_disconnect_by_func(pdata->widget, G_CALLBACK(widget_notify_cb), obj); + g_signal_handlers_disconnect_matched(pdata->widget, (GSignalMatchType)G_SIGNAL_MATCH_FUNC, + 0, 0, NULL, G_CALLBACK(widget_notify_cb), NULL); g_object_remove_weak_pointer(G_OBJECT(pdata->widget), (gpointer*)&pdata->widget); } if (pdata != NULL && pdata->shell != NULL) { - g_signal_handlers_disconnect_by_func(pdata->shell, G_CALLBACK(child_added_cb), obj); + g_signal_handlers_disconnect_matched(pdata->shell, (GSignalMatchType)G_SIGNAL_MATCH_FUNC, + 0, 0, NULL, G_CALLBACK(child_added_cb), NULL); g_object_remove_weak_pointer(G_OBJECT(pdata->shell), (gpointer*)&pdata->shell); } if (pdata != NULL && pdata->image != NULL) { - g_signal_handlers_disconnect_by_func(pdata->image, G_CALLBACK(image_notify_cb), obj); + g_signal_handlers_disconnect_matched(pdata->image, (GSignalMatchType)G_SIGNAL_MATCH_FUNC, + 0, 0, NULL, G_CALLBACK(image_notify_cb), NULL); g_object_remove_weak_pointer(G_OBJECT(pdata->image), (gpointer*)&pdata->image); } + g_free(pdata); + return; } +/* Called when the dbusmenu item that we're keeping around + is finalized */ +static void +dbusmenu_item_freed (gpointer data, GObject * obj) +{ + ParserData *pdata = (ParserData *)g_object_get_data(G_OBJECT(obj), PARSER_DATA); + + if (pdata != NULL && pdata->widget != NULL) { + g_object_steal_data(G_OBJECT(pdata->widget), CACHED_MENUITEM); + } +} + /* Called if we replace the cache on the object with a new dbusmenu menuitem */ static void @@ -198,10 +211,13 @@ new_menuitem (GtkWidget * widget) DbusmenuMenuitem * item = dbusmenu_menuitem_new(); ParserData *pdata = g_new0 (ParserData, 1); - g_object_set_data_full(G_OBJECT(item), PARSER_DATA, pdata, g_free); + g_object_set_data_full(G_OBJECT(item), PARSER_DATA, pdata, parse_data_free); g_object_set_data_full(G_OBJECT(widget), CACHED_MENUITEM, item, object_cache_freed); - g_object_weak_ref(G_OBJECT(item), dbusmenu_cache_freed, widget); + g_object_weak_ref(G_OBJECT(item), dbusmenu_item_freed, NULL); + + pdata->widget = widget; + g_object_add_weak_pointer(G_OBJECT (widget), (gpointer*)&pdata->widget); return item; } @@ -237,16 +253,16 @@ parse_menu_structure_helper (GtkWidget * widget, RecurseContext * recurse) if (recurse->parent == NULL) { recurse->parent = new_menuitem(widget); - } - ParserData *pdata = (ParserData *)g_object_get_data(G_OBJECT(recurse->parent), PARSER_DATA); + ParserData *pdata = (ParserData *)g_object_get_data(G_OBJECT(recurse->parent), PARSER_DATA); - pdata->shell = widget; - g_signal_connect (G_OBJECT (widget), - "child-added", - G_CALLBACK (child_added_cb), - recurse->parent); - g_object_add_weak_pointer(G_OBJECT (widget), (gpointer*)&pdata->shell); + pdata->shell = widget; + g_signal_connect (G_OBJECT (widget), + "child-added", + G_CALLBACK (child_added_cb), + recurse->parent); + g_object_add_weak_pointer(G_OBJECT (widget), (gpointer*)&pdata->shell); + } gtk_container_foreach (GTK_CONTAINER (widget), (GtkCallback)parse_menu_structure_helper, @@ -472,12 +488,10 @@ construct_dbusmenu_for_widget (GtkWidget * widget) DBUSMENU_MENUITEM_PROP_ENABLED, sensitive); - pdata->widget = widget; g_signal_connect (widget, "notify", G_CALLBACK (widget_notify_cb), mi); - g_object_add_weak_pointer(G_OBJECT (widget), (gpointer*)&pdata->widget); return mi; } -- cgit v1.2.3 From d69242596c18abf533cabb4eba80b5200496349d Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 23 Feb 2011 09:36:15 -0600 Subject: Switch signal handler to return bool so that we can signal if someone has handled it --- libdbusmenu-glib/menuitem-marshal.list | 2 +- libdbusmenu-glib/menuitem.c | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/libdbusmenu-glib/menuitem-marshal.list b/libdbusmenu-glib/menuitem-marshal.list index b2e02e5..4382ed7 100644 --- a/libdbusmenu-glib/menuitem-marshal.list +++ b/libdbusmenu-glib/menuitem-marshal.list @@ -4,4 +4,4 @@ VOID: OBJECT, UINT VOID: OBJECT VOID: VOID VOID: UINT -VOID: STRING, VARIANT, UINT +BOOLEAN: STRING, VARIANT, UINT diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index d8ae1a1..d420fd6 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -261,9 +261,9 @@ dbusmenu_menuitem_class_init (DbusmenuMenuitemClass *klass) G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET(DbusmenuMenuitemClass, event), - NULL, NULL, - _dbusmenu_menuitem_marshal_VOID__STRING_VARIANT_UINT, - G_TYPE_NONE, 3, G_TYPE_STRING, G_TYPE_VARIANT, G_TYPE_UINT); + g_signal_accumulator_true_handled, NULL, + _dbusmenu_menuitem_marshal_BOOLEAN__STRING_VARIANT_UINT, + G_TYPE_BOOLEAN, 3, G_TYPE_STRING, G_TYPE_VARIANT, G_TYPE_UINT); g_object_class_install_property (object_class, PROP_ID, g_param_spec_int(PROP_ID_S, "ID for the menu item", @@ -1533,12 +1533,13 @@ dbusmenu_menuitem_handle_event (DbusmenuMenuitem * mi, const gchar * name, GVari #endif DbusmenuMenuitemClass * class = DBUSMENU_MENUITEM_GET_CLASS(mi); - if (class->handle_event != NULL) { + gboolean handled = FALSE; + g_signal_emit(G_OBJECT(mi), EVENT, g_quark_from_string(name), name, variant, timestamp, &handled); + + if (!handled && class->handle_event != NULL) { return class->handle_event(mi, name, variant, timestamp); } - g_signal_emit(G_OBJECT(mi), EVENT, g_quark_from_string(name), name, variant, timestamp, TRUE); - return; } -- cgit v1.2.3 From 4c9b48b9f83801a398437f8fbf3f60a46d55b110 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 23 Feb 2011 10:31:05 -0600 Subject: Redefine so that we don't recurse if we shouldn't --- libdbusmenu-glib/menuitem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index ee18fab..f252afa 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1433,7 +1433,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) { + if (children == NULL || recurse == 0) { g_variant_builder_add_value(&tupleb, g_variant_new_array(G_VARIANT_TYPE_VARIANT, NULL, 0)); } else { GVariantBuilder childrenbuilder; -- cgit v1.2.3 From 3887a48a9c3557c396b472f7a8bb95101a025d0d Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 23 Feb 2011 11:21:10 -0600 Subject: If there's a singular NULL entry we also want the full list --- libdbusmenu-glib/menuitem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index bc38e24..3c8ff8d 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1274,7 +1274,7 @@ dbusmenu_menuitem_properties_variant (DbusmenuMenuitem * mi, const gchar ** prop GVariant * final_variant = NULL; - if (properties == NULL && g_hash_table_size(priv->properties) > 0) { + if ((properties == NULL || properties[0] == NULL) && g_hash_table_size(priv->properties) > 0) { GVariantBuilder builder; g_variant_builder_init(&builder, G_VARIANT_TYPE_ARRAY); -- cgit v1.2.3 From 749be25d3f7736e518b3d33d3d64349118bfdf84 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 23 Feb 2011 11:28:12 -0600 Subject: Adding visible and enabled to the initial grab. --- libdbusmenu-glib/client.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index d990b93..b6a00fc 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -317,11 +317,13 @@ dbusmenu_client_init (DbusmenuClient *self) priv->layoutcall = NULL; - gchar * layout_props[3]; + gchar * layout_props[5]; layout_props[0] = DBUSMENU_MENUITEM_PROP_TYPE; layout_props[1] = DBUSMENU_MENUITEM_PROP_LABEL; - layout_props[2] = NULL; - priv->layout_props = g_variant_new_strv((const gchar * const *)layout_props, 2); + layout_props[2] = DBUSMENU_MENUITEM_PROP_VISIBLE; + layout_props[3] = DBUSMENU_MENUITEM_PROP_ENABLED; + layout_props[4] = NULL; + priv->layout_props = g_variant_new_strv((const gchar * const *)layout_props, 4); g_variant_ref_sink(priv->layout_props); priv->current_revision = 0; -- cgit v1.2.3 From c90132b2e18252796eabf770ac2334c381b5d1f5 Mon Sep 17 00:00:00 2001 From: Mathieu Trudel-Lapierre Date: Wed, 23 Feb 2011 13:56:01 -0500 Subject: Rework widget_notify_cb() to get the properties directly. --- libdbusmenu-gtk/parser.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/libdbusmenu-gtk/parser.c b/libdbusmenu-gtk/parser.c index f516dde..b910ee7 100644 --- a/libdbusmenu-gtk/parser.c +++ b/libdbusmenu-gtk/parser.c @@ -750,30 +750,34 @@ widget_notify_cb (GtkWidget *widget, gpointer data) { DbusmenuMenuitem *child = (DbusmenuMenuitem *)data; + GValue prop_value = {0}; + + g_value_init (&prop_value, pspec->value_type); + g_object_get_property (G_OBJECT (widget), pspec->name, &prop_value); if (pspec->name == g_intern_static_string ("sensitive")) { dbusmenu_menuitem_property_set_bool (child, DBUSMENU_MENUITEM_PROP_ENABLED, - gtk_widget_get_sensitive (widget)); + g_value_get_boolean (&prop_value)); } else if (pspec->name == g_intern_static_string ("label")) { dbusmenu_menuitem_property_set (child, DBUSMENU_MENUITEM_PROP_LABEL, - gtk_menu_item_get_label (GTK_MENU_ITEM (widget))); + g_value_get_string (&prop_value)); } else if (pspec->name == g_intern_static_string ("visible")) { dbusmenu_menuitem_property_set_bool (child, DBUSMENU_MENUITEM_PROP_VISIBLE, - gtk_widget_get_visible (widget)); + g_value_get_boolean (&prop_value)); } else if (pspec->name == g_intern_static_string ("image") || pspec->name == g_intern_static_string ("always-show-image")) { GtkWidget *image; - image = gtk_image_menu_item_get_image (GTK_IMAGE_MENU_ITEM (widget)); + image = GTK_WIDGET (g_value_get_object (&prop_value)); update_icon (child, GTK_IMAGE (image)); } else if (pspec->name == g_intern_static_string ("parent")) @@ -782,7 +786,7 @@ widget_notify_cb (GtkWidget *widget, * We probably should have added a 'remove' method to the * UbuntuMenuProxy early on, but it's late in the cycle now. */ - if (gtk_widget_get_parent (widget) == NULL) + if (GTK_WIDGET (g_value_get_object (&prop_value)) == NULL) { g_signal_handlers_disconnect_by_func (widget, G_CALLBACK (widget_notify_cb), @@ -818,7 +822,7 @@ widget_notify_cb (GtkWidget *widget, recurse.parent = item; if (item != NULL) { - GtkWidget * menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (widget)); + GtkWidget * menu = GTK_WIDGET (g_value_get_object (&prop_value)); parse_menu_structure_helper(menu, &recurse); } else { /* Note: it would be really odd that we wouldn't have a cached @@ -827,6 +831,7 @@ widget_notify_cb (GtkWidget *widget, g_object_unref(G_OBJECT(recurse.parent)); } } + g_value_unset (&prop_value); } /* A child item was added to a menu we're watching. Let's try to integrate it. */ -- cgit v1.2.3 From 10859b3dd0cf399aa02a5adf7f848bb2e61121e5 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 23 Feb 2011 12:58:52 -0600 Subject: Search for and process type first --- libdbusmenu-glib/client.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index b6a00fc..6e25ba1 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -1492,10 +1492,22 @@ parse_layout_xml(DbusmenuClient * client, GVariant * layout, DbusmenuMenuitem * menu item. Sometimes they may just be copies */ if (childmi != NULL) { GVariantIter iter; - g_variant_iter_init(&iter, g_variant_get_child_value(child, 1)); gchar * prop; GVariant * value; + /* Set the type first as it can manage the behavior of + all other properties. */ + g_variant_iter_init(&iter, g_variant_get_child_value(child, 1)); + while (g_variant_iter_next(&iter, "{sv}", &prop, &value)) { + if (g_strcmp0(prop, DBUSMENU_MENUITEM_PROP_TYPE) == 0) { + dbusmenu_menuitem_property_set_variant(childmi, prop, value); + } + g_free(prop); + g_variant_unref(value); + } + + /* Now go through and do all the properties. */ + g_variant_iter_init(&iter, g_variant_get_child_value(child, 1)); while (g_variant_iter_next(&iter, "{sv}", &prop, &value)) { dbusmenu_menuitem_property_set_variant(childmi, prop, value); g_free(prop); -- cgit v1.2.3 From c5550da0485ca4b51fb7721eba15322dc5f4f896 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 23 Feb 2011 13:24:04 -0600 Subject: Only look at defaults if we have a value to compare with. --- libdbusmenu-glib/menuitem.c | 47 ++++++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index ee18fab..cdd2109 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1025,31 +1025,34 @@ dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * pro g_return_val_if_fail(property != NULL, FALSE); DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi); + GVariant * default_value = NULL; - const gchar * type = menuitem_get_type(mi); - - /* 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) { - /* If we have an expected type we should check to see if - the value we've been given is of the same type and generate - a warning if it isn't */ - if (!g_variant_is_of_type(value, default_type)) { - 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)); + if (value != NULL) { + const gchar * type = menuitem_get_type(mi); + + /* 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) { + /* If we have an expected type we should check to see if + the value we've been given is of the same type and generate + a warning if it isn't */ + if (!g_variant_is_of_type(value, default_type)) { + 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. */ - GVariant * 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) { + /* 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; + } } } -- cgit v1.2.3 From ce5252f0de896c0d841fb250148285cf2be3c33e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 24 Feb 2011 08:56:30 -0600 Subject: Bad merge, forgot this change in name --- libdbusmenu-glib/server.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdbusmenu-glib/server.h b/libdbusmenu-glib/server.h index f49988d..3e07395 100644 --- a/libdbusmenu-glib/server.h +++ b/libdbusmenu-glib/server.h @@ -149,7 +149,7 @@ struct _DbusmenuServer { GType dbusmenu_server_get_type (void); DbusmenuServer * dbusmenu_server_new (const gchar * object); -void dbusmenu_server_set_root (DbusmenuServer * server, +void dbusmenu_server_set_root (DbusmenuServer * self, DbusmenuMenuitem * root); DbusmenuTextDirection dbusmenu_server_get_text_direction (DbusmenuServer * server); void dbusmenu_server_set_text_direction (DbusmenuServer * server, -- cgit v1.2.3 From 76b4e15adaf273d765fb9ef1f4e19c58fac67831 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 24 Feb 2011 09:38:18 -0600 Subject: Documentation fixes --- docs/libdbusmenu-glib/reference/Makefile.am | 1 + .../reference/libdbusmenu-glib-docs.sgml | 1 + .../reference/libdbusmenu-glib-sections.txt | 29 ++++++++++++++++++++++ libdbusmenu-glib/client.h | 15 +++++++++++ libdbusmenu-glib/defaults.c | 8 +++--- libdbusmenu-glib/defaults.h | 4 +-- libdbusmenu-glib/enum-types.h.in | 6 +++++ libdbusmenu-glib/server.c | 2 ++ libdbusmenu-glib/server.h | 10 ++++++++ libdbusmenu-glib/types.h | 11 ++++++++ 10 files changed, 81 insertions(+), 6 deletions(-) diff --git a/docs/libdbusmenu-glib/reference/Makefile.am b/docs/libdbusmenu-glib/reference/Makefile.am index 1c8dfa8..2af5ec3 100644 --- a/docs/libdbusmenu-glib/reference/Makefile.am +++ b/docs/libdbusmenu-glib/reference/Makefile.am @@ -51,6 +51,7 @@ IGNORE_HFILES= \ dbus-menu-clean.xml.h \ client-menuitem.h \ client-private.h \ + defaults.h \ menuitem-marshal.h \ server-marshal.h \ menuitem-private.h diff --git a/docs/libdbusmenu-glib/reference/libdbusmenu-glib-docs.sgml b/docs/libdbusmenu-glib/reference/libdbusmenu-glib-docs.sgml index 16ed624..53a0ceb 100644 --- a/docs/libdbusmenu-glib/reference/libdbusmenu-glib-docs.sgml +++ b/docs/libdbusmenu-glib/reference/libdbusmenu-glib-docs.sgml @@ -18,6 +18,7 @@ + diff --git a/docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt b/docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt index b6a6902..9c69fb7 100644 --- a/docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt +++ b/docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt @@ -6,8 +6,11 @@ DBUSMENU_CLIENT_SIGNAL_ROOT_CHANGED DBUSMENU_CLIENT_SIGNAL_NEW_MENUITEM DBUSMENU_CLIENT_SIGNAL_EVENT_RESULT DBUSMENU_CLIENT_SIGNAL_ITEM_ACTIVATE +DBUSMENU_CLIENT_SIGNAL_TEXT_DIRECTION_CHANGED DBUSMENU_CLIENT_PROP_DBUS_NAME DBUSMENU_CLIENT_PROP_DBUS_OBJECT +DBUSMENU_CLIENT_PROP_STATUS +DBUSMENU_CLIENT_PROP_TEXT_DIRECTION DBUSMENU_CLIENT_TYPES_DEFAULT DBUSMENU_CLIENT_TYPES_SEPARATOR DBUSMENU_CLIENT_TYPES_IMAGE @@ -17,6 +20,8 @@ DbusmenuClientTypeHandler DbusmenuClientTypeDestroyHandler dbusmenu_client_new dbusmenu_client_get_root +dbusmenu_client_get_status +dbusmenu_client_get_text_direction dbusmenu_client_add_type_handler dbusmenu_client_add_type_handler_full @@ -122,11 +127,17 @@ DBUSMENU_SERVER_SIGNAL_LAYOUT_UPDATE DBUSMENU_SERVER_SIGNAL_ITEM_ACTIVATION DBUSMENU_SERVER_PROP_DBUS_OBJECT DBUSMENU_SERVER_PROP_ROOT_NODE +DBUSMENU_SERVER_PROP_STATUS +DBUSMENU_SERVER_PROP_TEXT_DIRECTION DBUSMENU_SERVER_PROP_VERSION DbusmenuServer DbusmenuServerClass dbusmenu_server_new +dbusmenu_server_get_status +dbusmenu_server_get_text_direction dbusmenu_server_set_root +dbusmenu_server_set_status +dbusmenu_server_set_text_direction DBUSMENU_SERVER DBUSMENU_IS_SERVER @@ -158,3 +169,21 @@ DbusmenuMenuitemProxyPrivate dbusmenu_menuitem_proxy_get_type +
+types +Types +DBUSMENU_TYPE_STATUS +DBUSMENU_TYPE_TEXT_DIRECTION +DbusmenuStatus +DbusmenuTextDirection +dbusmenu_status_get_nick +dbusmenu_status_get_type +dbusmenu_status_get_value_from_nick +dbusmenu_text_direction_get_nick +dbusmenu_text_direction_get_type +dbusmenu_text_direction_get_value_from_nick + +DbusmenuServerPrivate +dbusmenu_server_get_type +
+ diff --git a/libdbusmenu-glib/client.h b/libdbusmenu-glib/client.h index 0b94eb2..28d4dd3 100644 --- a/libdbusmenu-glib/client.h +++ b/libdbusmenu-glib/client.h @@ -74,6 +74,11 @@ G_BEGIN_DECLS * String to attach to signal #DbusmenuClient::event-result */ #define DBUSMENU_CLIENT_SIGNAL_EVENT_RESULT "event-result" +/** + * DBUSMENU_CLIENT_SIGNAL_TEXT_DIRECTION_CHANGED: + * + * String to attach to signal #DbusmenuClient::text-direction-changed + */ #define DBUSMENU_CLIENT_SIGNAL_TEXT_DIRECTION_CHANGED "text-direction-changed" /** @@ -88,7 +93,17 @@ G_BEGIN_DECLS * String to access property #DbusmenuClient:dbus-object */ #define DBUSMENU_CLIENT_PROP_DBUS_OBJECT "dbus-object" +/** + * DBUSMENU_CLIENT_PROP_STATUS: + * + * String to access property #DbusmenuClient:status + */ #define DBUSMENU_CLIENT_PROP_STATUS "status" +/** + * DBUSMENU_CLIENT_PROP_TEXT_DIRECTION: + * + * String to access property #DbusmenuClient:text-direction + */ #define DBUSMENU_CLIENT_PROP_TEXT_DIRECTION "text-direction" /** diff --git a/libdbusmenu-glib/defaults.c b/libdbusmenu-glib/defaults.c index 3ad5d76..c05ef38 100644 --- a/libdbusmenu-glib/defaults.c +++ b/libdbusmenu-glib/defaults.c @@ -156,7 +156,7 @@ entry_destroy (gpointer entry) static DbusmenuDefaults * default_defaults = NULL; -/** +/* * dbusmenu_defaults_ref_default: * * Get a reference to the default instance. If it doesn't exist this @@ -177,7 +177,7 @@ dbusmenu_defaults_ref_default (void) return default_defaults; } -/** +/* * dbusmenu_defaults_default_set: * @defaults: The #DbusmenuDefaults object to add to * @type: (allow-none): The #DbusmenuMenuitem type for this default if #NULL will default to #DBUSMENU_CLIENT_TYPE_DEFAULT @@ -216,7 +216,7 @@ dbusmenu_defaults_default_set (DbusmenuDefaults * defaults, const gchar * type, return; } -/** +/* * dbusmenu_defaults_default_get: * @defaults: The default database to use * @type: (allow-none): The #DbusmenuMenuitem type for this default if #NULL will default to #DBUSMENU_CLIENT_TYPE_DEFAULT @@ -253,7 +253,7 @@ dbusmenu_defaults_default_get (DbusmenuDefaults * defaults, const gchar * type, return entry->value; } -/** +/* * dbusmenu_defaults_default_get_type: * @defaults: The default database to use * @type: (allow-none): The #DbusmenuMenuitem type for this default if #NULL will default to #DBUSMENU_CLIENT_TYPE_DEFAULT diff --git a/libdbusmenu-glib/defaults.h b/libdbusmenu-glib/defaults.h index ab377f7..a1a8158 100644 --- a/libdbusmenu-glib/defaults.h +++ b/libdbusmenu-glib/defaults.h @@ -45,7 +45,7 @@ typedef struct _DbusmenuDefaults DbusmenuDefaults; typedef struct _DbusmenuDefaultsClass DbusmenuDefaultsClass; typedef struct _DbusmenuDefaultsPrivate DbusmenuDefaultsPrivate; -/** +/* * DbusmenuDefaultsClass: * * All of the signals and functions for #DbusmenuDefaults @@ -54,7 +54,7 @@ struct _DbusmenuDefaultsClass { GObjectClass parent_class; }; -/** +/* * DbusmenuDefaults: * * A singleton to hold all of the defaults for the menuitems diff --git a/libdbusmenu-glib/enum-types.h.in b/libdbusmenu-glib/enum-types.h.in index 8c5f463..488b615 100644 --- a/libdbusmenu-glib/enum-types.h.in +++ b/libdbusmenu-glib/enum-types.h.in @@ -51,6 +51,12 @@ G_END_DECLS GType @enum_name@_get_type (void) G_GNUC_CONST; const gchar * @enum_name@_get_nick (@EnumName@ value) G_GNUC_CONST; @EnumName@ @enum_name@_get_value_from_nick (const gchar * nick) G_GNUC_CONST; +/** + DBUSMENU_TYPE_@ENUMSHORT@: + + Gets the #GType value for the type associated with the + #@EnumName@ enumerated type. +*/ #define DBUSMENU_TYPE_@ENUMSHORT@ (@enum_name@_get_type()) /*** END value-header ***/ diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index c3faa6b..e3fd2cd 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -1635,6 +1635,7 @@ dbusmenu_server_get_text_direction (DbusmenuServer * server) /** dbusmenu_server_set_text_direction: @server: The #DbusmenuServer object to set the text direction on + @dir: Direction of the text Sets the text direction that should be exported over DBus for this server. If the value is set to #DBUSMENU_TEXT_DIRECTION_NONE @@ -1682,6 +1683,7 @@ dbusmenu_server_get_status (DbusmenuServer * server) /** dbusmenu_server_set_status: @server: The #DbusmenuServer to set the status on + @status: Status value to set on the server Changes the status of the server. */ diff --git a/libdbusmenu-glib/server.h b/libdbusmenu-glib/server.h index 3e07395..80b7abb 100644 --- a/libdbusmenu-glib/server.h +++ b/libdbusmenu-glib/server.h @@ -93,7 +93,17 @@ G_BEGIN_DECLS * String to access property #DbusmenuServer:version */ #define DBUSMENU_SERVER_PROP_VERSION "version" +/** + * DBUSMENU_SERVER_PROP_TEXT_DIRECTION: + * + * String to access property #DbusmenuServer:text-direction + */ #define DBUSMENU_SERVER_PROP_TEXT_DIRECTION "text-direction" +/** + * DBUSMENU_SERVER_PROP_STATUS: + * + * String to access property #DbusmenuServer:status + */ #define DBUSMENU_SERVER_PROP_STATUS "status" typedef struct _DbusmenuServerPrivate DbusmenuServerPrivate; diff --git a/libdbusmenu-glib/types.h b/libdbusmenu-glib/types.h index e573476..03ae801 100644 --- a/libdbusmenu-glib/types.h +++ b/libdbusmenu-glib/types.h @@ -59,6 +59,17 @@ typedef enum { /*< prefix=DBUSMENU_STATUS >*/ DBUSMENU_STATUS_NOTICE /*< nick=notice >*/ } DbusmenuStatus; +/** + SECTION:types + @short_description: Types that are used by both client and + server. + @stability: Unstable + @include: libdbusmenu-glib/types.h + + Enums that are used to describe states of the server across the + bus. They are sent over dbus using their nicks but then turned + back into enums by the client. +*/ G_END_DECLS #endif /* __DBUSMENU_TYPES_H__ */ -- cgit v1.2.3 From 5653c7e5642ae25fb54445f749ecfb0c947ead0c Mon Sep 17 00:00:00 2001 From: Chris Coulson Date: Thu, 24 Feb 2011 15:41:16 +0000 Subject: Disconnect the theme_changed_cb handler when widgets are destroyed --- libdbusmenu-gtk/parser.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/libdbusmenu-gtk/parser.c b/libdbusmenu-gtk/parser.c index f2fcb58..09b1e6e 100644 --- a/libdbusmenu-gtk/parser.c +++ b/libdbusmenu-gtk/parser.c @@ -161,6 +161,15 @@ dbusmenu_item_freed (gpointer data, GObject * obj) } } +static void +widget_freed (gpointer data, GObject * obj) +{ + g_signal_handlers_disconnect_by_func(gtk_icon_theme_get_default(), G_CALLBACK(theme_changed_cb), obj); + + return; +} + +#if 0 /* Called if we replace the cache on the object with a new dbusmenu menuitem */ static void @@ -175,6 +184,7 @@ object_cache_freed (gpointer data) return; } +#endif /* Gets the positon of the child with its' parent if it has one. Returns -1 if the position is unable to be calculated. */ @@ -213,8 +223,9 @@ new_menuitem (GtkWidget * widget) ParserData *pdata = g_new0 (ParserData, 1); g_object_set_data_full(G_OBJECT(item), PARSER_DATA, pdata, parse_data_free); - g_object_set_data_full(G_OBJECT(widget), CACHED_MENUITEM, item, object_cache_freed); + /* g_object_set_data_full(G_OBJECT(widget), CACHED_MENUITEM, item, object_cache_freed); */ g_object_weak_ref(G_OBJECT(item), dbusmenu_item_freed, NULL); + g_object_weak_ref(G_OBJECT(widget), widget_freed, NULL); pdata->widget = widget; g_object_add_weak_pointer(G_OBJECT (widget), (gpointer*)&pdata->widget); -- cgit v1.2.3 From 37fb090b4f9fb1e1a894c5c57e7c3d28eb71f92d Mon Sep 17 00:00:00 2001 From: Chris Coulson Date: Thu, 24 Feb 2011 15:43:25 +0000 Subject: Hold a weak pointer to each DbusmenuMenuitems parent. This avoids using g_object_{get/set}_data for storing a nodes parent in the parser code, and the associated problems with that (ie, a child out-living its parent, leading to invalid reads --- libdbusmenu-glib/menuitem.c | 102 +++++++++++++++++++++++++++++++++++++++++++- libdbusmenu-glib/menuitem.h | 4 ++ libdbusmenu-gtk/parser.c | 6 +-- 3 files changed, 105 insertions(+), 7 deletions(-) diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 89b2b91..49b83ce 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -62,6 +62,7 @@ struct _DbusmenuMenuitemPrivate gboolean realized; DbusmenuDefaults * defaults; gboolean exposed; + DbusmenuMenuitem * parent; }; /* Signals */ @@ -339,6 +340,11 @@ dbusmenu_menuitem_dispose (GObject *object) priv->defaults = NULL; } + if (priv->parent) { + g_object_remove_weak_pointer(G_OBJECT(priv->parent), (gpointer *)&priv->parent); + priv->parent = NULL; + } + G_OBJECT_CLASS (dbusmenu_menuitem_parent_class)->dispose (object); return; } @@ -565,11 +571,12 @@ dbusmenu_menuitem_get_children (DbusmenuMenuitem * mi) /* For all the taken children we need to signal that they were removed */ static void -take_children_signal (gpointer data, gpointer user_data) +take_children_helper (gpointer data, gpointer user_data) { #ifdef MASSIVEDEBUGGING g_debug("Menuitem %d (%s) signalling child removed %d (%s)", ID(user_data), LABEL(user_data), ID(data), LABEL(data)); #endif + dbusmenu_menuitem_unparent(DBUSMENU_MENUITEM(data)); g_signal_emit(G_OBJECT(user_data), signals[CHILD_REMOVED], 0, DBUSMENU_MENUITEM(data), TRUE); return; } @@ -595,7 +602,7 @@ dbusmenu_menuitem_take_children (DbusmenuMenuitem * mi) DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi); GList * children = priv->children; priv->children = NULL; - g_list_foreach(children, take_children_signal, mi); + g_list_foreach(children, take_children_helper, mi); dbusmenu_menuitem_property_remove(mi, DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY); @@ -704,6 +711,10 @@ dbusmenu_menuitem_child_append (DbusmenuMenuitem * mi, DbusmenuMenuitem * child) DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi); g_return_val_if_fail(g_list_find(priv->children, child) == NULL, FALSE); + if (!dbusmenu_menuitem_set_parent(child, mi)) { + return FALSE; + } + if (priv->children == NULL && !dbusmenu_menuitem_property_exist(mi, DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY)) { dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY, DBUSMENU_MENUITEM_CHILD_DISPLAY_SUBMENU); } @@ -736,6 +747,10 @@ dbusmenu_menuitem_child_prepend (DbusmenuMenuitem * mi, DbusmenuMenuitem * child DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi); g_return_val_if_fail(g_list_find(priv->children, child) == NULL, FALSE); + if (!dbusmenu_menuitem_set_parent(child, mi)) { + return FALSE; + } + if (priv->children == NULL && !dbusmenu_menuitem_property_exist(mi, DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY)) { dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY, DBUSMENU_MENUITEM_CHILD_DISPLAY_SUBMENU); } @@ -768,6 +783,7 @@ dbusmenu_menuitem_child_delete (DbusmenuMenuitem * mi, DbusmenuMenuitem * child) DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi); priv->children = g_list_remove(priv->children, child); + dbusmenu_menuitem_unparent(child); #ifdef MASSIVEDEBUGGING g_debug("Menuitem %d (%s) signalling child removed %d (%s)", ID(mi), LABEL(mi), ID(child), LABEL(child)); #endif @@ -802,6 +818,10 @@ dbusmenu_menuitem_child_add_position (DbusmenuMenuitem * mi, DbusmenuMenuitem * DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi); g_return_val_if_fail(g_list_find(priv->children, child) == NULL, FALSE); + if (!dbusmenu_menuitem_set_parent(child, mi)) { + return FALSE; + } + if (priv->children == NULL && !dbusmenu_menuitem_property_exist(mi, DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY)) { dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY, DBUSMENU_MENUITEM_CHILD_DISPLAY_SUBMENU); } @@ -936,6 +956,84 @@ dbusmenu_menuitem_find_id (DbusmenuMenuitem * mi, gint id) return find_id.mi; } +/** + * dbusmenu_menuitem_set_parent: + * @mi: The #DbusmenuMenuitem for which to set the parent + * @parent: The new parent #DbusmenuMenuitem + * + * Sets the parent of @mi to @parent. If @mi already + * has a parent, then this call will fail. The parent will + * be set automatically when using the usual methods to add a + * child menuitem, so this function should not normally be + * called directly + * + * Return value: Whether the parent was set successfully + */ +gboolean +dbusmenu_menuitem_set_parent (DbusmenuMenuitem * mi, DbusmenuMenuitem * parent) +{ + g_return_val_if_fail(DBUSMENU_IS_MENUITEM(mi), FALSE); + g_return_val_if_fail(DBUSMENU_IS_MENUITEM(mi), FALSE); + + DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi); + + if (priv->parent != NULL) { + g_warning ("Menu item already has a parent"); + return FALSE; + } + + priv->parent = parent; + g_object_add_weak_pointer(G_OBJECT(priv->parent), (gpointer *)&priv->parent); + + return TRUE; +} + +/** + * dbusmenu_menuitem_unparent: + * @mi: The #DbusmenuMenuitem to unparent + * + * Unparents the menu item @mi. If @mi doesn't have a + * parent, then this call will fail. The menuitem will + * be unparented automatically when using the usual methods + * to delete a child menuitem, so this function should not + * normally be called directly + * + * Return value: Whether the menu item was unparented successfully + */ +gboolean +dbusmenu_menuitem_unparent (DbusmenuMenuitem * mi) +{ + g_return_val_if_fail(DBUSMENU_IS_MENUITEM(mi), FALSE); + DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi); + + if (priv->parent == NULL) { + g_warning("Menu item doesn't have a parent"); + return FALSE; + } + + g_object_remove_weak_pointer(G_OBJECT(priv->parent), (gpointer *)&priv->parent); + priv->parent = NULL; + + return TRUE; +} + +/** + * dbusmenu_menuitem_get_parent: + * @mi: The #DbusmenuMenuitem for which to inspect the parent + * + * This function looks up the parent of @mi + * + * Return value: The parent of this menu item + */ +DbusmenuMenuitem * +dbusmenu_menuitem_get_parent (DbusmenuMenuitem * mi) +{ + g_return_val_if_fail(DBUSMENU_IS_MENUITEM(mi), NULL); + DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi); + + return priv->parent; +} + /** * dbusmenu_menuitem_property_set: * @mi: The #DbusmenuMenuitem to set the property on. diff --git a/libdbusmenu-glib/menuitem.h b/libdbusmenu-glib/menuitem.h index 4a1c156..5f56803 100644 --- a/libdbusmenu-glib/menuitem.h +++ b/libdbusmenu-glib/menuitem.h @@ -379,6 +379,10 @@ gboolean dbusmenu_menuitem_child_reorder (DbusmenuMenuitem * mi, DbusmenuMenuite DbusmenuMenuitem * dbusmenu_menuitem_child_find (DbusmenuMenuitem * mi, gint id); DbusmenuMenuitem * dbusmenu_menuitem_find_id (DbusmenuMenuitem * mi, gint id); +gboolean dbusmenu_menuitem_set_parent (DbusmenuMenuitem * mi, DbusmenuMenuitem * parent); +gboolean dbusmenu_menuitem_unparent (DbusmenuMenuitem *mi); +DbusmenuMenuitem * dbusmenu_menuitem_get_parent (DbusmenuMenuitem * mi); + gboolean dbusmenu_menuitem_property_set (DbusmenuMenuitem * mi, const gchar * property, const gchar * value); gboolean dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * property, GVariant * value); gboolean dbusmenu_menuitem_property_set_bool (DbusmenuMenuitem * mi, const gchar * property, const gboolean value); diff --git a/libdbusmenu-gtk/parser.c b/libdbusmenu-gtk/parser.c index 09b1e6e..44ea301 100644 --- a/libdbusmenu-gtk/parser.c +++ b/libdbusmenu-gtk/parser.c @@ -321,10 +321,6 @@ parse_menu_structure_helper (GtkWidget * widget, RecurseContext * recurse) /* Oops, let's tell our parents about us */ if (peek == NULL) { - /* TODO: Should we set a weak ref on the parent? */ - g_object_set_data (G_OBJECT (thisitem), - "dbusmenu-parent", - recurse->parent); gint pos = get_child_position (widget); if (pos >= 0) dbusmenu_menuitem_child_add_position (recurse->parent, @@ -813,7 +809,7 @@ widget_notify_cb (GtkWidget *widget, G_CALLBACK (widget_notify_cb), child); - DbusmenuMenuitem *parent = g_object_get_data (G_OBJECT (child), "dbusmenu-parent"); + DbusmenuMenuitem *parent = dbusmenu_menuitem_get_parent (child); if (DBUSMENU_IS_MENUITEM (parent) && DBUSMENU_IS_MENUITEM (child)) { -- cgit v1.2.3 From 017f243186a993adda6b55eac436bb7b6ce784c2 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 24 Feb 2011 10:22:46 -0600 Subject: Not commenting out code, just deleteing --- libdbusmenu-gtk/parser.c | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/libdbusmenu-gtk/parser.c b/libdbusmenu-gtk/parser.c index 09b1e6e..a68508b 100644 --- a/libdbusmenu-gtk/parser.c +++ b/libdbusmenu-gtk/parser.c @@ -169,23 +169,6 @@ widget_freed (gpointer data, GObject * obj) return; } -#if 0 -/* Called if we replace the cache on the object with a new - dbusmenu menuitem */ -static void -object_cache_freed (gpointer data) -{ - // TODO: make this have access to both data and obj so we can call these - //if (!G_IS_OBJECT(obj)) return; - //g_object_weak_unref(G_OBJECT(obj), dbusmenu_cache_freed, data); - //dbusmenu_cache_freed(data, obj); - - g_signal_handlers_disconnect_by_func(gtk_icon_theme_get_default(), G_CALLBACK(theme_changed_cb), data); - - return; -} -#endif - /* Gets the positon of the child with its' parent if it has one. Returns -1 if the position is unable to be calculated. */ static gint @@ -223,7 +206,6 @@ new_menuitem (GtkWidget * widget) ParserData *pdata = g_new0 (ParserData, 1); g_object_set_data_full(G_OBJECT(item), PARSER_DATA, pdata, parse_data_free); - /* g_object_set_data_full(G_OBJECT(widget), CACHED_MENUITEM, item, object_cache_freed); */ g_object_weak_ref(G_OBJECT(item), dbusmenu_item_freed, NULL); g_object_weak_ref(G_OBJECT(widget), widget_freed, NULL); -- cgit v1.2.3 From 3cb0a087b79ef0af68b3ba73944f503823603bff Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 24 Feb 2011 10:26:27 -0600 Subject: Checking to ensure we're the parent before deleting --- libdbusmenu-glib/menuitem.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 49b83ce..0bbce8c 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -781,6 +781,11 @@ dbusmenu_menuitem_child_delete (DbusmenuMenuitem * mi, DbusmenuMenuitem * child) g_return_val_if_fail(DBUSMENU_IS_MENUITEM(mi), FALSE); g_return_val_if_fail(DBUSMENU_IS_MENUITEM(child), FALSE); + if (dbusmenu_menuitem_get_parent(child) != mi) { + g_warning("Trying to remove a child that doesn't believe we're it's parent."); + return FALSE; + } + DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi); priv->children = g_list_remove(priv->children, child); dbusmenu_menuitem_unparent(child); -- cgit v1.2.3 From 2dce5a22fac21e608b85630a825c36fc86c1c592 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 24 Feb 2011 10:27:07 -0600 Subject: Adding a transfer annotation for the get_parent function --- libdbusmenu-glib/menuitem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 0bbce8c..de8a1ad 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1028,7 +1028,7 @@ dbusmenu_menuitem_unparent (DbusmenuMenuitem * mi) * * This function looks up the parent of @mi * - * Return value: The parent of this menu item + * Return value: (transfer none): The parent of this menu item */ DbusmenuMenuitem * dbusmenu_menuitem_get_parent (DbusmenuMenuitem * mi) -- cgit v1.2.3 From 233e2b72456b70ea86c163f25c08d5fa1981b42c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 24 Feb 2011 10:32:35 -0600 Subject: Add the new functions to the sections doc --- docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt b/docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt index b6a6902..b3a78b7 100644 --- a/docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt +++ b/docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt @@ -100,6 +100,9 @@ dbusmenu_menuitem_foreach dbusmenu_menuitem_handle_event dbusmenu_menuitem_send_about_to_show dbusmenu_menuitem_show_to_user +dbusmenu_menuitem_get_parent +dbusmenu_menuitem_set_parent +dbusmenu_menuitem_unparent DBUSMENU_MENUITEM DBUSMENU_IS_MENUITEM -- cgit v1.2.3 From 0e833536055614008cd6f75734d2c2a8c1e646bf Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 24 Feb 2011 10:35:55 -0600 Subject: Fixing signal emition to use the saved value instead of the enum --- libdbusmenu-glib/menuitem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 3dd98df..fb138b6 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1671,7 +1671,7 @@ dbusmenu_menuitem_handle_event (DbusmenuMenuitem * mi, const gchar * name, GVari DbusmenuMenuitemClass * class = DBUSMENU_MENUITEM_GET_CLASS(mi); gboolean handled = FALSE; - g_signal_emit(G_OBJECT(mi), EVENT, g_quark_from_string(name), name, variant, timestamp, &handled); + g_signal_emit(G_OBJECT(mi), signals[EVENT], g_quark_from_string(name), name, variant, timestamp, &handled); if (!handled && class->handle_event != NULL) { return class->handle_event(mi, name, variant, timestamp); -- cgit v1.2.3 From 92e58fcb8337d4828cfa3093e1650977af741fde Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 24 Feb 2011 10:40:09 -0600 Subject: Adding in the event signal for the menuitem --- docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt b/docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt index 11316d6..b1e2d8c 100644 --- a/docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt +++ b/docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt @@ -44,6 +44,7 @@ DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED DBUSMENU_MENUITEM_SIGNAL_CHILD_ADDED DBUSMENU_MENUITEM_SIGNAL_CHILD_REMOVED DBUSMENU_MENUITEM_SIGNAL_CHILD_MOVED +DBUSMENU_MENUITEM_SIGNAL_EVENT DBUSMENU_MENUITEM_SIGNAL_REALIZED DBUSMENU_MENUITEM_SIGNAL_REALIZED_ID DBUSMENU_MENUITEM_SIGNAL_ABOUT_TO_SHOW -- cgit v1.2.3 From 5525e24ddca6e5ef60ba888b0032674464ccfd17 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 24 Feb 2011 10:52:10 -0600 Subject: Document the event signal define. --- libdbusmenu-glib/menuitem.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libdbusmenu-glib/menuitem.h b/libdbusmenu-glib/menuitem.h index 6d41e25..f4eb989 100644 --- a/libdbusmenu-glib/menuitem.h +++ b/libdbusmenu-glib/menuitem.h @@ -96,6 +96,11 @@ G_BEGIN_DECLS * String to attach to signal #DbusmenuServer::about-to-show */ #define DBUSMENU_MENUITEM_SIGNAL_ABOUT_TO_SHOW "about-to-show" +/** + * DBUSMENU_MENUITEM_SIGNAL_EVENT: + * + * String to attach to signal #DbusmenuServer::event + */ #define DBUSMENU_MENUITEM_SIGNAL_EVENT "event" /** -- cgit v1.2.3 From 3566852c8b4330cff84f4a7c6bcf18601264f747 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 24 Feb 2011 13:52:01 -0600 Subject: Set property to status and return it --- libdbusmenu-glib/dbus-menu.xml | 2 +- libdbusmenu-glib/server.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libdbusmenu-glib/dbus-menu.xml b/libdbusmenu-glib/dbus-menu.xml index 829c16e..0d2a2d6 100644 --- a/libdbusmenu-glib/dbus-menu.xml +++ b/libdbusmenu-glib/dbus-menu.xml @@ -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 e3fd2cd..056d6cb 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -744,6 +744,8 @@ 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, "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 78f43d50ded332c262d28cfc268ea1c9928aef7e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 24 Feb 2011 14:21:43 -0600 Subject: Marking as having details available in the signal --- libdbusmenu-glib/menuitem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index fb138b6..5202aa1 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -261,7 +261,7 @@ dbusmenu_menuitem_class_init (DbusmenuMenuitemClass *klass) */ signals[EVENT] = g_signal_new(DBUSMENU_MENUITEM_SIGNAL_EVENT, G_TYPE_FROM_CLASS(klass), - G_SIGNAL_RUN_LAST, + G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, G_STRUCT_OFFSET(DbusmenuMenuitemClass, event), g_signal_accumulator_true_handled, NULL, _dbusmenu_menuitem_marshal_BOOLEAN__STRING_VARIANT_UINT, -- cgit v1.2.3 From f5ef3600b66047f13796972ee40acf7b50b81790 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 24 Feb 2011 14:44:37 -0600 Subject: 0.3.99 --- configure.ac | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 7f53d3c..195422b 100644 --- a/configure.ac +++ b/configure.ac @@ -1,11 +1,11 @@ -AC_INIT(libdbusmenu, 0.3.98, ted@canonical.com) +AC_INIT(libdbusmenu, 0.3.99, ted@canonical.com) AC_COPYRIGHT([Copyright 2009,2010 Canonical]) AC_PREREQ(2.62) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(libdbusmenu, 0.3.98, [-Wno-portability]) +AM_INIT_AUTOMAKE(libdbusmenu, 0.3.99, [-Wno-portability]) AM_MAINTAINER_MODE @@ -134,7 +134,7 @@ AC_PATH_PROG([XSLT_PROC], [xsltproc]) ########################### LIBDBUSMENU_CURRENT=3 -LIBDBUSMENU_REVISION=6 +LIBDBUSMENU_REVISION=7 LIBDBUSMENU_AGE=0 AC_SUBST(LIBDBUSMENU_CURRENT) -- cgit v1.2.3