[tepl] Metadata: return error if MetadataStore not activated
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tepl] Metadata: return error if MetadataStore not activated
- Date: Sat, 18 Apr 2020 17:19:22 +0000 (UTC)
commit f3d0ae9bac6121f09bbcd53dcb7d1e40efac60bc
Author: Sébastien Wilmet <swilmet gnome org>
Date: Thu Apr 16 07:11:38 2020 +0200
Metadata: return error if MetadataStore not activated
Another way would be to issue a warning, and continue as if the
MetadataStore was correctly loaded.
tepl/tepl-metadata.c | 27 +++++++++++----------------
1 file changed, 11 insertions(+), 16 deletions(-)
---
diff --git a/tepl/tepl-metadata.c b/tepl/tepl-metadata.c
index 144aed5..3491d8a 100644
--- a/tepl/tepl-metadata.c
+++ b/tepl/tepl-metadata.c
@@ -54,7 +54,7 @@ use_gvfs_metadata (void)
}
/******************************************************************************/
-/* Simplify TeplMetadataStore is_loaded/is_loading/load */
+/* Simplify TeplMetadataStore is_activated/is_loaded/is_loading/load */
static void
load_metadata_store__notify_loaded_cb (TeplMetadataStore *store,
@@ -102,7 +102,16 @@ load_metadata_store_async (TeplMetadataStore *store,
task = g_task_new (store, cancellable, callback, user_data);
g_task_set_priority (task, io_priority);
- if (_tepl_metadata_store_is_loaded (store))
+ if (!_tepl_metadata_store_is_activated (store))
+ {
+ g_task_return_new_error (task,
+ G_IO_ERROR,
+ G_IO_ERROR_FAILED,
+ "Failed to use the TeplMetadataStore because "
+ "tepl_metadata_store_set_store_file() has not been called.");
+ g_object_unref (task);
+ }
+ else if (_tepl_metadata_store_is_loaded (store))
{
g_task_return_boolean (task, TRUE);
g_object_unref (task);
@@ -207,13 +216,6 @@ _tepl_metadata_query_info_async (GFile *location,
store = tepl_metadata_store_get_singleton ();
- if (!_tepl_metadata_store_is_activated (store))
- {
- g_task_return_pointer (task, NULL, NULL);
- g_object_unref (task);
- return;
- }
-
load_metadata_store_async (store,
io_priority,
cancellable,
@@ -340,13 +342,6 @@ _tepl_metadata_set_attributes_async (GFile *location,
store = tepl_metadata_store_get_singleton ();
- if (!_tepl_metadata_store_is_activated (store))
- {
- g_task_return_boolean (task, FALSE);
- g_object_unref (task);
- return;
- }
-
load_metadata_store_async (store,
io_priority,
cancellable,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]