aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc/test-source-option-menu.c
blob: 91a7941e292c1fda7acb63981d9e943b3895eee3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
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 <ettore@ximian.com>
 */

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif


#include "e-source-option-menu.h"

#include <gtk/gtkwindow.h>
#include <gtk/gtkmain.h>

#include <libgnomeui/gnome-ui-init.h>


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;
}