From f50cbd6b5ec4ab3616e693e83ececd617f559521 Mon Sep 17 00:00:00 2001
From: JP Rosevear <jpr@ximian.com>
Date: Fri, 6 Feb 2004 02:47:44 +0000
Subject: add proto

004-02-05  JP Rosevear <jpr@ximian.com>

	* gui/calendar-config.h: add proto

	* gui/calendar-config.c (calendar_config_get_icaltimezone): return
	the icaltimezone based on the location and default to utc if we
	can't find one
	(calendar_config_get_hide_completed_tasks_sexp): use above

svn path=/trunk/; revision=24641
---
 calendar/gui/calendar-config.c | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

(limited to 'calendar/gui/calendar-config.c')

diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c
index 55317a4bd3..9280996d4a 100644
--- a/calendar/gui/calendar-config.c
+++ b/calendar/gui/calendar-config.c
@@ -171,12 +171,27 @@ calendar_config_add_notification_primary_calendar (GConfClientNotifyFunc func, g
    you should assume UTC (though Evolution will show the timezone-setting
    dialog the next time a calendar or task folder is selected). */
 gchar *
-calendar_config_get_timezone		(void)
+calendar_config_get_timezone (void)
 {
-	/* FIXME Guard against NULL? */
 	return gconf_client_get_string (config, CALENDAR_CONFIG_TIMEZONE, NULL);
 }
 
+icaltimezone *
+calendar_config_get_icaltimezone (void)
+{
+	char *location;
+	icaltimezone *zone = NULL;
+	
+	location = calendar_config_get_timezone ();
+	if (location)
+		zone = icaltimezone_get_builtin_timezone (location);
+
+	if (!zone)
+		zone = icaltimezone_get_utc_timezone ();
+	
+	return zone;
+}
+
 
 /* Sets the timezone. If set to NULL it defaults to UTC.
    FIXME: Should check it is being set to a valid timezone. */
@@ -988,15 +1003,14 @@ calendar_config_get_hide_completed_tasks_sexp (void)
 			   immediately, so we filter out all completed tasks.*/
 			sexp = g_strdup ("(not is-completed?)");
 		} else {
-			char *location, *isodate;
+			char *isodate;
 			icaltimezone *zone;
 			struct icaltimetype tt;
 			time_t t;
 
 			/* Get the current time, and subtract the appropriate
 			   number of days/hours/minutes. */
-			location = calendar_config_get_timezone ();
-			zone = icaltimezone_get_builtin_timezone (location);
+			zone = calendar_config_get_icaltimezone ();
 			tt = icaltime_current_time_with_zone (zone);
 
 			switch (units) {
-- 
cgit