[frogr] Made 'datetime' FrogrPicture property an string instead of a long.



commit 005741e6f181027338727addd26d9fde74e59387
Author: Mario Sanchez Prada <msanchez igalia com>
Date:   Sun Apr 24 19:49:40 2011 -0700

    Made 'datetime' FrogrPicture property an string instead of a long.
    
    This is better since the information retrieved from the exif metadata
    is already a string.

 src/frogr-picture.c |   39 +++++++++++++++++++--------------------
 src/frogr-picture.h |    4 ++--
 2 files changed, 21 insertions(+), 22 deletions(-)
---
diff --git a/src/frogr-picture.c b/src/frogr-picture.c
index 9e6a0cc..80863d0 100644
--- a/src/frogr-picture.c
+++ b/src/frogr-picture.c
@@ -43,7 +43,7 @@ struct _FrogrPicturePrivate
   GSList *tags_list;
 
   gulong filesize; /* In KB */
-  gulong datetime; /* In seconds */
+  gchar *datetime; /* ASCII, locale dependent, string */
 
   GSList *sets;
   GSList *groups;
@@ -228,7 +228,7 @@ _frogr_picture_set_property (GObject *object,
       frogr_picture_set_filesize (self, g_value_get_long (value));
       break;
     case PROP_DATETIME:
-      frogr_picture_set_datetime (self, g_value_get_long (value));
+      frogr_picture_set_datetime (self, g_value_get_string (value));
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -286,7 +286,7 @@ _frogr_picture_get_property (GObject *object,
       g_value_set_long (value, priv->filesize);
       break;
     case PROP_DATETIME:
-      g_value_set_long (value, priv->datetime);
+      g_value_set_string (value, priv->datetime);
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -335,6 +335,7 @@ _frogr_picture_finalize (GObject* object)
   g_free (priv->title);
   g_free (priv->description);
   g_free (priv->tags_string);
+  g_free (priv->datetime);
 
   /* free GSList of tags */
   g_slist_foreach (priv->tags_list, (GFunc) g_free, NULL);
@@ -468,13 +469,11 @@ frogr_picture_class_init(FrogrPictureClass *klass)
                                                       G_PARAM_READWRITE));
   g_object_class_install_property (obj_class,
                                    PROP_DATETIME,
-                                   g_param_spec_long ("datetime",
-                                                      "datetime",
-                                                      "Date and time in seconds for the file",
-                                                      G_MINLONG,
-                                                      G_MAXLONG,
-                                                      0,
-                                                      G_PARAM_READWRITE));
+                                   g_param_spec_string ("datetime",
+                                                        "datetime",
+                                                        "Date and time string for the file",
+                                                        NULL,
+                                                        G_PARAM_READWRITE));
 
   g_type_class_add_private (obj_class, sizeof (FrogrPicturePrivate));
 }
@@ -492,7 +491,7 @@ frogr_picture_init (FrogrPicture *self)
   priv->tags_string = NULL;
 
   priv->filesize = 0;
-  priv->datetime = 0;
+  priv->datetime = NULL;
 
   priv->tags_list = NULL;
   priv->sets = NULL;
@@ -875,29 +874,29 @@ void frogr_picture_set_filesize (FrogrPicture *self, gulong filesize)
   priv->filesize = filesize;
 }
 
-glong
-frogr_picture_get_datetime (FrogrPicture *self)
+void
+frogr_picture_set_datetime (FrogrPicture *self, const gchar *datetime)
 {
-  g_return_val_if_fail(FROGR_IS_PICTURE(self), 0);
+  g_return_if_fail(FROGR_IS_PICTURE(self));
 
   FrogrPicturePrivate *priv =
     FROGR_PICTURE_GET_PRIVATE (self);
 
-  return priv->datetime;
+  g_free (priv->datetime);
+  priv->datetime = g_strdup (datetime);
 }
 
-void
-frogr_picture_set_datetime (FrogrPicture *self, glong datetime)
+const gchar *
+frogr_picture_get_datetime (FrogrPicture *self)
 {
-  g_return_if_fail(FROGR_IS_PICTURE(self));
+  g_return_val_if_fail(FROGR_IS_PICTURE(self), 0);
 
   FrogrPicturePrivate *priv =
     FROGR_PICTURE_GET_PRIVATE (self);
 
-  priv->datetime = datetime;
+  return (const gchar *)priv->datetime;
 }
 
-
 GSList *
 frogr_picture_get_sets (FrogrPicture *self)
 {
diff --git a/src/frogr-picture.h b/src/frogr-picture.h
index f62b87c..04c89ab 100644
--- a/src/frogr-picture.h
+++ b/src/frogr-picture.h
@@ -116,8 +116,8 @@ void frogr_picture_set_pixbuf (FrogrPicture *self,
 gulong frogr_picture_get_filesize (FrogrPicture *self);
 void frogr_picture_set_filesize (FrogrPicture *self, gulong filesize);
 
-glong frogr_picture_get_datetime (FrogrPicture *self);
-void frogr_picture_set_datetime (FrogrPicture *self, glong datetime);
+void frogr_picture_set_datetime (FrogrPicture *self, const gchar *datetime);
+const gchar *frogr_picture_get_datetime (FrogrPicture *self);
 
 GSList *frogr_picture_get_sets (FrogrPicture *self);
 void frogr_picture_set_sets (FrogrPicture *self, GSList *sets);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]