[evolution] Bug #596753 - Autocompletion addressbooks not remembered



commit 0ed3ee1fa3b1f9f0735358fe66ba35f44e7c70ee
Author: Milan Crha <mcrha redhat com>
Date:   Tue Sep 29 20:10:35 2009 +0200

    Bug #596753 - Autocompletion addressbooks not remembered
    
    And select page in Edit->Preferences based on the active view.

 modules/addressbook/autocompletion-config.c |    3 +--
 modules/addressbook/e-book-shell-backend.c  |    1 +
 modules/calendar/e-cal-shell-backend.c      |    1 +
 modules/calendar/e-memo-shell-backend.c     |    1 +
 modules/calendar/e-task-shell-backend.c     |    1 +
 modules/mail/e-mail-shell-backend.c         |    1 +
 shell/e-shell-backend.h                     |    1 +
 shell/e-shell-window-actions.c              |    9 ++++++++-
 shell/test/e-test-shell-backend.c           |    1 +
 9 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/modules/addressbook/autocompletion-config.c b/modules/addressbook/autocompletion-config.c
index 7afc18d..6b51427 100644
--- a/modules/addressbook/autocompletion-config.c
+++ b/modules/addressbook/autocompletion-config.c
@@ -178,6 +178,7 @@ autocompletion_config_new (EShell *shell)
 	gtk_widget_show (scrolled_window);
 
 	source_selector = e_source_selector_new (source_list);
+	initialize_selection (E_SOURCE_SELECTOR (source_selector));
 	g_signal_connect (
 		source_selector, "selection_changed",
 		G_CALLBACK (source_selection_changed_cb), NULL);
@@ -186,7 +187,5 @@ autocompletion_config_new (EShell *shell)
 
 	gtk_box_pack_start (GTK_BOX (itembox), scrolled_window, TRUE, TRUE, 0);
 
-	initialize_selection (E_SOURCE_SELECTOR (source_selector));
-
 	return vbox;
 }
diff --git a/modules/addressbook/e-book-shell-backend.c b/modules/addressbook/e-book-shell-backend.c
index 06cd43a..11ff1e3 100644
--- a/modules/addressbook/e-book-shell-backend.c
+++ b/modules/addressbook/e-book-shell-backend.c
@@ -584,6 +584,7 @@ book_shell_backend_class_init (EBookShellBackendClass *class)
 	shell_backend_class->aliases = "contacts";
 	shell_backend_class->schemes = "";
 	shell_backend_class->sort_order = 300;
+	shell_backend_class->preferences_page = "contacts";
 	shell_backend_class->start = NULL;
 	shell_backend_class->migrate = e_book_shell_backend_migrate;
 
diff --git a/modules/calendar/e-cal-shell-backend.c b/modules/calendar/e-cal-shell-backend.c
index f58548f..2c3d459 100644
--- a/modules/calendar/e-cal-shell-backend.c
+++ b/modules/calendar/e-cal-shell-backend.c
@@ -747,6 +747,7 @@ cal_shell_backend_class_init (ECalShellBackendClass *class)
 	shell_backend_class->aliases = "";
 	shell_backend_class->schemes = "calendar";
 	shell_backend_class->sort_order = 400;
+	shell_backend_class->preferences_page = "calendar-and-tasks";
 	shell_backend_class->start = NULL;
 	shell_backend_class->migrate = e_cal_shell_backend_migrate;
 
diff --git a/modules/calendar/e-memo-shell-backend.c b/modules/calendar/e-memo-shell-backend.c
index 71d4460..84fb545 100644
--- a/modules/calendar/e-memo-shell-backend.c
+++ b/modules/calendar/e-memo-shell-backend.c
@@ -571,6 +571,7 @@ memo_shell_backend_class_init (EMemoShellBackendClass *class)
 	shell_backend_class->aliases = "";
 	shell_backend_class->schemes = "memo";
 	shell_backend_class->sort_order = 500;
+	shell_backend_class->preferences_page = "calendar-and-tasks";
 	shell_backend_class->start = NULL;
 	shell_backend_class->migrate = e_memo_shell_backend_migrate;
 
