[evolution-data-server] ECollectionBackend: Synchronize display-names on mail sources.



commit 8b87390df566cb9a67beaa83914ff864662e364b
Author: Matthew Barnes <mbarnes redhat com>
Date:   Thu Feb 28 10:29:18 2013 -0500

    ECollectionBackend: Synchronize display-names on mail sources.
    
    Keep display names of mail-related child sources synchronized with the
    collection source's display name.  This is needed to support GOA's new
    "imap_smtp" provider, but all known collection backend implementations
    are already doing it on their own anyway.
    
    Seems like a reasonable default behavior given our current use cases.

 libebackend/e-collection-backend.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/libebackend/e-collection-backend.c b/libebackend/e-collection-backend.c
index 51a3356..4b73e55 100644
--- a/libebackend/e-collection-backend.c
+++ b/libebackend/e-collection-backend.c
@@ -711,12 +711,30 @@ collection_backend_child_added (ECollectionBackend *backend,
                                 ESource *child_source)
 {
        ESource *collection_source;
+       const gchar *extension_name;
+       gboolean is_mail = FALSE;
 
        collection_backend_children_insert (backend, child_source);
        collection_backend_bind_child_enabled (backend, child_source);
 
        collection_source = e_backend_get_source (E_BACKEND (backend));
 
+       extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
+       is_mail |= e_source_has_extension (child_source, extension_name);
+
+       extension_name = E_SOURCE_EXTENSION_MAIL_IDENTITY;
+       is_mail |= e_source_has_extension (child_source, extension_name);
+
+       extension_name = E_SOURCE_EXTENSION_MAIL_TRANSPORT;
+       is_mail |= e_source_has_extension (child_source, extension_name);
+
+       /* Synchronize mail-related display names with the collection. */
+       if (is_mail)
+               g_object_bind_property (
+                       collection_source, "display-name",
+                       child_source, "display-name",
+                       G_BINDING_SYNC_CREATE);
+
        /* Collection children are not removable. */
        e_server_side_source_set_removable (
                E_SERVER_SIDE_SOURCE (child_source), FALSE);


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