summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnel A. Borja <arnelborja@src.gnome.org>2013-08-25 10:22:51 +0800
committerArnel A. Borja <arnelborja@src.gnome.org>2013-08-31 01:29:12 +0800
commit5ddff2c76a6f676a6bab34dd7c277e5c8d1f12f2 (patch)
tree9edc4acb1b61d0c159ff6a039019ad5e25fb1243
parent625d028f6889c5960b121687c5063b49144b186c (diff)
downloadlibmediaart-5ddff2c76a6f676a6bab34dd7c277e5c8d1f12f2.tar.gz
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.
-rw-r--r--libmediaart/extract.c33
1 files 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 <gio/gio.h>
+#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);
}