[evolution-data-server] Revert "ESourceRegistry: Do not mandate builtin sources."
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Revert "ESourceRegistry: Do not mandate builtin sources."
- Date: Sat, 15 Dec 2012 12:44:09 +0000 (UTC)
commit c33d4829b083557383d5d4a819057e98b210e428
Author: Matthew Barnes <mbarnes redhat com>
Date: Sat Dec 15 07:42:14 2012 -0500
Revert "ESourceRegistry: Do not mandate builtin sources."
This reverts commit 78340f9274d5c2ee0f52507f935f97d6b92f513e.
This violates a key invariant of the get_default() and especially
get_builtin() functions: that they never return NULL.
addressbook/backends/file/e-book-backend-file.c | 5 ++---
addressbook/libebook/e-book-client.c | 1 -
calendar/backends/file/e-cal-backend-file.c | 5 ++---
libedataserver/e-source-registry.c | 10 ++++++++--
tests/libebook/client/client-test-utils.c | 1 -
5 files changed, 12 insertions(+), 10 deletions(-)
---
diff --git a/addressbook/backends/file/e-book-backend-file.c b/addressbook/backends/file/e-book-backend-file.c
index 351e288..6fb1483 100644
--- a/addressbook/backends/file/e-book-backend-file.c
+++ b/addressbook/backends/file/e-book-backend-file.c
@@ -241,7 +241,7 @@ e_book_backend_file_extract_path_from_source (ESourceRegistry *registry,
* "system-$COMPONENT" but since the data directories are already
* split out by component, we'll continue to use the old "system"
* directories for these particular data sources. */
- if (builtin_source != NULL && e_source_equal (source, builtin_source))
+ if (e_source_equal (source, builtin_source))
uid = "system";
switch (path_type) {
@@ -257,8 +257,7 @@ e_book_backend_file_extract_path_from_source (ESourceRegistry *registry,
g_warn_if_reached ();
}
- if (builtin_source)
- g_object_unref (builtin_source);
+ g_object_unref (builtin_source);
return filename;
}
diff --git a/addressbook/libebook/e-book-client.c b/addressbook/libebook/e-book-client.c
index 45d04cf..f80bc63 100644
--- a/addressbook/libebook/e-book-client.c
+++ b/addressbook/libebook/e-book-client.c
@@ -1034,7 +1034,6 @@ e_book_client_get_self (ESourceRegistry *registry,
g_return_val_if_fail (E_IS_BOOK_CLIENT (client), FALSE);
source = e_source_registry_ref_builtin_address_book (registry);
- g_return_val_if_fail (source != NULL, FALSE);
*client = e_book_client_new (source, &local_error);
g_object_unref (source);
diff --git a/calendar/backends/file/e-cal-backend-file.c b/calendar/backends/file/e-cal-backend-file.c
index cd4ac34..00fa8d0 100644
--- a/calendar/backends/file/e-cal-backend-file.c
+++ b/calendar/backends/file/e-cal-backend-file.c
@@ -3431,15 +3431,14 @@ cal_backend_file_constructed (GObject *object)
* "system-$COMPONENT" but since the data directories are already
* split out by component, we'll continue to use the old "system"
* directories for these particular data sources. */
- if (builtin_source != NULL && e_source_equal (source, builtin_source))
+ if (e_source_equal (source, builtin_source))
uid = "system";
filename = g_build_filename (user_data_dir, component_type, uid, NULL);
e_cal_backend_set_cache_dir (backend, filename);
g_free (filename);
- if (builtin_source)
- g_object_unref (builtin_source);
+ g_object_unref (builtin_source);
}
/* Class initialization function for the file backend */
diff --git a/libedataserver/e-source-registry.c b/libedataserver/e-source-registry.c
index 5d2c553..93ae50b 100644
--- a/libedataserver/e-source-registry.c
+++ b/libedataserver/e-source-registry.c
@@ -2743,6 +2743,7 @@ 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;
}
@@ -2776,10 +2777,12 @@ 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 present in normal EDS installations. */
+ /* The built-in source is always present. */
if (source == NULL)
source = e_source_registry_ref_builtin_address_book (registry);
+ g_return_val_if_fail (E_IS_SOURCE (source), NULL);
+
return source;
}
@@ -2842,6 +2845,7 @@ 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;
}
@@ -2875,10 +2879,12 @@ e_source_registry_ref_default_calendar (ESourceRegistry *registry)
source = e_source_registry_ref_source (registry, uid);
g_free (uid);
- /* The built-in source is present in normal EDS installations. */
+ /* The built-in source is always present. */
if (source == NULL)
source = e_source_registry_ref_builtin_calendar (registry);
+ g_return_val_if_fail (E_IS_SOURCE (source), NULL);
+
return source;
}
diff --git a/tests/libebook/client/client-test-utils.c b/tests/libebook/client/client-test-utils.c
index bb41e82..f9bda66 100644
--- a/tests/libebook/client/client-test-utils.c
+++ b/tests/libebook/client/client-test-utils.c
@@ -71,7 +71,6 @@ open_system_book (ESourceRegistry *registry,
main_initialize ();
source = e_source_registry_ref_builtin_address_book (registry);
- g_return_val_if_fail (source != NULL, NULL);
book_client = e_book_client_new (source, &error);
g_object_unref (source);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]