From 5ddff2c76a6f676a6bab34dd7c277e5c8d1f12f2 Mon Sep 17 00:00:00 2001 From: "Arnel A. Borja" Date: Sun, 25 Aug 2013 10:22:51 +0800 Subject: extract: Use TrackerStorage to check if file is in a removable medium This will initialize a TrackerStorage on init and unrefs it on shutdown. Removed warnings for missing TrackerStorage. Uncommented media_art_copy_to_local which now works again. --- libmediaart/extract.c | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/libmediaart/extract.c b/libmediaart/extract.c index 8afc3f7..358c8d9 100644 --- a/libmediaart/extract.c +++ b/libmediaart/extract.c @@ -25,6 +25,8 @@ #include +#include "tracker-storage.h" + #include "extract.h" #include "cache.h" @@ -69,6 +71,7 @@ static gboolean disable_requests; static GHashTable *media_art_cache; static GDBusConnection *connection; +static TrackerStorage *storage; static void media_art_queue_cb (GObject *source_object, GAsyncResult *res, @@ -825,12 +828,9 @@ media_art_request_download (MediaArtType type, } } -#if 0 - static void -media_art_copy_to_local (TrackerStorage *storage, - const gchar *filename, - const gchar *local_uri) +media_art_copy_to_local (const gchar *filename, + const gchar *local_uri) { GSList *roots, *l; gboolean on_removable_device = FALSE; @@ -897,18 +897,6 @@ media_art_copy_to_local (TrackerStorage *storage, } } -#else -#warning "FIXME: WE don't have TrackerStorage, media_art_copy_to_local() does nothing." - -static void -media_art_copy_to_local (const gchar *filename, - const gchar *local_uri) -{ - g_warning ("FIXME: WE don't have TrackerStorage, media_art_copy_to_local() does nothing."); -} - -#endif - static void media_art_queue_cb (GObject *source_object, GAsyncResult *res, @@ -935,10 +923,7 @@ media_art_queue_cb (GObject *source_object, g_variant_unref (v); } - /* FIXME: was TrackerStorage ...*/ -#warning "FIXME: check for non-existant TrackerStorage" - - if (NULL && + if (storage && fi->art_path && g_file_test (fi->art_path, G_FILE_TEST_EXISTS)) { media_art_copy_to_local (fi->art_path, @@ -973,6 +958,8 @@ media_art_init (void) return FALSE; } + storage = tracker_storage_new (); + initialized = TRUE; return TRUE; @@ -983,6 +970,10 @@ media_art_shutdown (void) { g_return_if_fail (initialized == TRUE); + if (storage) { + g_object_unref (storage); + } + if (connection) { g_object_unref (connection); } -- cgit v1.2.1