[gnome-color-manager] Add a 'created' and 'modified' key to each device in the config file
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] Add a 'created' and 'modified' key to each device in the config file
- Date: Thu, 25 Mar 2010 17:10:22 +0000 (UTC)
commit 08d96daefe190e7be864417c6cc808ee7d7cb7e9
Author: Richard Hughes <richard hughsie com>
Date: Thu Mar 25 16:53:24 2010 +0000
Add a 'created' and 'modified' key to each device in the config file
src/gcm-device.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/gcm-device.c b/src/gcm-device.c
index 3b9a4ff..de0df4e 100644
--- a/src/gcm-device.c
+++ b/src/gcm-device.c
@@ -610,7 +610,9 @@ gcm_device_save (GcmDevice *device, GError **error)
gchar *dirname;
GFile *file = NULL;
gchar *filename = NULL;
+ gchar *timespec = NULL;
GError *error_local = NULL;
+ GTimeVal timeval;
g_return_val_if_fail (GCM_IS_DEVICE (device), FALSE);
g_return_val_if_fail (device->priv->id != NULL, FALSE);
@@ -657,6 +659,18 @@ gcm_device_save (GcmDevice *device, GError **error)
}
}
+ /* get current date and time */
+ g_get_current_time (&timeval);
+ timespec = g_time_val_to_iso8601 (&timeval);
+
+ /* the device does not have a created date and time */
+ ret = g_key_file_has_key (keyfile, device->priv->id, "created", NULL);
+ if (!ret)
+ g_key_file_set_string (keyfile, device->priv->id, "created", timespec);
+
+ /* add modified date */
+ g_key_file_set_string (keyfile, device->priv->id, "modified", timespec);
+
/* save data */
if (device->priv->profile_filename == NULL)
g_key_file_remove_key (keyfile, device->priv->id, "profile", NULL);
@@ -727,6 +741,7 @@ gcm_device_save (GcmDevice *device, GError **error)
/* update status */
gcm_device_set_saved (device, TRUE);
out:
+ g_free (timespec);
g_free (data);
g_free (filename);
g_free (dirname);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]