Merge lp:~pitti/libdbusmenu/fix-annotations into lp:libdbusmenu/0.5

Proposed by Martin Pitt
Status: Merged
Merged at revision: 216
Proposed branch: lp:~pitti/libdbusmenu/fix-annotations
Merge into: lp:libdbusmenu/0.5
Diff against target: 2031 lines (+757/-656)
17 files modified
libdbusmenu-glib/Makefile.am (+3/-3)
libdbusmenu-glib/client.c (+68/-68)
libdbusmenu-glib/client.h (+1/-1)
libdbusmenu-glib/menuitem-proxy.c (+17/-17)
libdbusmenu-glib/menuitem.c (+363/-360)
libdbusmenu-glib/menuitem.h (+2/-2)
libdbusmenu-gtk/Makefile.am (+3/-3)
libdbusmenu-gtk/client.c (+55/-55)
libdbusmenu-gtk/genericmenuitem.c (+26/-26)
libdbusmenu-gtk/menu.c (+17/-17)
libdbusmenu-gtk/menuitem.c (+60/-60)
libdbusmenu-gtk/menuitem.h (+1/-1)
libdbusmenu-gtk/parser.c (+10/-10)
libdbusmenu-gtk/serializablemenuitem.c (+31/-31)
tests/Makefile.am (+13/-2)
tests/test-glib-simple-items.py (+35/-0)
tests/test-gtk-shortcut-client.py (+52/-0)
To merge this branch: bzr merge lp:~pitti/libdbusmenu/fix-annotations
Reviewer Review Type Date Requested Status
Ted Gould (community) Approve
Review via email: mp+50578@code.launchpad.net

Description of the change

This branch fixes the GI/gtk-doc annotations. They need to be reformatted to be recognized by g-ir-scanner/gtk-doc, I added the necessary annotations, and also added a simple test case (Python port of test-glib-simple-items.c).

Now DbusmenuGtk-0.4.gir is fully introspectable. The two functions in Dbusmenu-0.4.gir which aren't are dbusmenu_client_add_type_handler{,_full}. They take a callback function (which isn't "async" or "call" scope) and a ClientTypeDestroyHandler, but GI can only handle such "notify" scope callbacks if the method takes a standard GDestroyNotify. Thus these two can't be made introspectable without an API/ABI change. Are these vitally important to write clients?

I also started working on a Python port of the "test-gtk-shortcut" test case [1]. This runs, but once the server comes alive, I get an error:

(test-gtk-shortcut-client.py:10192): LIBDBUSMENU-GLIB-WARNING **: Getting layout failed: GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: Type of message, `(iias)', does not match expected type `(i)'

and the menu with the shortcut isn't visible. I currently have no idea why this happens, this doesn't seem to be immediately related to the Python bits. Does that ring a bell for you?

[1] http://people.canonical.com/~pitti/tmp/dbusmenu-shortcut-python-test.patch

To post a comment you must log in.
217. By Martin Pitt

merge trunk

Revision history for this message
Martin Pitt (pitti) wrote :

I now merged to the new version from trunk. It seems the xml -> variant change magically fixed this, and the test-gtk-shortcut-client.py test case now works perfectly; so I pushed this as well.

218. By Martin Pitt

add test-gtk-shortcut-client.py Python GI test

This replicates tests/test-gtk-shortcut-client.c using Python and GI.

Revision history for this message
Ted Gould (ted) wrote :

