diff options
author | Sebastien Bacher <seb128@ubuntu.com> | 2010-08-26 23:35:01 +0200 |
---|---|---|
committer | Sebastien Bacher <seb128@ubuntu.com> | 2010-08-26 23:35:01 +0200 |
commit | b73234dae98ad8a921457858ff19079b8266d295 (patch) | |
tree | edaf13a853cadce20f972747a1ce0e1288af65a8 | |
parent | e8704dfe47c14af9c395449ad78fb3d8abd1b416 (diff) | |
parent | 411bc164d198eda669a4bf48de2510c80f94702d (diff) | |
download | libdbusmenu-b73234dae98ad8a921457858ff19079b8266d295.tar.gz libdbusmenu-b73234dae98ad8a921457858ff19079b8266d295.tar.bz2 libdbusmenu-b73234dae98ad8a921457858ff19079b8266d295.zip |
releasing version 0.3.12-0ubuntu1
30 files changed, 492 insertions, 60 deletions
@@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.67 for libdbusmenu 0.3.11. +# Generated by GNU Autoconf 2.67 for libdbusmenu 0.3.12. # # Report bugs to <ted@canonical.com>. # @@ -703,8 +703,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='libdbusmenu' PACKAGE_TARNAME='libdbusmenu' -PACKAGE_VERSION='0.3.11' -PACKAGE_STRING='libdbusmenu 0.3.11' +PACKAGE_VERSION='0.3.12' +PACKAGE_STRING='libdbusmenu 0.3.12' PACKAGE_BUGREPORT='ted@canonical.com' PACKAGE_URL='' @@ -1533,7 +1533,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libdbusmenu 0.3.11 to adapt to many kinds of systems. +\`configure' configures libdbusmenu 0.3.12 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1603,7 +1603,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libdbusmenu 0.3.11:";; + short | recursive ) echo "Configuration of libdbusmenu 0.3.12:";; esac cat <<\_ACEOF @@ -1741,7 +1741,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libdbusmenu configure 0.3.11 +libdbusmenu configure 0.3.12 generated by GNU Autoconf 2.67 Copyright (C) 2010 Free Software Foundation, Inc. @@ -2112,7 +2112,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libdbusmenu $as_me 0.3.11, which was +It was created by libdbusmenu $as_me 0.3.12, which was generated by GNU Autoconf 2.67. Invocation command line was $ $0 $@ @@ -2933,7 +2933,7 @@ fi # Define the identity of the package. PACKAGE=libdbusmenu - VERSION=0.3.11 + VERSION=0.3.12 # Some tools Automake needs. @@ -13065,7 +13065,7 @@ fi ########################### LIBDBUSMENU_CURRENT=1 -LIBDBUSMENU_REVISION=13 +LIBDBUSMENU_REVISION=14 LIBDBUSMENU_AGE=0 @@ -14379,7 +14379,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libdbusmenu $as_me 0.3.11, which was +This file was extended by libdbusmenu $as_me 0.3.12, which was generated by GNU Autoconf 2.67. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14445,7 +14445,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -libdbusmenu config.status 0.3.11 +libdbusmenu config.status 0.3.12 configured by $0, generated by GNU Autoconf 2.67, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index a5c8248..5ccf9c3 100644 --- a/configure.ac +++ b/configure.ac @@ -1,11 +1,11 @@ -AC_INIT(libdbusmenu, 0.3.11, ted@canonical.com) +AC_INIT(libdbusmenu, 0.3.12, ted@canonical.com) AC_COPYRIGHT([Copyright 2009,2010 Canonical]) AC_PREREQ(2.62) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(libdbusmenu, 0.3.11, [-Wno-portability]) +AM_INIT_AUTOMAKE(libdbusmenu, 0.3.12, [-Wno-portability]) AM_MAINTAINER_MODE @@ -99,7 +99,7 @@ AC_PATH_PROG([VALA_API_GEN], [vapigen]) ########################### LIBDBUSMENU_CURRENT=1 -LIBDBUSMENU_REVISION=13 +LIBDBUSMENU_REVISION=14 LIBDBUSMENU_AGE=0 AC_SUBST(LIBDBUSMENU_CURRENT) diff --git a/debian/changelog b/debian/changelog index 65d8354..8ac8ef1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,15 @@ +libdbusmenu (0.3.12-0ubuntu1) maverick; urgency=low + + * debian/rules: update the shlibs + + [ Ted Gould ] + * New upstream release. + * Support activation of menus client side + * Increase layout XML size (LP: #621238) + * Display an event for the status of the signal to the server + + -- Sebastien Bacher <seb128@ubuntu.com> Thu, 26 Aug 2010 23:34:45 +0200 + libdbusmenu (0.3.11-0ubuntu1) maverick; urgency=low * New upstream release. diff --git a/debian/rules b/debian/rules index e274757..496facc 100755 --- a/debian/rules +++ b/debian/rules @@ -6,6 +6,6 @@ include /usr/share/cdbs/1/class/gnome.mk DEB_CONFIGURE_EXTRA_FLAGS += --disable-scrollkeeper --enable-gtk-doc LDFLAGS += -Wl,-z,defs -Wl,--as-needed -DEB_DH_MAKESHLIBS_ARGS_libdbusmenu-gtk1 += -V 'libdbusmenu-gtk1 (>= 0.3.3)' -DEB_DH_MAKESHLIBS_ARGS_libdbusmenu-glib1 += -V 'libdbusmenu-glib1 (>= 0.3.3)' +DEB_DH_MAKESHLIBS_ARGS_libdbusmenu-gtk1 += -V 'libdbusmenu-gtk1 (>= 0.3.12)' +DEB_DH_MAKESHLIBS_ARGS_libdbusmenu-glib1 += -V 'libdbusmenu-glib1 (>= 0.3.12)' diff --git a/docs/libdbusmenu-glib/reference/html/ch01.html b/docs/libdbusmenu-glib/reference/html/ch01.html index f7ef0a5..5f81d45 100644 --- a/docs/libdbusmenu-glib/reference/html/ch01.html +++ b/docs/libdbusmenu-glib/reference/html/ch01.html @@ -21,7 +21,7 @@ </tr></table> <div class="chapter" title="API"> <div class="titlepage"><div><div><h2 class="title"> -<a name="id404092"></a>API</h2></div></div></div> +<a name="id579504"></a>API</h2></div></div></div> <div class="toc"><dl> <dt> <span class="refentrytitle"><a href="libdbusmenu-glib-DbusmenuServer.html">DbusmenuServer</a></span><span class="refpurpose"></span> diff --git a/docs/libdbusmenu-glib/reference/html/libdbusmenu-glib-DbusmenuClient.html b/docs/libdbusmenu-glib/reference/html/libdbusmenu-glib-DbusmenuClient.html index 3b91953..7d562fd 100644 --- a/docs/libdbusmenu-glib/reference/html/libdbusmenu-glib-DbusmenuClient.html +++ b/docs/libdbusmenu-glib/reference/html/libdbusmenu-glib-DbusmenuClient.html @@ -188,12 +188,13 @@ The client for a <a class="link" href="libdbusmenu-glib-DbusmenuServer.html#Dbus void (*layout_updated)(void); void (*root_changed) (DbusmenuMenuitem * newroot); void (*new_menuitem) (DbusmenuMenuitem * newitem); + void (*item_activate) (DbusmenuMenuitem * item, guint timestamp); /* Reserved for future use */ void (*reserved1) (void); void (*reserved2) (void); void (*reserved3) (void); - void (*reserved4) (void); + /* void (*reserved4) (void); */ } DbusmenuClientClass; </pre> <p> @@ -226,22 +227,22 @@ A simple class that takes all of the information from a </td> </tr> <tr> -<td><p><span class="term"><em class="structfield"><code><a name="DbusmenuClientClass.reserved1"></a>reserved1</code></em> ()</span></p></td> -<td>Reserved for future use. +<td><p><span class="term"><em class="structfield"><code><a name="DbusmenuClientClass.item-activate"></a>item_activate</code></em> ()</span></p></td> +<td>Slote for <span class="type">"item-activate"</span>. </td> </tr> <tr> -<td><p><span class="term"><em class="structfield"><code><a name="DbusmenuClientClass.reserved2"></a>reserved2</code></em> ()</span></p></td> +<td><p><span class="term"><em class="structfield"><code><a name="DbusmenuClientClass.reserved1"></a>reserved1</code></em> ()</span></p></td> <td>Reserved for future use. </td> </tr> <tr> -<td><p><span class="term"><em class="structfield"><code><a name="DbusmenuClientClass.reserved3"></a>reserved3</code></em> ()</span></p></td> +<td><p><span class="term"><em class="structfield"><code><a name="DbusmenuClientClass.reserved2"></a>reserved2</code></em> ()</span></p></td> <td>Reserved for future use. </td> </tr> <tr> -<td><p><span class="term"><em class="structfield"><code><a name="DbusmenuClientClass.reserved4"></a>reserved4</code></em> ()</span></p></td> +<td><p><span class="term"><em class="structfield"><code><a name="DbusmenuClientClass.reserved3"></a>reserved3</code></em> ()</span></p></td> <td>Reserved for future use. </td> </tr> @@ -457,6 +458,7 @@ This function connects into the type handling of the <a class="link" href="libdb <em class="parameter"><code>gpointer</code></em> user_data: <em class="parameter"><code>gpointer</code></em> user_data: <em class="parameter"><code>gpointer</code></em> user_data: +<em class="parameter"><code>gpointer</code></em> user_data: </td> </tr> <tr> diff --git a/docs/libdbusmenu-glib/reference/html/libdbusmenu-glib-DbusmenuMenuitem.html b/docs/libdbusmenu-glib/reference/html/libdbusmenu-glib-DbusmenuMenuitem.html index 9a234d1..8de8a14 100644 --- a/docs/libdbusmenu-glib/reference/html/libdbusmenu-glib-DbusmenuMenuitem.html +++ b/docs/libdbusmenu-glib/reference/html/libdbusmenu-glib-DbusmenuMenuitem.html @@ -435,7 +435,8 @@ as an XML fragment. Should call it's own children. void (*handle_event) (DbusmenuMenuitem * mi, const gchar * name, const GValue * value, guint timestamp); void (*send_about_to_show) (DbusmenuMenuitem * mi, dbusmenu_menuitem_about_to_show_cb cb, gpointer cb_data); - void (*reserved1) (void); + void (*show_to_user) (DbusmenuMenuitem * mi, guint timestamp, gpointer cb_data); + /* void (*reserved1) (void); */ /* void (*reserved2) (void); */ /* void (*reserved3) (void); */ /* void (*reserved4) (void); -- realized, realloc when bumping lib version */ @@ -495,8 +496,8 @@ as an XML fragment. Should call it's own children. </td> </tr> <tr> -<td><p><span class="term"><em class="structfield"><code><a name="DbusmenuMenuitemClass.reserved1"></a>reserved1</code></em> ()</span></p></td> -<td>Reserved for future use. +<td><p><span class="term"><em class="structfield"><code><a name="DbusmenuMenuitemClass.show-to-user"></a>show_to_user</code></em> ()</span></p></td> +<td>Slot for <span class="type">"show-to-user"</span>. </td> </tr> </tbody> diff --git a/docs/libdbusmenu-glib/reference/tmpl/client.sgml b/docs/libdbusmenu-glib/reference/tmpl/client.sgml index 6f61ddf..2766f35 100644 --- a/docs/libdbusmenu-glib/reference/tmpl/client.sgml +++ b/docs/libdbusmenu-glib/reference/tmpl/client.sgml @@ -92,10 +92,10 @@ DbusmenuClient @layout_updated: @root_changed: @new_menuitem: +@item_activate: @reserved1: @reserved2: @reserved3: -@reserved4: <!-- ##### USER_FUNCTION DbusmenuClientTypeHandler ##### --> <para> @@ -159,6 +159,7 @@ DbusmenuClient @id: @gpointer user_data: @gpointer user_data: +@gpointer user_data: @gpointer user_data: @cb_data: diff --git a/docs/libdbusmenu-glib/reference/tmpl/menuitem.sgml b/docs/libdbusmenu-glib/reference/tmpl/menuitem.sgml index 77b62de..e912225 100644 --- a/docs/libdbusmenu-glib/reference/tmpl/menuitem.sgml +++ b/docs/libdbusmenu-glib/reference/tmpl/menuitem.sgml @@ -221,7 +221,7 @@ DbusmenuMenuitem @buildxml: @handle_event: @send_about_to_show: -@reserved1: +@show_to_user: <!-- ##### FUNCTION dbusmenu_menuitem_new ##### --> <para> @@ -507,6 +507,7 @@ DbusmenuMenuitem @mi: @DbusmenuMenuitem * mi, gpointer data: @DbusmenuMenuitem * mi, gpointer data: +@DbusmenuMenuitem * mi, gpointer data: @DbusmenuMenuitem * mi, gpointer data: @data: diff --git a/docs/libdbusmenu-glib/reference/version.xml b/docs/libdbusmenu-glib/reference/version.xml index 2080591..0b9c019 100644 --- a/docs/libdbusmenu-glib/reference/version.xml +++ b/docs/libdbusmenu-glib/reference/version.xml @@ -1 +1 @@ -0.3.11 +0.3.12 diff --git a/docs/libdbusmenu-glib/reference/xml/client.xml b/docs/libdbusmenu-glib/reference/xml/client.xml index 528f4f8..e2757bb 100644 --- a/docs/libdbusmenu-glib/reference/xml/client.xml +++ b/docs/libdbusmenu-glib/reference/xml/client.xml @@ -160,12 +160,13 @@ The client for a <link linkend="DbusmenuServer"><type>DbusmenuServer</type></lin void (*layout_updated)(void); void (*root_changed) (DbusmenuMenuitem * newroot); void (*new_menuitem) (DbusmenuMenuitem * newitem); + void (*item_activate) (DbusmenuMenuitem * item, guint timestamp); /* Reserved for future use */ void (*reserved1) (void); void (*reserved2) (void); void (*reserved3) (void); - void (*reserved4) (void); + /* void (*reserved4) (void); */ } DbusmenuClientClass; </programlisting> <para> @@ -189,6 +190,10 @@ A simple class that takes all of the information from a <listitem><simpara>Slot for <link linkend="DbusmenuClient-new-menuitem"><type>"new-menuitem"</type></link>. </simpara></listitem> </varlistentry> +<varlistentry><term><structfield id="DbusmenuClientClass.item-activate">item_activate</structfield> ()</term> +<listitem><simpara>Slote for <link linkend="DbusmenuClient-item-activate"><type>"item-activate"</type></link>. +</simpara></listitem> +</varlistentry> <varlistentry><term><structfield id="DbusmenuClientClass.reserved1">reserved1</structfield> ()</term> <listitem><simpara>Reserved for future use. </simpara></listitem> @@ -201,10 +206,6 @@ A simple class that takes all of the information from a <listitem><simpara>Reserved for future use. </simpara></listitem> </varlistentry> -<varlistentry><term><structfield id="DbusmenuClientClass.reserved4">reserved4</structfield> ()</term> -<listitem><simpara>Reserved for future use. -</simpara></listitem> -</varlistentry> </variablelist></refsect2> <refsect2 id="DbusmenuClientTypeHandler" role="function"> <title>DbusmenuClientTypeHandler ()</title> @@ -344,6 +345,7 @@ This function connects into the type handling of the <link linkend="DbusmenuClie <parameter>gpointer</parameter> user_data: <parameter>gpointer</parameter> user_data: <parameter>gpointer</parameter> user_data: +<parameter>gpointer</parameter> user_data: </simpara></listitem></varlistentry> <varlistentry><term><parameter>cb_data</parameter> :</term> <listitem><simpara> diff --git a/docs/libdbusmenu-glib/reference/xml/menuitem.xml b/docs/libdbusmenu-glib/reference/xml/menuitem.xml index ef86f39..9e6b469 100644 --- a/docs/libdbusmenu-glib/reference/xml/menuitem.xml +++ b/docs/libdbusmenu-glib/reference/xml/menuitem.xml @@ -375,7 +375,8 @@ as an XML fragment. Should call it's own children. void (*handle_event) (DbusmenuMenuitem * mi, const gchar * name, const GValue * value, guint timestamp); void (*send_about_to_show) (DbusmenuMenuitem * mi, dbusmenu_menuitem_about_to_show_cb cb, gpointer cb_data); - void (*reserved1) (void); + void (*show_to_user) (DbusmenuMenuitem * mi, guint timestamp, gpointer cb_data); + /* void (*reserved1) (void); */ /* void (*reserved2) (void); */ /* void (*reserved3) (void); */ /* void (*reserved4) (void); -- realized, realloc when bumping lib version */ @@ -422,8 +423,8 @@ as an XML fragment. Should call it's own children. <listitem><simpara>Virtual function that notifies server that the client is about to show a menu. </simpara></listitem> </varlistentry> -<varlistentry><term><structfield id="DbusmenuMenuitemClass.reserved1">reserved1</structfield> ()</term> -<listitem><simpara>Reserved for future use. +<varlistentry><term><structfield id="DbusmenuMenuitemClass.show-to-user">show_to_user</structfield> ()</term> +<listitem><simpara>Slot for <link linkend="DbusmenuMenuitem-show-to-user"><type>"show-to-user"</type></link>. </simpara></listitem> </varlistentry> </variablelist></refsect2> diff --git a/docs/libdbusmenu-gtk/reference/html/ch01.html b/docs/libdbusmenu-gtk/reference/html/ch01.html index 37fd236..a5bbccc 100644 --- a/docs/libdbusmenu-gtk/reference/html/ch01.html +++ b/docs/libdbusmenu-gtk/reference/html/ch01.html @@ -21,7 +21,7 @@ </tr></table> <div class="chapter" title="API"> <div class="titlepage"><div><div><h2 class="title"> -<a name="id373680"></a>API</h2></div></div></div> +<a name="id453927"></a>API</h2></div></div></div> <div class="toc"><dl> <dt> <span class="refentrytitle"><a href="libdbusmenu-gtk-DbusmenuGtkMenu.html">DbusmenuGtkMenu</a></span><span class="refpurpose"></span> diff --git a/docs/libdbusmenu-gtk/reference/version.xml b/docs/libdbusmenu-gtk/reference/version.xml index 2080591..0b9c019 100644 --- a/docs/libdbusmenu-gtk/reference/version.xml +++ b/docs/libdbusmenu-gtk/reference/version.xml @@ -1 +1 @@ -0.3.11 +0.3.12 diff --git a/libdbusmenu-glib/Makefile.am b/libdbusmenu-glib/Makefile.am index 3df1513..0a6513f 100644 --- a/libdbusmenu-glib/Makefile.am +++ b/libdbusmenu-glib/Makefile.am @@ -4,6 +4,7 @@ CLEANFILES = EXTRA_DIST = \ dbusmenu-glib.pc.in \ dbus-menu.xml \ + client-marshal.list \ menuitem-marshal.list \ server-marshal.list @@ -32,6 +33,8 @@ libdbusmenu_glib_la_SOURCES = \ server.c \ server-marshal.h \ server-marshal.c \ + client-marshal.h \ + client-marshal.c \ client-menuitem.h \ client-menuitem.c \ client.h \ @@ -54,6 +57,8 @@ pkgconfigdir = $(libdir)/pkgconfig BUILT_SOURCES = \ dbusmenu-client.h \ dbusmenu-server.h \ + client-marshal.h \ + client-marshal.c \ menuitem-marshal.h \ menuitem-marshal.c \ server-marshal.h \ @@ -73,6 +78,16 @@ dbusmenu-client.h: dbus-menu.xml --output=dbusmenu-client.h \ $(srcdir)/dbus-menu.xml +client-marshal.h: $(srcdir)/client-marshal.list + glib-genmarshal --header \ + --prefix=_dbusmenu_client_marshal $(srcdir)/client-marshal.list \ + > client-marshal.h + +client-marshal.c: $(srcdir)/client-marshal.list + glib-genmarshal --body \ + --prefix=_dbusmenu_client_marshal $(srcdir)/client-marshal.list \ + > client-marshal.c + server-marshal.h: $(srcdir)/server-marshal.list glib-genmarshal --header \ --prefix=_dbusmenu_server_marshal $(srcdir)/server-marshal.list \ diff --git a/libdbusmenu-glib/Makefile.in b/libdbusmenu-glib/Makefile.in index f04bf5a..ba93681 100644 --- a/libdbusmenu-glib/Makefile.in +++ b/libdbusmenu-glib/Makefile.in @@ -83,6 +83,7 @@ am_libdbusmenu_glib_la_OBJECTS = libdbusmenu_glib_la-menuitem.lo \ libdbusmenu_glib_la-menuitem-proxy.lo \ libdbusmenu_glib_la-server.lo \ libdbusmenu_glib_la-server-marshal.lo \ + libdbusmenu_glib_la-client-marshal.lo \ libdbusmenu_glib_la-client-menuitem.lo \ libdbusmenu_glib_la-client.lo libdbusmenu_glib_la_OBJECTS = $(am_libdbusmenu_glib_la_OBJECTS) @@ -297,6 +298,7 @@ CLEANFILES = $(am__append_2) EXTRA_DIST = \ dbusmenu-glib.pc.in \ dbus-menu.xml \ + client-marshal.list \ menuitem-marshal.list \ server-marshal.list @@ -324,6 +326,8 @@ libdbusmenu_glib_la_SOURCES = \ server.c \ server-marshal.h \ server-marshal.c \ + client-marshal.h \ + client-marshal.c \ client-menuitem.h \ client-menuitem.c \ client.h \ @@ -345,6 +349,8 @@ pkgconfigdir = $(libdir)/pkgconfig BUILT_SOURCES = \ dbusmenu-client.h \ dbusmenu-server.h \ + client-marshal.h \ + client-marshal.c \ menuitem-marshal.h \ menuitem-marshal.c \ server-marshal.h \ @@ -452,6 +458,7 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdbusmenu_glib_la-client-marshal.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdbusmenu_glib_la-client-menuitem.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdbusmenu_glib_la-client.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdbusmenu_glib_la-menuitem-marshal.Plo@am__quote@ @@ -524,6 +531,14 @@ libdbusmenu_glib_la-server-marshal.lo: server-marshal.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdbusmenu_glib_la_CFLAGS) $(CFLAGS) -c -o libdbusmenu_glib_la-server-marshal.lo `test -f 'server-marshal.c' || echo '$(srcdir)/'`server-marshal.c +libdbusmenu_glib_la-client-marshal.lo: client-marshal.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdbusmenu_glib_la_CFLAGS) $(CFLAGS) -MT libdbusmenu_glib_la-client-marshal.lo -MD -MP -MF $(DEPDIR)/libdbusmenu_glib_la-client-marshal.Tpo -c -o libdbusmenu_glib_la-client-marshal.lo `test -f 'client-marshal.c' || echo '$(srcdir)/'`client-marshal.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libdbusmenu_glib_la-client-marshal.Tpo $(DEPDIR)/libdbusmenu_glib_la-client-marshal.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='client-marshal.c' object='libdbusmenu_glib_la-client-marshal.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdbusmenu_glib_la_CFLAGS) $(CFLAGS) -c -o libdbusmenu_glib_la-client-marshal.lo `test -f 'client-marshal.c' || echo '$(srcdir)/'`client-marshal.c + libdbusmenu_glib_la-client-menuitem.lo: client-menuitem.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdbusmenu_glib_la_CFLAGS) $(CFLAGS) -MT libdbusmenu_glib_la-client-menuitem.lo -MD -MP -MF $(DEPDIR)/libdbusmenu_glib_la-client-menuitem.Tpo -c -o libdbusmenu_glib_la-client-menuitem.lo `test -f 'client-menuitem.c' || echo '$(srcdir)/'`client-menuitem.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libdbusmenu_glib_la-client-menuitem.Tpo $(DEPDIR)/libdbusmenu_glib_la-client-menuitem.Plo @@ -876,6 +891,16 @@ dbusmenu-client.h: dbus-menu.xml --output=dbusmenu-client.h \ $(srcdir)/dbus-menu.xml +client-marshal.h: $(srcdir)/client-marshal.list + glib-genmarshal --header \ + --prefix=_dbusmenu_client_marshal $(srcdir)/client-marshal.list \ + > client-marshal.h + +client-marshal.c: $(srcdir)/client-marshal.list + glib-genmarshal --body \ + --prefix=_dbusmenu_client_marshal $(srcdir)/client-marshal.list \ + > client-marshal.c + server-marshal.h: $(srcdir)/server-marshal.list glib-genmarshal --header \ --prefix=_dbusmenu_server_marshal $(srcdir)/server-marshal.list \ diff --git a/libdbusmenu-glib/client-marshal.c b/libdbusmenu-glib/client-marshal.c new file mode 100644 index 0000000..56b0100 --- /dev/null +++ b/libdbusmenu-glib/client-marshal.c @@ -0,0 +1,131 @@ + +#include <glib-object.h> + + +#ifdef G_ENABLE_DEBUG +#define g_marshal_value_peek_boolean(v) g_value_get_boolean (v) +#define g_marshal_value_peek_char(v) g_value_get_char (v) +#define g_marshal_value_peek_uchar(v) g_value_get_uchar (v) +#define g_marshal_value_peek_int(v) g_value_get_int (v) +#define g_marshal_value_peek_uint(v) g_value_get_uint (v) +#define g_marshal_value_peek_long(v) g_value_get_long (v) +#define g_marshal_value_peek_ulong(v) g_value_get_ulong (v) +#define g_marshal_value_peek_int64(v) g_value_get_int64 (v) +#define g_marshal_value_peek_uint64(v) g_value_get_uint64 (v) +#define g_marshal_value_peek_enum(v) g_value_get_enum (v) +#define g_marshal_value_peek_flags(v) g_value_get_flags (v) +#define g_marshal_value_peek_float(v) g_value_get_float (v) +#define g_marshal_value_peek_double(v) g_value_get_double (v) +#define g_marshal_value_peek_string(v) (char*) g_value_get_string (v) +#define g_marshal_value_peek_param(v) g_value_get_param (v) +#define g_marshal_value_peek_boxed(v) g_value_get_boxed (v) +#define g_marshal_value_peek_pointer(v) g_value_get_pointer (v) +#define g_marshal_value_peek_object(v) g_value_get_object (v) +#define g_marshal_value_peek_variant(v) g_value_get_variant (v) +#else /* !G_ENABLE_DEBUG */ +/* WARNING: This code accesses GValues directly, which is UNSUPPORTED API. + * Do not access GValues directly in your code. Instead, use the + * g_value_get_*() functions + */ +#define g_marshal_value_peek_boolean(v) (v)->data[0].v_int +#define g_marshal_value_peek_char(v) (v)->data[0].v_int +#define g_marshal_value_peek_uchar(v) (v)->data[0].v_uint +#define g_marshal_value_peek_int(v) (v)->data[0].v_int +#define g_marshal_value_peek_uint(v) (v)->data[0].v_uint +#define g_marshal_value_peek_long(v) (v)->data[0].v_long +#define g_marshal_value_peek_ulong(v) (v)->data[0].v_ulong +#define g_marshal_value_peek_int64(v) (v)->data[0].v_int64 +#define g_marshal_value_peek_uint64(v) (v)->data[0].v_uint64 +#define g_marshal_value_peek_enum(v) (v)->data[0].v_long +#define g_marshal_value_peek_flags(v) (v)->data[0].v_ulong +#define g_marshal_value_peek_float(v) (v)->data[0].v_float +#define g_marshal_value_peek_double(v) (v)->data[0].v_double +#define g_marshal_value_peek_string(v) (v)->data[0].v_pointer +#define g_marshal_value_peek_param(v) (v)->data[0].v_pointer +#define g_marshal_value_peek_boxed(v) (v)->data[0].v_pointer +#define g_marshal_value_peek_pointer(v) (v)->data[0].v_pointer +#define g_marshal_value_peek_object(v) (v)->data[0].v_pointer +#define g_marshal_value_peek_variant(v) (v)->data[0].v_pointer +#endif /* !G_ENABLE_DEBUG */ + + +/* VOID:OBJECT,UINT (./client-marshal.list:1) */ +void +_dbusmenu_client_marshal_VOID__OBJECT_UINT (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) +{ + typedef void (*GMarshalFunc_VOID__OBJECT_UINT) (gpointer data1, + gpointer arg_1, + guint arg_2, + gpointer data2); + register GMarshalFunc_VOID__OBJECT_UINT callback; + register GCClosure *cc = (GCClosure*) closure; + register gpointer data1, data2; + + g_return_if_fail (n_param_values == 3); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__OBJECT_UINT) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + g_marshal_value_peek_object (param_values + 1), + g_marshal_value_peek_uint (param_values + 2), + data2); +} + +/* VOID:OBJECT,STRING,POINTER,UINT,POINTER (./client-marshal.list:2) */ +void +_dbusmenu_client_marshal_VOID__OBJECT_STRING_POINTER_UINT_POINTER (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) +{ + typedef void (*GMarshalFunc_VOID__OBJECT_STRING_POINTER_UINT_POINTER) (gpointer data1, + gpointer arg_1, + gpointer arg_2, + gpointer arg_3, + guint arg_4, + gpointer arg_5, + gpointer data2); + register GMarshalFunc_VOID__OBJECT_STRING_POINTER_UINT_POINTER callback; + register GCClosure *cc = (GCClosure*) closure; + register gpointer data1, data2; + + g_return_if_fail (n_param_values == 6); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__OBJECT_STRING_POINTER_UINT_POINTER) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + g_marshal_value_peek_object (param_values + 1), + g_marshal_value_peek_string (param_values + 2), + g_marshal_value_peek_pointer (param_values + 3), + g_marshal_value_peek_uint (param_values + 4), + g_marshal_value_peek_pointer (param_values + 5), + data2); +} + diff --git a/libdbusmenu-glib/client-marshal.h b/libdbusmenu-glib/client-marshal.h new file mode 100644 index 0000000..9c43fc9 --- /dev/null +++ b/libdbusmenu-glib/client-marshal.h @@ -0,0 +1,28 @@ + +#ifndef ___dbusmenu_client_marshal_MARSHAL_H__ +#define ___dbusmenu_client_marshal_MARSHAL_H__ + +#include <glib-object.h> + +G_BEGIN_DECLS + +/* VOID:OBJECT,UINT (./client-marshal.list:1) */ +extern void _dbusmenu_client_marshal_VOID__OBJECT_UINT (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); + +/* VOID:OBJECT,STRING,POINTER,UINT,POINTER (./client-marshal.list:2) */ +extern void _dbusmenu_client_marshal_VOID__OBJECT_STRING_POINTER_UINT_POINTER (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); + +G_END_DECLS + +#endif /* ___dbusmenu_client_marshal_MARSHAL_H__ */ + diff --git a/libdbusmenu-glib/client-marshal.list b/libdbusmenu-glib/client-marshal.list new file mode 100644 index 0000000..2e14491 --- /dev/null +++ b/libdbusmenu-glib/client-marshal.list @@ -0,0 +1,2 @@ +VOID: OBJECT, UINT +VOID: OBJECT, STRING, POINTER, UINT, POINTER diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 73a7aac..43bde5f 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -41,6 +41,7 @@ License version 3 and version 2.1 along with this program. If not, see #include "client-menuitem.h" #include "dbusmenu-client.h" #include "server-marshal.h" +#include "client-marshal.h" /* Properties */ enum { @@ -54,6 +55,8 @@ enum { LAYOUT_UPDATED, ROOT_CHANGED, NEW_MENUITEM, + ITEM_ACTIVATE, + EVENT_RESULT, LAST_SIGNAL }; @@ -100,6 +103,16 @@ struct _properties_listener_t { gboolean replied; }; +typedef struct _event_data_t event_data_t; +struct _event_data_t { + DbusmenuClient * client; + DbusmenuMenuitem * menuitem; + gchar * event; + GValue data; + guint timestamp; +}; + + #define DBUSMENU_CLIENT_GET_PRIVATE(o) \ (G_TYPE_INSTANCE_GET_PRIVATE ((o), DBUSMENU_TYPE_CLIENT, DbusmenuClientPrivate)) @@ -123,6 +136,7 @@ static void update_layout (DbusmenuClient * client); static void menuitem_get_properties_cb (DBusGProxy * proxy, GHashTable * properties, GError * error, gpointer data); static void get_properties_globber (DbusmenuClient * client, gint id, const gchar ** properties, org_ayatana_dbusmenu_get_properties_reply callback, gpointer user_data); static GQuark error_domain (void); +static void item_activated (DBusGProxy * proxy, gint id, guint timestamp, DbusmenuClient * client); /* Build a type */ G_DEFINE_TYPE (DbusmenuClient, dbusmenu_client, G_TYPE_OBJECT); @@ -187,6 +201,41 @@ dbusmenu_client_class_init (DbusmenuClientClass *klass) NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, G_TYPE_OBJECT); + /** + DbusmenuClient::item-activate: + @arg0: The #DbusmenuClient object + @arg1: The #DbusmenuMenuitem activated + @arg2: A timestamp that the event happened at + + Signaled when the server wants to activate an item in + order to display the menu. + */ + signals[ITEM_ACTIVATE] = g_signal_new(DBUSMENU_CLIENT_SIGNAL_ITEM_ACTIVATE, + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (DbusmenuClientClass, item_activate), + NULL, NULL, + _dbusmenu_client_marshal_VOID__OBJECT_UINT, + G_TYPE_NONE, 2, G_TYPE_OBJECT, G_TYPE_UINT); + /** + DbusmenuClient::event-error: + @arg0: The #DbusmenuClient object + @arg1: The #DbusmenuMenuitem sent an event + @arg2: The ID of the event sent + @arg3: The data sent along with the event + @arg4: A timestamp that the event happened at + @arg5: Possibly the error in sending the event (or NULL) + + Signal sent to show that there was an error in sending the event + to the server. + */ + signals[EVENT_RESULT] = g_signal_new(DBUSMENU_CLIENT_SIGNAL_EVENT_RESULT, + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (DbusmenuClientClass, event_result), + NULL, NULL, + _dbusmenu_client_marshal_VOID__OBJECT_STRING_POINTER_UINT_POINTER, + G_TYPE_NONE, 5, G_TYPE_OBJECT, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_UINT, G_TYPE_POINTER); g_object_class_install_property (object_class, PROP_DBUSOBJECT, g_param_spec_string(DBUSMENU_CLIENT_PROP_DBUS_OBJECT, "DBus Object we represent", @@ -582,6 +631,30 @@ get_properties_globber (DbusmenuClient * client, gint id, const gchar ** propert return; } +/* Called when a server item wants to activate the menu */ +static void +item_activated (DBusGProxy * proxy, gint id, guint timestamp, DbusmenuClient * client) +{ + g_return_if_fail(DBUSMENU_IS_CLIENT(client)); + + DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); + + if (priv->root == NULL) { + g_warning("Asked to activate item %d when we don't have a menu structure.", id); + return; + } + + DbusmenuMenuitem * menuitem = dbusmenu_menuitem_find_id(priv->root, id); + if (menuitem == NULL) { + g_warning("Unable to find menu item %d to activate.", id); + return; + } + + g_signal_emit(G_OBJECT(client), signals[ITEM_ACTIVATE], 0, menuitem, timestamp, TRUE); + + return; +} + /* Annoying little wrapper to make the right function update */ static void layout_update (DBusGProxy * proxy, guint revision, gint parent, DbusmenuClient * client) @@ -821,6 +894,10 @@ build_proxies (DbusmenuClient * client) dbus_g_proxy_add_signal(priv->menuproxy, "ItemUpdated", G_TYPE_INT, G_TYPE_INVALID); dbus_g_proxy_connect_signal(priv->menuproxy, "ItemUpdated", G_CALLBACK(id_update), client, NULL); + dbus_g_object_register_marshaller(_dbusmenu_server_marshal_VOID__INT_UINT, G_TYPE_NONE, G_TYPE_INT, G_TYPE_UINT, G_TYPE_INVALID); + dbus_g_proxy_add_signal(priv->menuproxy, "ItemActivationRequested", G_TYPE_INT, G_TYPE_UINT, G_TYPE_INVALID); + dbus_g_proxy_connect_signal(priv->menuproxy, "ItemActivationRequested", G_CALLBACK(item_activated), client, NULL); + update_layout(client); return; @@ -978,10 +1055,19 @@ menuitem_get_properties_new_cb (DBusGProxy * proxy, GHashTable * properties, GEr static void menuitem_call_cb (DBusGProxy * proxy, GError * error, gpointer userdata) { + event_data_t * edata = (event_data_t *)userdata; + if (error != NULL) { g_warning("Unable to call menu item %d: %s", GPOINTER_TO_INT(userdata), error->message); } + g_signal_emit(edata->client, signals[EVENT_RESULT], 0, edata->menuitem, edata->event, edata->data, edata->timestamp, error, TRUE); + + g_value_unset(&edata->data); + g_free(edata->event); + g_object_unref(edata->menuitem); + g_free(edata); + return; } @@ -994,6 +1080,13 @@ dbusmenu_client_send_event (DbusmenuClient * client, gint id, const gchar * name g_return_if_fail(id >= 0); g_return_if_fail(name != NULL); + DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); + DbusmenuMenuitem * mi = dbusmenu_menuitem_find_id(priv->root, id); + if (mi == NULL) { + g_warning("Asked to activate a menuitem %d that we don't know about", id); + return; + } + if (value == NULL) { GValue internalval = {0}; g_value_init(&internalval, G_TYPE_INT); @@ -1001,8 +1094,16 @@ dbusmenu_client_send_event (DbusmenuClient * client, gint id, const gchar * name value = &internalval; } - DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); - org_ayatana_dbusmenu_event_async (priv->menuproxy, id, name, value, timestamp, menuitem_call_cb, GINT_TO_POINTER(id)); + event_data_t * edata = g_new0(event_data_t, 1); + edata->client = client; + edata->menuitem = mi; + g_object_ref(edata->menuitem); + edata->event = g_strdup(name); + g_value_init(&edata->data, G_VALUE_TYPE(value)); + g_value_copy(value, &edata->data); + edata->timestamp = timestamp; + + org_ayatana_dbusmenu_event_async (priv->menuproxy, id, name, value, timestamp, menuitem_call_cb, edata); return; } @@ -1225,7 +1326,8 @@ parse_layout (DbusmenuClient * client, const gchar * layout) xmlDocPtr xmldoc; - xmldoc = xmlReadMemory(layout, g_utf8_strlen(layout, 16*1024), "dbusmenu.xml", NULL, 0); + /* No one should need more characters than this! */ + xmldoc = xmlReadMemory(layout, g_utf8_strlen(layout, 1024*1024), "dbusmenu.xml", NULL, 0); xmlNodePtr root = xmlDocGetRootElement(xmldoc); diff --git a/libdbusmenu-glib/client.h b/libdbusmenu-glib/client.h index 2b76f5e..5d4b5c3 100644 --- a/libdbusmenu-glib/client.h +++ b/libdbusmenu-glib/client.h @@ -46,6 +46,8 @@ G_BEGIN_DECLS #define DBUSMENU_CLIENT_SIGNAL_LAYOUT_UPDATED "layout-updated" #define DBUSMENU_CLIENT_SIGNAL_ROOT_CHANGED "root-changed" #define DBUSMENU_CLIENT_SIGNAL_NEW_MENUITEM "new-menuitem" +#define DBUSMENU_CLIENT_SIGNAL_ITEM_ACTIVATE "item-activate" +#define DBUSMENU_CLIENT_SIGNAL_EVENT_RESULT "event-result" #define DBUSMENU_CLIENT_PROP_DBUS_NAME "dbus-name" #define DBUSMENU_CLIENT_PROP_DBUS_OBJECT "dbus-object" @@ -59,10 +61,10 @@ G_BEGIN_DECLS @parent_class: #GObjectClass @layout_updated: Slot for #DbusmenuClient::layout-updated. @new_menuitem: Slot for #DbusmenuClient::new-menuitem. + @item_activate: Slot for #DbusmenuClient::item-activate. + @event_result: Slot for #DbusmenuClient::event-error. @reserved1: Reserved for future use. @reserved2: Reserved for future use. - @reserved3: Reserved for future use. - @reserved4: Reserved for future use. A simple class that takes all of the information from a #DbusmenuServer over DBus and makes the same set of @@ -75,12 +77,14 @@ struct _DbusmenuClientClass { void (*layout_updated)(void); void (*root_changed) (DbusmenuMenuitem * newroot); void (*new_menuitem) (DbusmenuMenuitem * newitem); + void (*item_activate) (DbusmenuMenuitem * item, guint timestamp); + void (*event_result) (DbusmenuMenuitem * item, gchar * event, GValue * data, guint timestamp, GError * error); /* Reserved for future use */ void (*reserved1) (void); void (*reserved2) (void); - void (*reserved3) (void); - void (*reserved4) (void); + /* void (*reserved3) (void); */ + /* void (*reserved4) (void); */ }; /** diff --git a/libdbusmenu-glib/dbusmenu-server.h b/libdbusmenu-glib/dbusmenu-server.h index 905c3f6..1f0995d 100644 --- a/libdbusmenu-glib/dbusmenu-server.h +++ b/libdbusmenu-glib/dbusmenu-server.h @@ -376,12 +376,11 @@ static const DBusGMethodInfo dbus_glib__dbusmenu_server_methods[] = { { (GCallback) _dbusmenu_server_about_to_show, dbus_glib_marshal__dbusmenu_server_BOOLEAN__INT_POINTER_POINTER, 491 }, }; -const DBusGObjectInfo dbus_glib__dbusmenu_server_object_info = { - 0, +const DBusGObjectInfo dbus_glib__dbusmenu_server_object_info = { 1, dbus_glib__dbusmenu_server_methods, 7, "org.ayatana.dbusmenu\0GetLayout\0S\0parentId\0I\0i\0revision\0O\0F\0N\0u\0layout\0O\0F\0N\0s\0\0org.ayatana.dbusmenu\0GetGroupProperties\0S\0ids\0I\0ai\0propertyNames\0I\0as\0properties\0O\0F\0N\0a(ia{sv})\0\0org.ayatana.dbusmenu\0GetChildren\0S\0id\0I\0i\0propertyNames\0I\0as\0properties\0O\0F\0N\0a(ia{sv})\0\0org.ayatana.dbusmenu\0GetProperty\0S\0id\0I\0i\0name\0I\0s\0value\0O\0F\0N\0v\0\0org.ayatana.dbusmenu\0GetProperties\0S\0id\0I\0i\0propertyNames\0I\0as\0properties\0O\0F\0N\0a{sv}\0\0org.ayatana.dbusmenu\0Event\0S\0id\0I\0i\0eventId\0I\0s\0data\0I\0v\0timestamp\0I\0u\0\0org.ayatana.dbusmenu\0AboutToShow\0S\0id\0I\0i\0needUpdate\0O\0F\0N\0b\0\0\0", "org.ayatana.dbusmenu\0ItemPropertyUpdated\0org.ayatana.dbusmenu\0ItemUpdated\0org.ayatana.dbusmenu\0LayoutUpdated\0org.ayatana.dbusmenu\0ItemActivationRequested\0\0", -"org.ayatana.dbusmenu\0version\0\0" +"org.ayatana.dbusmenu\0version\0version\0read\0\0" }; diff --git a/libdbusmenu-glib/menuitem-marshal.c b/libdbusmenu-glib/menuitem-marshal.c index aa7147a..d6ac0a6 100644 --- a/libdbusmenu-glib/menuitem-marshal.c +++ b/libdbusmenu-glib/menuitem-marshal.c @@ -21,6 +21,7 @@ #define g_marshal_value_peek_boxed(v) g_value_get_boxed (v) #define g_marshal_value_peek_pointer(v) g_value_get_pointer (v) #define g_marshal_value_peek_object(v) g_value_get_object (v) +#define g_marshal_value_peek_variant(v) g_value_get_variant (v) #else /* !G_ENABLE_DEBUG */ /* WARNING: This code accesses GValues directly, which is UNSUPPORTED API. * Do not access GValues directly in your code. Instead, use the @@ -44,6 +45,7 @@ #define g_marshal_value_peek_boxed(v) (v)->data[0].v_pointer #define g_marshal_value_peek_pointer(v) (v)->data[0].v_pointer #define g_marshal_value_peek_object(v) (v)->data[0].v_pointer +#define g_marshal_value_peek_variant(v) (v)->data[0].v_pointer #endif /* !G_ENABLE_DEBUG */ diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 623539c..ea69776 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -70,6 +70,7 @@ enum { CHILD_REMOVED, CHILD_MOVED, REALIZED, + SHOW_TO_USER, LAST_SIGNAL }; @@ -211,6 +212,22 @@ dbusmenu_menuitem_class_init (DbusmenuMenuitemClass *klass) NULL, NULL, _dbusmenu_menuitem_marshal_VOID__VOID, G_TYPE_NONE, 0, G_TYPE_NONE); + /** + DbusmenuMenuitem::show-to-user: + @arg0: The #DbusmenuMenuitem which should be shown. + @arg1: Timestamp the event happened at + + Signaled when the application would like the visualization + of this menu item shown to the user. This usually requires + going over the bus to get it done. + */ + signals[SHOW_TO_USER] = g_signal_new(DBUSMENU_MENUITEM_SIGNAL_SHOW_TO_USER, + G_TYPE_FROM_CLASS(klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(DbusmenuMenuitemClass, show_to_user), + NULL, NULL, + g_cclosure_marshal_VOID__UINT, + G_TYPE_NONE, 1, G_TYPE_UINT, G_TYPE_NONE); g_object_class_install_property (object_class, PROP_ID, g_param_spec_int(PROP_ID_S, "ID for the menu item", @@ -1349,3 +1366,22 @@ dbusmenu_menuitem_send_about_to_show (DbusmenuMenuitem * mi, dbusmenu_menuitem_a return; } + +/** + dbusmenu_menuitem_show_to_user: + @mi: #DbusmenuMenuitem to show + @timestamp: The time that the user requested it to be shown + + Signals that this menu item should be shown to the user. If this is + server side the server will then take it and send it over the + bus. +*/ +void +dbusmenu_menuitem_show_to_user (DbusmenuMenuitem * mi, guint timestamp) +{ + g_return_if_fail(DBUSMENU_IS_MENUITEM(mi)); + + g_signal_emit(G_OBJECT(mi), signals[SHOW_TO_USER], 0, timestamp, TRUE); + + return; +} diff --git a/libdbusmenu-glib/menuitem.h b/libdbusmenu-glib/menuitem.h index e17d851..9be938b 100644 --- a/libdbusmenu-glib/menuitem.h +++ b/libdbusmenu-glib/menuitem.h @@ -49,6 +49,7 @@ G_BEGIN_DECLS #define DBUSMENU_MENUITEM_SIGNAL_CHILD_MOVED "child-moved" #define DBUSMENU_MENUITEM_SIGNAL_REALIZED "realized" #define DBUSMENU_MENUITEM_SIGNAL_REALIZED_ID (g_signal_lookup(DBUSMENU_MENUITEM_SIGNAL_REALIZED, DBUSMENU_TYPE_MENUITEM)) +#define DBUSMENU_MENUITEM_SIGNAL_SHOW_TO_USER "show-to-user" #define DBUSMENU_MENUITEM_PROP_TYPE "type" #define DBUSMENU_MENUITEM_PROP_VISIBLE "visible" @@ -124,10 +125,7 @@ typedef void (*dbusmenu_menuitem_buildxml_slot_t) (DbusmenuMenuitem * mi, GPtrAr * @buildxml: Virtual function that appends the strings required to represent this menu item in the menu XML file. * @handle_event: This function is to override how events are handled by subclasses. Look at #dbusmenu_menuitem_handle_event for lots of good information. * @send_about_to_show: Virtual function that notifies server that the client is about to show a menu. - * @reserved1: Reserved for future use. - * @reserved2: Reserved for future use. - * @reserved3: Reserved for future use. - * @reserved4: Reserved for future use. + * @show_to_user: Slot for #DbusmenuMenuitem::show-to-user. */ typedef struct _DbusmenuMenuitemClass DbusmenuMenuitemClass; struct _DbusmenuMenuitemClass @@ -147,7 +145,8 @@ struct _DbusmenuMenuitemClass void (*handle_event) (DbusmenuMenuitem * mi, const gchar * name, const GValue * value, guint timestamp); void (*send_about_to_show) (DbusmenuMenuitem * mi, dbusmenu_menuitem_about_to_show_cb cb, gpointer cb_data); - void (*reserved1) (void); + void (*show_to_user) (DbusmenuMenuitem * mi, guint timestamp, gpointer cb_data); + /* void (*reserved1) (void); */ /* void (*reserved2) (void); */ /* void (*reserved3) (void); */ /* void (*reserved4) (void); -- realized, realloc when bumping lib version */ @@ -192,6 +191,8 @@ void dbusmenu_menuitem_foreach (DbusmenuMenuitem * mi, void (*func) (DbusmenuMen void dbusmenu_menuitem_handle_event (DbusmenuMenuitem * mi, const gchar * name, const GValue * value, guint timestamp); void dbusmenu_menuitem_send_about_to_show (DbusmenuMenuitem * mi, dbusmenu_menuitem_about_to_show_cb cb, gpointer cb_data); +void dbusmenu_menuitem_show_to_user (DbusmenuMenuitem * mi, guint timestamp); + /** * SECTION:menuitem * @short_description: A lowlevel represenation of a menuitem diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index d1b4888..26e7a0d 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -410,7 +410,7 @@ menuitem_child_moved (DbusmenuMenuitem * parent, DbusmenuMenuitem * child, guint /* Called when a menu item emits its activated signal so it gets passed across the bus. */ static void -menuitem_activated (DbusmenuMenuitem * mi, guint timestamp, DbusmenuServer * server) +menuitem_shown (DbusmenuMenuitem * mi, guint timestamp, DbusmenuServer * server) { g_signal_emit(G_OBJECT(server), signals[ITEM_ACTIVATION], 0, dbusmenu_menuitem_get_id(mi), timestamp, TRUE); return; @@ -425,7 +425,7 @@ menuitem_signals_create (DbusmenuMenuitem * mi, gpointer data) g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_CHILD_REMOVED, G_CALLBACK(menuitem_child_removed), data); g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_CHILD_MOVED, G_CALLBACK(menuitem_child_moved), data); g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED, G_CALLBACK(menuitem_property_changed), data); - g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(menuitem_activated), data); + g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_SHOW_TO_USER, G_CALLBACK(menuitem_shown), data); return; } diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c index b5b509f..44f95fe 100644 --- a/libdbusmenu-gtk/client.c +++ b/libdbusmenu-gtk/client.c @@ -54,6 +54,7 @@ static void new_menuitem (DbusmenuClient * client, DbusmenuMenuitem * mi, gpoint static void new_child (DbusmenuMenuitem * mi, DbusmenuMenuitem * child, guint position, DbusmenuGtkClient * gtkclient); static void delete_child (DbusmenuMenuitem * mi, DbusmenuMenuitem * child, DbusmenuGtkClient * gtkclient); static void move_child (DbusmenuMenuitem * mi, DbusmenuMenuitem * child, guint new, guint old, DbusmenuGtkClient * gtkclient); +static void item_activate (DbusmenuClient * client, DbusmenuMenuitem * mi, guint timestamp, gpointer userdata); static gboolean new_item_normal (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client); static gboolean new_item_seperator (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client); @@ -91,7 +92,9 @@ dbusmenu_gtkclient_init (DbusmenuGtkClient *self) dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(self), DBUSMENU_CLIENT_TYPES_DEFAULT, new_item_normal); dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(self), DBUSMENU_CLIENT_TYPES_SEPARATOR, new_item_seperator); + /* TODO: I think these can be handled in the class... */ g_signal_connect(G_OBJECT(self), DBUSMENU_CLIENT_SIGNAL_NEW_MENUITEM, G_CALLBACK(new_menuitem), NULL); + g_signal_connect(G_OBJECT(self), DBUSMENU_CLIENT_SIGNAL_ITEM_ACTIVATE, G_CALLBACK(item_activate), NULL); return; } @@ -431,6 +434,50 @@ new_menuitem (DbusmenuClient * client, DbusmenuMenuitem * mi, gpointer userdata) return; } +/* Goes through the tree of items and ensure's that all the items + above us are also displayed. */ +static void +activate_helper (GtkMenuShell * shell) +{ + if (shell == NULL) { + return; + } + + if (GTK_IS_MENU(shell)) { + GtkWidget * attach = gtk_menu_get_attach_widget(GTK_MENU(shell)); + + if (attach != NULL) { + GtkWidget * parent = gtk_widget_get_parent(GTK_WIDGET(attach)); + + if (parent != NULL) { + if (GTK_IS_MENU(parent)) { + activate_helper(GTK_MENU_SHELL(parent)); + } + gtk_menu_shell_select_item(GTK_MENU_SHELL(parent), attach); + } + } + } + + return; +} + +/* Signaled when we should show a menuitem at request of the application + that it is in. */ +static void +item_activate (DbusmenuClient * client, DbusmenuMenuitem * mi, guint timestamp, gpointer userdata) +{ + gpointer pmenu = g_object_get_data(G_OBJECT(mi), data_menu); + if (pmenu == NULL) { + g_warning("Activated menu item doesn't have a menu? ID: %d", dbusmenu_menuitem_get_id(mi)); + return; + } + + activate_helper(GTK_MENU_SHELL(pmenu)); + gtk_menu_shell_select_first(GTK_MENU_SHELL(pmenu), FALSE); + + return; +} + #ifdef MASSIVEDEBUGGING static void destroy_gmi (GtkMenuItem * gmi, DbusmenuMenuitem * mi) diff --git a/tests/test-gtk-label-client.c b/tests/test-gtk-label-client.c index 070c278..14eb5bd 100644 --- a/tests/test-gtk-label-client.c +++ b/tests/test-gtk-label-client.c @@ -22,7 +22,6 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include <gtk/gtk.h> #include <libdbusmenu-gtk/menu.h> -static guint layouton = 0; static GMainLoop * mainloop = NULL; static gboolean passed = TRUE; static guint death_timer = 0; @@ -105,7 +104,6 @@ verify_root_to_layout(DbusmenuMenuitem * mi, proplayout_t * layout) static gboolean timer_func (gpointer data) { - g_debug("Death timer. Oops. Got to: %d", layouton); passed = TRUE; g_main_loop_quit(mainloop); return FALSE; diff --git a/tests/test-gtk-submenu-client.c b/tests/test-gtk-submenu-client.c index 2e1ef7a..ec46122 100644 --- a/tests/test-gtk-submenu-client.c +++ b/tests/test-gtk-submenu-client.c @@ -102,6 +102,12 @@ timer_func (gpointer data) } passed = TRUE; + return FALSE; +} + +gboolean +finished_func (gpointer user_data) +{ g_main_loop_quit(mainloop); return FALSE; } @@ -127,7 +133,8 @@ main (int argc, char ** argv) gtk_window_set_title(GTK_WINDOW(window), "libdbusmenu-gtk test"); gtk_widget_show(window); - g_timeout_add_seconds(1, timer_func, menuitem); + g_timeout_add_seconds(2, timer_func, menuitem); + g_timeout_add_seconds(6, finished_func, menuitem); g_debug("Entering Mainloop"); mainloop = g_main_loop_new(NULL, FALSE); diff --git a/tests/test-gtk-submenu-server.c b/tests/test-gtk-submenu-server.c index ba3993e..11cede0 100644 --- a/tests/test-gtk-submenu-server.c +++ b/tests/test-gtk-submenu-server.c @@ -39,6 +39,17 @@ timer_func (gpointer data) return FALSE; } +static gboolean +show_item (gpointer pmi) +{ + DbusmenuMenuitem * mi = DBUSMENU_MENUITEM(pmi); + g_debug("Showing item"); + + dbusmenu_menuitem_show_to_user(mi, 0); + + return FALSE; +} + DbusmenuMenuitem * add_item(DbusmenuMenuitem * parent, const char * label) { @@ -81,12 +92,16 @@ main (int argc, char ** argv) add_item(item, "1.2"); add_item(item, "1.3"); + g_timeout_add_seconds(2, show_item, item); + item = add_item(root, "Folder 2"); add_item(item, "2.1"); add_item(item, "2.2"); add_item(item, "2.3"); - g_timeout_add_seconds(3, timer_func, NULL); + g_timeout_add_seconds(4, show_item, item); + + g_timeout_add_seconds(6, timer_func, NULL); mainloop = g_main_loop_new(NULL, FALSE); g_main_loop_run(mainloop); |