[goffice] GOFormat: improve GOFormatDetails usage.



commit ccc03f484be6a0062f34a4c1fe3653efcbe0984d
Author: Morten Welinder <terra gnome org>
Date:   Tue Jul 27 11:52:26 2010 -0400

    GOFormat: improve GOFormatDetails usage.

 ChangeLog               |    3 +++
 goffice/utils/formats.c |   24 +++++++++++++-----------
 2 files changed, 16 insertions(+), 11 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index dfc855b..cd8245d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,9 @@
 
 	* goffice/math/go-math.c: Use go_finitel as appropriate.
 
+	* goffice/utils/formats.c (_go_currency_date_format_init): Make
+	GOFormatDetails usage a bit more opaque.
+
 2010-07-13  Jean Brefort  <jean brefort normalesup org>
 
 	* goffice/canvas/goc-graph.c (goc_graph_do_tooltip): don't access a
diff --git a/goffice/utils/formats.c b/goffice/utils/formats.c
index 5f12086..e4a20c0 100644
--- a/goffice/utils/formats.c
+++ b/goffice/utils/formats.c
@@ -201,27 +201,29 @@ _go_currency_date_format_init (void)
 	GOFormat *fmt;
 	guint N;
 	int i;
-	GOFormatDetails details;
+	GOFormatDetails *details;
 
-	go_format_details_init (&details, GO_FORMAT_CURRENCY);
-	details.currency = currency;
+	details = go_format_details_new (GO_FORMAT_CURRENCY);
+	details->currency = currency;
 	for (i = 0; i < 6; i++) {
 		GString *str = g_string_new (NULL);
-		details.num_decimals = (i >= 3) ? 2 : 0;
-		details.negative_red = (i % 3 == 2);
-		details.negative_paren = (i % 3 >= 1);
-		go_format_generate_str (str, &details);
+		details->num_decimals = (i >= 3) ? 2 : 0;
+		details->negative_red = (i % 3 == 2);
+		details->negative_paren = (i % 3 >= 1);
+		go_format_generate_str (str, details);
 		fmts_currency[i] = g_string_free (str, FALSE);
 	}
+	go_format_details_free (details);
 
-	go_format_details_init (&details, GO_FORMAT_ACCOUNTING);
+	details = go_format_details_new (GO_FORMAT_ACCOUNTING);
 	for (i = 0; i < 4; i++) {
 		GString *str = g_string_new (NULL);
-		details.num_decimals = (i >= 2) ? 2 : 0;
-		details.currency = (i & 1) ? NULL : currency;
-		go_format_generate_str (str, &details);
+		details->num_decimals = (i >= 2) ? 2 : 0;
+		details->currency = (i & 1) ? NULL : currency;
+		go_format_generate_str (str, details);
 		fmts_accounting[i] = g_string_free (str, FALSE);
 	}
+	go_format_details_free (details);
 
 	/* ---------------------------------------- */
 



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