[PATCH 3/7] core: reorganised date-related keys.
- From: Guillaume Emont <guijemont igalia com>
- To: grilo-list gnome org
- Cc: Guillaume Emont <guijemont igalia com>
- Subject: [PATCH 3/7] core: reorganised date-related keys.
- Date: Fri, 22 Jul 2011 14:43:37 +0200
GRL_METADATA_KEY_DATE was removed because its definition is not precise enough.
GRL_METADATA_KEY_PUBLICATION_DATE and GRL_METADATA_KEY_MODIFCATION_DATE were added.
GDateTime *instances are not returned const any more in getters, for easier use
(GDateTime is immutable anyway).
---
src/data/grl-media.c | 70 +++++++++++++++++++++++++++++++++++++++---------
src/data/grl-media.h | 14 +++++++---
src/grl-metadata-key.c | 17 +++++++++---
src/grl-metadata-key.h | 3 +-
4 files changed, 82 insertions(+), 22 deletions(-)
diff --git a/src/data/grl-media.c b/src/data/grl-media.c
index eea3602..3a064a5 100644
--- a/src/data/grl-media.c
+++ b/src/data/grl-media.c
@@ -672,17 +672,17 @@ grl_media_set_duration (GrlMedia *media, gint duration)
}
/**
- * grl_media_set_date:
+ * grl_media_set_publication_date:
* @media: the media
* @date: the date
*
- * Set the media's date (TBD)
+ * Set the publication date of @media.
*/
void
-grl_media_set_date (GrlMedia *media, const GDateTime *date)
+grl_media_set_publication_date (GrlMedia *media, const GDateTime *date)
{
grl_data_set_boxed (GRL_DATA (media),
- GRL_METADATA_KEY_DATE,
+ GRL_METADATA_KEY_PUBLICATION_DATE,
date);
}
@@ -705,6 +705,24 @@ grl_media_set_creation_date (GrlMedia *media,
}
/**
+ * grl_media_set_modification_date:
+ * @media: the media
+ * @modification_date: date when the media was last modified
+ *
+ * Set the modification date of the media
+ *
+ */
+void
+grl_media_set_modification_date (GrlMedia *media,
+ const GDateTime *modification_date)
+
+{
+ grl_data_set_boxed (GRL_DATA (media),
+ GRL_METADATA_KEY_MODIFICATION_DATE,
+ modification_date);
+}
+
+/**
* grl_media_set_mime:
* @media: the media
* @mime: the mime type
@@ -1120,32 +1138,58 @@ grl_media_get_duration (GrlMedia *media)
}
/**
- * grl_media_get_date:
+ * grl_media_get_publication_date:
* @media: the media object
*
- * Returns: the media's date (TBD)
+ * Returns: (transfer full): the media's date (TBD)
*
* Since: 0.1.4
*/
-const GDateTime *
-grl_media_get_date (GrlMedia *media)
+GDateTime *
+grl_media_get_publication_date (GrlMedia *media)
{
- return grl_data_get_boxed (GRL_DATA (media), GRL_METADATA_KEY_DATE);
+ GDateTime *date;
+ date = grl_data_get_boxed (GRL_DATA (media),
+ GRL_METADATA_KEY_PUBLICATION_DATE);
+ if (date)
+ return g_date_time_ref (date);
+ return NULL;
}
/**
* grl_media_get_creation_date:
* @media: the media
*
- * Returns: date when media was created
+ * Returns: (transfer full): date when media was created
*
* Since: 0.1.12
*/
-const GDateTime *
+GDateTime *
grl_media_get_creation_date (GrlMedia *media)
{
- return grl_data_get_boxed (GRL_DATA (media),
- GRL_METADATA_KEY_CREATION_DATE);
+ GDateTime *date;
+ date = grl_data_get_boxed (GRL_DATA (media), GRL_METADATA_KEY_CREATION_DATE);
+ if (date)
+ return g_date_time_ref (date);
+ return NULL;
+}
+
+/**
+ * grl_media_get_modification_date:
+ * @media: the media
+ *
+ * Returns: (transfer full):date when the media was last modified
+ */
+GDateTime *
+grl_media_get_modification_date (GrlMedia *media)
+
+{
+ GDateTime *date;
+ date = grl_data_get_boxed (GRL_DATA (media),
+ GRL_METADATA_KEY_MODIFICATION_DATE);
+ if (date)
+ return g_date_time_ref (date);
+ return NULL;
}
/**
diff --git a/src/data/grl-media.h b/src/data/grl-media.h
index b23422e..e28c2bf 100644
--- a/src/data/grl-media.h
+++ b/src/data/grl-media.h
@@ -119,9 +119,13 @@ void grl_media_set_site (GrlMedia *media, const gchar *site);
void grl_media_set_duration (GrlMedia *media, gint duration);
-void grl_media_set_date (GrlMedia *media, const GDateTime *date);
+void grl_media_set_publication_date (GrlMedia *media, const GDateTime *date);
-void grl_media_set_creation_date (GrlMedia *media, const GDateTime *creation_date);
+void grl_media_set_creation_date (GrlMedia *media,
+ const GDateTime *creation_date);
+
+void grl_media_set_modification_date (GrlMedia *media,
+ const GDateTime *modification_date);
void grl_media_set_mime (GrlMedia *media, const gchar *mime);
@@ -187,9 +191,11 @@ const gchar *grl_media_get_site (GrlMedia *media);
gint grl_media_get_duration (GrlMedia *media);
-const GDateTime *grl_media_get_date (GrlMedia *media);
+GDateTime *grl_media_get_publication_date (GrlMedia *media);
+
+GDateTime *grl_media_get_creation_date (GrlMedia *media);
-const GDateTime *grl_media_get_creation_date (GrlMedia *media);
+GDateTime *grl_media_get_modification_date (GrlMedia *media);
const gchar *grl_media_get_mime (GrlMedia *media);
diff --git a/src/grl-metadata-key.c b/src/grl-metadata-key.c
index 5b19ba6..435b81b 100644
--- a/src/grl-metadata-key.c
+++ b/src/grl-metadata-key.c
@@ -67,12 +67,12 @@ grl_metadata_key_setup_system_keys (GrlPluginRegistry *registry)
NULL);
grl_plugin_registry_register_metadata_key_full (registry,
- g_param_spec_boxed ("date",
- "Date",
- "Publishing or recording date",
+ g_param_spec_boxed ("publishing-date",
+ "Publishing date",
+ "When the media was originally published",
G_TYPE_DATE_TIME,
G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE),
- GRL_METADATA_KEY_DATE,
+ GRL_METADATA_KEY_PUBLICATION_DATE,
NULL);
grl_plugin_registry_register_metadata_key_full (registry,
@@ -421,6 +421,15 @@ grl_metadata_key_setup_system_keys (GrlPluginRegistry *registry)
GRL_METADATA_KEY_ISO_SPEED,
NULL);
+ grl_plugin_registry_register_metadata_key_full (registry,
+ g_param_spec_boxed ("modification-date",
+ "Modification date",
+ "When the media was last modified",
+ G_TYPE_DATE_TIME,
+ G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE),
+ GRL_METADATA_KEY_MODIFICATION_DATE,
+ NULL);
+
/* Create the relations */
grl_plugin_registry_register_metadata_key_relation (registry,
GRL_METADATA_KEY_URL,
diff --git a/src/grl-metadata-key.h b/src/grl-metadata-key.h
index b11cf92..7c876c4 100644
--- a/src/grl-metadata-key.h
+++ b/src/grl-metadata-key.h
@@ -49,7 +49,7 @@ typedef guint32 GrlKeyID;
#define GRL_METADATA_KEY_BITRATE 4
#define GRL_METADATA_KEY_CERTIFICATE 5
#define GRL_METADATA_KEY_CHILDCOUNT 6
-#define GRL_METADATA_KEY_DATE 7
+#define GRL_METADATA_KEY_PUBLICATION_DATE 7
#define GRL_METADATA_KEY_DESCRIPTION 8
#define GRL_METADATA_KEY_DURATION 9
#define GRL_METADATA_KEY_EXTERNAL_PLAYER 10
@@ -82,6 +82,7 @@ typedef guint32 GrlKeyID;
#define GRL_METADATA_KEY_FLASH_USED 37
#define GRL_METADATA_KEY_EXPOSURE_TIME 38
#define GRL_METADATA_KEY_ISO_SPEED 39
+#define GRL_METADATA_KEY_MODIFICATION_DATE 40
const gchar *grl_metadata_key_get_name (GrlKeyID key);
--
1.7.4.1
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]