evolution r35944 - in branches/kill-bonobo: shell widgets/misc



Author: mbarnes
Date: Sat Aug  9 02:24:46 2008
New Revision: 35944
URL: http://svn.gnome.org/viewvc/evolution?rev=35944&view=rev

Log:
Kill EShellSettingsDialog.
Rename EMultiConfigDialog to EPreferencesWindow and improve the API.


Added:
   branches/kill-bonobo/widgets/misc/e-preferences-window.c   (contents, props changed)
      - copied, changed from r35942, /branches/kill-bonobo/widgets/misc/e-multi-config-dialog.c
   branches/kill-bonobo/widgets/misc/e-preferences-window.h   (contents, props changed)
      - copied, changed from r35942, /branches/kill-bonobo/widgets/misc/e-multi-config-dialog.h
   branches/kill-bonobo/widgets/misc/test-preferences-window.c   (contents, props changed)
      - copied, changed from r35942, /branches/kill-bonobo/widgets/misc/test-multi-config-dialog.c
Removed:
   branches/kill-bonobo/shell/e-shell-settings-dialog.c
   branches/kill-bonobo/shell/e-shell-settings-dialog.h
   branches/kill-bonobo/widgets/misc/e-multi-config-dialog.c
   branches/kill-bonobo/widgets/misc/e-multi-config-dialog.h
   branches/kill-bonobo/widgets/misc/test-multi-config-dialog.c
Modified:
   branches/kill-bonobo/shell/Makefile.am
   branches/kill-bonobo/widgets/misc/Makefile.am

Modified: branches/kill-bonobo/shell/Makefile.am
==============================================================================
--- branches/kill-bonobo/shell/Makefile.am	(original)
+++ branches/kill-bonobo/shell/Makefile.am	Sat Aug  9 02:24:46 2008
@@ -138,8 +138,6 @@
 	e-shell-importer.h			\
 	e-shell-registry.c			\
 	e-shell-registry.h			\
-	e-shell-settings-dialog.c		\
-	e-shell-settings-dialog.h		\
 	e-shell-window-private.c		\
 	e-shell-window-private.h		\
 	e-sidebar.c				\

Modified: branches/kill-bonobo/widgets/misc/Makefile.am
==============================================================================
--- branches/kill-bonobo/widgets/misc/Makefile.am	(original)
+++ branches/kill-bonobo/widgets/misc/Makefile.am	Sat Aug  9 02:24:46 2008
@@ -56,7 +56,7 @@
 	e-image-chooser.h			\
 	e-info-label.h				\
 	e-map.h					\
-	e-multi-config-dialog.h			\
+	e-preferences-window.h			\
 	e-online-button.h			\
 	e-search-bar.h				\
 	e-task-bar.h				\
@@ -104,7 +104,7 @@
 	e-image-chooser.c			\
 	e-info-label.c				\
 	e-map.c					\
-	e-multi-config-dialog.c			\
+	e-preferences-window.c			\
 	e-online-button.c			\
 	e-search-bar.c				\
 	e-task-bar.c				\
@@ -158,7 +158,7 @@
 	test-calendar			\
 	test-dateedit			\
 	test-dropdown-button		\
-	test-multi-config-dialog 	\
+	test-preferences-window		\
 	test-info-label
 
 # test-calendar
@@ -191,12 +191,12 @@
 	$(top_builddir)/e-util/libeutil.la  	\
 	$(E_WIDGETS_LIBS)
 
-# test-multi-config-dialog
+# test-preferences-window
 
-test_multi_config_dialog_SOURCES = 	\
-	test-multi-config-dialog.c
+test_preferences_window_SOURCES =		\
+	test-preferences-window.c
 
-test_multi_config_dialog_LDADD = 		\
+test_preferences_window_LDADD = 		\
 	libemiscwidgets.la			\
 	$(top_builddir)/e-util/libeutil.la	\
 	$(E_WIDGETS_LIBS)

