[evolution/account-mgmt] Lock down Receiving and Sending pages for GOA accounts.



commit be858c3cf611bf59d37ca6e9b0f8f34592b544ce
Author: Matthew Barnes <mbarnes redhat com>
Date:   Wed May 30 12:59:13 2012 -0400

    Lock down Receiving and Sending pages for GOA accounts.

 mail/e-mail-config-notebook.c |   41 ++++++++++++++++++++++++++++++-----------
 mail/e-mail-config-window.c   |    6 +++---
 2 files changed, 33 insertions(+), 14 deletions(-)
---
diff --git a/mail/e-mail-config-notebook.c b/mail/e-mail-config-notebook.c
index 982427f..999ee1b 100644
--- a/mail/e-mail-config-notebook.c
+++ b/mail/e-mail-config-notebook.c
@@ -19,6 +19,7 @@
 #include "e-mail-config-notebook.h"
 
 #include <libebackend/e-extensible.h>
+#include <libedataserver/e-source-goa.h>
 #include <libedataserver/e-source-mail-identity.h>
 
 #include <mail/e-mail-config-defaults-page.h>
@@ -304,6 +305,8 @@ mail_config_notebook_constructed (GObject *object)
 	EMailSession *session;
 	EMailConfigPage *page;
 	const gchar *extension_name;
+	gboolean add_receiving_page = TRUE;
+	gboolean add_sending_page = TRUE;
 
 	notebook = E_MAIL_CONFIG_NOTEBOOK (object);
 
@@ -319,6 +322,18 @@ mail_config_notebook_constructed (GObject *object)
 	extension = e_source_get_extension (source, extension_name);
 	mail_identity_extension = E_SOURCE_MAIL_IDENTITY (extension);
 
+	/* If we have a collection source and the collection source
+	 * has a [GNOME Online Accounts] extension, skip the Receiving
+	 * and Sending pages since GOA dictates those settings. */
+	source = notebook->priv->collection_source;
+	if (source != NULL) {
+		extension_name = E_SOURCE_EXTENSION_GOA;
+		if (e_source_has_extension (source, extension_name)) {
+			add_receiving_page = FALSE;
+			add_sending_page = FALSE;
+		}
+	}
+
 	/*** Identity Page ***/
 
 	page = e_mail_config_identity_page_new (
@@ -334,12 +349,14 @@ mail_config_notebook_constructed (GObject *object)
 		E_MAIL_CONFIG_SERVICE_PAGE (page),
 		notebook->priv->account_source,
 		notebook->priv->collection_source);
-	e_mail_config_notebook_add_page (notebook, page);
+	if (add_receiving_page) {
+		e_mail_config_notebook_add_page (notebook, page);
 
-	g_object_bind_property (
-		mail_identity_extension, "address",
-		page, "email-address",
-		G_BINDING_SYNC_CREATE);
+		g_object_bind_property (
+			mail_identity_extension, "address",
+			page, "email-address",
+			G_BINDING_SYNC_CREATE);
+	}
 
 	provider = e_mail_config_service_backend_get_provider (backend);
 
@@ -363,12 +380,14 @@ mail_config_notebook_constructed (GObject *object)
 			E_MAIL_CONFIG_SERVICE_PAGE (page),
 			notebook->priv->transport_source,
 			notebook->priv->collection_source);
-		e_mail_config_notebook_add_page (notebook, page);
+		if (add_sending_page) {
+			e_mail_config_notebook_add_page (notebook, page);
 
-		g_object_bind_property (
-			mail_identity_extension, "address",
-			page, "email-address",
-			G_BINDING_SYNC_CREATE);
+			g_object_bind_property (
+				mail_identity_extension, "address",
+				page, "email-address",
+				G_BINDING_SYNC_CREATE);
+		}
 	}
 
 	/*** Defaults Page ***/
diff --git a/mail/e-mail-config-window.c b/mail/e-mail-config-window.c
index 0470035..9c04929 100644
--- a/mail/e-mail-config-window.c
+++ b/mail/e-mail-config-window.c
@@ -364,20 +364,20 @@ mail_config_window_constructed (GObject *object)
 	gtk_widget_set_vexpand (widget, TRUE);
 	gtk_widget_set_margin_bottom (widget, 17);
 	gtk_notebook_set_show_tabs (GTK_NOTEBOOK (widget), FALSE);
-	gtk_grid_attach (GTK_GRID (container), widget, 2, 0, 1, 1);
+	gtk_grid_attach (GTK_GRID (container), widget, 2, 1, 1, 1);
 	window->priv->notebook = widget;  /* not referenced */
 	gtk_widget_show (widget);
 
 	widget = gtk_separator_new (GTK_ORIENTATION_VERTICAL);
 	gtk_widget_set_vexpand (widget, TRUE);
 	gtk_widget_set_valign (widget, GTK_ALIGN_FILL);
-	gtk_grid_attach (GTK_GRID (container), widget, 1, 0, 1, 1);
+	gtk_grid_attach (GTK_GRID (container), widget, 1, 1, 1, 1);
 	gtk_widget_show (widget);
 
 	widget = e_mail_config_sidebar_new (
 		E_MAIL_CONFIG_NOTEBOOK (window->priv->notebook));
 	gtk_widget_set_vexpand (widget, TRUE);
-	gtk_grid_attach (GTK_GRID (container), widget, 0, 0, 1, 1);
+	gtk_grid_attach (GTK_GRID (container), widget, 0, 1, 1, 1);
 	gtk_widget_show (widget);
 
 	/* Make the Apply button insensitive when required



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