From d88c38abebb672977729735513135da8b47409d4 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 15 Jul 2012 17:17:11 -0400 Subject: Rework handling of GOA mail. Disabling the mail part of an online account through the Control Center panel will now remove the CamelService from the EMailSession in addition to disabling the account/identity/transport ESources, causing it to be delisted from the account list in Preferences. Furthermore, hide the Enabled check box for accounts linked to GOA in Preferences. The collection ESource for these accounts can no longer be disabled through Evolution; all such account manipulation must be done through the Control Center panel. Lastly, display an icon next to accounts linked to GOA in Preferences. * Might be nice to show the actual provider icon instead of the generic Online Accounts icon from the Control Center, but need to think about how best to do that. Don't want a GOA dependency in core Evolution. Maybe ESourceCollection should grow a GIcon property for the online- accounts module in the registry service to set? --- mail/e-mail-account-store.c | 16 ++++++++++++++++ mail/e-mail-account-store.h | 2 ++ mail/e-mail-account-tree-view.c | 20 +++++++++++++++++++- 3 files changed, 37 insertions(+), 1 deletion(-) (limited to 'mail') diff --git a/mail/e-mail-account-store.c b/mail/e-mail-account-store.c index 51ad51cd95..b7228e2c71 100644 --- a/mail/e-mail-account-store.c +++ b/mail/e-mail-account-store.c @@ -981,6 +981,8 @@ e_mail_account_store_init (EMailAccountStore *store) types[ii++] = G_TYPE_BOOLEAN; /* COLUMN_DEFAULT */ types[ii++] = G_TYPE_STRING; /* COLUMN_BACKEND_NAME */ types[ii++] = G_TYPE_STRING; /* COLUMN_DISPLAY_NAME */ + types[ii++] = G_TYPE_BOOLEAN; /* COLUMN_ONLINE_ACCOUNT */ + types[ii++] = G_TYPE_BOOLEAN; /* COLUMN_ENABLED_VISIBLE */ g_assert (ii == E_MAIL_ACCOUNT_STORE_NUM_COLUMNS); @@ -1114,6 +1116,8 @@ e_mail_account_store_add_service (EMailAccountStore *store, const gchar *uid; gboolean builtin; gboolean enabled; + gboolean online_account = FALSE; + gboolean enabled_visible = TRUE; g_return_if_fail (E_IS_MAIL_ACCOUNT_STORE (store)); g_return_if_fail (CAMEL_IS_SERVICE (service)); @@ -1141,7 +1145,17 @@ e_mail_account_store_add_service (EMailAccountStore *store, collection = e_source_registry_find_extension ( registry, source, E_SOURCE_EXTENSION_COLLECTION); if (collection != NULL) { + const gchar *extension_name; + enabled = e_source_get_enabled (collection); + + /* Check for GNOME Online Accounts linkage. */ + extension_name = E_SOURCE_EXTENSION_GOA; + if (e_source_has_extension (collection, extension_name)) { + online_account = TRUE; + enabled_visible = FALSE; + } + g_object_unref (collection); } else { enabled = e_source_get_enabled (source); @@ -1168,6 +1182,8 @@ e_mail_account_store_add_service (EMailAccountStore *store, E_MAIL_ACCOUNT_STORE_COLUMN_SERVICE, service, E_MAIL_ACCOUNT_STORE_COLUMN_BUILTIN, builtin, E_MAIL_ACCOUNT_STORE_COLUMN_ENABLED, enabled, + E_MAIL_ACCOUNT_STORE_COLUMN_ONLINE_ACCOUNT, online_account, + E_MAIL_ACCOUNT_STORE_COLUMN_ENABLED_VISIBLE, enabled_visible, -1); /* This populates the rest of the columns. */ diff --git a/mail/e-mail-account-store.h b/mail/e-mail-account-store.h index 51d0afa088..063f6c07ad 100644 --- a/mail/e-mail-account-store.h +++ b/mail/e-mail-account-store.h @@ -53,6 +53,8 @@ typedef enum { E_MAIL_ACCOUNT_STORE_COLUMN_DEFAULT, E_MAIL_ACCOUNT_STORE_COLUMN_BACKEND_NAME, E_MAIL_ACCOUNT_STORE_COLUMN_DISPLAY_NAME, + E_MAIL_ACCOUNT_STORE_COLUMN_ONLINE_ACCOUNT, + E_MAIL_ACCOUNT_STORE_COLUMN_ENABLED_VISIBLE, E_MAIL_ACCOUNT_STORE_NUM_COLUMNS } EMailAccountStoreColumn; diff --git a/mail/e-mail-account-tree-view.c b/mail/e-mail-account-tree-view.c index 269a03d777..424294bf86 100644 --- a/mail/e-mail-account-tree-view.c +++ b/mail/e-mail-account-tree-view.c @@ -96,6 +96,10 @@ mail_account_tree_view_constructed (GObject *object) column, cell_renderer, "active", E_MAIL_ACCOUNT_STORE_COLUMN_ENABLED); + gtk_tree_view_column_add_attribute ( + column, cell_renderer, "visible", + E_MAIL_ACCOUNT_STORE_COLUMN_ENABLED_VISIBLE); + gtk_tree_view_append_column (tree_view, column); /* Column: Account Name */ @@ -106,12 +110,26 @@ mail_account_tree_view_constructed (GObject *object) cell_renderer = gtk_cell_renderer_text_new (); g_object_set (cell_renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL); - gtk_tree_view_column_pack_start (column, cell_renderer, TRUE); + gtk_tree_view_column_pack_start (column, cell_renderer, FALSE); gtk_tree_view_column_add_attribute ( column, cell_renderer, "text", E_MAIL_ACCOUNT_STORE_COLUMN_DISPLAY_NAME); + cell_renderer = gtk_cell_renderer_pixbuf_new (); + g_object_set ( + cell_renderer, "icon-name", "goa-panel", + "stock-size", GTK_ICON_SIZE_MENU, NULL); + gtk_tree_view_column_pack_start (column, cell_renderer, FALSE); + + gtk_tree_view_column_add_attribute ( + column, cell_renderer, "visible", + E_MAIL_ACCOUNT_STORE_COLUMN_ONLINE_ACCOUNT); + + /* This renderer is just an empty space filler. */ + cell_renderer = gtk_cell_renderer_pixbuf_new (); + gtk_tree_view_column_pack_start (column, cell_renderer, TRUE); + cell_renderer = gtk_cell_renderer_text_new (); g_object_set (cell_renderer, "text", _("Default"), NULL); gtk_tree_view_column_pack_end (column, cell_renderer, FALSE); -- cgit v1.2.3