[gnac] Clear cached metadata when removing file from list



commit d023487bb7c09c2dd00d738a359baa6dfeed3ac4
Author: BenoÃt Dupasquier <bdupasqu src gnome org>
Date:   Mon Feb 13 22:41:41 2012 +0000

    Clear cached metadata when removing file from list

 libgnac/libgnac-converter.c |    2 ++
 libgnac/libgnac-metadata.c  |   18 ++++++++++++++++++
 libgnac/libgnac-metadata.h  |    7 +++++++
 3 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/libgnac/libgnac-converter.c b/libgnac/libgnac-converter.c
index e21e2c5..35d9bc4 100644
--- a/libgnac/libgnac-converter.c
+++ b/libgnac/libgnac-converter.c
@@ -640,6 +640,7 @@ libgnac_converter_remove(LibgnacConverter  *self,
                   LIBGNAC_METADATA_TAG_DURATION(tags));
   }
 
+  libgnac_metadata_remove(metadata, ((LibgnacMediaItem *) item)->source);
   g_queue_remove(priv->queue, elem->data);
   g_hash_table_remove(priv->file_table, uri);
   g_signal_emit(self, signals[FILE_REMOVED], 0, uri);
@@ -657,6 +658,7 @@ libgnac_converter_clear(LibgnacConverter *self)
 
   g_queue_clear(priv->queue);
   g_hash_table_remove_all(priv->file_table);
+  libgnac_metadata_remove_all(metadata);
 
   priv->total_duration = 0;
 
diff --git a/libgnac/libgnac-metadata.c b/libgnac/libgnac-metadata.c
index b37f176..3252b55 100644
--- a/libgnac/libgnac-metadata.c
+++ b/libgnac/libgnac-metadata.c
@@ -440,6 +440,24 @@ libgnac_metadata_process_video_info(LibgnacMetadata *md)
 }
 
 
+gboolean
+libgnac_metadata_remove(LibgnacMetadata  *md,
+                        GFile            *uri)
+{
+  gchar *string_uri = g_file_get_uri(uri);
+  gboolean ret = g_hash_table_remove(md->priv->tags_table, string_uri);
+  g_free(string_uri);
+  return ret;
+}
+
+
+void
+libgnac_metadata_remove_all(LibgnacMetadata *md)
+{
+  g_hash_table_remove_all(md->priv->tags_table);
+}
+
+
 LibgnacTags *
 libgnac_metadata_extract(LibgnacMetadata  *md,
                          GFile            *uri,
diff --git a/libgnac/libgnac-metadata.h b/libgnac/libgnac-metadata.h
index f45eab9..1c26be3 100644
--- a/libgnac/libgnac-metadata.h
+++ b/libgnac/libgnac-metadata.h
@@ -67,6 +67,13 @@ libgnac_metadata_new(void);
 GType
 libgnac_metadata_get_type(void);
 
+gboolean
+libgnac_metadata_remove(LibgnacMetadata  *md,
+                        GFile            *uri);
+
+void
+libgnac_metadata_remove_all(LibgnacMetadata  *md);
+
 /*
  * The returned LibgnacTags must be freed with 
  * libgnac_metadata_tags_free.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]