aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.bzrignore3
-rw-r--r--Makefile.am2
-rw-r--r--configure.ac1
-rw-r--r--libdbusmenu-glib/menuitem.c6
-rw-r--r--libdbusmenu-glib/menuitem.h3
-rw-r--r--tests/Makefile.am24
-rw-r--r--tests/glib-server-nomenu.c18
7 files changed, 56 insertions, 1 deletions
diff --git a/.bzrignore b/.bzrignore
index 97954e9..7728c51 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -23,3 +23,6 @@ libdbusmenu_glib_la-server.lo
server-marshal.c
server-marshal.h
libdbusmenu_glib_la-server-marshal.lo
+.deps
+.libs
+glib-server-nomenu
diff --git a/Makefile.am b/Makefile.am
index 2527ed6..6f3f6f1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,3 +1,3 @@
-SUBDIRS = libdbusmenu-glib libdbusmenu-gtk libdbusmenu-qt
+SUBDIRS = libdbusmenu-glib libdbusmenu-gtk libdbusmenu-qt tests
diff --git a/configure.ac b/configure.ac
index 47f750a..96b23fc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -69,6 +69,7 @@ libdbusmenu-gtk/Makefile
libdbusmenu-gtk/dbusmenu-gtk.pc
libdbusmenu-qt/Makefile
libdbusmenu-qt/dbusmenu-qt.pc
+tests/Makefile
])
###########################
diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c
index 4187adc..b2f64f6 100644
--- a/libdbusmenu-glib/menuitem.c
+++ b/libdbusmenu-glib/menuitem.c
@@ -66,6 +66,12 @@ dbusmenu_menuitem_finalize (GObject *object)
}
/* Public interface */
+DbusmenuMenuitem *
+dbusmenu_menuitem_new (void)
+{
+ return g_object_new(DBUSMENU_TYPE_MENUITEM, NULL);
+}
+
guint
dbusmenu_menuitem_get_id (DbusmenuMenuitem * mi)
{
diff --git a/libdbusmenu-glib/menuitem.h b/libdbusmenu-glib/menuitem.h
index 15a07a5..daeee50 100644
--- a/libdbusmenu-glib/menuitem.h
+++ b/libdbusmenu-glib/menuitem.h
@@ -43,6 +43,9 @@ struct _DbusmenuMenuitem
GType dbusmenu_menuitem_get_type (void);
+DbusmenuMenuitem * dbusmenu_menuitem_new (void);
+guint dbusmenu_menuitem_get_id (DbusmenuMenuitem * mi);
+
GList * dbusmenu_menuitem_get_children (DbusmenuMenuitem * mi);
guint dbusmenu_menuitem_get_position (DbusmenuMenuitem * mi, DbusmenuMenuitem * parent);
diff --git a/tests/Makefile.am b/tests/Makefile.am
new file mode 100644
index 0000000..3c58cf0
--- /dev/null
+++ b/tests/Makefile.am
@@ -0,0 +1,24 @@
+
+libexec_PROGRAMS = \
+ glib-server-nomenu
+
+glib_server_nomenu_SOURCES = \
+ glib-server-nomenu.c
+
+glib_server_nomenu_CFLAGS = \
+ -I $(srcdir)/.. \
+ $(DBUSMENUGLIB_CFLAGS) -Wall -Werror
+
+glib_server_nomenu_LDADD = \
+ ../libdbusmenu-glib/libdbusmenu-glib.la \
+ $(DBUSMENUGLIB_LIBS)
+
+
+
+
+examplesdir = $(docdir)/examples/
+
+examples_DATA = \
+ $(glib_server_nomenu_SOURCES)
+
+EXTRA_DIST = $(examples_DATA)
diff --git a/tests/glib-server-nomenu.c b/tests/glib-server-nomenu.c
new file mode 100644
index 0000000..36aac3e
--- /dev/null
+++ b/tests/glib-server-nomenu.c
@@ -0,0 +1,18 @@
+#include <glib.h>
+
+#include <libdbusmenu-glib/server.h>
+#include <libdbusmenu-glib/menuitem.h>
+
+int
+main (int argc, char ** argv)
+{
+ g_type_init();
+
+ DbusmenuServer * server = dbusmenu_server_new("/org/test");
+ DbusmenuMenuitem * menuitem = dbusmenu_menuitem_new();
+ dbusmenu_server_set_root(server, menuitem);
+
+ g_main_loop_run(g_main_loop_new(NULL, FALSE));
+
+ return 0;
+}