[evolution-data-server/openismus-work: 113/122] ESourceRegistry: Do not mandate builtin sources.
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/openismus-work: 113/122] ESourceRegistry: Do not mandate builtin sources.
- Date: Mon, 17 Dec 2012 09:12:48 +0000 (UTC)
commit 45352a2748feeb46e99b377ef5595d7f1c36d364
Author: Tristan Van Berkom <tristanvb openismus com>
Date: Thu Dec 13 16:14:19 2012 +0900
ESourceRegistry: Do not mandate builtin sources.
This patch removes return_if_fail() critical warnings from
e_source_registry_ref_[default,builtin]_address_book() and
e_source_registry_ref_[default,builtin]_calendar(). This
avoids the console warnings when running make check.
Also, this patch fixes several locations in EDS where the
above functions blindly expect an #ESource to be returned.
Conflicts:
addressbook/libebook/e-book-client.c
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, 10 insertions(+), 12 deletions(-)
---
diff --git a/addressbook/backends/file/e-book-backend-file.c b/addressbook/backends/file/e-book-backend-file.c
index 4915dce..01cc92d 100644
--- a/addressbook/backends/file/e-book-backend-file.c
+++ b/addressbook/backends/file/e-book-backend-file.c
@@ -252,7 +252,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 (e_source_equal (source, builtin_source))
+ if (builtin_source != NULL && e_source_equal (source, builtin_source))
uid = "system";
switch (path_type) {
@@ -268,7 +268,8 @@ e_book_backend_file_extract_path_from_source (ESourceRegistry *registry,
g_warn_if_reached ();
}
- g_object_unref (builtin_source);
+ if (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 f821378..1d9c28d 100644
--- a/addressbook/libebook/e-book-client.c
+++ b/addressbook/libebook/e-book-client.c
@@ -752,6 +752,7 @@ 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 e017fa2..a131771 100644
--- a/calendar/backends/file/e-cal-backend-file.c
+++ b/calendar/backends/file/e-cal-backend-file.c
@@ -3426,14 +3426,15 @@ 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 (e_source_equal (source, builtin_source))
+ if (builtin_source != NULL && 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);
- g_object_unref (builtin_source);
+ if (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 681754b..f991b35 100644
--- a/libedataserver/e-source-registry.c
+++ b/libedataserver/e-source-registry.c
@@ -2565,7 +2565,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;
}
@@ -2599,12 +2598,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;
}
@@ -2667,7 +2664,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;
}
@@ -2701,12 +2697,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;
}
diff --git a/tests/libebook/client/client-test-utils.c b/tests/libebook/client/client-test-utils.c
index ba6fc42..2901e69 100644
--- a/tests/libebook/client/client-test-utils.c
+++ b/tests/libebook/client/client-test-utils.c
@@ -79,6 +79,7 @@ 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]