[grilo] core: reorganised date-related keys.
- From: Guillaume JÃrÃme Emont <guijemont src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo] core: reorganised date-related keys.
- Date: Fri, 7 Oct 2011 15:12:13 +0000 (UTC)
commit a76bc5cfa92f52775c8f2855b1bce4ec56ff4782
Author: Guillaume Emont <guijemont igalia com>
Date: Fri Jul 22 14:22:30 2011 +0200
core: reorganised date-related keys.
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 | 56 +++++++++++++++++++++++++++++++++++++----------
src/data/grl-media.h | 14 ++++++++---
src/grl-metadata-key.c | 17 +++++++++++---
src/grl-metadata-key.h | 3 +-
4 files changed, 69 insertions(+), 21 deletions(-)
---
diff --git a/src/data/grl-media.c b/src/data/grl-media.c
index eea3602..fa15f76 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,46 @@ 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 none): the publication date of @media (owned by @media).
*
* 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);
+ return grl_data_get_boxed (GRL_DATA (media),
+ GRL_METADATA_KEY_PUBLICATION_DATE);
}
/**
* grl_media_get_creation_date:
* @media: the media
*
- * Returns: date when media was created
+ * Returns: (transfer none): date when media was created (owned by @media).
*
* 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);
+}
+
+/**
+ * grl_media_get_modification_date:
+ * @media: the media
+ *
+ * Returns: (transfer none):date when the media was last modified (owned by @media).
+ */
+GDateTime *
+grl_media_get_modification_date (GrlMedia *media)
+
+{
return grl_data_get_boxed (GRL_DATA (media),
- GRL_METADATA_KEY_CREATION_DATE);
+ GRL_METADATA_KEY_MODIFICATION_DATE);
}
/**
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 8236596..befbcac 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,
@@ -431,6 +431,15 @@ grl_metadata_key_setup_system_keys (GrlPluginRegistry *registry)
GRL_METADATA_KEY_TRACK_NUMBER,
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 e73fbd3..e82b8a4 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
@@ -83,6 +83,7 @@ typedef guint32 GrlKeyID;
#define GRL_METADATA_KEY_EXPOSURE_TIME 38
#define GRL_METADATA_KEY_ISO_SPEED 39
#define GRL_METADATA_KEY_TRACK_NUMBER 40
+#define GRL_METADATA_KEY_MODIFICATION_DATE 41
const gchar *grl_metadata_key_get_name (GrlKeyID key);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]