Copied: branches/kill-bonobo/widgets/misc/e-preferences-window.c (from r35942, /branches/kill-bonobo/widgets/misc/e-multi-config-dialog.c)
==============================================================================
--- /branches/kill-bonobo/widgets/misc/e-multi-config-dialog.c	(original)
+++ branches/kill-bonobo/widgets/misc/e-preferences-window.c	Sat Aug  9 02:24:46 2008
@@ -1,5 +1,5 @@
 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-multi-config-dialog.c
+/* e-preferences-window.c
  *
  * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
  *
@@ -18,46 +18,33 @@
  * Boston, MA 02110-1301, USA.
  */
 
-#include "e-multi-config-dialog.h"
+#include "e-preferences-window.h"
 
 #include <libgnome/gnome-help.h>
 
 #define SWITCH_PAGE_INTERVAL 250
 
-#define E_MULTI_CONFIG_DIALOG_GET_PRIVATE(obj) \
+#define E_PREFERENCES_WINDOW_GET_PRIVATE(obj) \
 	(G_TYPE_INSTANCE_GET_PRIVATE \
-	((obj), E_TYPE_MULTI_CONFIG_DIALOG, EMultiConfigDialogPrivate))
+	((obj), E_TYPE_PREFERENCES_WINDOW, EPreferencesWindowPrivate))
 
