From 81724738fc6c8a41485a2dcfc4671f10c47cbc1c Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Mon, 1 Dec 2003 02:48:53 +0000 Subject: New test. * test-source-option-menu.c: New test. * e-source-option-menu.h: New. * e-source-option-menu.c: New. svn path=/trunk/; revision=23511 --- widgets/misc/test-source-option-menu.c | 78 ++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 widgets/misc/test-source-option-menu.c (limited to 'widgets/misc/test-source-option-menu.c') diff --git a/widgets/misc/test-source-option-menu.c b/widgets/misc/test-source-option-menu.c new file mode 100644 index 0000000000..91a7941e29 --- /dev/null +++ b/widgets/misc/test-source-option-menu.c @@ -0,0 +1,78 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ +/* test-source-option-menu.c - Test for ESourceOptionMenu. + * + * Copyright (C) 2003 Novell, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License 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 warranty of + * MERCHANTABILITY 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, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * Author: Ettore Perazzoli + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + + +#include "e-source-option-menu.h" + +#include +#include + +#include + + +static int +on_idle_create_widget (const char *gconf_path) +{ + GtkWidget *window; + GtkWidget *option_menu; + ESourceList *source_list; + GConfClient *gconf_client; + + gconf_client = gconf_client_get_default (); + source_list = e_source_list_new_for_gconf (gconf_client, gconf_path); + + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + option_menu = e_source_option_menu_new (source_list); + + gtk_container_add (GTK_CONTAINER (window), option_menu); + gtk_widget_show_all (window); + + g_object_unref (gconf_client); + g_object_unref (source_list); + + return FALSE; +} + + +int +main (int argc, char **argv) +{ + GnomeProgram *program; + const char *gconf_path; + + program = gnome_program_init ("test-source-list", "0.0", LIBGNOMEUI_MODULE, argc, argv, NULL); + + if (argc < 2) + gconf_path = "/apps/evolution/calendar/sources"; + else + gconf_path = argv [1]; + + g_idle_add ((GSourceFunc) on_idle_create_widget, (void *) gconf_path); + + gtk_main (); + + return 0; +} -- cgit v1.2.3