diff options
Diffstat (limited to 'widgets/misc/test-preferences-window.c')
-rw-r--r-- | widgets/misc/test-preferences-window.c | 60 |
1 files changed, 40 insertions, 20 deletions
diff --git a/widgets/misc/test-preferences-window.c b/widgets/misc/test-preferences-window.c index dec6b85cb5..c737964518 100644 --- a/widgets/misc/test-preferences-window.c +++ b/widgets/misc/test-preferences-window.c @@ -23,31 +23,50 @@ #include <gtk/gtk.h> -#define NUM_PAGES 10 - -static void -add_pages (EPreferencesWindow *preferences_window) +static GtkWidget * +create_page_number (gint i) { - gint i; + gchar *caption; + GtkWidget *widget; + + caption = g_strdup_printf ("Title of page %d", i); - for (i = 0; i < NUM_PAGES; i++) { - GtkWidget *widget; - gchar *caption; - gchar *page_name; + widget = gtk_label_new (caption); + gtk_widget_show (widget); - caption = g_strdup_printf ("Title of page %d", i); - page_name = g_strdup_printf ("page-%d", i); + g_free (caption); - widget = gtk_label_new (caption); - gtk_widget_show (widget); + return widget; +} - e_preferences_window_add_page ( - preferences_window, page_name, - "gtk-properties", caption, widget, i); +static GtkWidget * +create_page_zero (EPreferencesWindow *preferences_window) +{ + return create_page_number (0); +} +static GtkWidget * +create_page_one (EPreferencesWindow *preferences_window) +{ + return create_page_number (1); +} +static GtkWidget * +create_page_two (EPreferencesWindow *preferences_window) +{ + return create_page_number (2); +} - g_free (caption); - g_free (page_name); - } +static void +add_pages (EPreferencesWindow *preferences_window) +{ + e_preferences_window_add_page (preferences_window, "page-0", + "gtk-properties", "title 0", + create_page_zero, 0); + e_preferences_window_add_page (preferences_window, "page-1", + "gtk-properties", "title 1", + create_page_one, 1); + e_preferences_window_add_page (preferences_window, "page-2", + "gtk-properties", "title 2", + create_page_two, 2); } static gint @@ -67,7 +86,7 @@ main (gint argc, gchar **argv) gtk_init (&argc, &argv); - window = e_preferences_window_new (); + window = e_preferences_window_new (NULL); gtk_window_set_default_size (GTK_WINDOW (window), 400, 300); g_signal_connect( @@ -75,6 +94,7 @@ main (gint argc, gchar **argv) G_CALLBACK (delete_event_callback), NULL); add_pages (E_PREFERENCES_WINDOW (window)); + e_preferences_window_setup (E_PREFERENCES_WINDOW (window)); gtk_widget_show (window); |