-struct _EMultiConfigDialogPrivate {
+struct _EPreferencesWindowPrivate {
 	GtkWidget *icon_view;
 	GtkWidget *notebook;
-	guint timeout_id;
+	GHashTable *index;
 };
 
 enum {
 	COLUMN_TEXT,	/* G_TYPE_STRING */
-	COLUMN_PIXBUF	/* GDK_TYPE_PIXBUF */
+	COLUMN_PIXBUF,	/* GDK_TYPE_PIXBUF */
+	COLUMN_PAGE,	/* G_TYPE_INT */
+	COLUMN_SORT	/* G_TYPE_INT */
 };
 
 static gpointer parent_class;
 
-static GtkWidget *
-create_page_container (GtkWidget *widget)
-{
-	GtkWidget *vbox;
-
-	vbox = gtk_vbox_new (FALSE, 0);
-
-	gtk_box_pack_start (GTK_BOX (vbox), widget, TRUE, TRUE, 0);
-
-	gtk_widget_show (widget);
-	gtk_widget_show (vbox);
-
-	return vbox;
-}
-
 static GdkPixbuf *
-multi_config_dialog_load_pixbuf (const gchar *icon_name)
+preferences_window_load_pixbuf (const gchar *icon_name)
 {
 	GtkIconTheme *icon_theme;
 	GtkIconInfo *icon_info;
@@ -91,50 +78,40 @@
 	return pixbuf;
 }
 
-static gboolean
-multi_config_dialog_timeout_cb (EMultiConfigDialog *dialog)
+static void
+preferences_window_selection_changed_cb (EPreferencesWindow *dialog)
 {
 	GtkIconView *icon_view;
 	GtkNotebook *notebook;
+	GtkTreeModel *model;
+	GtkTreeIter iter;
 	GList *list;
+	gint page;
 
 	icon_view = GTK_ICON_VIEW (dialog->priv->icon_view);
-	notebook = GTK_NOTEBOOK (dialog->priv->notebook);
-
 	list = gtk_icon_view_get_selected_items (icon_view);
+	if (list == NULL)
+		return;
 
-	if (list != NULL) {
-		GtkTreePath *path = list->data;
-		gint page;
+	model = gtk_icon_view_get_model (icon_view);
+	gtk_tree_model_get_iter (model, &iter, list->data);
+	gtk_tree_model_get (model, &iter, COLUMN_PAGE, &page, -1);
 
-		page = gtk_tree_path_get_indices (path)[0];
-		gtk_notebook_set_current_page (notebook, page);
-	}
+	notebook = GTK_NOTEBOOK (dialog->priv->notebook);
+	gtk_notebook_set_current_page (notebook, page);
 
 	g_list_foreach (list, (GFunc) gtk_tree_path_free, NULL);
 	g_list_free (list);
 
-	dialog->priv->timeout_id = 0;
 	gtk_widget_grab_focus (GTK_WIDGET (icon_view));
-
-	return FALSE;
-}
-
-static void
-multi_config_dialog_selection_changed_cb (EMultiConfigDialog *dialog)
-{
-	if (dialog->priv->timeout_id == 0)
-		dialog->priv->timeout_id = g_timeout_add (
-			SWITCH_PAGE_INTERVAL, (GSourceFunc)
-			multi_config_dialog_timeout_cb, dialog);
 }
 
 static void
-multi_config_dialog_dispose (GObject *object)
+preferences_window_dispose (GObject *object)
 {
-	EMultiConfigDialogPrivate *priv;
+	EPreferencesWindowPrivate *priv;
 
-	priv = E_MULTI_CONFIG_DIALOG_GET_PRIVATE (object);
+	priv = E_PREFERENCES_WINDOW_GET_PRIVATE (object);
 
 	if (priv->icon_view != NULL) {
 		g_object_unref (priv->icon_view);
@@ -146,26 +123,27 @@
 		priv->notebook = NULL;
 	}
 
+	g_hash_table_remove_all (priv->index);
+
 	/* Chain up to parent's dispose() method. */
 	G_OBJECT_CLASS (parent_class)->dispose (object);
 }
 
 static void
-multi_config_dialog_finalize (GObject *object)
+preferences_window_finalize (GObject *object)
 {
-	EMultiConfigDialogPrivate *priv;
+	EPreferencesWindowPrivate *priv;
 
-	priv = E_MULTI_CONFIG_DIALOG_GET_PRIVATE (object);
+	priv = E_PREFERENCES_WINDOW_GET_PRIVATE (object);
 
-	if (priv->timeout_id != 0)
-		g_source_remove (priv->timeout_id);
+	g_hash_table_destroy (priv->index);
 
 	/* Chain up to parent's finalize() method. */
 	G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
 static void
-multi_config_dialog_map (GtkWidget *widget)
+preferences_window_map (GtkWidget *widget)
 {
 	GtkDialog *dialog;
 
@@ -181,8 +159,8 @@
 }
 
 static void
-multi_config_dialog_response (GtkDialog *dialog,
-		              gint response_id)
+preferences_window_response (GtkDialog *dialog,
+                             gint response_id)
 {
 	GError *error = NULL;
 
@@ -204,42 +182,51 @@
 }
 
 static void
-multi_config_dialog_class_init (EMultiConfigDialogClass *class)
+preferences_window_class_init (EPreferencesWindowClass *class)
 {
 	GObjectClass *object_class;
 	GtkWidgetClass *widget_class;
 	GtkDialogClass *dialog_class;
 
 	parent_class = g_type_class_peek_parent (class);
-	g_type_class_add_private (class, sizeof (EMultiConfigDialogPrivate));
+	g_type_class_add_private (class, sizeof (EPreferencesWindowPrivate));
 
 	object_class = G_OBJECT_CLASS (class);
-	object_class->dispose = multi_config_dialog_dispose;
-	object_class->finalize = multi_config_dialog_finalize;
+	object_class->dispose = preferences_window_dispose;
+	object_class->finalize = preferences_window_finalize;
 
 	widget_class = GTK_WIDGET_CLASS (class);
-	widget_class->map = multi_config_dialog_map;
+	widget_class->map = preferences_window_map;
 
 	dialog_class = GTK_DIALOG_CLASS (class);
-	dialog_class->response = multi_config_dialog_response;
+	dialog_class->response = preferences_window_response;
 }
 
 static void
-multi_config_dialog_init (EMultiConfigDialog *dialog)
+preferences_window_init (EPreferencesWindow *dialog)
 {
 	GtkListStore *store;
 	GtkWidget *container;
 	GtkWidget *hbox;
 	GtkWidget *widget;
+	GHashTable *index;
 
-	dialog->priv = E_MULTI_CONFIG_DIALOG_GET_PRIVATE (dialog);
+	index = g_hash_table_new_full (
+		g_str_hash, g_str_equal,
+		(GDestroyNotify) g_free,
+		(GDestroyNotify) gtk_tree_row_reference_free);
+
+	dialog->priv = E_PREFERENCES_WINDOW_GET_PRIVATE (dialog);
+	dialog->priv->index = index;
+
+	store = gtk_list_store_new (
+		4, G_TYPE_STRING, GDK_TYPE_PIXBUF, G_TYPE_INT, G_TYPE_INT);
+	gtk_tree_sortable_set_sort_column_id (
+		GTK_TREE_SORTABLE (store), COLUMN_SORT, GTK_SORT_ASCENDING);
 
 	gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
 	gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE);
 
-	/* XXX Remove this once we kill Bonobo. */
-	gtk_widget_realize (GTK_WIDGET (dialog));
-
 	container = GTK_DIALOG (dialog)->vbox;
 
 	hbox = gtk_hbox_new (FALSE, 12);
@@ -257,14 +244,13 @@
 
 	container = widget;
 
-	store = gtk_list_store_new (2, G_TYPE_STRING, GDK_TYPE_PIXBUF);
 	widget = gtk_icon_view_new_with_model (GTK_TREE_MODEL (store));
 	gtk_icon_view_set_columns (GTK_ICON_VIEW (widget), 1);
 	gtk_icon_view_set_text_column (GTK_ICON_VIEW (widget), COLUMN_TEXT);
 	gtk_icon_view_set_pixbuf_column (GTK_ICON_VIEW (widget), COLUMN_PIXBUF);
 	g_signal_connect_swapped (
 		widget, "selection-changed",
-		G_CALLBACK (multi_config_dialog_selection_changed_cb), dialog);
+		G_CALLBACK (preferences_window_selection_changed_cb), dialog);
 	gtk_container_add (GTK_CONTAINER (container), widget);
 	dialog->priv->icon_view = g_object_ref (widget);
 	gtk_widget_show (widget);
@@ -288,96 +274,104 @@
 }
 
 GType
