No issues found
1 /*
2 * test-preferences-window.c
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) version 3.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with the program; if not, see <http://www.gnu.org/licenses/>
16 *
17 *
18 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
19 *
20 */
21
22 #include "e-preferences-window.c"
23
24 #include <gtk/gtk.h>
25
26 static GtkWidget *
27 create_page_number (gint i)
28 {
29 gchar *caption;
30 GtkWidget *widget;
31
32 caption = g_strdup_printf ("Title of page %d", i);
33
34 widget = gtk_label_new (caption);
35 gtk_widget_show (widget);
36
37 g_free (caption);
38
39 return widget;
40 }
41
42 static GtkWidget *
43 create_page_zero (EPreferencesWindow *preferences_window)
44 {
45 return create_page_number (0);
46 }
47 static GtkWidget *
48 create_page_one (EPreferencesWindow *preferences_window)
49 {
50 return create_page_number (1);
51 }
52 static GtkWidget *
53 create_page_two (EPreferencesWindow *preferences_window)
54 {
55 return create_page_number (2);
56 }
57
58 static void
59 add_pages (EPreferencesWindow *preferences_window)
60 {
61 e_preferences_window_add_page (
62 preferences_window, "page-0",
63 "gtk-properties", "title 0", NULL,
64 create_page_zero, 0);
65 e_preferences_window_add_page (
66 preferences_window, "page-1",
67 "gtk-properties", "title 1", NULL,
68 create_page_one, 1);
69 e_preferences_window_add_page (
70 preferences_window, "page-2",
71 "gtk-properties", "title 2", NULL,
72 create_page_two, 2);
73 }
74
75 static gint
76 delete_event_callback (GtkWidget *widget,
77 GdkEventAny *event,
78 gpointer data)
79 {
80 gtk_main_quit ();
81
82 return TRUE;
83 }
84
85 gint
86 main (gint argc,
87 gchar **argv)
88 {
89 GtkWidget *window;
90
91 gtk_init (&argc, &argv);
92
93 window = e_preferences_window_new (NULL);
94 gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);
95
96 g_signal_connect (
97 window, "delete-event",
98 G_CALLBACK (delete_event_callback), NULL);
99
100 add_pages (E_PREFERENCES_WINDOW (window));
101 e_preferences_window_setup (E_PREFERENCES_WINDOW (window));
102
103 gtk_widget_show (window);
104
105 gtk_main ();
106
107 return 0;
108 }