[goffice] GOFormat: improve go_format_is_date.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] GOFormat: improve go_format_is_date.
- Date: Mon, 30 Aug 2010 20:43:23 +0000 (UTC)
commit ef9b8c18579b67bc004a6829fe2100e166987c25
Author: Morten Welinder <terra gnome org>
Date: Mon Aug 30 16:42:57 2010 -0400
GOFormat: improve go_format_is_date.
ChangeLog | 7 +++++++
NEWS | 1 +
goffice/utils/go-format.c | 14 +++++++++-----
3 files changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 5b23bc4..82cc45b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-08-30 Morten Welinder <terra gnome org>
+
+ * goffice/utils/go-format.c (go_format_month_before_day): Fix test
+ for date format.
+ (go_format_is_date): Return also an indication of whether the
+ format has time-of-day.
+
2010-08-29 Morten Welinder <terra gnome org>
* goffice/graph/gog-axis.c (map_date_calc_ticks): Fix condition
diff --git a/NEWS b/NEWS
index 0abbd99..6733868 100644
--- a/NEWS
+++ b/NEWS
@@ -18,6 +18,7 @@ Morten:
* Plug leaks.
* Fix char-xmlChar confusion.
* Fix graph crash. [#628259]
+ * Improve go_format_is_date.
--------------------------------------------------------------------------
goffice 0.8.9:
diff --git a/goffice/utils/go-format.c b/goffice/utils/go-format.c
index 6cdc8ec..23f26e8 100644
--- a/goffice/utils/go-format.c
+++ b/goffice/utils/go-format.c
@@ -4621,15 +4621,19 @@ go_format_is_var_width (GOFormat const *fmt)
* go_format_is_date:
* @fmt: Format to query
*
- * Returns: TRUE if the format is a date format.
- * Returns FALSE if the format is not a date format.
- * Returns -1 if the format is inconsistent.
+ * Returns:
+ * +2 if the format is a date format with time
+ * +1 if the format is any other date format.
+ * 0 if the format is not a date format.
+ * -1 if the format is inconsistent.
**/
int
go_format_is_date (GOFormat const *fmt)
{
g_return_val_if_fail (fmt != NULL, -1);
- return fmt->typ == GO_FMT_NUMBER && fmt->u.number.has_date;
+ if (go_format_get_family (fmt) != GO_FORMAT_DATE)
+ return 0;
+ return fmt->u.number.has_time ? +2 : +1;
}
#endif
@@ -4670,7 +4674,7 @@ go_format_month_before_day (GOFormat const *fmt)
{
g_return_val_if_fail (fmt != NULL, -1);
- if (go_format_is_date (fmt) != 1)
+ if (go_format_is_date (fmt) < 1)
return -1;
if (fmt->u.number.date_ybm)
return +2;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]