-e_multi_config_dialog_get_type (void)
+e_preferences_window_get_type (void)
 {
 	static GType type = 0;
 
 	if (G_UNLIKELY (type == 0)) {
 		const GTypeInfo type_info = {
-			sizeof (EMultiConfigDialogClass),
+			sizeof (EPreferencesWindowClass),
 			(GBaseInitFunc) NULL,
 			(GBaseFinalizeFunc) NULL,
-			(GClassInitFunc) multi_config_dialog_class_init,
+			(GClassInitFunc) preferences_window_class_init,
 			(GClassFinalizeFunc) NULL,
 			NULL,  /* class_data */
-			sizeof (EMultiConfigDialog),
+			sizeof (EPreferencesWindow),
 			0,     /* n_preallocs */
-			(GInstanceInitFunc) multi_config_dialog_init,
+			(GInstanceInitFunc) preferences_window_init,
 			NULL   /* value_table */
 		};
 
 		type = g_type_register_static (
-			GTK_TYPE_DIALOG, "EMultiConfigDialog", &type_info, 0);
+			GTK_TYPE_DIALOG, "EPreferencesWindow", &type_info, 0);
 	}
 
 	return type;
 }
 
 GtkWidget *
-e_multi_config_dialog_new (void)
+e_preferences_window_new (void)
 {
-	return g_object_new (e_multi_config_dialog_get_type (), NULL);
+	return g_object_new (E_TYPE_PREFERENCES_WINDOW, NULL);
 }
 
 void
