diff --git a/ChangeLog b/ChangeLog index 59432491140885c09ecbcbc3230712e5a564132e..831218c758211441450ad8a72ebaf080d905afb1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-03-23 Jannis Pohlmann <jannis@xfce.org> + + * docs/reference/tmpl/: Remove tdb related files from + SVN. They won't be installed to the system anyway. + * tests/Makefile.am, tests/test-menu-spec.c: Test program for + the menu specification test suite added again. + 2007-03-23 Jannis Pohlmann <jannis@xfce.org> * libxfce4menu/libxfce4menu-0.1.pc.in: Update pkg-config diff --git a/Makefile.am b/Makefile.am index a287698c2090e9a1f371fb3b38932fc169a577d2..cac466856c1b09fcd9f724992e63a3a4ccf6bf62 100644 --- a/Makefile.am +++ b/Makefile.am @@ -6,6 +6,7 @@ SUBDIRS = \ tdb \ libxfce4menu \ docs \ + tests \ po AUTOMAKE_OPTIONS = \ diff --git a/TODO b/TODO index df26a641057d28441d00c849fdb35e9cc4f0a3c7..bc288dacdf76b42c4b27193119d6f6127bee804d 100644 --- a/TODO +++ b/TODO @@ -4,6 +4,4 @@ TODO * Remove FrapMenu from libfrap during the next 24-48 hours * Add libxfce4menu.spec.in for building RPMs * Re-add test scripts - * Make sure -version-info is set correctly - * Keep tdb related stuff from being generated in docs/reference/tmpl/ * Add #ifdef's for GTK+ 2.6 and GLib 2.6 diff --git a/configure.in.in b/configure.in.in index c62f4bd35b1feb4a3d5e314d38b46094b5661a9f..ad2260b4083ff2a27e60370d2148a6408f6a192e 100644 --- a/configure.in.in +++ b/configure.in.in @@ -207,12 +207,13 @@ Makefile docs/Makefile docs/reference/Makefile docs/reference/version.xml -tdb/tdbconfig.h -tdb/Makefile libxfce4menu/Makefile libxfce4menu/libxfce4menu-0.1.pc libxfce4menu/libxfce4menu-config.h po/Makefile.in +tdb/tdbconfig.h +tdb/Makefile +tests/Makefile ]) dnl *************************** diff --git a/docs/reference/tmpl/config.sgml b/docs/reference/tmpl/config.sgml deleted file mode 100644 index 08e95421b86ac82903e57dead1ee6ebaa3773894..0000000000000000000000000000000000000000 --- a/docs/reference/tmpl/config.sgml +++ /dev/null @@ -1,19 +0,0 @@ -<!-- ##### SECTION Title ##### --> -config - -<!-- ##### SECTION Short_Description ##### --> - - -<!-- ##### SECTION Long_Description ##### --> -<para> - -</para> - -<!-- ##### SECTION See_Also ##### --> -<para> - -</para> - -<!-- ##### SECTION Stability_Level ##### --> - - diff --git a/docs/reference/tmpl/spinlock.sgml b/docs/reference/tmpl/spinlock.sgml deleted file mode 100644 index 1e9b1b2c715995b941422112540d71b7d2447360..0000000000000000000000000000000000000000 --- a/docs/reference/tmpl/spinlock.sgml +++ /dev/null @@ -1,19 +0,0 @@ -<!-- ##### SECTION Title ##### --> -spinlock - -<!-- ##### SECTION Short_Description ##### --> - - -<!-- ##### SECTION Long_Description ##### --> -<para> - -</para> - -<!-- ##### SECTION See_Also ##### --> -<para> - -</para> - -<!-- ##### SECTION Stability_Level ##### --> - - diff --git a/docs/reference/tmpl/tdb.sgml b/docs/reference/tmpl/tdb.sgml deleted file mode 100644 index a8e7193fc752ab3ea9473a7b287637b347444c77..0000000000000000000000000000000000000000 --- a/docs/reference/tmpl/tdb.sgml +++ /dev/null @@ -1,19 +0,0 @@ -<!-- ##### SECTION Title ##### --> -tdb - -<!-- ##### SECTION Short_Description ##### --> - - -<!-- ##### SECTION Long_Description ##### --> -<para> - -</para> - -<!-- ##### SECTION See_Also ##### --> -<para> - -</para> - -<!-- ##### SECTION Stability_Level ##### --> - - diff --git a/docs/reference/tmpl/tdbconfig.sgml b/docs/reference/tmpl/tdbconfig.sgml deleted file mode 100644 index 670602323ee6ceb7f341049f023c56f2377b3fd8..0000000000000000000000000000000000000000 --- a/docs/reference/tmpl/tdbconfig.sgml +++ /dev/null @@ -1,19 +0,0 @@ -<!-- ##### SECTION Title ##### --> -tdbconfig - -<!-- ##### SECTION Short_Description ##### --> - - -<!-- ##### SECTION Long_Description ##### --> -<para> - -</para> - -<!-- ##### SECTION See_Also ##### --> -<para> - -</para> - -<!-- ##### SECTION Stability_Level ##### --> - - diff --git a/tests/Makefile.am b/tests/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..b8a6779be17a87ba3c573e36c99a206c1b7c12d4 --- /dev/null +++ b/tests/Makefile.am @@ -0,0 +1,29 @@ +# $Id$ +# +# vi:set ts=8 sw=8 noet ai nocindent syntax=automake: + +INCLUDES = \ + -I$(top_srcdir) \ + -DG_LOG_DOMAIN=\"libxfce4menu-tests\" + +TESTS = \ + test-menu-spec + +check_PROGRAMS = \ + test-menu-spec + +test_menu_spec_SOURCES = \ + test-menu-spec.c + +test_menu_spec_CFLAGS = \ + $(LIBXFCE4UTIL_CFLAGS) \ + $(GLIB_CFLAGS) + +test_menu_spec_DEPENDENCIES = \ + $(top_builddir)/libxfce4menu/libxfce4menu-$(LIBXFCE4MENU_VERSION_MAJOR).$(LIBXFCE4MENU_VERSION_MINOR).la + +test_menu_spec_LDADD = \ + $(LIBXFCE4UTIL_LIBS) \ + $(GLIB_LIBS) \ + $(top_builddir)/libxfce4menu/libxfce4menu-$(LIBXFCE4MENU_VERSION_MAJOR).$(LIBXFCE4MENU_VERSION_MINOR).la + diff --git a/tests/test-menu-spec.c b/tests/test-menu-spec.c new file mode 100644 index 0000000000000000000000000000000000000000..d0acade1d93ab6659e4b71fa6dc7662ea9105fd1 --- /dev/null +++ b/tests/test-menu-spec.c @@ -0,0 +1,122 @@ +/* $Id$ */ +/* vi:set expandtab sw=2 sts=2: */ +/*- + * Copyright (c) 2007 Jannis Pohlmann <jannis@xfce.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#ifdef HAVE_STDLIB_H +#include <stdlib.h> +#endif + +#include <glib/gprintf.h> + +#include <libxfce4util/libxfce4util.h> +#include <libxfce4menu/libxfce4menu.h> + + + +void +print_menu (XfceMenu *menu, gboolean is_root) +{ + XfceMenuDirectory *directory; + GSList *menus; + GSList *items; + GSList *iter; + const gchar *name; + + /* Determine menu name */ + directory = xfce_menu_get_directory (menu); + name = is_root ? "" : (directory == NULL ? xfce_menu_get_name (menu) : xfce_menu_directory_get_name (directory)); + + /* Fetch submenus */ + menus = xfce_menu_get_menus (menu); + + /* Print child menus */ + for (iter = menus; iter != NULL; iter = g_slist_next (iter)) + { + XfceMenuDirectory *submenu_directory = xfce_menu_get_directory (XFCE_MENU (iter->data)); + + /* Don't display hidden menus */ + if (G_LIKELY (submenu_directory == NULL || !xfce_menu_directory_get_no_display (submenu_directory))) + print_menu (XFCE_MENU (iter->data), FALSE); + } + + /* Free submenu list */ + g_slist_free (menus); + + /* Fetch menu items */ + items = xfce_menu_get_items (menu); + + /* Print menu items */ + for (iter = items; iter != NULL; iter = g_slist_next (iter)) + { + XfceMenuItem *item = iter->data; + + if (G_UNLIKELY (!xfce_menu_item_get_no_display (item))) + g_printf ("%s/\t%s\t%s\n", name, xfce_menu_item_get_desktop_id (item), xfce_menu_item_get_filename (item)); + } + + /* Free menu item list */ + g_slist_free (items); +} + + + +int +main (int argc, + char **argv) +{ + XfceMenu *menu; + GError *error = NULL; +#ifdef HAVE_STDLIB_H + int exit_code = EXIT_SUCCESS; +#else + int exit_code = 0; +#endif + + /* Initialize menu library */ + xfce_menu_init (NULL); + + /* Try to get the root menu */ + menu = xfce_menu_get_root (&error); + + if (G_LIKELY (menu != NULL)) + { + /* Print menu contents according to the test suite criteria */ + print_menu (menu, TRUE); + } + else + { + g_error (error->message); + g_error_free (error); +#ifdef HAVE_STDLIB_H + exit_code = EXIT_FAILURE; +#else + exit_code = -1; +#endif + } + + /* Shut down the menu library */ + xfce_menu_shutdown (); + + return exit_code; +}