Author: jannis Date: 2007-03-23 11:11:47 +0000 (Fri, 23 Mar 2007) New Revision: 25266
Added: libxfce4menu/trunk/tests/Makefile.am libxfce4menu/trunk/tests/test-menu-spec.c Removed: libxfce4menu/trunk/docs/reference/tmpl/config.sgml libxfce4menu/trunk/docs/reference/tmpl/spinlock.sgml libxfce4menu/trunk/docs/reference/tmpl/tdb.sgml libxfce4menu/trunk/docs/reference/tmpl/tdbconfig.sgml Modified: libxfce4menu/trunk/ChangeLog libxfce4menu/trunk/Makefile.am libxfce4menu/trunk/TODO libxfce4menu/trunk/configure.in.in libxfce4menu/trunk/docs/reference/tmpl/ Log: * 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. Modified: libxfce4menu/trunk/ChangeLog =================================================================== --- libxfce4menu/trunk/ChangeLog 2007-03-23 10:42:49 UTC (rev 25265) +++ libxfce4menu/trunk/ChangeLog 2007-03-23 11:11:47 UTC (rev 25266) @@ -1,5 +1,12 @@ 2007-03-23 Jannis Pohlmann <[EMAIL PROTECTED]> + * 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 <[EMAIL PROTECTED]> + * libxfce4menu/libxfce4menu-0.1.pc.in: Update pkg-config information to point to the new header file location. Modified: libxfce4menu/trunk/Makefile.am =================================================================== --- libxfce4menu/trunk/Makefile.am 2007-03-23 10:42:49 UTC (rev 25265) +++ libxfce4menu/trunk/Makefile.am 2007-03-23 11:11:47 UTC (rev 25266) @@ -6,6 +6,7 @@ tdb \ libxfce4menu \ docs \ + tests \ po AUTOMAKE_OPTIONS = \ Modified: libxfce4menu/trunk/TODO =================================================================== --- libxfce4menu/trunk/TODO 2007-03-23 10:42:49 UTC (rev 25265) +++ libxfce4menu/trunk/TODO 2007-03-23 11:11:47 UTC (rev 25266) @@ -4,6 +4,4 @@ * 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 Modified: libxfce4menu/trunk/configure.in.in =================================================================== --- libxfce4menu/trunk/configure.in.in 2007-03-23 10:42:49 UTC (rev 25265) +++ libxfce4menu/trunk/configure.in.in 2007-03-23 11:11:47 UTC (rev 25266) @@ -207,12 +207,13 @@ 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 *************************** Property changes on: libxfce4menu/trunk/docs/reference/tmpl ___________________________________________________________________ Name: svn:ignore + spinlock.sgml tdb*.sgml config.sgml Deleted: libxfce4menu/trunk/docs/reference/tmpl/config.sgml Deleted: libxfce4menu/trunk/docs/reference/tmpl/spinlock.sgml Deleted: libxfce4menu/trunk/docs/reference/tmpl/tdb.sgml Deleted: libxfce4menu/trunk/docs/reference/tmpl/tdbconfig.sgml Added: libxfce4menu/trunk/tests/Makefile.am =================================================================== --- libxfce4menu/trunk/tests/Makefile.am (rev 0) +++ libxfce4menu/trunk/tests/Makefile.am 2007-03-23 11:11:47 UTC (rev 25266) @@ -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 + Property changes on: libxfce4menu/trunk/tests/Makefile.am ___________________________________________________________________ Name: svn:keywords + Id Author Date Revision Added: libxfce4menu/trunk/tests/test-menu-spec.c =================================================================== --- libxfce4menu/trunk/tests/test-menu-spec.c (rev 0) +++ libxfce4menu/trunk/tests/test-menu-spec.c 2007-03-23 11:11:47 UTC (rev 25266) @@ -0,0 +1,122 @@ +/* $Id$ */ +/* vi:set expandtab sw=2 sts=2: */ +/*- + * Copyright (c) 2007 Jannis Pohlmann <[EMAIL PROTECTED]> + * + * 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; +} Property changes on: libxfce4menu/trunk/tests/test-menu-spec.c ___________________________________________________________________ Name: svn:keywords + Id Author Date Revision _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org http://foo-projects.org/mailman/listinfo/xfce4-commits