[tepl] MetadataManager/MetadataAttic: implement copy_from()
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tepl] MetadataManager/MetadataAttic: implement copy_from()
- Date: Sat, 18 Apr 2020 17:21:08 +0000 (UTC)
commit 7a999603ac95ce47efea0d31ab905724b0224ffd
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sat Apr 18 15:02:43 2020 +0200
MetadataManager/MetadataAttic: implement copy_from()
tepl/tepl-metadata-attic.c | 24 +++++++++++++++++++++++-
tepl/tepl-metadata-attic.h | 5 +++++
tepl/tepl-metadata-manager.c | 8 ++++----
3 files changed, 32 insertions(+), 5 deletions(-)
---
diff --git a/tepl/tepl-metadata-attic.c b/tepl/tepl-metadata-attic.c
index 0ab67b8..deb43ca 100644
--- a/tepl/tepl-metadata-attic.c
+++ b/tepl/tepl-metadata-attic.c
@@ -18,7 +18,6 @@
*/
#include "tepl-metadata-attic.h"
-#include "tepl-metadata.h"
struct _TeplMetadataAtticPrivate
{
@@ -188,3 +187,26 @@ _tepl_metadata_attic_append_xml_to_string (TeplMetadataAttic *metadata,
g_free (uri);
g_free (uri_escaped);
}
+
+void
+_tepl_metadata_attic_copy_into (TeplMetadataAttic *from_metadata_attic,
+ TeplMetadata *to_metadata)
+{
+ GHashTableIter iter;
+ gpointer key_p;
+ gpointer value_p;
+
+ g_return_if_fail (TEPL_IS_METADATA_ATTIC (from_metadata_attic));
+ g_return_if_fail (TEPL_IS_METADATA (to_metadata));
+
+ g_hash_table_iter_init (&iter, from_metadata_attic->priv->hash_table);
+ while (g_hash_table_iter_next (&iter, &key_p, &value_p))
+ {
+ const gchar *key = key_p;
+ const gchar *value = value_p;
+
+ tepl_metadata_set (to_metadata, key, value);
+ }
+
+ set_current_atime (from_metadata_attic);
+}
diff --git a/tepl/tepl-metadata-attic.h b/tepl/tepl-metadata-attic.h
index 2819f10..73615ca 100644
--- a/tepl/tepl-metadata-attic.h
+++ b/tepl/tepl-metadata-attic.h
@@ -21,6 +21,7 @@
#define TEPL_METADATA_ATTIC_H
#include <gio/gio.h>
+#include "tepl-metadata.h"
G_BEGIN_DECLS
@@ -71,6 +72,10 @@ void _tepl_metadata_attic_append_xml_to_string (TeplMetadataAttic
*metadata,
GFile *location,
GString *string);
+G_GNUC_INTERNAL
+void _tepl_metadata_attic_copy_into (TeplMetadataAttic
*from_metadata_attic,
+ TeplMetadata *to_metadata);
+
G_END_DECLS
#endif /* TEPL_METADATA_ATTIC_H */
diff --git a/tepl/tepl-metadata-manager.c b/tepl/tepl-metadata-manager.c
index 85d2752..b93b8d9 100644
--- a/tepl/tepl-metadata-manager.c
+++ b/tepl/tepl-metadata-manager.c
@@ -324,17 +324,17 @@ tepl_metadata_manager_copy_from (TeplMetadataManager *from_manager,
GFile *for_location,
TeplMetadata *to_metadata)
{
- TeplMetadataAttic *metadata_attic;
+ TeplMetadataAttic *from_metadata_attic;
g_return_if_fail (TEPL_IS_METADATA_MANAGER (from_manager));
g_return_if_fail (G_IS_FILE (for_location));
g_return_if_fail (TEPL_IS_METADATA (to_metadata));
- metadata_attic = g_hash_table_lookup (from_manager->priv->hash_table, for_location);
+ from_metadata_attic = g_hash_table_lookup (from_manager->priv->hash_table, for_location);
- if (metadata_attic != NULL)
+ if (from_metadata_attic != NULL)
{
- /* TODO */
+ _tepl_metadata_attic_copy_into (from_metadata_attic, to_metadata);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]