diff --git a/modules/calendar/e-task-shell-backend.c b/modules/calendar/e-task-shell-backend.c
index 2564c18..c17f73d 100644
--- a/modules/calendar/e-task-shell-backend.c
+++ b/modules/calendar/e-task-shell-backend.c
@@ -581,6 +581,7 @@ task_shell_backend_class_init (ETaskShellBackendClass *class)
 	shell_backend_class->aliases = "";
 	shell_backend_class->schemes = "task";
 	shell_backend_class->sort_order = 600;
+	shell_backend_class->preferences_page = "calendar-and-tasks";
 	shell_backend_class->start = NULL;
 	shell_backend_class->migrate = e_task_shell_backend_migrate;
 
diff --git a/modules/mail/e-mail-shell-backend.c b/modules/mail/e-mail-shell-backend.c
index 0d945c6..1e0655f 100644
--- a/modules/mail/e-mail-shell-backend.c
+++ b/modules/mail/e-mail-shell-backend.c
@@ -907,6 +907,7 @@ mail_shell_backend_class_init (EMailShellBackendClass *class)
 	shell_backend_class->aliases = "";
 	shell_backend_class->schemes = "mailto:email";;
 	shell_backend_class->sort_order = 200;
+	shell_backend_class->preferences_page = "mail-accounts";
 	shell_backend_class->start = mail_shell_backend_start;
 	shell_backend_class->migrate = e_mail_shell_migrate;
 }
diff --git a/shell/e-shell-backend.h b/shell/e-shell-backend.h
index ad1b129..8a6fd7a 100644
--- a/shell/e-shell-backend.h
+++ b/shell/e-shell-backend.h
@@ -108,6 +108,7 @@ struct _EShellBackendClass {
 	const gchar *aliases;
 	const gchar *schemes;
 	gint sort_order;
+	const gchar *preferences_page;
 
 	/* Methods */
 	void		(*start)		(EShellBackend *shell_backend);
diff --git a/shell/e-shell-window-actions.c b/shell/e-shell-window-actions.c
index e01aeb1..9616e97 100644
--- a/shell/e-shell-window-actions.c
+++ b/shell/e-shell-window-actions.c
@@ -20,6 +20,7 @@
  */
 
 #include "e-shell-window-private.h"
+#include "e-preferences-window.h"
 
 #include <e-util/e-dialog-utils.h>
 #include <e-util/e-error.h>
@@ -905,8 +906,12 @@ action_preferences_cb (GtkAction *action,
 {
 	EShell *shell;
 	GtkWidget *preferences_window;
+	EShellView *shell_view;
+	EShellBackend *shell_backend;
 
 	shell = e_shell_window_get_shell (shell_window);
+	shell_view = e_shell_window_get_shell_view (shell_window, e_shell_window_get_active_view (shell_window));
+	shell_backend = shell_view ? e_shell_view_get_shell_backend (shell_view) : NULL;
 	preferences_window = e_shell_get_preferences_window (shell);
 
 	gtk_window_set_transient_for (
@@ -917,7 +922,9 @@ action_preferences_cb (GtkAction *action,
 		GTK_WIN_POS_CENTER_ON_PARENT);
 	gtk_window_present (GTK_WINDOW (preferences_window));
 
-	/* FIXME Switch to a page appropriate for the current view. */
+	if (shell_backend && E_SHELL_BACKEND_GET_CLASS (shell_backend)->preferences_page) {
+		e_preferences_window_show_page (E_PREFERENCES_WINDOW (preferences_window), E_SHELL_BACKEND_GET_CLASS (shell_backend)->preferences_page);
+	}
 }
 
 /**
diff --git a/shell/test/e-test-shell-backend.c b/shell/test/e-test-shell-backend.c
index 6a6c03b..58fe1aa 100644
--- a/shell/test/e-test-shell-backend.c
+++ b/shell/test/e-test-shell-backend.c
@@ -183,6 +183,7 @@ test_shell_backend_class_init (ETestShellBackendClass *class)
 	shell_backend_class->aliases = "monkey";
 	shell_backend_class->schemes = "";
 	shell_backend_class->sort_order = 100;
+	shell_backend_class->preferences_page = NULL;
 	shell_backend_class->start = test_shell_backend_start;
 	shell_backend_class->migrate = test_shell_backend_migrate;
 }



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