1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
2 /* test-source-option-menu.c - Test for ESourceOptionMenu.
4 * Copyright (C) 2003 Novell, Inc.
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of version 2 of the GNU Lesser General Public
8 * License as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this program; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
20 * Author: Ettore Perazzoli <ettore@ximian.com>
28 #include "e-source-option-menu.h"
30 #include <gtk/gtkwindow.h>
31 #include <gtk/gtkmain.h>
34 source_selected_callback (ESourceOptionMenu *menu,
38 g_print ("source selected: \"%s\"\n", e_source_peek_name (source));
43 on_idle_create_widget (const char *gconf_path)
46 GtkWidget *option_menu;
47 ESourceList *source_list;
48 GConfClient *gconf_client;
50 gconf_client = gconf_client_get_default ();
51 source_list = e_source_list_new_for_gconf (gconf_client, gconf_path);
53 window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
54 option_menu = e_source_option_menu_new (source_list);
55 g_signal_connect (option_menu, "source_selected", G_CALLBACK (source_selected_callback), NULL);
57 gtk_container_add (GTK_CONTAINER (window), option_menu);
58 gtk_widget_show_all (window);
60 g_object_unref (gconf_client);
61 g_object_unref (source_list);
68 main (int argc, char **argv)
70 const char *gconf_path;
72 gtk_init (&argc, &argv);
75 gconf_path = "/apps/evolution/calendar/sources";
77 gconf_path = argv [1];
79 g_idle_add ((GSourceFunc) on_idle_create_widget, (void *) gconf_path);