[gnumeric] Properties: always format GsfTimestamps in the same way.



commit d891021d388a8328778588173100f07a8dcf814c
Author: Morten Welinder <terra gnome org>
Date:   Tue Mar 8 15:31:32 2011 -0500

    Properties: always format GsfTimestamps in the same way.

 src/dialogs/ChangeLog             |    7 +++++-
 src/dialogs/dialog-doc-metadata.c |   43 ++++++++++++++++++-------------------
 2 files changed, 27 insertions(+), 23 deletions(-)
---
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index 3653962..4b07304 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,6 +1,11 @@
+2011-03-08  Morten Welinder  <terra gnome org>
+
+	* dialog-doc-metadata.c (dialog_doc_metadata_transform_timestamp_to_str):
+	Use time2str.
+
 2011-03-02  Andreas J. Guelzow <aguelzow pyrshep ca>
 
-	* formula-guru.ui: make sure everything is visible (also in 
+	* formula-guru.ui: make sure everything is visible (also in
 	translations)
 
 2011-02-26  Morten Welinder  <terra gnome org>
diff --git a/src/dialogs/dialog-doc-metadata.c b/src/dialogs/dialog-doc-metadata.c
index fc8f228..c31f843 100644
--- a/src/dialogs/dialog-doc-metadata.c
+++ b/src/dialogs/dialog-doc-metadata.c
@@ -163,6 +163,23 @@ dialog_doc_metadata_transform_str_to_docprop_vect (const GValue *string_value,
 	/* TODO */
 }
 
+static char *
+time2str (time_t t)
+{
+	char buffer[4000];
+	gsize len;
+	char const *format = "%c";
+
+	if (t == -1)
+		return NULL;
+
+	len = strftime (buffer, sizeof (buffer), format, localtime (&t));
+	if (len == 0)
+		return NULL;
+
+	return g_locale_to_utf8 (buffer, len, NULL, NULL, NULL);
+}
+
 /*
  * OTHER TO G_TYPE_STRING
  */
@@ -170,16 +187,15 @@ static void
 dialog_doc_metadata_transform_timestamp_to_str (const GValue *timestamp_value,
 						GValue       *string_value)
 {
-	GsfTimestamp *timestamp = NULL;
+	GsfTimestamp const *timestamp = NULL;
 
 	g_return_if_fail (VAL_IS_GSF_TIMESTAMP (timestamp_value));
 	g_return_if_fail (G_VALUE_HOLDS_STRING (string_value));
 
-	timestamp = (GsfTimestamp *) g_value_get_boxed (timestamp_value);
-
+	timestamp = g_value_get_boxed (timestamp_value);
 	if (timestamp != NULL)
-		g_value_set_string (string_value,
-				    gsf_timestamp_as_string (timestamp));
+		g_value_take_string (string_value,
+				     time2str (timestamp->timet));
 }
 
 static void
@@ -269,23 +285,6 @@ dialog_doc_metadata_set_up_permissions (DialogDocMetaData *state)
 	gtk_widget_set_sensitive (GTK_WIDGET (state->others_write), FALSE);
 }
 
-static char *
-time2str (time_t t)
-{
-	char buffer[4000];
-	gsize len;
-	char const *format = "%c";
-
-	if (t == -1)
-		return NULL;
-
-	len = strftime (buffer, sizeof (buffer), format, localtime (&t));
-	if (len == 0)
-		return NULL;
-
-	return g_locale_to_utf8 (buffer, len, NULL, NULL, NULL);
-}
-
  /* @auto_fill : if TRUE and the text is NULL, try to set the label text with an automatic value. */
 static void
 dialog_doc_metadata_set_label (DialogDocMetaData *state,



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