[evolution/webkit] Composer: Add Edit -> Preferences



commit 11499767bf767e04f73c5ddf8f95214a46276c83
Author: Matthew Barnes <mbarnes redhat com>
Date:   Thu Feb 3 14:09:50 2011 -0500

    Composer: Add Edit -> Preferences
    
    Opens the Preferences window to the Composer Preferences section.

 composer/e-composer-actions.c       |   75 +++++++++++++++++++++++++---------
 composer/e-composer-private.h       |    1 +
 composer/evolution-composer.ui      |    4 ++
 shell/e-shell-window-actions.c      |    5 +-
 widgets/misc/e-preferences-window.c |   14 ++++--
 5 files changed, 71 insertions(+), 28 deletions(-)
---
diff --git a/composer/e-composer-actions.c b/composer/e-composer-actions.c
index 1f1cb44..bbd2aac 100644
--- a/composer/e-composer-actions.c
+++ b/composer/e-composer-actions.c
@@ -61,6 +61,19 @@ action_close_cb (GtkAction *action,
 }
 
 static void
+action_new_message_cb (GtkAction *action,
+                       EMsgComposer *composer)
+{
+	EMsgComposer *new_composer;
+	EShell *shell;
+
+	shell = e_msg_composer_get_shell (composer);
+
+	new_composer = e_msg_composer_new (shell);
+	gtk_widget_show (GTK_WIDGET (new_composer));
+}
+
+static void
 action_pgp_encrypt_cb (GtkToggleAction *action,
                        EMsgComposer *composer)
 {
@@ -81,6 +94,34 @@ action_pgp_sign_cb (GtkToggleAction *action,
 }
 
 static void
+action_preferences_cb (GtkAction *action,
+                       EMsgComposer *composer)
+{
+	EShell *shell;
+	GtkWidget *preferences_window;
+	const gchar *page_name = "composer";
+
+	shell = e_msg_composer_get_shell (composer);
+	preferences_window = e_shell_get_preferences_window (shell);
+	e_preferences_window_setup (E_PREFERENCES_WINDOW (preferences_window));
+
+	gtk_window_set_transient_for (
+		GTK_WINDOW (preferences_window),
+		GTK_WINDOW (composer));
+	gtk_window_set_position (
+		GTK_WINDOW (preferences_window),
+		GTK_WIN_POS_CENTER_ON_PARENT);
+	gtk_window_present (GTK_WINDOW (preferences_window));
+
+	if (e_shell_get_express_mode (shell))
+		e_preferences_window_filter_page (
+			E_PREFERENCES_WINDOW (preferences_window), page_name);
+	else
+		e_preferences_window_show_page (
+			E_PREFERENCES_WINDOW (preferences_window), page_name);
+}
+
+static void
 action_print_cb (GtkAction *action,
                  EMsgComposer *composer)
 {
@@ -218,19 +259,6 @@ action_send_cb (GtkAction *action,
 }
 
 static void
-action_new_message_cb (GtkAction *action,
-                       EMsgComposer *composer)
-{
-	EMsgComposer *new_composer;
-	EShell *shell;
-
-	shell = e_msg_composer_get_shell (composer);
-
-	new_composer = e_msg_composer_new (shell);
-	gtk_widget_show (GTK_WIDGET (new_composer));
-}
-
-static void
 action_smime_encrypt_cb (GtkToggleAction *action,
                          EMsgComposer *composer)
 {
@@ -266,6 +294,20 @@ static GtkActionEntry entries[] = {
 	  N_("Close the current file"),
 	  G_CALLBACK (action_close_cb) },
 
+	{ "new-message",
+	  "mail-message-new",
+	  N_("New _Message"),
+	  "<Control>n",
+	  N_("Open New Message window"),
+	  G_CALLBACK (action_new_message_cb) },
+
+	{ "preferences",
+	  GTK_STOCK_PREFERENCES,
+	  NULL,
+	  NULL,
+	  N_("Configure Evolution"),
+	  G_CALLBACK (action_preferences_cb) },
+
 	{ "save",
 	  GTK_STOCK_SAVE,
 	  N_("_Save"),
@@ -280,13 +322,6 @@ static GtkActionEntry entries[] = {
 	  N_("Save the current file with a different name"),
 	  G_CALLBACK (action_save_as_cb) },
 
-	{ "new-message",
-	  "mail-message-new",
-	  N_("New _Message"),
-	  "<Control>n",
-	  N_("Open New Message window"),
-	  G_CALLBACK (action_new_message_cb) },
-
 	/* Menus */
 
 	{ "charset-menu",
diff --git a/composer/e-composer-private.h b/composer/e-composer-private.h
index 5cf503e..9ed3b11 100644
--- a/composer/e-composer-private.h
+++ b/composer/e-composer-private.h
@@ -52,6 +52,7 @@
 #include "widgets/misc/e-attachment-paned.h"
 #include "widgets/misc/e-attachment-store.h"
 #include "widgets/misc/e-picture-gallery.h"
+#include "widgets/misc/e-preferences-window.h"
 #include "widgets/misc/e-signature-combo-box.h"
 #include "widgets/misc/e-web-view.h"
 #include "shell/e-shell.h"
diff --git a/composer/evolution-composer.ui b/composer/evolution-composer.ui
index d1eb10c..91fce38 100644
--- a/composer/evolution-composer.ui
+++ b/composer/evolution-composer.ui
@@ -20,6 +20,10 @@
         <menuitem action='close'/>
       </menu>
     </placeholder>
+    <menu action='edit-menu'>
+      <separator/>
+      <menuitem action='preferences'/>
+    </menu>
     <placeholder name='pre-insert-menu'>
       <menu action='view-menu'>
         <menuitem action='view-reply-to'/>
diff --git a/shell/e-shell-window-actions.c b/shell/e-shell-window-actions.c
index 6547ba6..928cab7 100644
--- a/shell/e-shell-window-actions.c
+++ b/shell/e-shell-window-actions.c
@@ -930,15 +930,14 @@ action_preferences_cb (GtkAction *action,
 	shell_backend_class = E_SHELL_BACKEND_GET_CLASS (shell_backend);
 
 	if (shell_backend_class->preferences_page != NULL) {
-		if (e_shell_get_express_mode (shell)) {
+		if (e_shell_get_express_mode (shell))
 			e_preferences_window_filter_page (
 				E_PREFERENCES_WINDOW (preferences_window),
 				shell_backend_class->preferences_page);
-		} else {
+		else
 			e_preferences_window_show_page (
 				E_PREFERENCES_WINDOW (preferences_window),
 				shell_backend_class->preferences_page);
-		}
 	}
 }
 
diff --git a/widgets/misc/e-preferences-window.c b/widgets/misc/e-preferences-window.c
index 48b1d3e..9b6d726 100644
--- a/widgets/misc/e-preferences-window.c
+++ b/widgets/misc/e-preferences-window.c
@@ -210,7 +210,7 @@ preferences_window_show (GtkWidget *widget)
 
 	priv = E_PREFERENCES_WINDOW_GET_PRIVATE (widget);
 	if (!priv->setup)
-		g_warning ("Error - preferences window has not been setup correctly");
+		g_warning ("Preferences window has not been setup correctly");
 
 	icon_view = GTK_ICON_VIEW (priv->icon_view);
 
@@ -308,7 +308,8 @@ e_preferences_window_init (EPreferencesWindow *window)
 
 	container = widget;
 
-	widget = gtk_icon_view_new_with_model (GTK_TREE_MODEL (window->priv->filter));
+	widget = gtk_icon_view_new_with_model (
+		GTK_TREE_MODEL (window->priv->filter));
 	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);
@@ -379,7 +380,6 @@ gpointer
 e_preferences_window_get_shell (EPreferencesWindow *window)
 {
 	g_return_val_if_fail (E_IS_PREFERENCES_WINDOW (window), NULL);
-	g_return_val_if_fail (window->priv != NULL, NULL);
 
 	return window->priv->shell;
 }
@@ -389,7 +389,7 @@ e_preferences_window_add_page (EPreferencesWindow *window,
                                const gchar *page_name,
                                const gchar *icon_name,
                                const gchar *caption,
-			       EPreferencesWindowCreatePageFn create_fn,
+                               EPreferencesWindowCreatePageFn create_fn,
                                gint sort_order)
 {
 	GtkTreeRowReference *reference;
@@ -434,7 +434,9 @@ e_preferences_window_add_page (EPreferencesWindow *window,
 	gtk_widget_show (GTK_WIDGET (align));
 	g_object_set_data (G_OBJECT (align), "create_fn", create_fn);
 	gtk_notebook_append_page (notebook, align, NULL);
-	gtk_container_child_set (GTK_CONTAINER (notebook), align, "tab-fill", FALSE, "tab-expand", FALSE, NULL);
+	gtk_container_child_set (
+		GTK_CONTAINER (notebook), align,
+		"tab-fill", FALSE, "tab-expand", FALSE, NULL);
 
 	/* Force GtkIconView to recalculate the text wrap width,
 	 * otherwise we get a really narrow icon list on the left
@@ -507,6 +509,8 @@ e_preferences_window_setup (EPreferencesWindow *window)
 	GtkNotebook *notebook;
 	EPreferencesWindowPrivate *priv;
 
+	g_return_if_fail (E_IS_PREFERENCES_WINDOW (window));
+
 	priv = E_PREFERENCES_WINDOW_GET_PRIVATE (window);
 	notebook = GTK_NOTEBOOK (priv->notebook);
 	num = gtk_notebook_get_n_pages (notebook);



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