-e_multi_config_dialog_add_page (EMultiConfigDialog *dialog,
-				const gchar *caption,
-				const gchar *icon_name,
-				EConfigPage *page_widget)
+e_preferences_window_add_page (EPreferencesWindow *dialog,
+                               const gchar *page_name,
+                               const gchar *icon_name,
+                               const gchar *caption,
+                               gint sort_order,
+                               GtkWidget *widget)
 {
+	GtkTreeRowReference *reference;
 	GtkIconView *icon_view;
 	GtkNotebook *notebook;
 	GtkTreeModel *model;
+	GtkTreePath *path;
+	GHashTable *index;
 	GdkPixbuf *pixbuf;
 	GtkTreeIter iter;
+	gint page;
 
 	g_return_if_fail (E_IS_MULTI_CONFIG_DIALOG (dialog));
-	g_return_if_fail (caption != NULL);
+	g_return_if_fail (page_name != NULL);
 	g_return_if_fail (icon_name != NULL);
-	g_return_if_fail (E_IS_CONFIG_PAGE (page_widget));
+	g_return_if_fail (caption != NULL);
+	g_return_if_fail (GTK_IS_WIDGET (widget));
 
 	icon_view = GTK_ICON_VIEW (dialog->priv->icon_view);
 	notebook = GTK_NOTEBOOK (dialog->priv->notebook);
 
+	page = gtk_notebook_get_n_pages (notebook);
 	model = gtk_icon_view_get_model (icon_view);
-	pixbuf = multi_config_dialog_load_pixbuf (icon_name);
+	pixbuf = preferences_window_load_pixbuf (icon_name);
 
 	gtk_list_store_append (GTK_LIST_STORE (model), &iter);
 
 	gtk_list_store_set (
 		GTK_LIST_STORE (model), &iter,
-		COLUMN_TEXT, caption, COLUMN_PIXBUF, pixbuf, -1);
+		COLUMN_TEXT, caption, COLUMN_PIXBUF, pixbuf,
+		COLUMN_PAGE, page, COLUMN_SORT, sort_order, -1);
 
-	if (gtk_tree_model_iter_n_children (model, NULL) == 1) {
-		GtkTreePath *path;
+	index = dialog->priv->index;
+	path = gtk_tree_model_get_path (model, &iter);
+	reference = gtk_tree_row_reference_new (model, path);
+	g_hash_table_insert (index, g_strdup (page_name), reference);
+	gtk_tree_path_free (path);
 
-		path = gtk_tree_path_new_first ();
-		gtk_icon_view_select_path (icon_view, path);
-		gtk_tree_path_free (path);
-	}
+	gtk_notebook_append_page (notebook, widget, NULL);
 
-	gtk_notebook_append_page (
-		notebook, create_page_container (
-		GTK_WIDGET (page_widget)), NULL);
+	if (page == 0)
+		e_preferences_window_show_page (dialog, page_name);
 }
 
 void
-e_multi_config_dialog_show_page (EMultiConfigDialog *dialog,
-                                 gint page)
+e_preferences_window_show_page (EPreferencesWindow *dialog,
+                                const gchar *page_name)
 {
+	GtkTreeRowReference *reference;
 	GtkIconView *icon_view;
-	GtkNotebook *notebook;
 	GtkTreePath *path;
 
 	g_return_if_fail (E_IS_MULTI_CONFIG_DIALOG (dialog));
+	g_return_if_fail (page_name != NULL);
 
 	icon_view = GTK_ICON_VIEW (dialog->priv->icon_view);
-	notebook = GTK_NOTEBOOK (dialog->priv->notebook);
+	reference = g_hash_table_lookup (dialog->priv->index, page_name);
+	g_return_if_fail (reference != NULL);
 
-	path = gtk_tree_path_new_from_indices (page, -1);
+	path = gtk_tree_row_reference_get_path (reference);
 	gtk_icon_view_select_path (icon_view, path);
 	gtk_icon_view_scroll_to_path (icon_view, path, FALSE, 0.0, 0.0);
 	gtk_tree_path_free (path);
-
-	gtk_notebook_set_current_page (notebook, page);
 }

Copied: branches/kill-bonobo/widgets/misc/e-preferences-window.h (from r35942, /branches/kill-bonobo/widgets/misc/e-multi-config-dialog.h)
==============================================================================
--- /branches/kill-bonobo/widgets/misc/e-multi-config-dialog.h	(original)
+++ branches/kill-bonobo/widgets/misc/e-preferences-window.h	Sat Aug  9 02:24:46 2008
@@ -1,5 +1,5 @@
 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-multi-config-dialog.h
