aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-gtk
diff options
context:
space:
mode:
Diffstat (limited to 'libdbusmenu-gtk')
-rw-r--r--libdbusmenu-gtk/Makefile.am6
-rw-r--r--libdbusmenu-gtk/Makefile.in7
-rw-r--r--libdbusmenu-gtk/client.c110
-rw-r--r--libdbusmenu-gtk/client.h42
-rw-r--r--libdbusmenu-gtk/genericmenuitem.c54
-rw-r--r--libdbusmenu-gtk/genericmenuitem.h4
-rw-r--r--libdbusmenu-gtk/menu.c36
-rw-r--r--libdbusmenu-gtk/menu.h33
-rw-r--r--libdbusmenu-gtk/menuitem.c120
-rw-r--r--libdbusmenu-gtk/menuitem.h15
-rw-r--r--libdbusmenu-gtk/parser.c118
-rw-r--r--libdbusmenu-gtk/parser.h14
-rw-r--r--libdbusmenu-gtk/serializablemenuitem.c64
-rw-r--r--libdbusmenu-gtk/serializablemenuitem.h18
14 files changed, 352 insertions, 289 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 = \
diff --git a/libdbusmenu-gtk/Makefile.in b/libdbusmenu-gtk/Makefile.in
index 6ea746d..64abec5 100644
--- a/libdbusmenu-gtk/Makefile.in
+++ b/libdbusmenu-gtk/Makefile.in
@@ -191,6 +191,7 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
+GLIB_MKENUMS = @GLIB_MKENUMS@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
GREP = @GREP@
@@ -385,17 +386,17 @@ INTROSPECTION_GIRS = $(am__append_1)
@INTROSPECTION_TEN_FALSE@INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) \
@INTROSPECTION_TEN_FALSE@ --warn-all \
@INTROSPECTION_TEN_FALSE@ --add-include-path=$(top_builddir)/libdbusmenu-glib \
-@INTROSPECTION_TEN_FALSE@ $(addprefix --c-include=libdbusmenu-gtk/, $(introspection_sources))
+@INTROSPECTION_TEN_FALSE@ $(addprefix --c-include=libdbusmenu-gtk/, $(libdbusmenu_gtkinclude_HEADERS))
@INTROSPECTION_TEN_TRUE@INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) \
@INTROSPECTION_TEN_TRUE@ --warn-all \
@INTROSPECTION_TEN_TRUE@ --add-include-path=$(top_builddir)/libdbusmenu-glib \
-@INTROSPECTION_TEN_TRUE@ $(addprefix --c-include=libdbusmenu-gtk/, $(introspection_sources)) \
+@INTROSPECTION_TEN_TRUE@ $(addprefix --c-include=libdbusmenu-gtk/, $(libdbusmenu_gtkinclude_HEADERS)) \
@INTROSPECTION_TEN_TRUE@ --symbol-prefix=dbusmenu \
@INTROSPECTION_TEN_TRUE@ --identifier-prefix=DbusmenuGtk
INTROSPECTION_COMPILER_ARGS = --includedir=$(builddir) --includedir=$(top_builddir)/libdbusmenu-glib
-@HAVE_INTROSPECTION_TRUE@introspection_sources = $(libdbusmenu_gtkinclude_HEADERS)
+@HAVE_INTROSPECTION_TRUE@introspection_sources = $(filter-out genericmenuitem.%, $(libdbusmenu_gtkinclude_HEADERS) $(libdbusmenu_gtk_la_SOURCES))
@HAVE_INTROSPECTION_TRUE@DbusmenuGtk_0_4_gir_INCLUDES = \
@HAVE_INTROSPECTION_TRUE@ GObject-2.0 \
@HAVE_INTROSPECTION_TRUE@ $(GTKGIR) \
diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c
index 7ab2fe9..50978ff 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_object: 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/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
diff --git a/libdbusmenu-gtk/genericmenuitem.c b/libdbusmenu-gtk/genericmenuitem.c
index 2af70f3..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.
@@ -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/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
*/
diff --git a/libdbusmenu-gtk/menu.c b/libdbusmenu-gtk/menu.c
index 2a27fe2..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;
}
@@ -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_object: 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/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
diff --git a/libdbusmenu-gtk/menuitem.c b/libdbusmenu-gtk/menuitem.c
index fa5eb89..508b43f 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 <gtk/gtk.h>
/**
- 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 #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
+ * 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..41f2187 100644
--- a/libdbusmenu-gtk/menuitem.h
+++ b/libdbusmenu-gtk/menuitem.h
@@ -43,8 +43,19 @@ 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);
+
+/**
+ 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.c b/libdbusmenu-gtk/parser.c
index 8aa2837..97f7979 100644
--- a/libdbusmenu-gtk/parser.c
+++ b/libdbusmenu-gtk/parser.c
@@ -85,16 +85,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 full): A dbusmenu item representing the menu structure
+ */
DbusmenuMenuitem *
dbusmenu_gtk_parse_menu_structure (GtkWidget * widget)
{
@@ -109,56 +109,62 @@ 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 if we replace the cache on the object with a new
- dbusmenu menuitem */
+/* Called when the dbusmenu item that we're keeping around
+ is finalized */
static void
-object_cache_freed (gpointer data)
+dbusmenu_item_freed (gpointer data, GObject * obj)
{
- // 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);
+ ParserData *pdata = (ParserData *)g_object_get_data(G_OBJECT(obj), PARSER_DATA);
- g_signal_handlers_disconnect_by_func(gtk_icon_theme_get_default(), G_CALLBACK(theme_changed_cb), data);
+ if (pdata != NULL && pdata->widget != NULL) {
+ g_object_steal_data(G_OBJECT(pdata->widget), CACHED_MENUITEM);
+ }
+}
+
+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;
}
@@ -198,10 +204,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_weak_ref(G_OBJECT(item), dbusmenu_item_freed, NULL);
+ g_object_weak_ref(G_OBJECT(widget), widget_freed, NULL);
- 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);
+ pdata->widget = widget;
+ g_object_add_weak_pointer(G_OBJECT (widget), (gpointer*)&pdata->widget);
return item;
}
@@ -237,16 +246,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,
@@ -294,10 +303,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,
@@ -472,12 +477,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;
}
@@ -750,30 +753,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,13 +789,13 @@ 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),
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))
{
@@ -818,7 +825,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 +834,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. */
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 <libdbusmenu-glib/menuitem.h>
#include <gtk/gtk.h>
+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.c b/libdbusmenu-gtk/serializablemenuitem.c
index cfd864d..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
*/
@@ -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)
{
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