In the parser the annotation should be transfer full. I'll fix that and
merge it in. Thanks!

  review approve

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'libdbusmenu-glib/Makefile.am'
--- libdbusmenu-glib/Makefile.am 2011-02-09 17:45:41 +0000
+++ libdbusmenu-glib/Makefile.am 2011-02-21 13:11:23 +0000
@@ -122,21 +122,21 @@
122INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) \122INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) \
123 --warn-all \123 --warn-all \
124 --add-include-path=$(srcdir) \124 --add-include-path=$(srcdir) \
125 $(addprefix --c-include=libdbusmenu-glib/, $(introspection_sources)) \125 $(addprefix --c-include=libdbusmenu-glib/, $(libdbusmenu_glibinclude_HEADERS)) \
126 --symbol-prefix=dbusmenu \126 --symbol-prefix=dbusmenu \
127 --identifier-prefix=Dbusmenu127 --identifier-prefix=Dbusmenu
128else128else
129INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) \129INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) \
130 --warn-all \130 --warn-all \
131 --add-include-path=$(srcdir) \131 --add-include-path=$(srcdir) \
132 $(addprefix --c-include=libdbusmenu-glib/, $(introspection_sources))132 $(addprefix --c-include=libdbusmenu-glib/, $(libdbusmenu_glibinclude_HEADERS))
133endif133endif
134134
135INTROSPECTION_COMPILER_ARGS = --includedir=$(builddir)135INTROSPECTION_COMPILER_ARGS = --includedir=$(builddir)
136136
137if HAVE_INTROSPECTION137if HAVE_INTROSPECTION
138138
139introspection_sources = $(libdbusmenu_glibinclude_HEADERS)139introspection_sources = $(libdbusmenu_glibinclude_HEADERS) $(libdbusmenu_glib_la_SOURCES)
140140
141Dbusmenu-0.4.gir: libdbusmenu-glib.la141Dbusmenu-0.4.gir: libdbusmenu-glib.la
142Dbusmenu_0_4_gir_INCLUDES = \142Dbusmenu_0_4_gir_INCLUDES = \
143143
=== modified file 'libdbusmenu-glib/client.c'
--- libdbusmenu-glib/client.c 2011-02-15 17:42:52 +0000
+++ libdbusmenu-glib/client.c 2011-02-21 13:11:23 +0000
@@ -1682,17 +1682,17 @@
16821682
1683/* Public API */1683/* Public API */
1684/**1684/**
1685 dbusmenu_client_new:1685 * dbusmenu_client_new:
1686 @name: The DBus name for the server to connect to1686 * @name: The DBus name for the server to connect to
1687 @object: The object on the server to monitor1687 * @object: The object on the server to monitor
16881688 *
1689 This function creates a new client that connects to a specific1689 * This function creates a new client that connects to a specific
1690 server on DBus. That server is at a specific location sharing1690 * server on DBus. That server is at a specific location sharing
1691 a known object. The interface is assumed by the code to be 1691 * a known object. The interface is assumed by the code to be
1692 the DBus menu interface. The newly created client will start1692 * the DBus menu interface. The newly created client will start
1693 sending out events as it syncs up with the server.1693 * sending out events as it syncs up with the server.
16941694 *
1695 Return value: A brand new #DbusmenuClient1695 * Return value: A brand new #DbusmenuClient
1696*/1696*/
1697DbusmenuClient *1697DbusmenuClient *
1698dbusmenu_client_new (const gchar * name, const gchar * object)1698dbusmenu_client_new (const gchar * name, const gchar * object)
@@ -1706,21 +1706,21 @@
1706}1706}
17071707
1708/**1708/**
1709 dbusmenu_client_get_root:1709 * dbusmenu_client_get_root:
1710 @client: The #DbusmenuClient to get the root node from1710 * @client: The #DbusmenuClient to get the root node from
17111711 *
1712 Grabs the root node for the specified client @client. This1712 * Grabs the root node for the specified client @client. This
1713 function may block. It will block if there is currently a1713 * function may block. It will block if there is currently a
1714 call to update the layout, it will block on that layout 1714 * call to update the layout, it will block on that layout
1715 updated and then return the newly updated layout. Chances1715 * updated and then return the newly updated layout. Chances
1716 are that this update is in the queue for the mainloop as1716 * are that this update is in the queue for the mainloop as
1717 it would have been requested some time ago, but in theory1717 * it would have been requested some time ago, but in theory
1718 it could block longer.1718 * it could block longer.
17191719 *
1720 Return value: A #DbusmenuMenuitem representing the root of1720 * Return value: (transfer none): A #DbusmenuMenuitem representing the root of
1721 menu on the server. If there is no server or there is1721 * menu on the server. If there is no server or there is
1722 an error receiving its layout it'll return #NULL.1722 * an error receiving its layout it'll return #NULL.
1723*/1723 */
1724DbusmenuMenuitem *1724DbusmenuMenuitem *
1725dbusmenu_client_get_root (DbusmenuClient * client)1725dbusmenu_client_get_root (DbusmenuClient * client)
1726{1726{
@@ -1749,25 +1749,25 @@
1749}1749}
17501750
1751/**1751/**
1752 dbusmenu_client_add_type_handler:1752 * dbusmenu_client_add_type_handler:
1753 @client: Client where we're getting types coming in1753 * @client: Client where we're getting types coming in
1754 @type: A text string that will be matched with the 'type'1754 * @type: A text string that will be matched with the 'type'
1755 property on incoming menu items1755 * property on incoming menu items
1756 @newfunc: The function that will be executed with those new1756 * @newfunc: The function that will be executed with those new
1757 items when they come in.1757 * items when they come in.
17581758 *
1759 This function connects into the type handling of the #DbusmenuClient.1759 * This function connects into the type handling of the #DbusmenuClient.
1760 Every new menuitem that comes in immediately gets asked for it's1760 * Every new menuitem that comes in immediately gets asked for it's
1761 properties. When we get those properties we check the 'type'1761 * properties. When we get those properties we check the 'type'
1762 property and look to see if it matches a handler that is known1762 * property and look to see if it matches a handler that is known
1763 by the client. If so, the @newfunc function is executed on that1763 * by the client. If so, the @newfunc function is executed on that
1764 #DbusmenuMenuitem. If not, then the DbusmenuClient::new-menuitem1764 * #DbusmenuMenuitem. If not, then the DbusmenuClient::new-menuitem
1765 signal is sent.1765 * signal is sent.
17661766 *
1767 In the future the known types will be sent to the server so that it1767 * In the future the known types will be sent to the server so that it
1768 can make choices about the menu item types availble.1768 * can make choices about the menu item types availble.
17691769 *
1770 Return value: If registering the new type was successful.1770 * Return value: If registering the new type was successful.
1771*/1771*/
1772gboolean1772gboolean
1773dbusmenu_client_add_type_handler (DbusmenuClient * client, const gchar * type, DbusmenuClientTypeHandler newfunc)1773dbusmenu_client_add_type_handler (DbusmenuClient * client, const gchar * type, DbusmenuClientTypeHandler newfunc)
@@ -1776,29 +1776,29 @@
1776}1776}
17771777
1778/**1778/**
1779 dbusmenu_client_add_type_handler_full:1779 * dbusmenu_client_add_type_handler_full:
1780 @client: Client where we're getting types coming in1780 * @client: Client where we're getting types coming in
1781 @type: A text string that will be matched with the 'type'1781 * @type: A text string that will be matched with the 'type'
1782 property on incoming menu items1782 * property on incoming menu items
1783 @newfunc: The function that will be executed with those new1783 * @newfunc: The function that will be executed with those new
1784 items when they come in.1784 * items when they come in.
1785 @user_data: Data passed to @newfunc when it is called1785 * @user_data: Data passed to @newfunc when it is called
1786 @destroy_func: A function that is called when the type handler is1786 * @destroy_func: A function that is called when the type handler is
1787 removed (usually on client destruction) which will free1787 * removed (usually on client destruction) which will free
1788 the resources in @user_data.1788 * the resources in @user_data.
17891789 *
1790 This function connects into the type handling of the #DbusmenuClient.1790 * This function connects into the type handling of the #DbusmenuClient.
1791 Every new menuitem that comes in immediately gets asked for it's1791 * Every new menuitem that comes in immediately gets asked for it's
1792 properties. When we get those properties we check the 'type'1792 * properties. When we get those properties we check the 'type'
1793 property and look to see if it matches a handler that is known1793 * property and look to see if it matches a handler that is known
1794 by the client. If so, the @newfunc function is executed on that1794 * by the client. If so, the @newfunc function is executed on that
1795 #DbusmenuMenuitem. If not, then the DbusmenuClient::new-menuitem1795 * #DbusmenuMenuitem. If not, then the DbusmenuClient::new-menuitem
1796 signal is sent.1796 * signal is sent.
17971797 *
1798 In the future the known types will be sent to the server so that it1798 * In the future the known types will be sent to the server so that it
1799 can make choices about the menu item types availble.1799 * can make choices about the menu item types availble.
18001800 *
1801 Return value: If registering the new type was successful.1801 * Return value: If registering the new type was successful.
1802*/1802*/
1803gboolean1803gboolean
1804dbusmenu_client_add_type_handler_full (DbusmenuClient * client, const gchar * type, DbusmenuClientTypeHandler newfunc, gpointer user_data, DbusmenuClientTypeDestroyHandler destroy_func)1804dbusmenu_client_add_type_handler_full (DbusmenuClient * client, const gchar * type, DbusmenuClientTypeHandler newfunc, gpointer user_data, DbusmenuClientTypeDestroyHandler destroy_func)
18051805
=== modified file 'libdbusmenu-glib/client.h'
--- libdbusmenu-glib/client.h 2011-01-27 15:35:14 +0000
+++ libdbusmenu-glib/client.h 2011-02-21 13:11:23 +0000
@@ -145,7 +145,7 @@
145 const gchar * type,145 const gchar * type,
146 DbusmenuClientTypeHandler newfunc,146 DbusmenuClientTypeHandler newfunc,
147 gpointer user_data,147 gpointer user_data,
148 DbusmenuClientTypeDestroyHandler destory_func);148 DbusmenuClientTypeDestroyHandler destroy_func);
149void dbusmenu_client_send_event (DbusmenuClient * client,149void dbusmenu_client_send_event (DbusmenuClient * client,
150 gint id,150 gint id,
151 const gchar * name,151 const gchar * name,
152152
=== modified file 'libdbusmenu-glib/menuitem-proxy.c'
--- libdbusmenu-glib/menuitem-proxy.c 2010-11-18 02:50:45 +0000
+++ libdbusmenu-glib/menuitem-proxy.c 2011-02-21 13:11:23 +0000
@@ -325,14 +325,14 @@
325}325}
326326
327/**327/**
328 dbusmenu_menuitem_proxy_new:328 * dbusmenu_menuitem_proxy_new:
329 @mi: The #DbusmenuMenuitem to proxy329 * @mi: The #DbusmenuMenuitem to proxy
330330 *
331 Builds a new #DbusmenuMenuitemProxy object that proxies331 * Builds a new #DbusmenuMenuitemProxy object that proxies
332 all of the values for @mi.332 * all of the values for @mi.
333333 *
334 Return value: A new #DbusmenuMenuitemProxy object.334 * Return value: A new #DbusmenuMenuitemProxy object.
335*/335 */
336DbusmenuMenuitemProxy *336DbusmenuMenuitemProxy *
337dbusmenu_menuitem_proxy_new (DbusmenuMenuitem * mi)337dbusmenu_menuitem_proxy_new (DbusmenuMenuitem * mi)
338{338{
@@ -344,15 +344,15 @@
344}344}
345345
346/**346/**
347 dbusmenu_menuitem_proxy_get_wrapped:347 * dbusmenu_menuitem_proxy_get_wrapped:
348 @pmi: #DbusmenuMenuitemProxy to look into348 * @pmi: #DbusmenuMenuitemProxy to look into
349349 *
350 Accesses the private variable of which #DbusmenuMenuitem350 * Accesses the private variable of which #DbusmenuMenuitem
351 we are doing the proxying for.351 * we are doing the proxying for.
352352 *
353 Return value: A #DbusmenuMenuitem object or a #NULL if we353 * Return value: (transfer none): A #DbusmenuMenuitem object or a #NULL if we
354 don't have one or there is an error.354 * don't have one or there is an error.
355*/355 */
356DbusmenuMenuitem *356DbusmenuMenuitem *
357dbusmenu_menuitem_proxy_get_wrapped (DbusmenuMenuitemProxy * pmi)357dbusmenu_menuitem_proxy_get_wrapped (DbusmenuMenuitemProxy * pmi)
358{358{
359359
=== modified file 'libdbusmenu-glib/menuitem.c'
--- libdbusmenu-glib/menuitem.c 2011-02-15 17:42:52 +0000
+++ libdbusmenu-glib/menuitem.c 2011-02-21 13:11:23 +0000
@@ -95,7 +95,7 @@
95static void get_property (GObject * obj, guint id, GValue * value, GParamSpec * pspec);95static void get_property (GObject * obj, guint id, GValue * value, GParamSpec * pspec);
96static void g_value_transform_STRING_BOOLEAN (const GValue * in, GValue * out);96static void g_value_transform_STRING_BOOLEAN (const GValue * in, GValue * out);
97static void g_value_transform_STRING_INT (const GValue * in, GValue * out);97static void g_value_transform_STRING_INT (const GValue * in, GValue * out);
98static void handle_event (DbusmenuMenuitem * mi, const gchar * name, GVariant * value, guint timestamp);98static void handle_event (DbusmenuMenuitem * mi, const gchar * name, GVariant * variant, guint timestamp);
99static void send_about_to_show (DbusmenuMenuitem * mi, void (*cb) (DbusmenuMenuitem * mi, gpointer user_data), gpointer cb_data);99static void send_about_to_show (DbusmenuMenuitem * mi, void (*cb) (DbusmenuMenuitem * mi, gpointer user_data), gpointer cb_data);
100100
101/* GObject stuff */101/* GObject stuff */
@@ -428,12 +428,12 @@
428/* Public interface */428/* Public interface */
429429
430/**430/**
431 dbusmenu_menuitem_new:431 * dbusmenu_menuitem_new:
432432 *
433 Create a new #DbusmenuMenuitem with all default values.433 * Create a new #DbusmenuMenuitem with all default values.
434434 *
435 Return value: A newly allocated #DbusmenuMenuitem.435 * Return value: A newly allocated #DbusmenuMenuitem.
436*/436 */
437DbusmenuMenuitem *437DbusmenuMenuitem *
438dbusmenu_menuitem_new (void)438dbusmenu_menuitem_new (void)
439{439{
@@ -441,13 +441,13 @@
441}441}
442442
443/**443/**
444 dbusmenu_menuitem_new_with_id:444 * dbusmenu_menuitem_new_with_id:
445 @id: ID to use for this menuitem445 * @id: ID to use for this menuitem
446446 *
447 This creates a blank #DbusmenuMenuitem with a specific ID.447 * This creates a blank #DbusmenuMenuitem with a specific ID.
448448 *
449 Return value: A newly allocated #DbusmenuMenuitem.449 * Return value: A newly allocated #DbusmenuMenuitem.
450*/450 */
451DbusmenuMenuitem *451DbusmenuMenuitem *
452dbusmenu_menuitem_new_with_id (gint id)452dbusmenu_menuitem_new_with_id (gint id)
453{453{
@@ -457,13 +457,13 @@
457}457}
458458
459/**459/**
460 dbusmenu_menuitem_get_id:460 * dbusmenu_menuitem_get_id:
461 @mi: The #DbusmenuMenuitem to query.461 * @mi: The #DbusmenuMenuitem to query.
462462 *
463 Gets the unique ID for @mi.463 * Gets the unique ID for @mi.
464464 *
465 Return value: The ID of the @mi.465 * Return value: The ID of the @mi.
466*/466 */
467gint467gint
468dbusmenu_menuitem_get_id (DbusmenuMenuitem * mi)468dbusmenu_menuitem_get_id (DbusmenuMenuitem * mi)
469{469{
@@ -480,17 +480,17 @@
480}480}
481481
482/**482/**
483 dbusmenu_menuitem_realized:483 * dbusmenu_menuitem_realized:
484 @mi: #DbusmenuMenuitem to check on484 * @mi: #DbusmenuMenuitem to check on
485485 *
486 This function returns whether the menuitem has been realized or486 * This function returns whether the menuitem has been realized or
487 not. This is significant mostly in client implementations that487 * not. This is significant mostly in client implementations that
488 can use this additional state to see if the second layers of488 * can use this additional state to see if the second layers of
489 the implementation have been built yet.489 * the implementation have been built yet.
490490 *
491 Return value: Returns whether or not the menu item has been realized491 * Return value: Returns whether or not the menu item has been realized
492 yet or not.492 * yet or not.
493*/493 */
494gboolean494gboolean
495dbusmenu_menuitem_realized (DbusmenuMenuitem * mi)495dbusmenu_menuitem_realized (DbusmenuMenuitem * mi)
496{496{
@@ -500,12 +500,12 @@
500}500}
501501
502/**502/**
503 dbusmenu_menuitem_set_realized:503 * dbusmenu_menuitem_set_realized:
504 @mi: #DbusmenuMenuitem to realize504 * @mi: #DbusmenuMenuitem to realize
505505 *
506 Sets the internal variable tracking whether it's been realized and506 * Sets the internal variable tracking whether it's been realized and
507 signals the DbusmenuMenuitem::realized event.507 * signals the DbusmenuMenuitem::realized event.
508*/508 */
509void509void
510dbusmenu_menuitem_set_realized (DbusmenuMenuitem * mi)510dbusmenu_menuitem_set_realized (DbusmenuMenuitem * mi)
511{511{
@@ -520,15 +520,15 @@
520}520}
521521
522/**522/**
523 dbusmenu_menuitem_get_children:523 * dbusmenu_menuitem_get_children:
524 @mi: The #DbusmenuMenuitem to query.524 * @mi: The #DbusmenuMenuitem to query.
525525 *
526 Returns simply the list of children that this menu item526 * Returns simply the list of children that this menu item
527 has. The list is valid until another child related function527 * has. The list is valid until another child related function
528 is called, where it might be changed.528 * is called, where it might be changed.
529529 *
530 Return value: A #GList of pointers to #DbusmenuMenuitem objects.530 * Return value: (transfer none): A #GList of pointers to #DbusmenuMenuitem objects.
531*/531 */
532GList *532GList *
533dbusmenu_menuitem_get_children (DbusmenuMenuitem * mi)533dbusmenu_menuitem_get_children (DbusmenuMenuitem * mi)
534{534{
@@ -551,18 +551,18 @@
551}551}
552552
553/**553/**
554 dbusmenu_menuitem_take_children:554 * dbusmenu_menuitem_take_children:
555 @mi: The #DbusmenMenuitem to take the children from.555 * @mi: The #DbusmenMenuitem to take the children from.
556556 *
557 While the name sounds devious that's exactly what this function557 * While the name sounds devious that's exactly what this function
558 does. It takes the list of children from the @mi and clears the558 * does. It takes the list of children from the @mi and clears the
559 internal list. The calling function is now in charge of the ref's559 * internal list. The calling function is now in charge of the ref's
560 on the children it has taken. A lot of responsibility involved560 * on the children it has taken. A lot of responsibility involved
561 in taking children.561 * in taking children.
562562 *
563 Return value: (transfer full) (array) (element-type Dbusmenu.Menuitem)563 * Return value: (transfer full) (element-type Dbusmenu.Menuitem):
564 A #GList of pointers to #DbusmenuMenuitem objects.564 * A #GList of pointers to #DbusmenuMenuitem objects.
565*/565 */
566GList *566GList *
567dbusmenu_menuitem_take_children (DbusmenuMenuitem * mi)567dbusmenu_menuitem_take_children (DbusmenuMenuitem * mi)
568{568{
@@ -579,16 +579,16 @@
579}579}
580580
581/**581/**
582 dbusmenu_menuitem_get_position:582 * dbusmenu_menuitem_get_position:
583 @mi: The #DbusmenuMenuitem to find the position of583 * @mi: The #DbusmenuMenuitem to find the position of
584 @parent: The #DbusmenuMenuitem who's children contain @mi584 * @parent: The #DbusmenuMenuitem who's children contain @mi
585585 *
586 This function returns the position of the menu item @mi586 * This function returns the position of the menu item @mi
587 in the children of @parent. It will return zero if the587 * in the children of @parent. It will return zero if the
588 menu item can't be found.588 * menu item can't be found.
589589 *
590 Return value: The position of @mi in the children of @parent.590 * Return value: The position of @mi in the children of @parent.
591*/591 */
592guint592guint
593dbusmenu_menuitem_get_position (DbusmenuMenuitem * mi, DbusmenuMenuitem * parent)593dbusmenu_menuitem_get_position (DbusmenuMenuitem * mi, DbusmenuMenuitem * parent)
594{594{
@@ -618,15 +618,15 @@
618}618}
619619
620/**620/**
621 dbusmenu_menuitem_get_position_realized:621 * dbusmenu_menuitem_get_position_realized:
622 @mi: The #DbusmenuMenuitem to find the position of622 * @mi: The #DbusmenuMenuitem to find the position of
623 @parent: The #DbusmenuMenuitem who's children contain @mi623 * @parent: The #DbusmenuMenuitem who's children contain @mi
624624 *
625 This function is very similar to #dbusmenu_menuitem_get_position625 * This function is very similar to #dbusmenu_menuitem_get_position
626 except that it only counts in the children that have been realized.626 * except that it only counts in the children that have been realized.
627627 *
628 Return value: The position of @mi in the realized children of @parent.628 * Return value: The position of @mi in the realized children of @parent.
629*/629 */
630guint630guint
631dbusmenu_menuitem_get_position_realized (DbusmenuMenuitem * mi, DbusmenuMenuitem * parent)631dbusmenu_menuitem_get_position_realized (DbusmenuMenuitem * mi, DbusmenuMenuitem * parent)
632{632{
@@ -662,15 +662,15 @@
662}662}
663663
664/**664/**
665 dbusmenu_menuitem_child_append:665 * dbusmenu_menuitem_child_append:
666 @mi: The #DbusmenuMenuitem which will become a new parent666 * @mi: The #DbusmenuMenuitem which will become a new parent
667 @child: The #DbusmenMenuitem that will be a child667 * @child: The #DbusmenMenuitem that will be a child
668668 *
669 This function adds @child to the list of children on @mi at669 * This function adds @child to the list of children on @mi at
670 the end of that list.670 * the end of that list.
671671 *
672 Return value: Whether the child has been added successfully.672 * Return value: Whether the child has been added successfully.
673*/673 */
674gboolean674gboolean
675dbusmenu_menuitem_child_append (DbusmenuMenuitem * mi, DbusmenuMenuitem * child)675dbusmenu_menuitem_child_append (DbusmenuMenuitem * mi, DbusmenuMenuitem * child)
676{676{
@@ -694,15 +694,15 @@
694}694}
695695
696/**696/**
697 dbusmenu_menuitem_child_prepend:697 * dbusmenu_menuitem_child_prepend:
698 @mi: The #DbusmenuMenuitem which will become a new parent698 * @mi: The #DbusmenuMenuitem which will become a new parent
699 @child: The #DbusmenMenuitem that will be a child699 * @child: The #DbusmenMenuitem that will be a child
700700 *
701 This function adds @child to the list of children on @mi at701 * This function adds @child to the list of children on @mi at
702 the beginning of that list.702 * the beginning of that list.
703703 *
704 Return value: Whether the child has been added successfully.704 * Return value: Whether the child has been added successfully.
705*/705 */
706gboolean706gboolean
707dbusmenu_menuitem_child_prepend (DbusmenuMenuitem * mi, DbusmenuMenuitem * child)707dbusmenu_menuitem_child_prepend (DbusmenuMenuitem * mi, DbusmenuMenuitem * child)
708{708{
@@ -726,16 +726,16 @@
726}726}
727727
728/**728/**
729 dbusmenu_menuitem_child_delete:729 * dbusmenu_menuitem_child_delete:
730 @mi: The #DbusmenuMenuitem which has @child as a child730 * @mi: The #DbusmenuMenuitem which has @child as a child
731 @child: The child #DbusmenuMenuitem that you want to no longer731 * @child: The child #DbusmenuMenuitem that you want to no longer
732 be a child of @mi.732 * be a child of @mi.
733 733 *
734 This function removes @child from the children list of @mi. It does734 * This function removes @child from the children list of @mi. It does
735 not call #g_object_unref on @child.735 * not call #g_object_unref on @child.
736736 *
737 Return value: If we were able to delete @child.737 * Return value: If we were able to delete @child.
738*/738 */
739gboolean739gboolean
740dbusmenu_menuitem_child_delete (DbusmenuMenuitem * mi, DbusmenuMenuitem * child)740dbusmenu_menuitem_child_delete (DbusmenuMenuitem * mi, DbusmenuMenuitem * child)
741{741{
@@ -758,17 +758,17 @@
758}758}
759759
760/**760/**
761 dbusmenu_menuitem_child_add_position:761 * dbusmenu_menuitem_child_add_position:
762 @mi: The #DbusmenuMenuitem that we're adding the child @child to.762 * @mi: The #DbusmenuMenuitem that we're adding the child @child to.
763 @child: The #DbusmenuMenuitem to make a child of @mi.763 * @child: The #DbusmenuMenuitem to make a child of @mi.
764 @position: Where in @mi object's list of chidren @child should be placed.764 * @position: Where in @mi object's list of chidren @child should be placed.
765765 *
766 Puts @child in the list of children for @mi at the location766 * Puts @child in the list of children for @mi at the location
767 specified in @position. If there is not enough entires available767 * specified in @position. If there is not enough entires available
768 then @child will be placed at the end of the list.768 * then @child will be placed at the end of the list.
769769 *
770 Return value: Whether @child was added successfully.770 * Return value: Whether @child was added successfully.
771*/771 */
772gboolean772gboolean
773dbusmenu_menuitem_child_add_position (DbusmenuMenuitem * mi, DbusmenuMenuitem * child, guint position)773dbusmenu_menuitem_child_add_position (DbusmenuMenuitem * mi, DbusmenuMenuitem * child, guint position)
774{774{
@@ -792,17 +792,17 @@
792}792}
793793
794/**794/**
795 dbusmenu_menuitem_child_reorder:795 * dbusmenu_menuitem_child_reorder:
796 @base: The #DbusmenuMenuitem that has children needing realignment796 * @mi: The #DbusmenuMenuitem that has children needing realignment
797 @child: The #DbusmenuMenuitem that is a child needing to be moved797 * @child: The #DbusmenuMenuitem that is a child needing to be moved
798 @position: The position in the list to place it in798 * @position: The position in the list to place it in
799799 *
800 This function moves a child on the list of children. It is800 * This function moves a child on the list of children. It is
801 for a child that is already in the list, but simply needs a 801 * for a child that is already in the list, but simply needs a
802 new location.802 * new location.
803803 *
804 Return value: Whether the move was successful.804 * Return value: Whether the move was successful.
805*/805 */
806gboolean806gboolean
807dbusmenu_menuitem_child_reorder(DbusmenuMenuitem * mi, DbusmenuMenuitem * child, guint position)807dbusmenu_menuitem_child_reorder(DbusmenuMenuitem * mi, DbusmenuMenuitem * child, guint position)
808{808{
@@ -832,16 +832,16 @@
832}832}
833833
834/**834/**
835 dbusmenu_menuitem_child_find:835 * dbusmenu_menuitem_child_find:
836 @mi: The #DbusmenuMenuitem who's children to look on836 * @mi: The #DbusmenuMenuitem who's children to look on
837 @id: The ID of the child that we're looking for.837 * @id: The ID of the child that we're looking for.
838838 *
839 Search the children of @mi to find one with the ID of @id.839 * Search the children of @mi to find one with the ID of @id.
840 If it doesn't exist then we return #NULL.840 * If it doesn't exist then we return #NULL.
841841 *
842 Return value: The menu item with the ID @id or #NULL if it842 * Return value: (transfer none): The menu item with the ID @id or #NULL if it
843 can't be found.843 * can't be found.
844*/844 */
845DbusmenuMenuitem *845DbusmenuMenuitem *
846dbusmenu_menuitem_child_find (DbusmenuMenuitem * mi, gint id)846dbusmenu_menuitem_child_find (DbusmenuMenuitem * mi, gint id)
847{847{
@@ -885,18 +885,18 @@
885}885}
886886
887/**887/**
888 dbusmenu_menuitem_find_id:888 * dbusmenu_menuitem_find_id:
889 @mi: #DbusmenuMenuitem at the top of the tree to search889 * @mi: #DbusmenuMenuitem at the top of the tree to search
890 @id: ID of the #DbusmenuMenuitem to search for890 * @id: ID of the #DbusmenuMenuitem to search for
891891 *
892 This function searchs the whole tree of children that892 * This function searchs the whole tree of children that
893 are attached to @mi. This could be quite a few nodes, all893 * are attached to @mi. This could be quite a few nodes, all
894 the way down the tree. It is a depth first search.894 * the way down the tree. It is a depth first search.
895895 *
896 Return value: The #DbusmenuMenuitem with the ID of @id896 * Return value: (transfer none): The #DbusmenuMenuitem with the ID of @id
897 or #NULL if there isn't such a menu item in the tree897 * or #NULL if there isn't such a menu item in the tree
898 represented by @mi.898 * represented by @mi.
899*/899 */
900DbusmenuMenuitem *900DbusmenuMenuitem *
901dbusmenu_menuitem_find_id (DbusmenuMenuitem * mi, gint id)901dbusmenu_menuitem_find_id (DbusmenuMenuitem * mi, gint id)
902{902{
@@ -913,20 +913,20 @@
913}913}
914914
915/**915/**
916 dbusmenu_menuitem_property_set:916 * dbusmenu_menuitem_property_set:
917 @mi: The #DbusmenuMenuitem to set the property on.917 * @mi: The #DbusmenuMenuitem to set the property on.
918 @property: Name of the property to set.918 * @property: Name of the property to set.
919 @value: The value of the property.919 * @value: The value of the property.
920920 *
921 Takes the pair of @property and @value and places them as a921 * Takes the pair of @property and @value and places them as a
922 property on @mi. If a property already exists by that name,922 * property on @mi. If a property already exists by that name,
923 then the value is set to the new value. If not, the property923 * then the value is set to the new value. If not, the property
924 is added. If the value is changed or the property was previously924 * is added. If the value is changed or the property was previously
925 unset then the signal #DbusmenuMenuitem::prop-changed will be925 * unset then the signal #DbusmenuMenuitem::prop-changed will be
926 emitted by this function.926 * emitted by this function.
927927 *
928 Return value: A boolean representing if the property value was set.928 * Return value: A boolean representing if the property value was set.
929*/929 */
930gboolean930gboolean
931dbusmenu_menuitem_property_set (DbusmenuMenuitem * mi, const gchar * property, const gchar * value)931dbusmenu_menuitem_property_set (DbusmenuMenuitem * mi, const gchar * property, const gchar * value)
932{932{
@@ -938,20 +938,20 @@
938}938}
939939
940/**940/**
941 dbusmenu_menuitem_property_set_bool:941 * dbusmenu_menuitem_property_set_bool:
942 @mi: The #DbusmenuMenuitem to set the property on.942 * @mi: The #DbusmenuMenuitem to set the property on.
943 @property: Name of the property to set.943 * @property: Name of the property to set.
944 @value: The value of the property.944 * @value: The value of the property.
945945 *
946 Takes a boolean @value and sets it on @property as a946 * Takes a boolean @value and sets it on @property as a
947 property on @mi. If a property already exists by that name,947 * property on @mi. If a property already exists by that name,
948 then the value is set to the new value. If not, the property948 * then the value is set to the new value. If not, the property
949 is added. If the value is changed or the property was previously949 * is added. If the value is changed or the property was previously
950 unset then the signal #DbusmenuMenuitem::prop-changed will be950 * unset then the signal #DbusmenuMenuitem::prop-changed will be
951 emitted by this function.951 * emitted by this function.
952952 *
953 Return value: A boolean representing if the property value was set.953 * Return value: A boolean representing if the property value was set.
954*/954 */
955gboolean955gboolean
956dbusmenu_menuitem_property_set_bool (DbusmenuMenuitem * mi, const gchar * property, const gboolean value)956dbusmenu_menuitem_property_set_bool (DbusmenuMenuitem * mi, const gchar * property, const gboolean value)
957{957{
@@ -960,20 +960,20 @@
960}960}
961961
962/**962/**
963 dbusmenu_menuitem_property_set_int:963 * dbusmenu_menuitem_property_set_int:
964 @mi: The #DbusmenuMenuitem to set the property on.964 * @mi: The #DbusmenuMenuitem to set the property on.
965 @property: Name of the property to set.965 * @property: Name of the property to set.
966 @value: The value of the property.966 * @value: The value of the property.
967967 *
968 Takes a boolean @value and sets it on @property as a968 * Takes a boolean @value and sets it on @property as a
969 property on @mi. If a property already exists by that name,969 * property on @mi. If a property already exists by that name,
970 then the value is set to the new value. If not, the property970 * then the value is set to the new value. If not, the property
971 is added. If the value is changed or the property was previously971 * is added. If the value is changed or the property was previously
972 unset then the signal #DbusmenuMenuitem::prop-changed will be972 * unset then the signal #DbusmenuMenuitem::prop-changed will be
973 emitted by this function.973 * emitted by this function.
974974 *
975 Return value: A boolean representing if the property value was set.975 * Return value: A boolean representing if the property value was set.
976*/976 */
977gboolean977gboolean
978dbusmenu_menuitem_property_set_int (DbusmenuMenuitem * mi, const gchar * property, const gint value)978dbusmenu_menuitem_property_set_int (DbusmenuMenuitem * mi, const gchar * property, const gint value)
979{979{
@@ -982,20 +982,20 @@
982}982}
983983
984/**984/**
985 dbusmenu_menuitem_property_set_variant:985 * dbusmenu_menuitem_property_set_variant:
986 @mi: The #DbusmenuMenuitem to set the property on.986 * @mi: The #DbusmenuMenuitem to set the property on.
987 @property: Name of the property to set.987 * @property: Name of the property to set.
988 @value: The value of the property.988 * @value: The value of the property.
989989 *
990 Takes the pair of @property and @value and places them as a990 * Takes the pair of @property and @value and places them as a
991 property on @mi. If a property already exists by that name,991 * property on @mi. If a property already exists by that name,
992 then the value is set to the new value. If not, the property992 * then the value is set to the new value. If not, the property
993 is added. If the value is changed or the property was previously993 * is added. If the value is changed or the property was previously
994 unset then the signal #DbusmenuMenuitem::prop-changed will be994 * unset then the signal #DbusmenuMenuitem::prop-changed will be
995 emitted by this function.995 * emitted by this function.
996996 *
997 Return value: A boolean representing if the property value was set.997 * Return value: A boolean representing if the property value was set.
998*/998 */
999gboolean999gboolean
1000dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * property, GVariant * value)1000dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * property, GVariant * value)
1001{1001{
@@ -1034,18 +1034,18 @@
1034}1034}
10351035
1036/**1036/**
1037 dbusmenu_menuitem_property_get:1037 * dbusmenu_menuitem_property_get:
1038 @mi: The #DbusmenuMenuitem to look for the property on.1038 * @mi: The #DbusmenuMenuitem to look for the property on.
1039 @property: The property to grab.1039 * @property: The property to grab.
10401040 *
1041 Look up a property on @mi and return the value of it if1041 * Look up a property on @mi and return the value of it if
1042 it exits. #NULL will be returned if the property doesn't1042 * it exits. #NULL will be returned if the property doesn't
1043 exist.1043 * exist.
10441044 *
1045 Return value: A string with the value of the property1045 * Return value: (transfer none): A string with the value of the property
1046 that shouldn't be free'd. Or #NULL if the property1046 * that shouldn't be free'd. Or #NULL if the property
1047 is not set or is not a string.1047 * is not set or is not a string.
1048*/1048 */
1049const gchar *1049const gchar *
1050dbusmenu_menuitem_property_get (DbusmenuMenuitem * mi, const gchar * property)1050dbusmenu_menuitem_property_get (DbusmenuMenuitem * mi, const gchar * property)
1051{1051{
@@ -1056,16 +1056,16 @@
1056}1056}
10571057
1058/**1058/**
1059 dbusmenu_menuitem_property_get_variant:1059 * dbusmenu_menuitem_property_get_variant:
1060 @mi: The #DbusmenuMenuitem to look for the property on.1060 * @mi: The #DbusmenuMenuitem to look for the property on.
1061 @property: The property to grab.1061 * @property: The property to grab.
10621062 *
1063 Look up a property on @mi and return the value of it if1063 * Look up a property on @mi and return the value of it if
1064 it exits. #NULL will be returned if the property doesn't1064 * it exits. #NULL will be returned if the property doesn't
1065 exist.1065 * exist.
10661066 *
1067 Return value: A GVariant for the property.1067 * Return value: (transfer none): A GVariant for the property.
1068*/1068 */
1069GVariant *1069GVariant *
1070dbusmenu_menuitem_property_get_variant (DbusmenuMenuitem * mi, const gchar * property)1070dbusmenu_menuitem_property_get_variant (DbusmenuMenuitem * mi, const gchar * property)
1071{1071{
@@ -1078,15 +1078,15 @@
1078}1078}
10791079
1080/**1080/**
1081 dbusmenu_menuitem_property_get_bool:1081 * dbusmenu_menuitem_property_get_bool:
1082 @mi: The #DbusmenuMenuitem to look for the property on.1082 * @mi: The #DbusmenuMenuitem to look for the property on.
1083 @property: The property to grab.1083 * @property: The property to grab.
10841084 *
1085 Look up a property on @mi and return the value of it if1085 * Look up a property on @mi and return the value of it if
1086 it exits. Returns #FALSE if the property doesn't exist.1086 * it exits. Returns #FALSE if the property doesn't exist.
10871087 *
1088 Return value: The value of the property or #FALSE.1088 * Return value: The value of the property or #FALSE.
1089*/1089 */
1090gboolean1090gboolean
1091dbusmenu_menuitem_property_get_bool (DbusmenuMenuitem * mi, const gchar * property)1091dbusmenu_menuitem_property_get_bool (DbusmenuMenuitem * mi, const gchar * property)
1092{1092{
@@ -1112,15 +1112,15 @@
1112}1112}
11131113
1114/**1114/**
1115 dbusmenu_menuitem_property_get_int:1115 * dbusmenu_menuitem_property_get_int:
1116 @mi: The #DbusmenuMenuitem to look for the property on.1116 * @mi: The #DbusmenuMenuitem to look for the property on.
1117 @property: The property to grab.1117 * @property: The property to grab.
11181118 *
1119 Look up a property on @mi and return the value of it if1119 * Look up a property on @mi and return the value of it if
1120 it exits. Returns zero if the property doesn't exist.1120 * it exits. Returns zero if the property doesn't exist.
11211121 *
1122 Return value: The value of the property or zero.1122 * Return value: The value of the property or zero.
1123*/1123 */
1124gint1124gint
1125dbusmenu_menuitem_property_get_int (DbusmenuMenuitem * mi, const gchar * property)1125dbusmenu_menuitem_property_get_int (DbusmenuMenuitem * mi, const gchar * property)
1126{1126{
@@ -1142,15 +1142,15 @@
11421142
11431143
1144/**1144/**
1145 dbusmenu_menuitem_property_exit:1145 * dbusmenu_menuitem_property_exit:
1146 @mi: The #DbusmenuMenuitem to look for the property on.1146 * @mi: The #DbusmenuMenuitem to look for the property on.
1147 @property: The property to look for.1147 * @property: The property to look for.
11481148 *
1149 Checkes to see if a particular property exists on @mi and 1149 * Checkes to see if a particular property exists on @mi and
1150 returns #TRUE if so.1150 * returns #TRUE if so.
11511151 *
1152 Return value: A boolean checking to see if the property is available1152 * Return value: A boolean checking to see if the property is available
1153*/1153 */
1154gboolean1154gboolean
1155dbusmenu_menuitem_property_exist (DbusmenuMenuitem * mi, const gchar * property)1155dbusmenu_menuitem_property_exist (DbusmenuMenuitem * mi, const gchar * property)
1156{1156{
@@ -1165,12 +1165,12 @@
1165}1165}
11661166
1167/**1167/**
1168 dbusmenu_menuitem_property_remove:1168 * dbusmenu_menuitem_property_remove:
1169 @mi: The #DbusmenuMenuitem to remove the property on.1169 * @mi: The #DbusmenuMenuitem to remove the property on.
1170 @property: The property to look for.1170 * @property: The property to look for.
11711171 *
1172 Removes a property from the menuitem.1172 * Removes a property from the menuitem.
1173*/1173 */
1174void1174void
1175dbusmenu_menuitem_property_remove (DbusmenuMenuitem * mi, const gchar * property)1175dbusmenu_menuitem_property_remove (DbusmenuMenuitem * mi, const gchar * property)
1176{1176{
@@ -1185,15 +1185,16 @@
1185}1185}
11861186
1187/**1187/**
1188 dbusmenu_menuitem_properties_list:1188 * dbusmenu_menuitem_properties_list:
1189 @mi: #DbusmenuMenuitem to list the properties on1189 * @mi: #DbusmenuMenuitem to list the properties on
11901190 *
1191 This functiong gets a list of the names of all the properties1191 * This functiong gets a list of the names of all the properties
1192 that are set on this menu item. This data on the list is owned1192 * that are set on this menu item. This data on the list is owned
1193 by the menuitem but the list is not and should be freed using1193 * by the menuitem but the list is not and should be freed using
1194 g_list_free() when the calling function is done with it.1194 * g_list_free() when the calling function is done with it.
11951195 *
1196 Return value: A list of strings or NULL if there are none.1196 * Return value: (transfer container): A list of strings or NULL if there are
1197 * none.
1197*/1198*/
1198GList *1199GList *
1199dbusmenu_menuitem_properties_list (DbusmenuMenuitem * mi)1200dbusmenu_menuitem_properties_list (DbusmenuMenuitem * mi)
@@ -1219,18 +1220,18 @@
1219}1220}
12201221
1221/**1222/**
1222 dbusmenu_menuitem_properties_copy:1223 * dbusmenu_menuitem_properties_copy:
1223 @mi: #DbusmenuMenuitem that we're interested in the properties of1224 * @mi: #DbusmenuMenuitem that we're interested in the properties of
12241225 *
1225 This function takes the properties of a #DbusmenuMenuitem1226 * This function takes the properties of a #DbusmenuMenuitem
1226 and puts them into a #GHashTable that is referenced by the1227 * and puts them into a #GHashTable that is referenced by the
1227 key of a string and has the value of a string. The hash1228 * key of a string and has the value of a string. The hash
1228 table may not have any entries if there aren't any or there1229 * table may not have any entries if there aren't any or there
1229 is an error in processing. It is the caller's responsibility1230 * is an error in processing. It is the caller's responsibility
1230 to destroy the created #GHashTable.1231 * to destroy the created #GHashTable.
12311232 *
1232 Return value: A brand new #GHashTable that contains all of the1233 * Return value: (transfer full): A brand new #GHashTable that contains all of
1233 properties that are on this #DbusmenuMenuitem @mi.1234 * theroperties that are on this #DbusmenuMenuitem @mi.
1234*/1235*/
1235GHashTable *1236GHashTable *
1236dbusmenu_menuitem_properties_copy (DbusmenuMenuitem * mi)1237dbusmenu_menuitem_properties_copy (DbusmenuMenuitem * mi)
@@ -1257,14 +1258,14 @@
1257}1258}
12581259
1259/**1260/**
1260 dbusmenu_menuitem_properties_variant:1261 * dbusmenu_menuitem_properties_variant:
1261 @mi: #DbusmenuMenuitem to get properties from1262 * @mi: #DbusmenuMenuitem to get properties from
12621263 *
1263 Grabs the properties of the menuitem as a GVariant with the1264 * Grabs the properties of the menuitem as a GVariant with the
1264 type "a{sv}".1265 * type "a{sv}".
12651266 *
1266 Return Value: A GVariant of type "a{sv}" or NULL on error.1267 * Return Value: (transfer full): A GVariant of type "a{sv}" or NULL on error.
1267*/1268 */
1268GVariant *1269GVariant *
1269dbusmenu_menuitem_properties_variant (DbusmenuMenuitem * mi, const gchar ** properties)1270dbusmenu_menuitem_properties_variant (DbusmenuMenuitem * mi, const gchar ** properties)
1270{1271{
@@ -1287,15 +1288,15 @@
1287}1288}
12881289
1289/**1290/**
1290 dbusmenu_menuitem_set_root:1291 * dbusmenu_menuitem_set_root:
1291 @mi: #DbusmenuMenuitem to set whether it's root1292 * @mi: #DbusmenuMenuitem to set whether it's root
1292 @root: Whether @mi is a root node or not1293 * @root: Whether @mi is a root node or not
12931294 *
1294 This function sets the internal value of whether this is a1295 * This function sets the internal value of whether this is a
1295 root node or not.1296 * root node or not.
12961297 *
1297 Return value: None1298 * Return value: None
1298*/1299 */
1299void1300void
1300dbusmenu_menuitem_set_root (DbusmenuMenuitem * mi, gboolean root)1301dbusmenu_menuitem_set_root (DbusmenuMenuitem * mi, gboolean root)
1301{1302{
@@ -1306,14 +1307,14 @@
1306}1307}
13071308
1308/**1309/**
1309 dbusmenu_menuitem_get_root:1310 * dbusmenu_menuitem_get_root:
1310 @mi: #DbusmenuMenuitem to see whether it's root1311 * @mi: #DbusmenuMenuitem to see whether it's root
13111312 *
1312 This function returns the internal value of whether this is a1313 * This function returns the internal value of whether this is a
1313 root node or not.1314 * root node or not.
13141315 *
1315 Return value: #TRUE if this is a root node1316 * Return value: #TRUE if this is a root node
1316*/1317 */
1317gboolean1318gboolean
1318dbusmenu_menuitem_get_root (DbusmenuMenuitem * mi)1319dbusmenu_menuitem_get_root (DbusmenuMenuitem * mi)
1319{1320{
@@ -1324,15 +1325,17 @@
13241325
13251326
1326/**1327/**
1327 dbusmenu_menuitem_buildvariant:1328 * dbusmenu_menuitem_buildvariant:
1328 @mi: #DbusmenuMenuitem to represent in XML1329 * @mi: #DbusmenuMenuitem to represent in a variant
1329 @array: (element-type utf8): A list of string that will be turned into an XML file1330 * @properties: (element-type utf8): A list of string that will be put into
13301331 * a variant
1331 This function will add strings to the array @array. It will put1332 *
1332 at least one entry if this menu item has no children. If it has1333 * This function will put at least one entry if this menu item has no children.
1333 children it will put two for this entry, one representing the1334 * If it has children it will put two for this entry, one representing the
1334 start tag and one that is a closing tag. It will allow it's1335 * start tag and one that is a closing tag. It will allow it's
1335 children to place their own tags in the array in between those two.1336 * children to place their own tags in the array in between those two.
1337 *
1338 * Return value: (transfer full): Variant representing @properties
1336*/1339*/
1337GVariant *1340GVariant *
1338dbusmenu_menuitem_build_variant (DbusmenuMenuitem * mi, const gchar ** properties, gint recurse)1341dbusmenu_menuitem_build_variant (DbusmenuMenuitem * mi, const gchar ** properties, gint recurse)
@@ -1393,15 +1396,15 @@
1393}1396}
13941397
1395/**1398/**
1396 dbusmenu_menuitem_foreach:1399 * dbusmenu_menuitem_foreach:
1397 @mi: The #DbusmenItem to start from1400 * @mi: The #DbusmenItem to start from
1398 @func: Function to call on every node in the tree1401 * @func: Function to call on every node in the tree
1399 @data: (closure): User data to pass to the function1402 * @data: (closure): User data to pass to the function
14001403 *
1401 This calls the function @func on this menu item and all1404 * This calls the function @func on this menu item and all
1402 of the children of this item. And their children. And1405 * of the children of this item. And their children. And
1403 their children. And... you get the point. It will get1406 * their children. And... you get the point. It will get
1404 called on the whole tree.1407 * called on the whole tree.
1405*/1408*/
1406void1409void
1407dbusmenu_menuitem_foreach (DbusmenuMenuitem * mi, void (*func) (DbusmenuMenuitem * mi, gpointer data), gpointer data)1410dbusmenu_menuitem_foreach (DbusmenuMenuitem * mi, void (*func) (DbusmenuMenuitem * mi, gpointer data), gpointer data)
@@ -1417,23 +1420,23 @@
1417}1420}
14181421
1419/**1422/**
1420 dbusmenu_menuitem_handle_event:1423 * dbusmenu_menuitem_handle_event:
1421 @mi: The #DbusmenuMenuitem to send the signal on.1424 * @mi: The #DbusmenuMenuitem to send the signal on.
1422 @name: The name of the signal1425 * @name: The name of the signal
1423 @variant: A value that could be set for the event1426 * @variant: A value that could be set for the event
1424 @timestamp: The timestamp of when the event happened1427 * @timestamp: The timestamp of when the event happened
14251428 *
1426 This function is called to create an event. It is likely1429 * This function is called to create an event. It is likely
1427 to be overrided by subclasses. The default menu item1430 * to be overrided by subclasses. The default menu item
1428 will respond to the activate signal and do:1431 * will respond to the activate signal and do:
14291432 *
1430 Emits the #DbusmenuMenuitem::item-activate signal on this1433 * Emits the #DbusmenuMenuitem::item-activate signal on this
1431 menu item. Called by server objects when they get the1434 * menu item. Called by server objects when they get the
1432 appropriate DBus signals from the client.1435 * appropriate DBus signals from the client.
14331436 *
1434 If you subclass this function you should really think1437 * If you subclass this function you should really think
1435 about calling the parent function unless you have a good1438 * about calling the parent function unless you have a good
1436 reason not to.1439 * reason not to.
1437*/1440*/
1438void1441void
1439dbusmenu_menuitem_handle_event (DbusmenuMenuitem * mi, const gchar * name, GVariant * variant, guint timestamp)1442dbusmenu_menuitem_handle_event (DbusmenuMenuitem * mi, const gchar * name, GVariant * variant, guint timestamp)
@@ -1451,16 +1454,16 @@
1451}1454}
14521455
1453/**1456/**
1454 dbusmenu_menuitem_send_about_to_show:1457 * dbusmenu_menuitem_send_about_to_show:
1455 @mi: The #DbusmenuMenuitem to send the signal on.1458 * @mi: The #DbusmenuMenuitem to send the signal on.
1456 @cb: Callback to call when the call has returned.1459 * @cb: Callback to call when the call has returned.
1457 @cb_data: (closure): Data to pass to the callback.1460 * @cb_data: (closure): Data to pass to the callback.
14581461 *
1459 This function is used to send the even that the submenu1462 * This function is used to send the even that the submenu
1460 of this item is about to be shown. Callers to this event1463 * of this item is about to be shown. Callers to this event
1461 should delay showing the menu until their callback is1464 * should delay showing the menu until their callback is
1462 called if possible.1465 * called if possible.
1463*/1466 */
1464void1467void
1465dbusmenu_menuitem_send_about_to_show (DbusmenuMenuitem * mi, void (*cb) (DbusmenuMenuitem * mi, gpointer user_data), gpointer cb_data)1468dbusmenu_menuitem_send_about_to_show (DbusmenuMenuitem * mi, void (*cb) (DbusmenuMenuitem * mi, gpointer user_data), gpointer cb_data)
1466{1469{
@@ -1480,14 +1483,14 @@
1480}1483}
14811484
1482/**1485/**
1483 dbusmenu_menuitem_show_to_user:1486 * dbusmenu_menuitem_show_to_user:
1484 @mi: #DbusmenuMenuitem to show1487 * @mi: #DbusmenuMenuitem to show
1485 @timestamp: The time that the user requested it to be shown1488 * @timestamp: The time that the user requested it to be shown
14861489 *
1487 Signals that this menu item should be shown to the user. If this is1490 * Signals that this menu item should be shown to the user. If this is
1488 server side the server will then take it and send it over the1491 * server side the server will then take it and send it over the
1489 bus.1492 * bus.
1490*/1493 */
1491void1494void
1492dbusmenu_menuitem_show_to_user (DbusmenuMenuitem * mi, guint timestamp)1495dbusmenu_menuitem_show_to_user (DbusmenuMenuitem * mi, guint timestamp)
1493{1496{
14941497
=== modified file 'libdbusmenu-glib/menuitem.h'
--- libdbusmenu-glib/menuitem.h 2011-02-14 20:43:27 +0000
+++ libdbusmenu-glib/menuitem.h 2011-02-21 13:11:23 +0000
@@ -157,7 +157,7 @@
157157
158 /* Virtual functions */158 /* Virtual functions */
159 dbusmenu_menuitem_buildvariant_slot_t buildvariant;159 dbusmenu_menuitem_buildvariant_slot_t buildvariant;
160 void (*handle_event) (DbusmenuMenuitem * mi, const gchar * name, GVariant * value, guint timestamp);160 void (*handle_event) (DbusmenuMenuitem * mi, const gchar * name, GVariant * variant, guint timestamp);
161 void (*send_about_to_show) (DbusmenuMenuitem * mi, void (*cb) (DbusmenuMenuitem * mi, gpointer user_data), gpointer cb_data);161 void (*send_about_to_show) (DbusmenuMenuitem * mi, void (*cb) (DbusmenuMenuitem * mi, gpointer user_data), gpointer cb_data);
162162
163 void (*show_to_user) (DbusmenuMenuitem * mi, guint timestamp, gpointer cb_data);163 void (*show_to_user) (DbusmenuMenuitem * mi, guint timestamp, gpointer cb_data);
@@ -208,7 +208,7 @@
208gboolean dbusmenu_menuitem_get_root (DbusmenuMenuitem * mi);208gboolean dbusmenu_menuitem_get_root (DbusmenuMenuitem * mi);
209209
210void dbusmenu_menuitem_foreach (DbusmenuMenuitem * mi, void (*func) (DbusmenuMenuitem * mi, gpointer data), gpointer data);210void dbusmenu_menuitem_foreach (DbusmenuMenuitem * mi, void (*func) (DbusmenuMenuitem * mi, gpointer data), gpointer data);
211void dbusmenu_menuitem_handle_event (DbusmenuMenuitem * mi, const gchar * name, GVariant * value, guint timestamp);211void dbusmenu_menuitem_handle_event (DbusmenuMenuitem * mi, const gchar * name, GVariant * variant, guint timestamp);
212void dbusmenu_menuitem_send_about_to_show (DbusmenuMenuitem * mi, void (*cb) (DbusmenuMenuitem * mi, gpointer user_data), gpointer cb_data);212void dbusmenu_menuitem_send_about_to_show (DbusmenuMenuitem * mi, void (*cb) (DbusmenuMenuitem * mi, gpointer user_data), gpointer cb_data);
213213
214void dbusmenu_menuitem_show_to_user (DbusmenuMenuitem * mi, guint timestamp);214void dbusmenu_menuitem_show_to_user (DbusmenuMenuitem * mi, guint timestamp);
215215
=== modified file 'libdbusmenu-gtk/Makefile.am'
--- libdbusmenu-gtk/Makefile.am 2011-02-09 17:45:41 +0000
+++ libdbusmenu-gtk/Makefile.am 2011-02-21 13:11:23 +0000
@@ -78,21 +78,21 @@
78INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) \78INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) \
79 --warn-all \79 --warn-all \
80 --add-include-path=$(top_builddir)/libdbusmenu-glib \80 --add-include-path=$(top_builddir)/libdbusmenu-glib \
81 $(addprefix --c-include=libdbusmenu-gtk/, $(introspection_sources)) \81 $(addprefix --c-include=libdbusmenu-gtk/, $(libdbusmenu_gtkinclude_HEADERS)) \
82 --symbol-prefix=dbusmenu \82 --symbol-prefix=dbusmenu \
83 --identifier-prefix=DbusmenuGtk83 --identifier-prefix=DbusmenuGtk
84else84else
85INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) \85INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) \
86 --warn-all \86 --warn-all \
87 --add-include-path=$(top_builddir)/libdbusmenu-glib \87 --add-include-path=$(top_builddir)/libdbusmenu-glib \
88 $(addprefix --c-include=libdbusmenu-gtk/, $(introspection_sources))88 $(addprefix --c-include=libdbusmenu-gtk/, $(libdbusmenu_gtkinclude_HEADERS))
89endif89endif
9090
91INTROSPECTION_COMPILER_ARGS = --includedir=$(builddir) --includedir=$(top_builddir)/libdbusmenu-glib91INTROSPECTION_COMPILER_ARGS = --includedir=$(builddir) --includedir=$(top_builddir)/libdbusmenu-glib
9292
93if HAVE_INTROSPECTION93if HAVE_INTROSPECTION
9494
95introspection_sources = $(libdbusmenu_gtkinclude_HEADERS)95introspection_sources = $(filter-out genericmenuitem.%, $(libdbusmenu_gtkinclude_HEADERS) $(libdbusmenu_gtk_la_SOURCES))
9696
97DbusmenuGtk$(VER)-0.4.gir: libdbusmenu-gtk$(VER).la97DbusmenuGtk$(VER)-0.4.gir: libdbusmenu-gtk$(VER).la
98DbusmenuGtk_0_4_gir_INCLUDES = \98DbusmenuGtk_0_4_gir_INCLUDES = \
9999
=== modified file 'libdbusmenu-gtk/client.c'
--- libdbusmenu-gtk/client.c 2011-01-27 19:49:40 +0000
+++ libdbusmenu-gtk/client.c 2011-02-21 13:11:23 +0000
@@ -219,13 +219,13 @@
219219
220220
221/**221/**
222 dbusmenu_gtkclient_set_accel_group:222 * dbusmenu_gtkclient_set_accel_group:
223 @client: To set the group on223 * @client: To set the group on
224 @agroup: The new acceleration group224 * @agroup: The new acceleration group
225225 *
226 Sets the acceleration group for the menu items with accelerators226 * Sets the acceleration group for the menu items with accelerators
227 on this client.227 * on this client.
228*/228 */
229void229void
230dbusmenu_gtkclient_set_accel_group (DbusmenuGtkClient * client, GtkAccelGroup * agroup)230dbusmenu_gtkclient_set_accel_group (DbusmenuGtkClient * client, GtkAccelGroup * agroup)
231{231{
@@ -256,14 +256,14 @@
256}256}
257257
258/**258/**
259 dbusmenu_gtkclient_get_accel_group:259 * dbusmenu_gtkclient_get_accel_group:
260 @client: Client to query for an accelerator group260 * @client: Client to query for an accelerator group
261261 *
262 Gets the accel group for this client.262 * Gets the accel group for this client.
263263 *
264 Return value: Either a valid group or #NULL on error or264 * Return value: (transfer none): Either a valid group or #NULL on error or
265 none set.265 * none set.
266*/266 */
267GtkAccelGroup *267GtkAccelGroup *
268dbusmenu_gtkclient_get_accel_group (DbusmenuGtkClient * client)268dbusmenu_gtkclient_get_accel_group (DbusmenuGtkClient * client)
269{269{
@@ -493,21 +493,21 @@
493#endif493#endif
494494
495/**495/**
496 dbusmenu_gtkclient_newitem_base:496 * dbusmenu_gtkclient_newitem_base:
497 @client: The client handling everything on this connection497 * @client: The client handling everything on this connection
498 @item: The #DbusmenuMenuitem to attach the GTK-isms to498 * @item: The #DbusmenuMenuitem to attach the GTK-isms to
499 @gmi: A #GtkMenuItem representing the GTK world's view of this menuitem499 * @gmi: A #GtkMenuItem representing the GTK world's view of this menuitem
500 @parent: The parent #DbusmenuMenuitem500 * @parent: The parent #DbusmenuMenuitem
501501 *
502 This function provides some of the basic connectivity for being in502 * This function provides some of the basic connectivity for being in
503 the GTK world. Things like visibility and sensitivity of the item are503 * the GTK world. Things like visibility and sensitivity of the item are
504 handled here so that the subclasses don't have to. If you're building504 * handled here so that the subclasses don't have to. If you're building
505 your on GTK menu item you can use this function to apply those basic505 * your on GTK menu item you can use this function to apply those basic
506 attributes so that you don't have to deal with them either.506 * attributes so that you don't have to deal with them either.
507507 *
508 This also handles passing the "activate" signal back to the508 * This also handles passing the "activate" signal back to the
509 #DbusmenuMenuitem side of thing.509 * #DbusmenuMenuitem side of thing.
510*/510 */
511void511void
512dbusmenu_gtkclient_newitem_base (DbusmenuGtkClient * client, DbusmenuMenuitem * item, GtkMenuItem * gmi, DbusmenuMenuitem * parent)512dbusmenu_gtkclient_newitem_base (DbusmenuGtkClient * client, DbusmenuMenuitem * item, GtkMenuItem * gmi, DbusmenuMenuitem * parent)
513{513{
@@ -617,15 +617,15 @@
617/* Public API */617/* Public API */
618618
619/**619/**
620 dbusmenu_gtkclient_new:620 * dbusmenu_gtkclient_new:
621 @dbus_name: Name of the #DbusmenuServer on DBus621 * @dbus_name: Name of the #DbusmenuServer on DBus
622 @dbus_name: Name of the object on the #DbusmenuServer622 * @dbus_name: Name of the object on the #DbusmenuServer
623623 *
624 Creates a new #DbusmenuGtkClient object and creates a #DbusmenuClient624 * Creates a new #DbusmenuGtkClient object and creates a #DbusmenuClient
625 that connects across DBus to a #DbusmenuServer.625 * that connects across DBus to a #DbusmenuServer.
626626 *
627 Return value: A new #DbusmenuGtkClient sync'd with a server627 * Return value: A new #DbusmenuGtkClient sync'd with a server
628*/628 */
629DbusmenuGtkClient *629DbusmenuGtkClient *
630dbusmenu_gtkclient_new (gchar * dbus_name, gchar * dbus_object)630dbusmenu_gtkclient_new (gchar * dbus_name, gchar * dbus_object)
631{631{
@@ -636,15 +636,15 @@
636}636}
637637
638/**638/**
639 dbusmenu_gtkclient_menuitem_get:639 * dbusmenu_gtkclient_menuitem_get:
640 @client: A #DbusmenuGtkClient with the item in it.640 * @client: A #DbusmenuGtkClient with the item in it.
641 @item: #DbusmenuMenuitem to get associated #GtkMenuItem on.641 * @item: #DbusmenuMenuitem to get associated #GtkMenuItem on.
642642 *
643 This grabs the #GtkMenuItem that is associated with the643 * This grabs the #GtkMenuItem that is associated with the
644 #DbusmenuMenuitem.644 * #DbusmenuMenuitem.
645645 *
646 Return value: The #GtkMenuItem that can be played with.646 * Return value: (transfer none): The #GtkMenuItem that can be played with.
647*/647 */
648GtkMenuItem *648GtkMenuItem *
649dbusmenu_gtkclient_menuitem_get (DbusmenuGtkClient * client, DbusmenuMenuitem * item)649dbusmenu_gtkclient_menuitem_get (DbusmenuGtkClient * client, DbusmenuMenuitem * item)
650{650{
@@ -660,13 +660,13 @@
660}660}
661661
662/**662/**
663 dbusmenu_gtkclient_menuitem_get_submenu:663 * dbusmenu_gtkclient_menuitem_get_submenu:
664 @client: A #DbusmenuGtkClient with the item in it.664 * @client: A #DbusmenuGtkClient with the item in it.
665 @item: #DbusmenuMenuitem to get associated #GtkMenu on.665 * @item: #DbusmenuMenuitem to get associated #GtkMenu on.
666666 *
667 This grabs the submenu associated with the menuitem.667 * This grabs the submenu associated with the menuitem.
668668 *
669 Return value: The #GtkMenu if there is one.669 * Return value: (transfer none): The #GtkMenu if there is one.
670*/670*/
671GtkMenu *671GtkMenu *
672dbusmenu_gtkclient_menuitem_get_submenu (DbusmenuGtkClient * client, DbusmenuMenuitem * item)672dbusmenu_gtkclient_menuitem_get_submenu (DbusmenuGtkClient * client, DbusmenuMenuitem * item)
673673
=== modified file 'libdbusmenu-gtk/genericmenuitem.c'
--- libdbusmenu-gtk/genericmenuitem.c 2010-12-09 22:50:02 +0000
+++ libdbusmenu-gtk/genericmenuitem.c 2011-02-21 13:11:23 +0000
@@ -278,12 +278,12 @@
278}278}
279279
280/**280/**
281 genericmenuitem_set_check_type:281 * genericmenuitem_set_check_type:
282 @item: #Genericmenuitem to set the type on282 * @item: #Genericmenuitem to set the type on
283 @check_type: Which type of check should be displayed283 * @check_type: Which type of check should be displayed
284284 *
285 This function changes the type of the checkmark that285 * This function changes the type of the checkmark that
286 appears in the left hand gutter for the menuitem.286 * appears in the left hand gutter for the menuitem.
287*/287*/
288void288void
289genericmenuitem_set_check_type (Genericmenuitem * item, GenericmenuitemCheckType check_type)289genericmenuitem_set_check_type (Genericmenuitem * item, GenericmenuitemCheckType check_type)
@@ -317,14 +317,14 @@
317}317}
318318
319/**319/**
320 genericmenuitem_set_state:320 * genericmenuitem_set_state:
321 @item: #Genericmenuitem to set the type on321 * @item: #Genericmenuitem to set the type on
322 @check_type: What is the state of the check 322 * @check_type: What is the state of the check
323323 *
324 Sets the state of the check in the menu item. It does324 * Sets the state of the check in the menu item. It does
325 not require, but isn't really useful if the type of325 * not require, but isn't really useful if the type of
326 check that the menuitem is set to #GENERICMENUITEM_CHECK_TYPE_NONE.326 * check that the menuitem is set to #GENERICMENUITEM_CHECK_TYPE_NONE.
327*/327 */
328void328void
329genericmenuitem_set_state (Genericmenuitem * item, GenericmenuitemState state)329genericmenuitem_set_state (Genericmenuitem * item, GenericmenuitemState state)
330{330{
@@ -377,11 +377,11 @@
377}377}
378378
379/**379/**
380 genericmenuitem_set_image:380 * genericmenuitem_set_image:
381 @item: A #Genericmenuitem381 * @item: A #Genericmenuitem
382 @image: The image to set as the image of @item382 * @image: The image to set as the image of @item
383383 *
384 Sets the image of the menu item.384 * Sets the image of the menu item.
385*/385*/
386void386void
387genericmenuitem_set_image (Genericmenuitem * menu_item, GtkWidget * image)387genericmenuitem_set_image (Genericmenuitem * menu_item, GtkWidget * image)
@@ -439,13 +439,13 @@
439}439}
440440
441/**441/**
442 genericmenuitem_get_image:442 * genericmenuitem_get_image:
443 @item: A #Genericmenuitem443 * @item: A #Genericmenuitem
444444 *
445 Returns the image if there is one.445 * Returns the image if there is one.
446446 *
447 Return value: A pointer to the image of the item or #NULL447 * Return value: (transfer none): A pointer to the image of the item or #NULL
448 if there isn't one.448 * if there isn't one.
449*/449*/
450GtkWidget *450GtkWidget *
451genericmenuitem_get_image (Genericmenuitem * menu_item)451genericmenuitem_get_image (Genericmenuitem * menu_item)
452452
=== modified file 'libdbusmenu-gtk/menu.c'
--- libdbusmenu-gtk/menu.c 2011-01-31 16:12:20 +0000
+++ libdbusmenu-gtk/menu.c 2011-02-21 13:11:23 +0000
@@ -398,15 +398,15 @@
398/* Public API */398/* Public API */
399399
400/**400/**
401 dbusmenu_gtkmenu_new:401 * dbusmenu_gtkmenu_new:
402 @dbus_name: Name of the #DbusmenuServer on DBus402 * @dbus_name: Name of the #DbusmenuServer on DBus
403 @dbus_name: Name of the object on the #DbusmenuServer403 * @dbus_object: Name of the object on the #DbusmenuServer
404404 *
405 Creates a new #DbusmenuGtkMenu object and creates a #DbusmenuClient405 * Creates a new #DbusmenuGtkMenu object and creates a #DbusmenuClient
406 that connects across DBus to a #DbusmenuServer.406 * that connects across DBus to a #DbusmenuServer.
407407 *
408 Return value: A new #DbusmenuGtkMenu sync'd with a server408 * Return value: A new #DbusmenuGtkMenu sync'd with a server
409*/409 */
410DbusmenuGtkMenu *410DbusmenuGtkMenu *
411dbusmenu_gtkmenu_new (gchar * dbus_name, gchar * dbus_object)411dbusmenu_gtkmenu_new (gchar * dbus_name, gchar * dbus_object)
412{412{
@@ -417,14 +417,14 @@
417}417}
418418
419/**419/**
420 dbusmenu_gtkmenu_get_client:420 * dbusmenu_gtkmenu_get_client:
421 @menu: The #DbusmenuGtkMenu to get the client from421 * @menu: The #DbusmenuGtkMenu to get the client from
422422 *
423 An accessor for the client that this menu is using to423 * An accessor for the client that this menu is using to
424 communicate with the server.424 * communicate with the server.
425425 *
426 Return value: A valid #DbusmenuGtkClient or NULL on error.426 * Return value: (transfer none): A valid #DbusmenuGtkClient or NULL on error.
427*/427 */
428DbusmenuGtkClient *428DbusmenuGtkClient *
429dbusmenu_gtkmenu_get_client (DbusmenuGtkMenu * menu)429dbusmenu_gtkmenu_get_client (DbusmenuGtkMenu * menu)
430{430{
431431
=== modified file 'libdbusmenu-gtk/menuitem.c'
--- libdbusmenu-gtk/menuitem.c 2010-12-02 02:13:48 +0000
+++ libdbusmenu-gtk/menuitem.c 2011-02-21 13:11:23 +0000
@@ -31,17 +31,17 @@
31#include <gtk/gtk.h>31#include <gtk/gtk.h>
3232
33/**33/**
34 dbusmenu_menuitem_property_set_image:34 * dbusmenu_menuitem_property_set_image:
35 @menuitem: The #DbusmenuMenuitem to set the property on.35 * @menuitem: The #DbusmenuMenuitem to set the property on.
36 @property: Name of the property to set.36 * @property: Name of the property to set.
37 @data: The image to place on the property.37 * @data: The image to place on the property.
3838 *
39 This function takes the pixbuf that is stored in @data and39 * This function takes the pixbuf that is stored in @data and
40 turns it into a base64 encoded PNG so that it can be placed40 * turns it into a base64 encoded PNG so that it can be placed
41 onto a standard #DbusmenuMenuitem property.41 * onto a standard #DbusmenuMenuitem property.
4242 *
43 Return value: Whether the function was able to set the property43 * Return value: Whether the function was able to set the property
44 or not.44 * or not.
45*/45*/
46gboolean46gboolean
47dbusmenu_menuitem_property_set_image (DbusmenuMenuitem * menuitem, const gchar * property, const GdkPixbuf * data)47dbusmenu_menuitem_property_set_image (DbusmenuMenuitem * menuitem, const gchar * property, const GdkPixbuf * data)
@@ -77,17 +77,17 @@
77}77}
7878
79/**79/**
80 dbusmenu_menuitem_property_get_image:80 * dbusmenu_menuitem_property_get_image:
81 @menuitem: The #DbusmenuMenuite to look for the property on81 * @menuitem: The #DbusmenuMenuite to look for the property on
82 @property: The name of the property to look for.82 * @property: The name of the property to look for.
8383 *
84 This function looks on the menu item for a property by the84 * This function looks on the menu item for a property by the
85 name of @property. If one exists it tries to turn it into85 * name of @property. If one exists it tries to turn it into
86 a #GdkPixbuf. It assumes that the property is a base64 encoded86 * a #GdkPixbuf. It assumes that the property is a base64 encoded
87 PNG file like the one created by #dbusmenu_menuite_property_set_image.87 * PNG file like the one created by #dbusmenu_menuite_property_set_image.
8888 *
89 Return value: A pixbuf or #NULL to signal error.89 * Return value: (transfer full): A pixbuf or #NULL to signal error.
90*/90 */
91GdkPixbuf *91GdkPixbuf *
92dbusmenu_menuitem_property_get_image (DbusmenuMenuitem * menuitem, const gchar * property)92dbusmenu_menuitem_property_get_image (DbusmenuMenuitem * menuitem, const gchar * property)
93{93{
@@ -131,16 +131,16 @@
131}131}
132132
133/**133/**
134 dbusmenu_menuitem_property_set_shortcut_string:134 * dbusmenu_menuitem_property_set_shortcut_string:
135 @menuitem: The #DbusmenuMenuitem to set the shortcut on135 * @menuitem: The #DbusmenuMenuitem to set the shortcut on
136 @shortcut: String describing the shortcut136 * @shortcut: String describing the shortcut
137137 *
138 This function takes a GTK shortcut string as defined in138 * This function takes a GTK shortcut string as defined in
139 #gtk_accelerator_parse and turns that into the information139 * #gtk_accelerator_parse and turns that into the information
140 required to send it over DBusmenu.140 * required to send it over DBusmenu.
141141 *
142 Return value: Whether it was successful at setting the property.142 * Return value: Whether it was successful at setting the property.
143*/143 */
144gboolean144gboolean
145dbusmenu_menuitem_property_set_shortcut_string (DbusmenuMenuitem * menuitem, const gchar * shortcut)145dbusmenu_menuitem_property_set_shortcut_string (DbusmenuMenuitem * menuitem, const gchar * shortcut)
146{146{
@@ -161,16 +161,16 @@
161}161}
162162
163/**163/**
164 dbusmenu_menuitem_property_set_shortcut:164 * dbusmenu_menuitem_property_set_shortcut:
165 @menuitem: The #DbusmenuMenuitem to set the shortcut on165 * @menuitem: The #DbusmenuMenuitem to set the shortcut on
166 @key: The keycode of the key to send166 * @key: The keycode of the key to send
167 @modifier: A bitmask of modifiers used to activate the item167 * @modifier: A bitmask of modifiers used to activate the item
168168 *
169 Takes the modifer described by @key and @modifier and places that into169 * Takes the modifer described by @key and @modifier and places that into
170 the format sending across Dbus for shortcuts.170 * the format sending across Dbus for shortcuts.
171171 *
172 Return value: Whether it was successful at setting the property.172 * Return value: Whether it was successful at setting the property.
173*/173 */
174gboolean174gboolean
175dbusmenu_menuitem_property_set_shortcut (DbusmenuMenuitem * menuitem, guint key, GdkModifierType modifier)175dbusmenu_menuitem_property_set_shortcut (DbusmenuMenuitem * menuitem, guint key, GdkModifierType modifier)
176{176{
@@ -213,16 +213,16 @@
213}213}
214214
215/**215/**
216 dbusmenu_menuitem_property_set_shortcut_menuitem:216 * dbusmenu_menuitem_property_set_shortcut_menuitem:
217 @menuitem: The #DbusmenuMenuitem to set the shortcut on217 * @menuitem: The #DbusmenuMenuitem to set the shortcut on
218 @gmi: A menu item to steal the shortcut off of218 * @gmi: A menu item to steal the shortcut off of
219219 *
220 Takes the shortcut that is installed on a menu item and calls220 * Takes the shortcut that is installed on a menu item and calls
221 #dbusmenu_menuitem_property_set_shortcut with it. It also sets221 * #dbusmenu_menuitem_property_set_shortcut with it. It also sets
222 up listeners to watch it change.222 * up listeners to watch it change.
223223 *
224 Return value: Whether it was successful at setting the property.224 * Return value: Whether it was successful at setting the property.
225*/225 */
226gboolean226gboolean
227dbusmenu_menuitem_property_set_shortcut_menuitem (DbusmenuMenuitem * menuitem, const GtkMenuItem * gmi)227dbusmenu_menuitem_property_set_shortcut_menuitem (DbusmenuMenuitem * menuitem, const GtkMenuItem * gmi)
228{228{
@@ -260,14 +260,14 @@
260}260}
261261
262/**262/**
263 dbusmenu_menuitem_property_get_shortcut:263 * dbusmenu_menuitem_property_get_shortcut:
264 @menuitem: The #DbusmenuMenuitem to get the shortcut off264 * @menuitem: The #DbusmenuMenuitem to get the shortcut off
265 @key: Location to put the key value265 * @key: (out): Location to put the key value
266 @modifier: Location to put the modifier mask266 * @modifier: (out): Location to put the modifier mask
267267 *
268 This function gets a GTK shortcut as a key and a mask268 * This function gets a GTK shortcut as a key and a mask
269 for use to set the accelerators.269 * for use to set the accelerators.
270*/270 */
271void271void
272dbusmenu_menuitem_property_get_shortcut (DbusmenuMenuitem * menuitem, guint * key, GdkModifierType * modifier)272dbusmenu_menuitem_property_get_shortcut (DbusmenuMenuitem * menuitem, guint * key, GdkModifierType * modifier)
273{273{
274274
=== modified file 'libdbusmenu-gtk/menuitem.h'
--- libdbusmenu-gtk/menuitem.h 2011-01-21 22:48:41 +0000
+++ libdbusmenu-gtk/menuitem.h 2011-02-21 13:11:23 +0000
@@ -43,7 +43,7 @@
43gboolean dbusmenu_menuitem_property_set_shortcut (DbusmenuMenuitem * menuitem, guint key, GdkModifierType modifier);43gboolean dbusmenu_menuitem_property_set_shortcut (DbusmenuMenuitem * menuitem, guint key, GdkModifierType modifier);
44gboolean dbusmenu_menuitem_property_set_shortcut_string (DbusmenuMenuitem * menuitem, const gchar * shortcut);44gboolean dbusmenu_menuitem_property_set_shortcut_string (DbusmenuMenuitem * menuitem, const gchar * shortcut);
45gboolean dbusmenu_menuitem_property_set_shortcut_menuitem (DbusmenuMenuitem * menuitem, const GtkMenuItem * gmi);45gboolean dbusmenu_menuitem_property_set_shortcut_menuitem (DbusmenuMenuitem * menuitem, const GtkMenuItem * gmi);
46void dbusmenu_menuitem_property_get_shortcut (DbusmenuMenuitem * menuitem, guint * key, GdkModifierType * modifiers);46void dbusmenu_menuitem_property_get_shortcut (DbusmenuMenuitem * menuitem, guint * key, GdkModifierType * modifier);
4747
48G_END_DECLS48G_END_DECLS
4949
5050
=== modified file 'libdbusmenu-gtk/parser.c'
--- libdbusmenu-gtk/parser.c 2011-02-17 12:48:27 +0000
+++ libdbusmenu-gtk/parser.c 2011-02-21 13:11:23 +0000
@@ -85,16 +85,16 @@
85 gpointer data);85 gpointer data);
8686
87/**87/**
88 dbusmenu_gtk_parse_menu_structure:88 * dbusmenu_gtk_parse_menu_structure:
89 @widget: A #GtkMenuItem or #GtkMenuShell to turn into a #DbusmenuMenuitem89 * @widget: A #GtkMenuItem or #GtkMenuShell to turn into a #DbusmenuMenuitem
9090 *
91 Goes through the GTK structures and turns them into the appropraite91 * Goes through the GTK structures and turns them into the appropraite
92 Dbusmenu structures along with setting up all the relationships92 * Dbusmenu structures along with setting up all the relationships
93 between the objects. It also stores the dbusmenu items as a cache93 * between the objects. It also stores the dbusmenu items as a cache
94 on the GTK items so that they'll be reused if necissary.94 * on the GTK items so that they'll be reused if necissary.
9595 *
96 Return value: A dbusmenu item representing the menu structure96 * Return value: (transfer none): A dbusmenu item representing the menu structure
97*/97 */
98DbusmenuMenuitem *98DbusmenuMenuitem *
99dbusmenu_gtk_parse_menu_structure (GtkWidget * widget)99dbusmenu_gtk_parse_menu_structure (GtkWidget * widget)
100{100{
101101
=== modified file 'libdbusmenu-gtk/serializablemenuitem.c'
--- libdbusmenu-gtk/serializablemenuitem.c 2011-01-27 15:28:44 +0000
+++ libdbusmenu-gtk/serializablemenuitem.c 2011-02-21 13:11:23 +0000
@@ -166,18 +166,18 @@
166}166}
167167
168/**168/**
169 dbusmenu_gtk_serializable_menu_item_build_menuitem:169 * dbusmenu_gtk_serializable_menu_item_build_menuitem:
170 @smi: #DbusmenuGtkSerializableMenuItem to build a #DbusmenuMenuitem mirroring170 * @smi: #DbusmenuGtkSerializableMenuItem to build a #DbusmenuMenuitem mirroring
171171 *
172 This function is for menu items that are instanciated from172 * This function is for menu items that are instanciated from
173 GTK and have their properites set using GTK functions. This173 * GTK and have their properites set using GTK functions. This
174 builds a #DbusmenuMenuitem that then has the properties that174 * builds a #DbusmenuMenuitem that then has the properties that
175 should be sent over the bus to create a new item of this175 * should be sent over the bus to create a new item of this
176 type on the other side.176 * type on the other side.
177177 *
178 Return value: (transfer full) A #DbusmenuMenuitem who's values will be178 * Return value: (transfer full): A #DbusmenuMenuitem who's values will be
179 set by this object.179 * set by this object.
180*/180 */
181DbusmenuMenuitem *181DbusmenuMenuitem *
182dbusmenu_gtk_serializable_menu_item_build_menuitem (DbusmenuGtkSerializableMenuItem * smi)182dbusmenu_gtk_serializable_menu_item_build_menuitem (DbusmenuGtkSerializableMenuItem * smi)
183{183{
@@ -225,15 +225,15 @@
225}225}
226226
227/**227/**
228 dbusmenu_gtk_serializable_menu_item_register_to_client:228 * dbusmenu_gtk_serializable_menu_item_register_to_client:
229 @client: #DbusmenuClient that we should register a type at.229 * @client: #DbusmenuClient that we should register a type at.
230 @item_type: The #GType of a class that is a subclass of #DbusmenuGtkSerializableMenuItem230 * @item_type: The #GType of a class that is a subclass of #DbusmenuGtkSerializableMenuItem
231231 *
232 Registers a generic handler for dealing with all subclasses of232 * Registers a generic handler for dealing with all subclasses of
233 #DbusmenuGtkSerializableMenuItem. This handler responds to the callback,233 * #DbusmenuGtkSerializableMenuItem. This handler responds to the callback,
234 creates a new object and attaches it to the appropriate #DbusmenuMenuitem234 * creates a new object and attaches it to the appropriate #DbusmenuMenuitem
235 object.235 * object.
236*/236 */
237void237void
238dbusmenu_gtk_serializable_menu_item_register_to_client (DbusmenuClient * client, GType item_type)238dbusmenu_gtk_serializable_menu_item_register_to_client (DbusmenuClient * client, GType item_type)
239{239{
@@ -265,16 +265,16 @@
265}265}
266266
267/**267/**
268 dbusmenu_gtk_serializable_menu_item_set_menuitem:268 * dbusmenu_gtk_serializable_menu_item_set_menuitem:
269 @smi: #DbusmenuGtkSerializableMenuItem to set the @DbusmenuGtkSerializableMenuItem::dbusmenu-menuitem of269 * @smi: #DbusmenuGtkSerializableMenuItem to set the @DbusmenuGtkSerializableMenuItem::dbusmenu-menuitem of
270 @mi: Menuitem to get the properties from270 * @mi: Menuitem to get the properties from
271271 *
272 This function is used on the server side to signal to the object272 * This function is used on the server side to signal to the object
273 that it should get its' property change events from @mi instead273 * that it should get its' property change events from @mi instead
274 of expecting calls to its' API. A call to this function sets the274 * of expecting calls to its' API. A call to this function sets the
275 property and subclasses should listen to the notify signal to275 * property and subclasses should listen to the notify signal to
276 pick up this property being set.276 * pick up this property being set.
277*/277 */
278void278void
279dbusmenu_gtk_serializable_menu_item_set_menuitem (DbusmenuGtkSerializableMenuItem * smi, DbusmenuMenuitem * mi)279dbusmenu_gtk_serializable_menu_item_set_menuitem (DbusmenuGtkSerializableMenuItem * smi, DbusmenuMenuitem * mi)
280{280{
281281
=== modified file 'tests/Makefile.am'
--- tests/Makefile.am 2011-02-15 21:06:42 +0000
+++ tests/Makefile.am 2011-02-21 13:11:23 +0000
@@ -16,9 +16,11 @@
16 test-gtk-objects-test \16 test-gtk-objects-test \
17 test-gtk-label \17 test-gtk-label \
18 test-gtk-shortcut \18 test-gtk-shortcut \
19 test-gtk-shortcut-python \
19 test-gtk-reorder \20 test-gtk-reorder \
20 test-gtk-submenu \21 test-gtk-submenu \
21 test-gtk-parser-test22 test-gtk-parser-test \
23 test-glib-simple-items.py
2224
23check_PROGRAMS = \25check_PROGRAMS = \
24 glib-server-nomenu \26 glib-server-nomenu \
@@ -49,6 +51,9 @@
4951
50XVFB_RUN=". $(srcdir)/run-xvfb.sh"52XVFB_RUN=". $(srcdir)/run-xvfb.sh"
5153
54# for the GI tests, prefer/use the typelibs from the local build tree
55TESTS_ENVIRONMENT = env GI_TYPELIB_PATH=$(top_builddir)/libdbusmenu-glib:$(top_builddir)/libdbusmenu-gtk:$(GI_TYPELIB_PATH)
56
52######################57######################
53# JSON Loader lib58# JSON Loader lib
54######################59######################
@@ -472,6 +477,12 @@
472 @echo $(DBUS_RUNNER) --task ./test-gtk-shortcut-client --task-name Client --task ./test-gtk-shortcut-server --task-name Server --ignore-return >> $@477 @echo $(DBUS_RUNNER) --task ./test-gtk-shortcut-client --task-name Client --task ./test-gtk-shortcut-server --task-name Server --ignore-return >> $@
473 @chmod +x $@478 @chmod +x $@
474479
480test-gtk-shortcut-python: test-gtk-shortcut-server Makefile.am
481 @echo "#!/bin/bash" > $@
482 @echo $(XVFB_RUN) >> $@
483 @echo $(DBUS_RUNNER) --task ./test-gtk-shortcut-client.py --task-name Client --task ./test-gtk-shortcut-server --task-name Server --ignore-return >> $@
484 @chmod +x $@
485
475test_gtk_shortcut_server_SOURCES = \486test_gtk_shortcut_server_SOURCES = \
476 test-gtk-shortcut-server.c487 test-gtk-shortcut-server.c
477488
@@ -629,5 +640,5 @@
629 -rm -rf $(builddir)/mago.results640 -rm -rf $(builddir)/mago.results
630641
631DISTCLEANFILES += \642DISTCLEANFILES += \
632 $(TESTS) 643 $(filter-out %.py, $(TESTS))
633644
634645
=== added file 'tests/test-glib-simple-items.py'
--- tests/test-glib-simple-items.py 1970-01-01 00:00:00 +0000
+++ tests/test-glib-simple-items.py 2011-02-21 13:11:23 +0000
@@ -0,0 +1,35 @@
1#!/usr/bin/python
2# This is the Python GI version of test-glib-simple-items.c
3
4import gobject
5from gi.repository import Dbusmenu
6
7dummies = ['Bob', 'Jim', 'Alvin', 'Mary']
8
9def dummy_users(root):
10 count = 0
11 for user in dummies:
12 mi = Dbusmenu.Menuitem()
13 print 'Creating item: %d %s' % (mi.get_id(), user)
14 print '\tRoot ID:', root.get_id()
15 mi.property_set('label', user)
16 root.child_add_position(mi, count)
17 assert mi.property_get('label') == user
18 count += 1
19
20def quititall(mainloop):
21 mainloop.quit()
22 return False
23
24# main
25
26server = Dbusmenu.Server.new('/test/object')
27root_menuitem = Dbusmenu.Menuitem()
28server.set_root(root_menuitem)
29print 'Root ID:', root_menuitem.get_id()
30
31dummy_users(root_menuitem)
32
33mainloop = gobject.MainLoop()
34gobject.timeout_add_seconds(1, quititall, mainloop)
35mainloop.run()
036
=== added file 'tests/test-gtk-shortcut-client.py'
--- tests/test-gtk-shortcut-client.py 1970-01-01 00:00:00 +0000
+++ tests/test-gtk-shortcut-client.py 2011-02-21 13:11:23 +0000
@@ -0,0 +1,52 @@
1#!/usr/bin/python
2
3# A test for libdbusmenu to ensure its quality. This is the Python GI version
4# of test-gtk-shortcut-client.c
5#
6# Copyright 2011 Canonical Ltd.
7# Authors:
8# Martin Pitt <martin.pitt@ubuntu.com>
9
10import sys
11import gobject
12from gi.repository import Gtk, DbusmenuGtk
13Gtk.require_version('2.0')
14
15passed = True
16main_loop = gobject.MainLoop()
17
18def timer_func(data):
19 passed = True
20 main_loop.quit()
21 return False
22
23# main
24print 'Building Window'
25window = Gtk.Window(type=Gtk.WindowType.TOPLEVEL)
26menubar = Gtk.MenuBar()
27menuitem = Gtk.MenuItem(label='Test')
28
29dmenu = DbusmenuGtk.Menu(dbus_name='glib.label.test', dbus_object='/org/test')
30dclient = dmenu.get_client()
31agroup = Gtk.AccelGroup()
32dclient.set_accel_group(agroup)
33
34menuitem.set_submenu(dmenu)
35menuitem.show()
36menubar.append(menuitem)
37menubar.show()
38window.add(menubar)
39window.set_title('libdbusmenu-gtk test')
40window.add_accel_group(agroup)
41window.show_all()
42
43gobject.timeout_add_seconds(10, timer_func, window)
44
45print 'Entering Mainloop'
46main_loop.run()
47
48if passed:
49 print 'Quiting'
50else:
51 print "Quiting as we're a failure"
52 sys.exit(1)

Subscribers

People subscribed via source and target branches