aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCody Russell <crussell@canonical.com>2010-06-21 14:47:08 -0500
committerCody Russell <crussell@canonical.com>2010-06-21 14:47:08 -0500
commitc4eb1c83cb2bc10c1cfb2346a83182f09e159e53 (patch)
tree5e640a3f32b597dd406cbd425d1ced9b5e5ab3ff
parentcfdd33a19758224cb835efa705a410d3d4d0db91 (diff)
parent3d800bf9b0133a613d28c31957c081d157a89af8 (diff)
downloadlibdbusmenu-c4eb1c83cb2bc10c1cfb2346a83182f09e159e53.tar.gz
libdbusmenu-c4eb1c83cb2bc10c1cfb2346a83182f09e159e53.tar.bz2
libdbusmenu-c4eb1c83cb2bc10c1cfb2346a83182f09e159e53.zip
Mainline merge, resolve conflicts.
-rw-r--r--.bzrignore3
-rw-r--r--INSTALL114
-rw-r--r--Makefile.am4
-rwxr-xr-xautogen.sh3
-rw-r--r--configure.ac18
-rw-r--r--docs/Makefile.am1
-rw-r--r--docs/libdbusmenu-glib/Makefile.am1
-rw-r--r--docs/libdbusmenu-glib/reference/Makefile.am92
-rw-r--r--docs/libdbusmenu-glib/reference/libdbusmenu-glib-docs.sgml33
-rw-r--r--docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt157
-rw-r--r--docs/libdbusmenu-glib/reference/tmpl/dummy.sgml0
-rw-r--r--docs/libdbusmenu-glib/reference/version.xml.in1
-rw-r--r--docs/libdbusmenu-gtk/Makefile.am1
-rw-r--r--docs/libdbusmenu-gtk/reference/Makefile.am87
-rw-r--r--docs/libdbusmenu-gtk/reference/libdbusmenu-gtk-docs.sgml30
-rw-r--r--docs/libdbusmenu-gtk/reference/tmpl/dummy.sgml0
-rw-r--r--docs/libdbusmenu-gtk/reference/version.xml.in1
-rw-r--r--gtk-doc.local.make194
-rw-r--r--libdbusmenu-glib/client.c28
-rw-r--r--libdbusmenu-glib/menuitem.c20
-rw-r--r--libdbusmenu-glib/menuitem.h2
-rw-r--r--tests/Makefile.am35
-rw-r--r--tests/test-glib-submenu-client.c119
-rw-r--r--tests/test-glib-submenu-server.c109
-rw-r--r--tests/test-glib-submenu.h54
25 files changed, 1082 insertions, 25 deletions
diff --git a/.bzrignore b/.bzrignore
index 0f5b495..c5aa635 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -77,3 +77,6 @@ tests/test-gtk-objects.xml
tests/test-gtk-shortcut
tests/test-gtk-shortcut-client
tests/test-gtk-shortcut-server
+tests/test-glib-submenu
+tests/test-glib-submenu-client
+tests/test-glib-submenu-server
diff --git a/INSTALL b/INSTALL
index 8b82ade..7d1c323 100644
--- a/INSTALL
+++ b/INSTALL
@@ -2,10 +2,12 @@ Installation Instructions
*************************
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
-2006, 2007, 2008 Free Software Foundation, Inc.
+2006, 2007, 2008, 2009 Free Software Foundation, Inc.
- This file is free documentation; the Free Software Foundation gives
-unlimited permission to copy, distribute and modify it.
+ Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved. This file is offered as-is,
+without warranty of any kind.
Basic Installation
==================
@@ -13,7 +15,11 @@ Basic Installation
Briefly, the shell commands `./configure; make; make install' should
configure, build, and install this package. The following
more-detailed instructions are generic; see the `README' file for
-instructions specific to this package.
+instructions specific to this package. Some packages provide this
+`INSTALL' file but do not implement all of the features documented
+below. The lack of an optional feature in a given package is not
+necessarily a bug. More recommendations for GNU packages can be found
+in *note Makefile Conventions: (standards)Makefile Conventions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
@@ -42,7 +48,7 @@ may remove or edit it.
you want to change it or regenerate `configure' using a newer version
of `autoconf'.
-The simplest way to compile this package is:
+ The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system.
@@ -53,12 +59,22 @@ The simplest way to compile this package is:
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
- the package.
+ the package, generally using the just-built uninstalled binaries.
4. Type `make install' to install the programs and any data files and
- documentation.
-
- 5. You can remove the program binaries and object files from the
+ documentation. When installing into a prefix owned by root, it is
+ recommended that the package be configured and built as a regular
+ user, and only the `make install' phase executed with root
+ privileges.
+
+ 5. Optionally, type `make installcheck' to repeat any self-tests, but
+ this time using the binaries in their final installed location.
+ This target does not install anything. Running this target as a
+ regular user, particularly if the prior `make install' required
+ root privileges, verifies that the installation completed
+ correctly.
+
+ 6. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
@@ -67,8 +83,15 @@ The simplest way to compile this package is:
all sorts of other programs in order to regenerate files that came
with the distribution.
- 6. Often, you can also type `make uninstall' to remove the installed
- files again.
+ 7. Often, you can also type `make uninstall' to remove the installed
+ files again. In practice, not all packages have tested that
+ uninstallation works correctly, even though it is required by the
+ GNU Coding Standards.
+
+ 8. Some packages, particularly those that use Automake, provide `make
+ distcheck', which can by used by developers to test that all other
+ targets like `make install' and `make uninstall' work correctly.
+ This target is generally not run by end users.
Compilers and Options
=====================
@@ -93,7 +116,8 @@ same time, by placing the object files for each architecture in their
own directory. To do this, you can use GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
-source code in the directory that `configure' is in and in `..'.
+source code in the directory that `configure' is in and in `..'. This
+is known as a "VPATH" build.
With a non-GNU `make', it is safer to compile the package for one
architecture at a time in the source code directory. After you have
@@ -120,7 +144,8 @@ Installation Names
By default, `make install' installs the package's commands under
`/usr/local/bin', include files under `/usr/local/include', etc. You
can specify an installation prefix other than `/usr/local' by giving
-`configure' the option `--prefix=PREFIX'.
+`configure' the option `--prefix=PREFIX', where PREFIX must be an
+absolute file name.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
@@ -131,15 +156,46 @@ Documentation and other data files still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=DIR' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
-you can set and what kinds of files go in them.
+you can set and what kinds of files go in them. In general, the
+default for these options is expressed in terms of `${prefix}', so that
+specifying just `--prefix' will affect all of the other directory
+specifications that were not explicitly provided.
+
+ The most portable way to affect installation locations is to pass the
+correct locations to `configure'; however, many packages provide one or
+both of the following shortcuts of passing variable assignments to the
+`make install' command line to change installation locations without
+having to reconfigure or recompile.
+
+ The first method involves providing an override variable for each
+affected directory. For example, `make install
+prefix=/alternate/directory' will choose an alternate location for all
+directory configuration variables that were expressed in terms of
+`${prefix}'. Any directories that were specified during `configure',
+but not in terms of `${prefix}', must each be overridden at install
+time for the entire installation to be relocated. The approach of
+makefile variable overrides for each directory variable is required by
+the GNU Coding Standards, and ideally causes no recompilation.
+However, some platforms have known limitations with the semantics of
+shared libraries that end up requiring recompilation when using this
+method, particularly noticeable in packages that use GNU Libtool.
+
+ The second method involves providing the `DESTDIR' variable. For
+example, `make install DESTDIR=/alternate/directory' will prepend
+`/alternate/directory' before all installation names. The approach of
+`DESTDIR' overrides is not required by the GNU Coding Standards, and
+does not work on platforms that have drive letters. On the other hand,
+it does better at avoiding recompilation issues, and works well even
+when some directory options were not specified in terms of `${prefix}'
+at `configure' time.
+
+Optional Features
+=================
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
-Optional Features
-=================
-
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
@@ -152,6 +208,13 @@ find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
+ Some packages offer the ability to configure how verbose the
+execution of `make' will be. For these packages, running `./configure
+--enable-silent-rules' sets the default to minimal output, which can be
+overridden with `make V=1'; while running `./configure
+--disable-silent-rules' sets the default to verbose, which can be
+overridden with `make V=0'.
+
Particular systems
==================
@@ -159,7 +222,7 @@ Particular systems
CC is not installed, it is recommended to use the following options in
order to use an ANSI C compiler:
- ./configure CC="cc -Ae"
+ ./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
@@ -174,6 +237,16 @@ and if that doesn't work, try
./configure CC="cc -nodtk"
+ On Solaris, don't put `/usr/ucb' early in your `PATH'. This
+directory contains several dysfunctional programs; working variants of
+these programs are available in `/usr/bin'. So, if you need `/usr/ucb'
+in your `PATH', put it _after_ `/usr/bin'.
+
+ On Haiku, software installed for all users goes in `/boot/common',
+not `/usr/local'. It is recommended to use the following options:
+
+ ./configure --prefix=/boot/common
+
Specifying the System Type
==========================
@@ -189,7 +262,8 @@ type, such as `sun4', or a canonical name which has the form:
where SYSTEM can have one of these forms:
- OS KERNEL-OS
+ OS
+ KERNEL-OS
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
@@ -277,7 +351,7 @@ operates.
`configure' can determine that directory automatically.
`--prefix=DIR'
- Use DIR as the installation prefix. *Note Installation Names::
+ Use DIR as the installation prefix. *note Installation Names::
for more details, including other options available for fine-tuning
the installation locations.
diff --git a/Makefile.am b/Makefile.am
index 658f946..3853d2a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -8,7 +8,7 @@ SUBDIRS = \
libdbusmenu-gtk \
tools \
tests \
+ docs \
po
-DISTCHECK_CONFIGURE_FLAGS = --enable-introspection
-
+DISTCHECK_CONFIGURE_FLAGS = --enable-introspection --enable-gtk-doc
diff --git a/autogen.sh b/autogen.sh
index 3d22cbe..93174f5 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -9,4 +9,5 @@ which gnome-autogen.sh || {
USE_GNOME2_MACROS=1 \
USE_COMMON_DOC_BUILD=yes \
-. gnome-autogen.sh
+gnome-autogen.sh --enable-gtk-doc
+
diff --git a/configure.ac b/configure.ac
index 33ad44d..938fe84 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,11 +1,11 @@
-AC_INIT(libdbusmenu, 0.3.1, ted@canonical.com)
+AC_INIT(libdbusmenu, 0.3.2, ted@canonical.com)
AC_COPYRIGHT([Copyright 2009,2010 Canonical])
AC_PREREQ(2.62)
AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE(libdbusmenu, 0.3.1, [-Wno-portability])
+AM_INIT_AUTOMAKE(libdbusmenu, 0.3.2, [-Wno-portability])
AM_MAINTAINER_MODE
@@ -22,6 +22,13 @@ AC_CONFIG_MACRO_DIR([m4])
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
###########################
+# GTK Doc
+###########################
+
+GTK_DOC_CHECK([1.4])
+GNOME_DOC_INIT
+
+###########################
# Dependencies - GLib
###########################
@@ -119,6 +126,13 @@ libdbusmenu-gtk/dbusmenu-gtk.pc
tools/Makefile
tools/testapp/Makefile
tests/Makefile
+docs/Makefile
+docs/libdbusmenu-glib/Makefile
+docs/libdbusmenu-glib/reference/Makefile
+docs/libdbusmenu-glib/reference/version.xml
+docs/libdbusmenu-gtk/Makefile
+docs/libdbusmenu-gtk/reference/Makefile
+docs/libdbusmenu-gtk/reference/version.xml
])
###########################
diff --git a/docs/Makefile.am b/docs/Makefile.am
new file mode 100644
index 0000000..87ffe5f
--- /dev/null
+++ b/docs/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = libdbusmenu-glib libdbusmenu-gtk
diff --git a/docs/libdbusmenu-glib/Makefile.am b/docs/libdbusmenu-glib/Makefile.am
new file mode 100644
index 0000000..f3ddc22
--- /dev/null
+++ b/docs/libdbusmenu-glib/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = reference
diff --git a/docs/libdbusmenu-glib/reference/Makefile.am b/docs/libdbusmenu-glib/reference/Makefile.am
new file mode 100644
index 0000000..e8a3610
--- /dev/null
+++ b/docs/libdbusmenu-glib/reference/Makefile.am
@@ -0,0 +1,92 @@
+## Process this file with automake to produce Makefile.in
+
+# We require automake 1.6 at least.
+AUTOMAKE_OPTIONS = 1.6
+
+# This is a blank Makefile.am for using gtk-doc.
+# Copy this to your project's API docs directory and modify the variables to
+# suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples
+# of using the various options.
+
+# The name of the module, e.g. 'glib'.
+DOC_MODULE=libdbusmenu-glib
+
+# The top-level SGML file. You can change this if you want to.
+DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml
+
+# The directory containing the source code. Relative to $(srcdir).
+# gtk-doc will search all .c & .h files beneath here for inline comments
+# documenting the functions and macros.
+# e.g. DOC_SOURCE_DIR=../../../gtk
+DOC_SOURCE_DIR=../../../libdbusmenu-glib
+
+# Extra options to pass to gtkdoc-scangobj. Not normally needed.
+SCANGOBJ_OPTIONS=--nogtkinit --type-init-func="g_type_init()"
+
+# Extra options to supply to gtkdoc-scan.
+# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED"
+SCAN_OPTIONS=
+
+# Extra options to supply to gtkdoc-mkdb.
+# e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml
+MKDB_OPTIONS=--sgml-mode --output-format=xml
+
+# Extra options to supply to gtkdoc-mktmpl
+# e.g. MKTMPL_OPTIONS=--only-section-tmpl
+MKTMPL_OPTIONS=
+
+# Extra options to supply to gtkdoc-fixref. Not normally needed.
+# e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html
+FIXXREF_OPTIONS=
+
+# Used for dependencies. The docs will be rebuilt if any of these change.
+# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h
+# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c
+HFILE_GLOB=$(top_srcdir)/libdbusmenu-glib/*.h
+CFILE_GLOB=$(top_srcdir)/libdbusmenu-glib/*.c
+
+# Header files to ignore when scanning.
+# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h
+IGNORE_HFILES= \
+ menuitem-marshal.h \
+ server-marshal.h \
+ menuitem-private.h \
+ dbusmenu-client.h \
+ dbusmenu-server.h
+
+# Images to copy into HTML directory.
+# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png
+HTML_IMAGES=
+
+# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE).
+# e.g. content_files=running.sgml building.sgml changes-2.0.sgml
+content_files=version.xml
+
+# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded
+# These files must be listed here *and* in content_files
+# e.g. expand_content_files=running.sgml
+expand_content_files=
+
+# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library.
+# Only needed if you are using gtkdoc-scangobj to dynamically query widget
+# signals and properties.
+# e.g. INCLUDES=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS)
+# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib)
+INCLUDES=-I$(top_srcdir) $(DBUSMENUGLIB_CFLAGS) $(DBUSMENUGTK_CFLAGS)
+GTKDOC_LIBS=$(top_builddir)/libdbusmenu-glib/libdbusmenu-glib.la
+
+# This includes the standard gtk-doc make rules, copied by gtkdocize.
+include $(top_srcdir)/gtk-doc.local.make
+
+# Other files to distribute
+# e.g. EXTRA_DIST += version.xml.in
+EXTRA_DIST += version.xml.in
+
+# Files not to distribute
+# for --rebuild-types in $(SCAN_OPTIONS), e.g. $(DOC_MODULE).types
+# for --rebuild-sections in $(SCAN_OPTIONS) e.g. $(DOC_MODULE)-sections.txt
+#DISTCLEANFILES +=
+
+# Comment this out if you want your docs-status tested during 'make check'
+#TESTS = $(GTKDOC_CHECK)
+
diff --git a/docs/libdbusmenu-glib/reference/libdbusmenu-glib-docs.sgml b/docs/libdbusmenu-glib/reference/libdbusmenu-glib-docs.sgml
new file mode 100644
index 0000000..ecc25a3
--- /dev/null
+++ b/docs/libdbusmenu-glib/reference/libdbusmenu-glib-docs.sgml
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+ "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
+[
+ <!ENTITY % local.common.attrib "xmlns:xi CDATA #FIXED 'http://www.w3.org/2003/XInclude'">
+]>
+<book id="index">
+ <bookinfo>
+ <title>libdbusmenu-glib Reference Manual</title>
+ </bookinfo>
+
+ <chapter>
+ <title>API</title>
+ <xi:include href="xml/server.xml"/>
+ <xi:include href="xml/menuitem-proxy.xml"/>
+ <xi:include href="xml/menuitem.xml"/>
+ <xi:include href="xml/client.xml"/>
+ <xi:include href="xml/client-menuitem.xml"/>
+ <xi:include href="xml/dbusmenu-client.xml"/>
+ <xi:include href="xml/dbusmenu-server.xml"/>
+
+ </chapter>
+ <chapter id="object-tree">
+ <title>Object Hierarchy</title>
+ <xi:include href="xml/tree_index.sgml"/>
+ </chapter>
+ <index id="api-index-full">
+ <title>API Index</title>
+ <xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
+ </index>
+
+ <xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
+</book>
diff --git a/docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt b/docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt
new file mode 100644
index 0000000..0186049
--- /dev/null
+++ b/docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt
@@ -0,0 +1,157 @@
+<SECTION>
+<FILE>client</FILE>
+<TITLE>DbusmenuClient</TITLE>
+DBUSMENU_CLIENT_SIGNAL_LAYOUT_UPDATED
+DBUSMENU_CLIENT_SIGNAL_ROOT_CHANGED
+DBUSMENU_CLIENT_SIGNAL_NEW_MENUITEM
+DBUSMENU_CLIENT_PROP_DBUS_NAME
+DBUSMENU_CLIENT_PROP_DBUS_OBJECT
+DBUSMENU_CLIENT_TYPES_DEFAULT
+DBUSMENU_CLIENT_TYPES_SEPARATOR
+DBUSMENU_CLIENT_TYPES_IMAGE
+DbusmenuClient
+DbusmenuClientClass
+DbusmenuClientTypeHandler
+dbusmenu_client_new
+dbusmenu_client_get_root
+dbusmenu_client_add_type_handler
+dbusmenu_client_send_event
+dbusmenu_client_send_about_to_show
+<SUBSECTION Standard>
+DBUSMENU_CLIENT
+DBUSMENU_IS_CLIENT
+DBUSMENU_TYPE_CLIENT
+dbusmenu_client_get_type
+DBUSMENU_CLIENT_CLASS
+DBUSMENU_IS_CLIENT_CLASS
+DBUSMENU_CLIENT_GET_CLASS
+</SECTION>
+
+<SECTION>
+<FILE>menuitem</FILE>
+<TITLE>DbusmenuMenuitem</TITLE>
+DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED
+DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED
+DBUSMENU_MENUITEM_SIGNAL_CHILD_ADDED
+DBUSMENU_MENUITEM_SIGNAL_CHILD_REMOVED
+DBUSMENU_MENUITEM_SIGNAL_CHILD_MOVED
+DBUSMENU_MENUITEM_SIGNAL_REALIZED
+DBUSMENU_MENUITEM_SIGNAL_REALIZED_ID
+DBUSMENU_MENUITEM_PROP_TYPE
+DBUSMENU_MENUITEM_PROP_VISIBLE
+DBUSMENU_MENUITEM_PROP_ENABLED
+DBUSMENU_MENUITEM_PROP_LABEL
+DBUSMENU_MENUITEM_PROP_ICON_NAME
+DBUSMENU_MENUITEM_PROP_ICON_DATA
+DBUSMENU_MENUITEM_PROP_TOGGLE_TYPE
+DBUSMENU_MENUITEM_PROP_TOGGLE_STATE
+DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY
+DBUSMENU_MENUITEM_TOGGLE_CHECK
+DBUSMENU_MENUITEM_TOGGLE_RADIO
+DBUSMENU_MENUITEM_TOGGLE_STATE_UNCHECKED
+DBUSMENU_MENUITEM_TOGGLE_STATE_CHECKED
+DBUSMENU_MENUITEM_TOGGLE_STATE_UNKNOWN
+DBUSMENU_MENUITEM_ICON_NAME_BLANK
+DBUSMENU_MENUITEM_CHILD_DISPLAY_SUBMENU
+DbusmenuMenuitem
+dbusmenu_menuitem_about_to_show_cb
+dbusmenu_menuitem_buildxml_slot_t
+DbusmenuMenuitemClass
+dbusmenu_menuitem_new
+dbusmenu_menuitem_new_with_id
+dbusmenu_menuitem_get_id
+dbusmenu_menuitem_get_children
+dbusmenu_menuitem_take_children
+dbusmenu_menuitem_get_position
+dbusmenu_menuitem_get_position_realized
+dbusmenu_menuitem_child_append
+dbusmenu_menuitem_child_prepend
+dbusmenu_menuitem_child_delete
+dbusmenu_menuitem_child_add_position
+dbusmenu_menuitem_child_reorder
+dbusmenu_menuitem_child_find
+dbusmenu_menuitem_find_id
+dbusmenu_menuitem_property_set
+dbusmenu_menuitem_property_set_value
+dbusmenu_menuitem_property_set_bool
+dbusmenu_menuitem_property_set_int
+dbusmenu_menuitem_property_get
+dbusmenu_menuitem_property_get_value
+dbusmenu_menuitem_property_get_bool
+dbusmenu_menuitem_property_get_int
+dbusmenu_menuitem_property_exist
+dbusmenu_menuitem_properties_list
+dbusmenu_menuitem_properties_copy
+dbusmenu_menuitem_property_remove
+dbusmenu_menuitem_set_root
+dbusmenu_menuitem_get_root
+dbusmenu_menuitem_foreach
+dbusmenu_menuitem_handle_event
+dbusmenu_menuitem_send_about_to_show
+<SUBSECTION Standard>
+DBUSMENU_MENUITEM
+DBUSMENU_IS_MENUITEM
+DBUSMENU_TYPE_MENUITEM
+dbusmenu_menuitem_get_type
+DBUSMENU_MENUITEM_CLASS
+DBUSMENU_IS_MENUITEM_CLASS
+DBUSMENU_MENUITEM_GET_CLASS
+</SECTION>
+
+<SECTION>
+<FILE>server</FILE>
+<TITLE>DbusmenuServer</TITLE>
+DBUSMENU_SERVER_SIGNAL_ID_PROP_UPDATE
+DBUSMENU_SERVER_SIGNAL_ID_UPDATE
+DBUSMENU_SERVER_SIGNAL_LAYOUT_UPDATED
+DBUSMENU_SERVER_SIGNAL_LAYOUT_UPDATE
+DBUSMENU_SERVER_PROP_DBUS_OBJECT
+DBUSMENU_SERVER_PROP_ROOT_NODE
+DBUSMENU_SERVER_PROP_VERSION
+DbusmenuServer
+DbusmenuServerClass
+dbusmenu_server_new
+dbusmenu_server_set_root
+<SUBSECTION Standard>
+DBUSMENU_SERVER
+DBUSMENU_IS_SERVER
+DBUSMENU_TYPE_SERVER
+dbusmenu_server_get_type
+DBUSMENU_SERVER_CLASS
+DBUSMENU_IS_SERVER_CLASS
+DBUSMENU_SERVER_GET_CLASS
+</SECTION>
+
+<SECTION>
+<FILE>client-menuitem</FILE>
+<TITLE>DbusmenuClientMenuitem</TITLE>
+DBUSMENU_CLIENT_MENUITEM_TYPE
+DbusmenuClientMenuitem
+DbusmenuClientMenuitemClass
+dbusmenu_client_menuitem_new
+<SUBSECTION Standard>
+DBUSMENU_CLIENT_MENUITEM
+DBUSMENU_IS_CLIENT_MENUITEM
+dbusmenu_client_menuitem_get_type
+DBUSMENU_CLIENT_MENUITEM_CLASS
+DBUSMENU_IS_CLIENT_MENUITEM_CLASS
+DBUSMENU_CLIENT_MENUITEM_GET_CLASS
+</SECTION>
+
+<SECTION>
+<FILE>menuitem-proxy</FILE>
+<TITLE>DbusmenuMenuitemProxy</TITLE>
+DbusmenuMenuitemProxy
+DbusmenuMenuitemProxyClass
+dbusmenu_menuitem_proxy_new
+dbusmenu_menuitem_proxy_get_wrapped
+<SUBSECTION Standard>
+DBUSMENU_MENUITEM_PROXY
+DBUSMENU_IS_MENUITEM_PROXY
+DBUSMENU_TYPE_MENUITEM_PROXY
+dbusmenu_menuitem_proxy_get_type
+DBUSMENU_MENUITEM_PROXY_CLASS
+DBUSMENU_IS_MENUITEM_PROXY_CLASS
+DBUSMENU_MENUITEM_PROXY_GET_CLASS
+</SECTION>
+
diff --git a/docs/libdbusmenu-glib/reference/tmpl/dummy.sgml b/docs/libdbusmenu-glib/reference/tmpl/dummy.sgml
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/docs/libdbusmenu-glib/reference/tmpl/dummy.sgml
diff --git a/docs/libdbusmenu-glib/reference/version.xml.in b/docs/libdbusmenu-glib/reference/version.xml.in
new file mode 100644
index 0000000..d78bda9
--- /dev/null
+++ b/docs/libdbusmenu-glib/reference/version.xml.in
@@ -0,0 +1 @@
+@VERSION@
diff --git a/docs/libdbusmenu-gtk/Makefile.am b/docs/libdbusmenu-gtk/Makefile.am
new file mode 100644
index 0000000..f3ddc22
--- /dev/null
+++ b/docs/libdbusmenu-gtk/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = reference
diff --git a/docs/libdbusmenu-gtk/reference/Makefile.am b/docs/libdbusmenu-gtk/reference/Makefile.am
new file mode 100644
index 0000000..ec1bd28
--- /dev/null
+++ b/docs/libdbusmenu-gtk/reference/Makefile.am
@@ -0,0 +1,87 @@
+## Process this file with automake to produce Makefile.in
+
+# We require automake 1.6 at least.
+AUTOMAKE_OPTIONS = 1.6
+
+# This is a blank Makefile.am for using gtk-doc.
+# Copy this to your project's API docs directory and modify the variables to
+# suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples
+# of using the various options.
+
+# The name of the module, e.g. 'glib'.
+DOC_MODULE=libdbusmenu-gtk
+
+# The top-level SGML file. You can change this if you want to.
+DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml
+
+# The directory containing the source code. Relative to $(srcdir).
+# gtk-doc will search all .c & .h files beneath here for inline comments
+# documenting the functions and macros.
+# e.g. DOC_SOURCE_DIR=../../../gtk
+DOC_SOURCE_DIR=../../../libdbusmenu-gtk
+
+# Extra options to pass to gtkdoc-scangobj. Not normally needed.
+SCANGOBJ_OPTIONS=--nogtkinit --type-init-func="g_type_init()"
+
+# Extra options to supply to gtkdoc-scan.
+# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED"
+SCAN_OPTIONS=
+
+# Extra options to supply to gtkdoc-mkdb.
+# e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml
+MKDB_OPTIONS=--sgml-mode --output-format=xml
+
+# Extra options to supply to gtkdoc-mktmpl
+# e.g. MKTMPL_OPTIONS=--only-section-tmpl
+MKTMPL_OPTIONS=
+
+# Extra options to supply to gtkdoc-fixref. Not normally needed.
+# e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html
+FIXXREF_OPTIONS=
+
+# Used for dependencies. The docs will be rebuilt if any of these change.
+# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h
+# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c
+HFILE_GLOB=$(top_srcdir)/libdbusmenu-gtk/*.h
+CFILE_GLOB=$(top_srcdir)/libdbusmenu-gtk/*.c
+
+# Header files to ignore when scanning.
+# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h
+IGNORE_HFILES=
+
+# Images to copy into HTML directory.
+# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png
+HTML_IMAGES=
+
+# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE).
+# e.g. content_files=running.sgml building.sgml changes-2.0.sgml
+content_files=version.xml
+
+# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded
+# These files must be listed here *and* in content_files
+# e.g. expand_content_files=running.sgml
+expand_content_files=
+
+# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library.
+# Only needed if you are using gtkdoc-scangobj to dynamically query widget
+# signals and properties.
+# e.g. INCLUDES=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS)
+# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib)
+INCLUDES=-I$(top_srcdir) $(DBUSMENUGLIB_CFLAGS) $(DBUSMENUGTK_CFLAGS)
+GTKDOC_LIBS=$(top_builddir)/libdbusmenu-gtk/libdbusmenu-gtk.la
+
+# This includes the standard gtk-doc make rules, copied by gtkdocize.
+include $(top_srcdir)/gtk-doc.local.make
+
+# Other files to distribute
+# e.g. EXTRA_DIST += version.xml.in
+EXTRA_DIST += version.xml.in
+
+# Files not to distribute
+# for --rebuild-types in $(SCAN_OPTIONS), e.g. $(DOC_MODULE).types
+# for --rebuild-sections in $(SCAN_OPTIONS) e.g. $(DOC_MODULE)-sections.txt
+#DISTCLEANFILES +=
+
+# Comment this out if you want your docs-status tested during 'make check'
+#TESTS = $(GTKDOC_CHECK)
+
diff --git a/docs/libdbusmenu-gtk/reference/libdbusmenu-gtk-docs.sgml b/docs/libdbusmenu-gtk/reference/libdbusmenu-gtk-docs.sgml
new file mode 100644
index 0000000..ae9ab07
--- /dev/null
+++ b/docs/libdbusmenu-gtk/reference/libdbusmenu-gtk-docs.sgml
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+ "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
+[
+ <!ENTITY % local.common.attrib "xmlns:xi CDATA #FIXED 'http://www.w3.org/2003/XInclude'">
+]>
+<book id="index">
+ <bookinfo>
+ <title>libdbusmenu-gtk Reference Manual</title>
+ </bookinfo>
+
+ <chapter>
+ <title>API</title>
+ <xi:include href="xml/menu.xml"/>
+ <xi:include href="xml/client.xml"/>
+ <xi:include href="xml/genericmenuitem.xml"/>
+ <xi:include href="xml/menuitem.xml"/>
+
+ </chapter>
+ <chapter id="object-tree">
+ <title>Object Hierarchy</title>
+ <xi:include href="xml/tree_index.sgml"/>
+ </chapter>
+ <index id="api-index-full">
+ <title>API Index</title>
+ <xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
+ </index>
+
+ <xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
+</book>
diff --git a/docs/libdbusmenu-gtk/reference/tmpl/dummy.sgml b/docs/libdbusmenu-gtk/reference/tmpl/dummy.sgml
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/docs/libdbusmenu-gtk/reference/tmpl/dummy.sgml
diff --git a/docs/libdbusmenu-gtk/reference/version.xml.in b/docs/libdbusmenu-gtk/reference/version.xml.in
new file mode 100644
index 0000000..d78bda9
--- /dev/null
+++ b/docs/libdbusmenu-gtk/reference/version.xml.in
@@ -0,0 +1 @@
+@VERSION@
diff --git a/gtk-doc.local.make b/gtk-doc.local.make
new file mode 100644
index 0000000..3dcda60
--- /dev/null
+++ b/gtk-doc.local.make
@@ -0,0 +1,194 @@
+# -*- mode: makefile -*-
+
+####################################
+# Everything below here is generic #
+####################################
+
+if GTK_DOC_USE_LIBTOOL
+GTKDOC_CC = $(LIBTOOL) --mode=compile $(CC) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+GTKDOC_LD = $(LIBTOOL) --mode=link $(CC) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS)
+GTKDOC_RUN = $(LIBTOOL) --mode=execute
+else
+GTKDOC_CC = $(CC) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+GTKDOC_LD = $(CC) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS)
+GTKDOC_RUN = sh -c
+endif
+
+# We set GPATH here; this gives us semantics for GNU make
+# which are more like other make's VPATH, when it comes to
+# whether a source that is a target of one rule is then
+# searched for in VPATH/GPATH.
+#
+GPATH = $(srcdir)
+
+TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)
+
+EXTRA_DIST = \
+ $(content_files) \
+ $(HTML_IMAGES) \
+ $(DOC_MAIN_SGML_FILE)
+
+DOC_STAMPS=scan-build.stamp tmpl-build.stamp sgml-build.stamp html-build.stamp \
+ $(srcdir)/tmpl.stamp $(srcdir)/sgml.stamp $(srcdir)/html.stamp
+
+SCANOBJ_FILES = \
+ $(DOC_MODULE).args \
+ $(DOC_MODULE).hierarchy \
+ $(DOC_MODULE).interfaces \
+ $(DOC_MODULE).prerequisites \
+ $(DOC_MODULE).signals
+
+REPORT_FILES = \
+ $(DOC_MODULE)-undocumented.txt \
+ $(DOC_MODULE)-undeclared.txt \
+ $(DOC_MODULE)-unused.txt
+
+CLEANFILES = $(SCANOBJ_FILES) $(REPORT_FILES) $(DOC_STAMPS)
+
+if ENABLE_GTK_DOC
+all-local: html-build.stamp
+else
+all-local:
+endif
+
+docs: html-build.stamp
+
+$(REPORT_FILES): sgml-build.stamp
+
+#### scan ####
+
+scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB)
+ @echo 'gtk-doc: Scanning header files'
+ @-chmod -R u+w $(srcdir)
+ cd $(srcdir) && \
+ gtkdoc-scan --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="$(IGNORE_HFILES)" $(SCAN_OPTIONS) $(EXTRA_HFILES)
+ if grep -l '^..*$$' $(srcdir)/$(DOC_MODULE).types > /dev/null 2>&1 ; then \
+ CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" RUN="$(GTKDOC_RUN)" CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS)" LDFLAGS="$(GTKDOC_LIBS) $(LDFLAGS)" gtkdoc-scangobj $(SCANGOBJ_OPTIONS) --module=$(DOC_MODULE) --output-dir=$(srcdir) ; \
+ else \
+ cd $(srcdir) ; \
+ for i in $(SCANOBJ_FILES) ; do \
+ test -f $$i || touch $$i ; \
+ done \
+ fi
+ touch scan-build.stamp
+
+$(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt: scan-build.stamp
+ @true
+
+#### templates ####
+
+tmpl-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt
+ @echo 'gtk-doc: Rebuilding template files'
+ @-chmod -R u+w $(srcdir)
+ cd $(srcdir) && gtkdoc-mktmpl --module=$(DOC_MODULE) $(MKTMPL_OPTIONS)
+ touch tmpl-build.stamp
+
+tmpl.stamp: tmpl-build.stamp
+ @true
+
+tmpl/*.sgml:
+ @true
+
+
+#### xml ####
+
+sgml-build.stamp: tmpl.stamp $(HFILE_GLOB) $(CFILE_GLOB) $(DOC_MODULE)-sections.txt $(srcdir)/tmpl/*.sgml $(expand_content_files)
+ @echo 'gtk-doc: Building XML'
+ @-chmod -R u+w $(srcdir)
+ cd $(srcdir) && \
+ gtkdoc-mkdb --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --output-format=xml --expand-content-files="$(expand_content_files)" --main-sgml-file=$(DOC_MAIN_SGML_FILE) $(MKDB_OPTIONS)
+ touch sgml-build.stamp
+
+sgml.stamp: sgml-build.stamp
+ @true
+
+#### html ####
+
+html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
+ @echo 'gtk-doc: Building HTML'
+ @-chmod -R u+w $(srcdir)
+ rm -rf $(srcdir)/html
+ mkdir $(srcdir)/html
+ mkhtml_options=""; \
+ gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-path"; \
+ if test "$(?)" = "0"; then \
+ mkhtml_options=--path="$(srcdir)"; \
+ fi
+ cd $(srcdir)/html && gtkdoc-mkhtml $(mkhtml_options) $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE)
+ test "x$(HTML_IMAGES)" = "x" || ( cd $(srcdir) && cp $(HTML_IMAGES) html )
+ @echo 'gtk-doc: Fixing cross-references'
+ cd $(srcdir) && gtkdoc-fixxref --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
+ touch html-build.stamp
+
+##############
+
+clean-local:
+ rm -f *~ *.bak
+ rm -rf .libs
+
+distclean-local:
+ cd $(srcdir) && \
+ rm -rf xml $(REPORT_FILES) \
+ $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
+
+maintainer-clean-local: clean
+ cd $(srcdir) && rm -rf xml html
+
+install-data-local:
+ installfiles=`echo $(srcdir)/html/*`; \
+ if test "$$installfiles" = '$(srcdir)/html/*'; \
+ then echo '-- Nothing to install' ; \
+ else \
+ if test -n "$(DOC_MODULE_VERSION)"; then \
+ installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \
+ else \
+ installdir="$(DESTDIR)$(TARGET_DIR)"; \
+ fi; \
+ $(mkinstalldirs) $${installdir} ; \
+ for i in $$installfiles; do \
+ echo '-- Installing '$$i ; \
+ $(INSTALL_DATA) $$i $${installdir}; \
+ done; \
+ if test -n "$(DOC_MODULE_VERSION)"; then \
+ mv -f $${installdir}/$(DOC_MODULE).devhelp2 \
+ $${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp2; \
+ mv -f $${installdir}/$(DOC_MODULE).devhelp \
+ $${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp; \
+ fi; \
+ ! which gtkdoc-rebase >/dev/null 2>&1 || \
+ gtkdoc-rebase --relative --dest-dir=$(DESTDIR) --html-dir=$${installdir} ; \
+ fi
+
+uninstall-local:
+ if test -n "$(DOC_MODULE_VERSION)"; then \
+ installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \
+ else \
+ installdir="$(DESTDIR)$(TARGET_DIR)"; \
+ fi; \
+ rm -rf $${installdir}
+
+#
+# Require gtk-doc when making dist
+#
+if ENABLE_GTK_DOC
+dist-check-gtkdoc:
+else
+dist-check-gtkdoc:
+ @echo "*** gtk-doc must be installed and enabled in order to make dist"
+ @false
+endif
+
+dist-hook: dist-check-gtkdoc dist-hook-local
+ mkdir $(distdir)/tmpl
+ mkdir $(distdir)/xml
+ mkdir $(distdir)/html
+ -cp $(srcdir)/tmpl/*.sgml $(distdir)/tmpl
+ -cp $(srcdir)/xml/*.xml $(distdir)/xml
+ -cp $(srcdir)/html/* $(distdir)/html
+ -cp $(srcdir)/$(DOC_MODULE).types $(distdir)/
+ -cp $(srcdir)/$(DOC_MODULE)-sections.txt $(distdir)/
+ cd $(distdir) && rm -f $(DISTCLEANFILES)
+ ! which gtkdoc-rebase >/dev/null 2>&1 || \
+ gtkdoc-rebase --online --relative --html-dir=$(distdir)/html
+
+.PHONY : dist-hook-local docs
diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c
index c0d3b7a..fa233a4 100644
--- a/libdbusmenu-glib/client.c
+++ b/libdbusmenu-glib/client.c
@@ -30,6 +30,8 @@ License version 3 and version 2.1 along with this program. If not, see
#include "config.h"
#endif
+#include <dbus/dbus-glib-bindings.h>
+
#include <libxml/parser.h>
#include <libxml/tree.h>
@@ -397,6 +399,25 @@ dbus_owner_change (DBusGProxy * proxy, const gchar * name, const gchar * prev, c
return build_proxies(client);
}
+/* This is the response to see if the name has an owner. If
+ it does, then we should build the proxies here. Race condition
+ check. */
+static void
+name_owner_check (DBusGProxy *proxy, gboolean has_owner, GError *error, gpointer userdata)
+{
+ if (error != NULL) {
+ return;
+ }
+
+ if (!has_owner) {
+ return;
+ }
+
+ DbusmenuClient * client = DBUSMENU_CLIENT(userdata);
+ build_proxies(client);
+ return;
+}
+
/* This function builds the DBus proxy which will look out for
the service coming up. */
static void
@@ -426,6 +447,13 @@ build_dbus_proxy (DbusmenuClient * client)
dbus_g_proxy_connect_signal(priv->dbusproxy, "NameOwnerChanged",
G_CALLBACK(dbus_owner_change), client, NULL);
+ /* Now let's check to make sure we're not in some race
+ condition case. */
+ org_freedesktop_DBus_name_has_owner_async(priv->dbusproxy,
+ priv->dbus_name,
+ name_owner_check,
+ client);
+
return;
}
diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c
index 93c7d38..623539c 100644
--- a/libdbusmenu-glib/menuitem.c
+++ b/libdbusmenu-glib/menuitem.c
@@ -517,6 +517,9 @@ dbusmenu_menuitem_take_children (DbusmenuMenuitem * mi)
GList * children = priv->children;
priv->children = NULL;
g_list_foreach(children, take_children_signal, mi);
+
+ dbusmenu_menuitem_property_remove(mi, DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY);
+
return children;
}
@@ -622,6 +625,10 @@ dbusmenu_menuitem_child_append (DbusmenuMenuitem * mi, DbusmenuMenuitem * child)
DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi);
g_return_val_if_fail(g_list_find(priv->children, child) == NULL, FALSE);
+ if (priv->children == NULL && !dbusmenu_menuitem_property_exist(mi, DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY)) {
+ dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY, DBUSMENU_MENUITEM_CHILD_DISPLAY_SUBMENU);
+ }
+
priv->children = g_list_append(priv->children, child);
#ifdef MASSIVEDEBUGGING
g_debug("Menuitem %d (%s) signalling child added %d (%s) at %d", ID(mi), LABEL(mi), ID(child), LABEL(child), g_list_length(priv->children) - 1);
@@ -650,6 +657,10 @@ dbusmenu_menuitem_child_prepend (DbusmenuMenuitem * mi, DbusmenuMenuitem * child
DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi);
g_return_val_if_fail(g_list_find(priv->children, child) == NULL, FALSE);
+ if (priv->children == NULL && !dbusmenu_menuitem_property_exist(mi, DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY)) {
+ dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY, DBUSMENU_MENUITEM_CHILD_DISPLAY_SUBMENU);
+ }
+
priv->children = g_list_prepend(priv->children, child);
#ifdef MASSIVEDEBUGGING
g_debug("Menuitem %d (%s) signalling child added %d (%s) at %d", ID(mi), LABEL(mi), ID(child), LABEL(child), 0);
@@ -683,6 +694,11 @@ dbusmenu_menuitem_child_delete (DbusmenuMenuitem * mi, DbusmenuMenuitem * child)
#endif
g_signal_emit(G_OBJECT(mi), signals[CHILD_REMOVED], 0, child, TRUE);
g_object_unref(G_OBJECT(child));
+
+ if (priv->children == NULL) {
+ dbusmenu_menuitem_property_remove(mi, DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY);
+ }
+
return TRUE;
}
@@ -707,6 +723,10 @@ dbusmenu_menuitem_child_add_position (DbusmenuMenuitem * mi, DbusmenuMenuitem *
DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi);
g_return_val_if_fail(g_list_find(priv->children, child) == NULL, FALSE);
+ if (priv->children == NULL && !dbusmenu_menuitem_property_exist(mi, DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY)) {
+ dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY, DBUSMENU_MENUITEM_CHILD_DISPLAY_SUBMENU);
+ }
+
priv->children = g_list_insert(priv->children, child, position);
#ifdef MASSIVEDEBUGGING
g_debug("Menuitem %d (%s) signalling child added %d (%s) at %d", ID(mi), LABEL(mi), ID(child), LABEL(child), position);
diff --git a/libdbusmenu-glib/menuitem.h b/libdbusmenu-glib/menuitem.h
index 77997ba..e17d851 100644
--- a/libdbusmenu-glib/menuitem.h
+++ b/libdbusmenu-glib/menuitem.h
@@ -59,6 +59,7 @@ G_BEGIN_DECLS
#define DBUSMENU_MENUITEM_PROP_TOGGLE_TYPE "toggle-type"
#define DBUSMENU_MENUITEM_PROP_TOGGLE_STATE "toggle-state"
#define DBUSMENU_MENUITEM_PROP_SHORTCUT "shortcut"
+#define DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY "children-display"
#define DBUSMENU_MENUITEM_TOGGLE_CHECK "checkmark"
#define DBUSMENU_MENUITEM_TOGGLE_RADIO "radio"
@@ -74,6 +75,7 @@ G_BEGIN_DECLS
#define DBUSMENU_MENUITEM_SHORTCUT_SHIFT "Shift"
#define DBUSMENU_MENUITEM_SHORTCUT_SUPER "Super"
+#define DBUSMENU_MENUITEM_CHILD_DISPLAY_SUBMENU "submenu"
/**
* DbusmenuMenuitem:
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 356146f..66f286b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -8,6 +8,7 @@ TESTS = \
test-glib-proxy \
test-glib-simple-items \
test-gtk-objects-test \
+ test-glib-submenu \
test-gtk-label \
test-gtk-shortcut \
test-gtk-reorder
@@ -23,6 +24,8 @@ check_PROGRAMS = \
test-glib-proxy-server \
test-glib-proxy-proxy \
test-gtk-objects \
+ test-glib-submenu-client \
+ test-glib-submenu-server \
test-gtk-label-client \
test-gtk-label-server \
test-gtk-shortcut-client \
@@ -80,6 +83,38 @@ test_glib_layout_client_LDADD = \
../libdbusmenu-glib/libdbusmenu-glib.la \
$(DBUSMENUGLIB_LIBS)
+######################
+# Test Glib Submenu
+######################
+
+test-glib-submenu: test-glib-submenu-client test-glib-submenu-server Makefile.am
+ @echo "#!/bin/bash" > $@
+ @echo $(DBUS_RUNNER) --task ./test-glib-submenu-client --task-name Client --task ./test-glib-submenu-server --task-name Server --ignore-return >> $@
+ @chmod +x $@
+
+test_glib_submenu_server_SOURCES = \
+ test-glib-submenu.h \
+ test-glib-submenu-server.c
+
+test_glib_submenu_server_CFLAGS = \
+ -I $(srcdir)/.. \
+ $(DBUSMENUGLIB_CFLAGS) -Wall -Werror
+
+test_glib_submenu_server_LDADD = \
+ ../libdbusmenu-glib/libdbusmenu-glib.la \
+ $(DBUSMENUGLIB_LIBS)
+
+test_glib_submenu_client_SOURCES = \
+ test-glib-submenu.h \
+ test-glib-submenu-client.c
+
+test_glib_submenu_client_CFLAGS = \
+ -I $(srcdir)/.. \
+ $(DBUSMENUGLIB_CFLAGS) -Wall -Werror
+
+test_glib_submenu_client_LDADD = \
+ ../libdbusmenu-glib/libdbusmenu-glib.la \
+ $(DBUSMENUGLIB_LIBS)
######################
# Test Glib Object
diff --git a/tests/test-glib-submenu-client.c b/tests/test-glib-submenu-client.c
new file mode 100644
index 0000000..57762cd
--- /dev/null
+++ b/tests/test-glib-submenu-client.c
@@ -0,0 +1,119 @@
+/*
+A test for libdbusmenu to ensure its quality.
+
+Copyright 2009 Canonical Ltd.
+
+Authors:
+ Ted Gould <ted@canonical.com>
+
+This program is free software: you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 3, as published
+by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranties of
+MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <glib.h>
+
+#include <libdbusmenu-glib/client.h>
+#include <libdbusmenu-glib/menuitem.h>
+
+#include "test-glib-submenu.h"
+
+static guint layouton = 0;
+static GMainLoop * mainloop = NULL;
+static gboolean passed = TRUE;
+
+static void
+realization (DbusmenuMenuitem * mi)
+{
+ const gchar * value;
+ gboolean original = passed;
+
+ value = dbusmenu_menuitem_property_get(mi, DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY);
+
+ if (layouton % 2 == 0) {
+ if (value == NULL) {
+ passed = FALSE;
+ }
+ } else {
+ if (value != NULL) {
+ passed = FALSE;
+ }
+ }
+
+ if (original != passed) {
+ g_debug("Oops, this is where we failed");
+ }
+
+ return;
+}
+
+static void
+layout_updated (DbusmenuClient * client, gpointer data)
+{
+ g_debug("Layout Updated");
+
+ DbusmenuMenuitem * menuroot = dbusmenu_client_get_root(client);
+ if (menuroot == NULL) {
+ g_debug("Root is NULL?");
+ return;
+ }
+
+ GList * children = dbusmenu_menuitem_get_children(menuroot);
+ if (children == NULL) {
+ g_debug("No Children on root -- fail");
+ passed = FALSE;
+ } else {
+ for (; children != NULL; children = g_list_next(children)) {
+ g_signal_connect(G_OBJECT(children->data), DBUSMENU_MENUITEM_SIGNAL_REALIZED, G_CALLBACK(realization), NULL);
+ }
+ }
+
+ layouton++;
+
+ if (layouts[layouton].id == -1) {
+ g_main_loop_quit(mainloop);
+ }
+
+ return;
+}
+
+static gboolean
+timer_func (gpointer data)
+{
+ g_debug("Death timer. Oops. Got to: %d", layouton);
+ passed = FALSE;
+ g_main_loop_quit(mainloop);
+ return FALSE;
+}
+
+int
+main (int argc, char ** argv)
+{
+ g_type_init();
+
+ DbusmenuClient * client = dbusmenu_client_new("org.dbusmenu.test", "/org/test");
+ g_signal_connect(G_OBJECT(client), DBUSMENU_CLIENT_SIGNAL_LAYOUT_UPDATED, G_CALLBACK(layout_updated), NULL);
+
+ g_timeout_add_seconds(10, timer_func, client);
+
+ mainloop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(mainloop);
+
+ g_object_unref(G_OBJECT(client));
+
+ if (passed) {
+ g_debug("Quiting");
+ return 0;
+ } else {
+ g_debug("Quiting as we're a failure");
+ return 1;
+ }
+}
diff --git a/tests/test-glib-submenu-server.c b/tests/test-glib-submenu-server.c
new file mode 100644
index 0000000..68f7004
--- /dev/null
+++ b/tests/test-glib-submenu-server.c
@@ -0,0 +1,109 @@
+/*
+A test for libdbusmenu to ensure its quality.
+
+Copyright 2009 Canonical Ltd.
+
+Authors:
+ Ted Gould <ted@canonical.com>
+
+This program is free software: you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 3, as published
+by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranties of
+MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <glib.h>
+
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
+#include <dbus/dbus-glib-lowlevel.h>
+#include <dbus/dbus-glib-bindings.h>
+
+#include <libdbusmenu-glib/server.h>
+#include <libdbusmenu-glib/menuitem.h>
+
+#include "test-glib-submenu.h"
+
+
+static DbusmenuMenuitem *
+layout2menuitem (layout_t * layout)
+{
+ if (layout == NULL || layout->id == 0) return NULL;
+
+ DbusmenuMenuitem * local = dbusmenu_menuitem_new_with_id(layout->id);
+
+ if (layout->submenu != NULL) {
+ guint count;
+ for (count = 0; layout->submenu[count].id != -1; count++) {
+ DbusmenuMenuitem * child = layout2menuitem(&layout->submenu[count]);
+ if (child != NULL) {
+ dbusmenu_menuitem_child_append(local, child);
+ }
+ }
+ }
+
+ /* g_debug("Layout to menu return: 0x%X", (unsigned int)local); */
+ return local;
+}
+
+static guint layouton = 0;
+static DbusmenuServer * server = NULL;
+static GMainLoop * mainloop = NULL;
+
+static gboolean
+timer_func (gpointer data)
+{
+ if (layouts[layouton].id == -1) {
+ g_main_loop_quit(mainloop);
+ return FALSE;
+ }
+ g_debug("Updating to Layout %d", layouton);
+
+ dbusmenu_server_set_root(server, layout2menuitem(&layouts[layouton]));
+ layouton++;
+
+ return TRUE;
+}
+
+int
+main (int argc, char ** argv)
+{
+ GError * error = NULL;
+
+ g_type_init();
+
+ DBusGConnection * connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL);
+ g_debug("DBus ID: %s", dbus_connection_get_server_id(dbus_g_connection_get_connection(dbus_g_bus_get(DBUS_BUS_SESSION, NULL))));
+
+ DBusGProxy * bus_proxy = dbus_g_proxy_new_for_name(connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS);
+ guint nameret = 0;
+
+ if (!org_freedesktop_DBus_request_name(bus_proxy, "org.dbusmenu.test", 0, &nameret, &error)) {
+ g_error("Unable to call to request name");
+ return 1;
+ }
+
+ if (nameret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
+ g_error("Unable to get name");
+ return 1;
+ }
+
+ server = dbusmenu_server_new("/org/test");
+
+ timer_func(NULL);
+ g_timeout_add(2500, timer_func, NULL);
+
+ mainloop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(mainloop);
+
+ g_debug("Quiting");
+
+ return 0;
+}
diff --git a/tests/test-glib-submenu.h b/tests/test-glib-submenu.h
new file mode 100644
index 0000000..f585d1b
--- /dev/null
+++ b/tests/test-glib-submenu.h
@@ -0,0 +1,54 @@
+/*
+A test for libdbusmenu to ensure its quality.
+
+Copyright 2009 Canonical Ltd.
+
+Authors:
+ Ted Gould <ted@canonical.com>
+
+This program is free software: you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 3, as published
+by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranties of
+MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+typedef struct _layout_t layout_t;
+struct _layout_t {
+ gint id;
+ layout_t * submenu;
+};
+
+layout_t submenu_l2[] = {
+ {id: 6, submenu: NULL},
+ {id: 7, submenu: NULL},
+ {id: 8, submenu: NULL},
+ {id: -1, submenu: NULL}
+};
+
+layout_t submenu[] = {
+ {id: 2, submenu: submenu_l2},
+ {id: 3, submenu: submenu_l2},
+ {id: -1, submenu: NULL}
+};
+
+layout_t no_submenu[] = {
+ {id: 4, submenu: NULL},
+ {id: 5, submenu: NULL},
+ {id: -1, submenu: NULL}
+};
+
+layout_t layouts[] = {
+ {id: 1, submenu: no_submenu},
+ {id: 1, submenu: submenu},
+ {id: 1, submenu: no_submenu},
+ {id: 1, submenu: submenu},
+ {id: -1, submenu: NULL}
+};
+