[frogr] FIXME! Temporary commit to fill the date and time of a picture based on basic information from the f
- From: Mario Sanchez Prada <msanchez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [frogr] FIXME! Temporary commit to fill the date and time of a picture based on basic information from the f
- Date: Sun, 24 Apr 2011 06:40:55 +0000 (UTC)
commit aaf668b07d5bb46af27be4f56928c33575980eda
Author: Mario Sanchez Prada <msanchez igalia com>
Date: Sat Apr 23 16:18:31 2011 +0200
FIXME! Temporary commit to fill the date and time of a picture based on
basic information from the file, instead of using the exif metadata.
src/frogr-picture-loader.c | 30 ++++++++++++++++++++++++++++--
1 files changed, 28 insertions(+), 2 deletions(-)
---
diff --git a/src/frogr-picture-loader.c b/src/frogr-picture-loader.c
index 5a04003..85124ce 100644
--- a/src/frogr-picture-loader.c
+++ b/src/frogr-picture-loader.c
@@ -311,8 +311,33 @@ _load_next_picture_cb (GObject *object,
/* Get (scaled, and maybe rotated) pixbuf */
s_pixbuf = _get_corrected_pixbuf (pixbuf);
- /* Get the file size (in bytes) */
- filesize = g_file_info_get_size (file_info);
+ /* FIXME: Actually retrieve the date and time from the exif
+ metadata. Using the modification time for this file is a
+ temporary workaround to allow me advance on this while
+ working offline in a plane. */
+ glong datetime = 0;
+
+ if (file_info)
+ g_object_unref (file_info);
+
+ file_info = g_file_query_info (file,
+ G_FILE_ATTRIBUTE_TIME_MODIFIED,
+ G_FILE_QUERY_INFO_NONE,
+ NULL, &error);
+ if (!error)
+ {
+ GTimeVal timeval;
+ g_file_info_get_modification_time (file_info, &timeval);
+ datetime = timeval.tv_sec;
+
+ DEBUG ("DateTime for the picture: %ld\n", datetime);
+ }
+ else
+ {
+ g_warning ("Not able to get the modification time: %s", error->message);
+ g_error_free (error);
+ }
+
/* Build the FrogrPicture */
fpicture = frogr_picture_new (file_uri,
@@ -329,6 +354,7 @@ _load_next_picture_cb (GObject *object,
/* FrogrPicture stores the size in KB */
frogr_picture_set_filesize (fpicture, filesize / 1024);
+ frogr_picture_set_datetime (fpicture, datetime);
/* Free */
if (file_info)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]