ESourceRegistry: Do not mandate builtin sources.
[platform/upstream/evolution-data-server.git] / libedataserver / e-source-registry.c
index 4c9c572..5d2c553 100644 (file)
@@ -985,6 +985,7 @@ source_registry_dispose (GObject *object)
        g_hash_table_remove_all (priv->sources);
 
        if (priv->settings != NULL) {
+               g_signal_handlers_disconnect_by_data (priv->settings, object);
                g_object_unref (priv->settings);
                priv->settings = NULL;
        }
@@ -1032,7 +1033,8 @@ source_registry_initable_init (GInitable *initable,
 
        registry->priv->thread_closure = closure;
 
-       registry->priv->manager_thread = g_thread_new (NULL,
+       registry->priv->manager_thread = g_thread_new (
+               NULL,
                source_registry_object_manager_thread,
                closure);
 
@@ -1770,6 +1772,12 @@ e_source_registry_authenticate_sync (ESourceRegistry *registry,
 
 exit:
        g_main_context_pop_thread_default (main_context);
+
+       /* Make sure the main_context doesn't have pending operations;
+          workarounds https://bugzilla.gnome.org/show_bug.cgi?id=690126 */
+       while (g_main_context_pending (main_context))
+               g_main_context_iteration (main_context, FALSE);
+
        g_main_context_unref (main_context);
 
        return success;
@@ -2735,7 +2743,6 @@ e_source_registry_ref_builtin_address_book (ESourceRegistry *registry)
 
        uid = E_SOURCE_BUILTIN_ADDRESS_BOOK_UID;
        source = e_source_registry_ref_source (registry, uid);
-       g_return_val_if_fail (source != NULL, NULL);
 
        return source;
 }
@@ -2769,12 +2776,10 @@ e_source_registry_ref_default_address_book (ESourceRegistry *registry)
        source = e_source_registry_ref_source (registry, uid);
        g_free (uid);
 
-       /* The built-in source is always present. */
+       /* The built-in source is present in normal EDS installations. */
        if (source == NULL)
                source = e_source_registry_ref_builtin_address_book (registry);
 
-       g_return_val_if_fail (E_IS_SOURCE (source), NULL);
-
        return source;
 }
 
@@ -2837,7 +2842,6 @@ e_source_registry_ref_builtin_calendar (ESourceRegistry *registry)
 
        uid = E_SOURCE_BUILTIN_CALENDAR_UID;
        source = e_source_registry_ref_source (registry, uid);
-       g_return_val_if_fail (source != NULL, NULL);
 
        return source;
 }
@@ -2871,12 +2875,10 @@ e_source_registry_ref_default_calendar (ESourceRegistry *registry)
        source = e_source_registry_ref_source (registry, uid);
        g_free (uid);
 
-       /* The built-in source is always present. */
+       /* The built-in source is present in normal EDS installations. */
        if (source == NULL)
                source = e_source_registry_ref_builtin_calendar (registry);
 
-       g_return_val_if_fail (E_IS_SOURCE (source), NULL);
-
        return source;
 }