+/* e-preferences-window.h
  *
  * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
  *
@@ -18,61 +18,56 @@
  * Boston, MA 02110-1301, USA.
  */
 
-#ifndef E_MULTI_CONFIG_DIALOG_H
-#define E_MULTI_CONFIG_DIALOG_H
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "e-config-page.h"
+#ifndef E_PREFERENCES_WINDOW_H
+#define E_PREFERENCES_WINDOW_H
 
 #include <gtk/gtk.h>
 
-G_BEGIN_DECLS
-
 /* Standard GObject macros */
-#define E_TYPE_MULTI_CONFIG_DIALOG \
-	(e_multi_config_dialog_get_type ())
-#define E_MULTI_CONFIG_DIALOG(obj) \
+#define E_TYPE_PREFERENCES_WINDOW \
+	(e_preferences_window_get_type ())
+#define E_PREFERENCES_WINDOW(obj) \
 	(G_TYPE_CHECK_INSTANCE_CAST \
-	((obj), E_TYPE_MULTI_CONFIG_DIALOG, EMultiConfigDialog))
-#define E_MULTI_CONFIG_DIALOG_CLASS(cls) \
+	((obj), E_TYPE_PREFERENCES_WINDOW, EPreferencesWindow))
+#define E_PREFERENCES_WINDOW_CLASS(cls) \
 	(G_TYPE_CHECK_CLASS_CAST \
-	((cls), E_TYPE_MULTI_CONFIG_DIALOG, EMultiConfigDialogClass))
+	((cls), E_TYPE_PREFERENCES_WINDOW, EPreferencesWindowClass))
 #define E_IS_MULTI_CONFIG_DIALOG(obj) \
 	(G_TYPE_CHECK_INSTANCE_TYPE \
-	((obj), E_TYPE_MULTI_CONFIG_DIALOG))
+	((obj), E_TYPE_PREFERENCES_WINDOW))
 #define E_IS_MULTI_CONFIG_DIALOG_CLASS(cls) \
 	(G_TYPE_CHECK_CLASS_TYPE \
-	((obj), E_TYPE_MULTI_CONFIG_DIALOG))
-#define E_MULTI_CONFIG_DIALOG_GET_CLASS(obj) \
+	((obj), E_TYPE_PREFERENCES_WINDOW))
+#define E_PREFERENCES_WINDOW_GET_CLASS(obj) \
 	(G_TYPE_INSTANCE_GET_TYPE \
-	((obj), E_TYPE_MULTI_CONFIG_DIALOG, EMultiConfigDialogClass))
+	((obj), E_TYPE_PREFERENCES_WINDOW, EPreferencesWindowClass))
 
-typedef struct _EMultiConfigDialog EMultiConfigDialog;
-typedef struct _EMultiConfigDialogClass EMultiConfigDialogClass;
-typedef struct _EMultiConfigDialogPrivate EMultiConfigDialogPrivate;
+G_BEGIN_DECLS
 
-struct _EMultiConfigDialog {
+typedef struct _EPreferencesWindow EPreferencesWindow;
+typedef struct _EPreferencesWindowClass EPreferencesWindowClass;
+typedef struct _EPreferencesWindowPrivate EPreferencesWindowPrivate;
+
+struct _EPreferencesWindow {
 	GtkDialog parent;
-	EMultiConfigDialogPrivate *priv;
+	EPreferencesWindowPrivate *priv;
 };
 
-struct _EMultiConfigDialogClass {
+struct _EPreferencesWindowClass {
 	GtkDialogClass parent_class;
 };
 
-GType		e_multi_config_dialog_get_type	(void);
-GtkWidget *	e_multi_config_dialog_new	(void);
-
-void		e_multi_config_dialog_add_page	(EMultiConfigDialog *dialog,
-						 const gchar *caption,
+GType		e_preferences_window_get_type	(void);
+GtkWidget *	e_preferences_window_new	(void);
+void		e_preferences_window_add_page	(EPreferencesWindow *window,
+						 const gchar *page_name,
 						 const gchar *icon_name,
-						 EConfigPage *page);
-void		e_multi_config_dialog_show_page	(EMultiConfigDialog *dialog,
-						 gint page);
+						 const gchar *caption,
+						 gint sort_order,
+						 GtkWidget *widget);
+void		e_preferences_window_show_page	(EPreferencesWindow *window,
+						 const gchar *page_name);
 
 G_END_DECLS
 
-#endif /* E_MULTI_CONFIG_DIALOG_H */
+#endif /* E_PREFERENCES_WINDOW_H */

Copied: branches/kill-bonobo/widgets/misc/test-preferences-window.c (from r35942, /branches/kill-bonobo/widgets/misc/test-multi-config-dialog.c)
==============================================================================
--- /branches/kill-bonobo/widgets/misc/test-multi-config-dialog.c	(original)
+++ branches/kill-bonobo/widgets/misc/test-preferences-window.c	Sat Aug  9 02:24:46 2008
@@ -1,5 +1,5 @@
 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* test-multi-config-dialog.c
+/* test-preferences-window.c
  *
  * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
  *
@@ -16,47 +16,38 @@
  * License along with this program; if not, write to the
  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  * Boston, MA 02110-1301, USA.
- *
- * Authors:
- *   Ettore Perazzoli <ettore ximian com>
  */
 
-#include "e-multi-config-dialog.c"
+#include "e-preferences-window.c"
 
 #include <gtk/gtk.h>
 #include <libgnomeui/gnome-app.h>
 #include <libgnomeui/gnome-ui-init.h>
 
-
 #define NUM_PAGES 10
 
-
 static void
-add_pages (EMultiConfigDialog *multi_config_dialog)
+add_pages (EPreferencesWindow *preferences_window)
 {
 	int i;
 
 	for (i = 0; i < NUM_PAGES; i ++) {
 		GtkWidget *widget;
-		GtkWidget *page;
-		char *string;
-		char *title;
+		char *caption;
+		char *page_name;
 
-		string = g_strdup_printf ("This is page %d", i);
-		title = g_strdup_printf ("Title of page %d", i);
+		caption = g_strdup_printf ("Title of page %d", i);
+		page_name = g_strdup_printf ("page-%d", i);
 
-		widget = gtk_label_new (string);
+		widget = gtk_label_new (caption);
 		gtk_widget_show (widget);
 
-		page = e_config_page_new ();
-		gtk_container_add (GTK_CONTAINER (page), widget);
-
-		e_multi_config_dialog_add_page (
-			multi_config_dialog, title, "gtk-properties",
-			E_CONFIG_PAGE (page));
+		e_preferences_window_add_page (
+			preferences_window, page_name,
+			"gtk-properties", caption, i, widget);
 
-		g_free (string);
-		g_free (title);
+		g_free (caption);
+		g_free (page_name);
 	}
 }
 
@@ -70,23 +61,22 @@
 	return TRUE;
 }
 
-
 int
 main (int argc, char **argv)
 {
 	GtkWidget *dialog;
 
 	gnome_program_init (
-		"test-multi-config-dialog", "0.0", LIBGNOMEUI_MODULE,
+		"test-preferences-window", "0.0", LIBGNOMEUI_MODULE,
 		argc, argv, GNOME_PARAM_NONE);
 
-	dialog = e_multi_config_dialog_new ();
+	dialog = e_preferences_window_new ();
 
 	gtk_window_set_default_size (GTK_WINDOW (dialog), 400, 300);
 	g_signal_connect((dialog), "delete_event",
 			    G_CALLBACK (delete_event_callback), NULL);
 
-	add_pages (E_MULTI_CONFIG_DIALOG (dialog));
+	add_pages (E_PREFERENCES_WINDOW (dialog));
 
 	gtk_widget_show (dialog);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]