Commit c3876df7 authored by Federico Mena Quintero's avatar Federico Mena Quintero Committed by Federico Mena Quintero

Fixes bug #5282.

2001-10-24  Federico Mena Quintero  <federico@ximian.com>

	Fixes bug #5282.

	* cal-util/timeutil.c (icaltimetype_to_tm_with_zone): New function
	to avoid copying the same code all over the place.
	(icaltimetype_to_tm): Also set the tm.tm_wday.

	* gui/alarm-notify/alarm-queue.c (queue_midnight_refresh): Use
	time_day_end_with_zone().
	(load_alarms_for_today): Likewise.  And oops, we were only
	computing the times and not loading the alarms.
	(obj_updated_cb): Likewise.
	(load_alarms): Removed assertion that is no longer valid because
	we may load the alarms for a client in two stages.

	* gui/dialogs/alarm-page.c (get_alarm_string): Convert absolute
	trigger times to the local timezone.

	* gui/alarm-notify/alarm-notify-dialog.c (write_html_heading):
	Convert the times to the local timezone.
	(alarm_notify_dialog): Likewise, for the window title.
	(alarm_notify_dialog): Set the window layer to WIN_LAYER_ONTOP.

	* gui/e-cell-date-edit-text.c (ecd_get_text): Use
	icaltimetype_to_tm_with_zone().

	* gui/alarm-notify/save.c (get_config_db): Made public.
	(discard_config_db): Made public.

	* gui/alarm-notify/config-data.[ch]: New files with functions to
	fetch the calendar configuration data used by the alarm daemon.

svn path=/trunk/; revision=13986
parent 4d26929f
2001-10-24 Federico Mena Quintero <federico@ximian.com>
Fixes bug #5282.
* cal-util/timeutil.c (icaltimetype_to_tm_with_zone): New function
to avoid copying the same code all over the place.
(icaltimetype_to_tm): Also set the tm.tm_wday.
* gui/alarm-notify/alarm-queue.c (queue_midnight_refresh): Use
time_day_end_with_zone().
(load_alarms_for_today): Likewise. And oops, we were only
computing the times and not loading the alarms.
(obj_updated_cb): Likewise.
(load_alarms): Removed assertion that is no longer valid because
we may load the alarms for a client in two stages.
* gui/dialogs/alarm-page.c (get_alarm_string): Convert absolute
trigger times to the local timezone.
* gui/alarm-notify/alarm-notify-dialog.c (write_html_heading):
Convert the times to the local timezone.
(alarm_notify_dialog): Likewise, for the window title.
(alarm_notify_dialog): Set the window layer to WIN_LAYER_ONTOP.
* gui/e-cell-date-edit-text.c (ecd_get_text): Use
icaltimetype_to_tm_with_zone().
* gui/alarm-notify/save.c (get_config_db): Made public.
(discard_config_db): Made public.
* gui/alarm-notify/config-data.[ch]: New files with functions to
fetch the calendar configuration data used by the alarm daemon.
2001-10-23 Damon Chaplin <damon@ximian.com> 2001-10-23 Damon Chaplin <damon@ximian.com>
* cal-util/cal-component.c (cal_component_event_dates_match): make sure * cal-util/cal-component.c (cal_component_event_dates_match): make sure
......
...@@ -532,15 +532,51 @@ icaltimetype_to_tm (struct icaltimetype *itt) ...@@ -532,15 +532,51 @@ icaltimetype_to_tm (struct icaltimetype *itt)
tm.tm_min = itt->minute; tm.tm_min = itt->minute;
tm.tm_hour = itt->hour; tm.tm_hour = itt->hour;
} }
tm.tm_mday = itt->day; tm.tm_mday = itt->day;
tm.tm_mon = itt->month - 1; tm.tm_mon = itt->month - 1;
tm.tm_year = itt->year - 1900; tm.tm_year = itt->year - 1900;
tm.tm_wday = time_day_of_week (itt->day, itt->month - 1, itt->year);
tm.tm_isdst = -1; tm.tm_isdst = -1;
return tm; return tm;
} }
/**
* icaltimetype_to_tm_with_zone:
* @itt: A time value.
* @from_zone: Source timezone.
* @to_zone: Destination timezone.
*
* Converts a time value from one timezone to another, and returns a struct tm
* representation of the time.
*
* Return value: The converted time as a struct tm. All fields will be
* set properly except for tm.tm_yday.
**/
struct tm
icaltimetype_to_tm_with_zone (struct icaltimetype *itt,
icaltimezone *from_zone,
icaltimezone *to_zone)
{
struct tm tm;
struct icaltimetype itt_copy;
memset (&tm, 0, sizeof (tm));
tm.tm_isdst = -1;
g_return_val_if_fail (itt != NULL, tm);
g_return_val_if_fail (from_zone != NULL, tm);
g_return_val_if_fail (to_zone != NULL, tm);
itt_copy = *itt;
icaltimezone_convert_time (&itt_copy, from_zone, to_zone);
tm = icaltimetype_to_tm (&itt_copy);
return tm;
}
struct icaltimetype struct icaltimetype
tm_to_icaltimetype (struct tm *tm, gboolean is_date) tm_to_icaltimetype (struct tm *tm, gboolean is_date)
{ {
......
...@@ -114,6 +114,9 @@ void time_to_gdate_with_zone (GDate *date, time_t time, icaltimezone *zone); ...@@ -114,6 +114,9 @@ void time_to_gdate_with_zone (GDate *date, time_t time, icaltimezone *zone);
**************************************************************************/ **************************************************************************/
struct tm icaltimetype_to_tm (struct icaltimetype *itt); struct tm icaltimetype_to_tm (struct icaltimetype *itt);
struct tm icaltimetype_to_tm_with_zone (struct icaltimetype *itt,
icaltimezone *from_zone,
icaltimezone *to_zone);
struct icaltimetype tm_to_icaltimetype (struct tm *tm, gboolean is_date); struct icaltimetype tm_to_icaltimetype (struct tm *tm, gboolean is_date);
#endif #endif
...@@ -53,6 +53,8 @@ evolution_alarm_notify_SOURCES = \ ...@@ -53,6 +53,8 @@ evolution_alarm_notify_SOURCES = \
alarm-notify-dialog.h \ alarm-notify-dialog.h \
alarm-queue.c \ alarm-queue.c \
alarm-queue.h \ alarm-queue.h \
config-data.c \
config-data.h \
notify-main.c \ notify-main.c \
save.c \ save.c \
save.h save.h
......
...@@ -38,7 +38,9 @@ ...@@ -38,7 +38,9 @@
#include <gal/widgets/e-scroll-frame.h> #include <gal/widgets/e-scroll-frame.h>
#include <gtkhtml/gtkhtml.h> #include <gtkhtml/gtkhtml.h>
#include <gtkhtml/gtkhtml-stream.h> #include <gtkhtml/gtkhtml-stream.h>
#include "cal-util/timeutil.h"
#include "alarm-notify-dialog.h" #include "alarm-notify-dialog.h"
#include "config-data.h"
GtkWidget *make_html_display (gchar *widget_name, char *s1, char *s2, int scroll, int shadow); GtkWidget *make_html_display (gchar *widget_name, char *s1, char *s2, int scroll, int shadow);
...@@ -136,7 +138,7 @@ static void ...@@ -136,7 +138,7 @@ static void
url_requested_cb (GtkHTML *html, const char *url, GtkHTMLStream *stream, gpointer data) url_requested_cb (GtkHTML *html, const char *url, GtkHTMLStream *stream, gpointer data)
{ {
if (!strncmp ("file:///", url, strlen ("file:///"))) { if (!strncmp ("file:///", url, strlen ("file:///"))) {
FILE *fp; FILE *fp;
const char *filename = url + strlen ("file://"); const char *filename = url + strlen ("file://");
char buf[4096]; char buf[4096];
...@@ -149,16 +151,16 @@ url_requested_cb (GtkHTML *html, const char *url, GtkHTMLStream *stream, gpointe ...@@ -149,16 +151,16 @@ url_requested_cb (GtkHTML *html, const char *url, GtkHTMLStream *stream, gpointe
gtk_html_stream_close (stream, GTK_HTML_STREAM_ERROR); gtk_html_stream_close (stream, GTK_HTML_STREAM_ERROR);
return; return;
} }
while ((len = fread (buf, 1, sizeof(buf), fp)) > 0) while ((len = fread (buf, 1, sizeof(buf), fp)) > 0)
gtk_html_stream_write (stream, buf, len); gtk_html_stream_write (stream, buf, len);
if (feof (fp)) { if (feof (fp)) {
fclose (fp); fclose (fp);
gtk_html_stream_close (stream, GTK_HTML_STREAM_OK); gtk_html_stream_close (stream, GTK_HTML_STREAM_OK);
return; return;
} }
fclose (fp); fclose (fp);
} }
...@@ -174,7 +176,7 @@ make_html_display (gchar *widget_name, char *s1, char *s2, int scroll, int shado ...@@ -174,7 +176,7 @@ make_html_display (gchar *widget_name, char *s1, char *s2, int scroll, int shado
gtk_widget_push_visual(gdk_rgb_get_visual()); gtk_widget_push_visual(gdk_rgb_get_visual());
gtk_widget_push_colormap(gdk_rgb_get_cmap()); gtk_widget_push_colormap(gdk_rgb_get_cmap());
html = gtk_html_new(); html = gtk_html_new();
gtk_html_set_default_content_type (GTK_HTML (html), gtk_html_set_default_content_type (GTK_HTML (html),
...@@ -185,27 +187,27 @@ make_html_display (gchar *widget_name, char *s1, char *s2, int scroll, int shado ...@@ -185,27 +187,27 @@ make_html_display (gchar *widget_name, char *s1, char *s2, int scroll, int shado
GTK_SIGNAL_FUNC (url_requested_cb), GTK_SIGNAL_FUNC (url_requested_cb),
NULL); NULL);
gtk_widget_pop_colormap(); gtk_widget_pop_colormap();
gtk_widget_pop_visual(); gtk_widget_pop_visual();
frame = e_scroll_frame_new(NULL, NULL); frame = e_scroll_frame_new(NULL, NULL);
e_scroll_frame_set_policy(E_SCROLL_FRAME(frame), e_scroll_frame_set_policy(E_SCROLL_FRAME(frame),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC); GTK_POLICY_AUTOMATIC);
e_scroll_frame_set_shadow_type (E_SCROLL_FRAME (frame), e_scroll_frame_set_shadow_type (E_SCROLL_FRAME (frame),
GTK_SHADOW_IN); GTK_SHADOW_IN);
gtk_widget_set_usize (frame, 300, 200); gtk_widget_set_usize (frame, 300, 200);
gtk_container_add(GTK_CONTAINER (frame), html); gtk_container_add(GTK_CONTAINER (frame), html);
gtk_widget_show_all(frame); gtk_widget_show_all(frame);
gtk_object_set_user_data(GTK_OBJECT (frame), html); gtk_object_set_user_data(GTK_OBJECT (frame), html);
return frame; return frame;
} }
static void static void
...@@ -218,34 +220,51 @@ write_times (GtkHTMLStream *stream, char *start, char *end) ...@@ -218,34 +220,51 @@ write_times (GtkHTMLStream *stream, char *start, char *end)
} }
/* Converts a time_t to a string, relative to the specified timezone */
static char *
timet_to_str_with_zone (time_t t, icaltimezone *zone)
{
struct icaltimetype itt;
struct tm tm;
char buf[256];
if (t == -1)
return g_strdup (_("invalid time"));
itt = icaltime_from_timet_with_zone (t, FALSE, zone);
tm = icaltimetype_to_tm (&itt);
e_time_format_date_and_time (&tm, config_data_get_24_hour_format (),
FALSE, FALSE, buf, sizeof (buf));
return g_strdup (buf);
}
/* Creates a heading for the alarm notification dialog */ /* Creates a heading for the alarm notification dialog */
static void static void
write_html_heading (GtkHTMLStream *stream, const char *message, CalComponentVType vtype, time_t occur_start, time_t occur_end) write_html_heading (GtkHTMLStream *stream, const char *message,
CalComponentVType vtype, time_t occur_start, time_t occur_end)
{ {
char *buf; char *buf;
char s[128], e[128]; char *start, *end;
char *start = NULL, *end = NULL;
char *bg_path = "file://" EVOLUTION_ICONSDIR "/bcg.png"; char *bg_path = "file://" EVOLUTION_ICONSDIR "/bcg.png";
char *image_path = "file://" EVOLUTION_ICONSDIR "/alarm.png"; char *image_path = "file://" EVOLUTION_ICONSDIR "/alarm.png";
icaltimezone *current_zone;
if (occur_start != -1) { /* Stringize the times */
struct tm tm;
tm = *localtime (&occur_start); current_zone = config_data_get_timezone ();
strftime (s, sizeof (s), "%A %b %d %Y %H:%M", &tm);
start = e_utf8_from_locale_string (s);
}
if (occur_end != -1) { buf = timet_to_str_with_zone (occur_start, current_zone);
struct tm tm; start = e_utf8_from_locale_string (buf);
g_free (buf);
tm = *localtime (&occur_end); buf = timet_to_str_with_zone (occur_end, current_zone);
strftime (e, sizeof (e), "%A %b %d %Y %H:%M", &tm); end = e_utf8_from_locale_string (buf);
end = e_utf8_from_locale_string (e); g_free (buf);
}
/* Write the header */
/* I love combinatorial explosion */ gtk_html_stream_printf (stream,
gtk_html_stream_printf (stream,
"<HTML><BODY background=\"%s\">" "<HTML><BODY background=\"%s\">"
"<TABLE WIDTH=\"100%%\">" "<TABLE WIDTH=\"100%%\">"
"<TR>" "<TR>"
...@@ -259,25 +278,25 @@ write_html_heading (GtkHTMLStream *stream, const char *message, CalComponentVTyp ...@@ -259,25 +278,25 @@ write_html_heading (GtkHTMLStream *stream, const char *message, CalComponentVTyp
gtk_html_stream_printf (stream, "<br><br><font size=\"+2\">%s</font><br><br>", message); gtk_html_stream_printf (stream, "<br><br><font size=\"+2\">%s</font><br><br>", message);
/* Write the times */
switch (vtype) { switch (vtype) {
case CAL_COMPONENT_EVENT: case CAL_COMPONENT_EVENT:
/* gtk_html_stream_printf (stream, "%s<br>", U_("Notification about your appointment")); */
write_times (stream, start, end); write_times (stream, start, end);
break; break;
case CAL_COMPONENT_TODO: case CAL_COMPONENT_TODO:
/* gtk_html_stream_printf (stream, "%s<br>", U_("Notification about your task")); */
write_times (stream, start, end); write_times (stream, start, end);
break; break;
default: default:
/* Only VEVENTs and VTODOs can have alarms */ /* Only VEVENTs and VTODOs can have alarms */
g_assert_not_reached (); g_assert_not_reached ();
buf = NULL;
break; break;
} }
g_free (start); g_free (start);
g_free (end); g_free (end);
return;
} }
/** /**
...@@ -289,10 +308,10 @@ write_html_heading (GtkHTMLStream *stream, const char *message, CalComponentVTyp ...@@ -289,10 +308,10 @@ write_html_heading (GtkHTMLStream *stream, const char *message, CalComponentVTyp
* @message; Message to display in the dialog; usually comes from the component. * @message; Message to display in the dialog; usually comes from the component.
* @func: Function to be called when a dialog action is invoked. * @func: Function to be called when a dialog action is invoked.
* @func_data: Closure data for @func. * @func_data: Closure data for @func.
* *
* Runs the alarm notification dialog. The specified @func will be used to * Runs the alarm notification dialog. The specified @func will be used to
* notify the client about result of the actions in the dialog. * notify the client about result of the actions in the dialog.
* *
* Return value: TRUE on success, FALSE if the dialog could not be created. * Return value: TRUE on success, FALSE if the dialog could not be created.
**/ **/
gboolean gboolean
...@@ -301,9 +320,9 @@ alarm_notify_dialog (time_t trigger, time_t occur_start, time_t occur_end, ...@@ -301,9 +320,9 @@ alarm_notify_dialog (time_t trigger, time_t occur_start, time_t occur_end,
AlarmNotifyFunc func, gpointer func_data) AlarmNotifyFunc func, gpointer func_data)
{ {
AlarmNotify *an; AlarmNotify *an;
char buf[256];
struct tm tm_trigger;
GtkHTMLStream *stream; GtkHTMLStream *stream;
icaltimezone *current_zone;
char *buf, *title;
g_return_val_if_fail (trigger != -1, FALSE); g_return_val_if_fail (trigger != -1, FALSE);
...@@ -346,9 +365,15 @@ alarm_notify_dialog (time_t trigger, time_t occur_start, time_t occur_end, ...@@ -346,9 +365,15 @@ alarm_notify_dialog (time_t trigger, time_t occur_start, time_t occur_end,
GTK_SIGNAL_FUNC (dialog_destroy_cb), an); GTK_SIGNAL_FUNC (dialog_destroy_cb), an);
/* Title */ /* Title */
tm_trigger = *localtime (&trigger);
strftime (buf, sizeof (buf), _("Alarm on %A %b %d %Y %H:%M"), &tm_trigger); current_zone = config_data_get_timezone ();
gtk_window_set_title (GTK_WINDOW (an->dialog), buf);
buf = timet_to_str_with_zone (trigger, current_zone);
title = g_strdup_printf (_("Alarm on %s"), buf);
g_free (buf);
gtk_window_set_title (GTK_WINDOW (an->dialog), title);
g_free (title);
/* html heading */ /* html heading */
stream = gtk_html_begin (GTK_HTML (an->html)); stream = gtk_html_begin (GTK_HTML (an->html));
...@@ -360,7 +385,7 @@ alarm_notify_dialog (time_t trigger, time_t occur_start, time_t occur_end, ...@@ -360,7 +385,7 @@ alarm_notify_dialog (time_t trigger, time_t occur_start, time_t occur_end,
gtk_signal_connect (GTK_OBJECT (an->dialog), "delete_event", gtk_signal_connect (GTK_OBJECT (an->dialog), "delete_event",
GTK_SIGNAL_FUNC (delete_event_cb), GTK_SIGNAL_FUNC (delete_event_cb),
an); an);
gtk_signal_connect (GTK_OBJECT (an->close), "clicked", gtk_signal_connect (GTK_OBJECT (an->close), "clicked",
GTK_SIGNAL_FUNC (close_clicked_cb), GTK_SIGNAL_FUNC (close_clicked_cb),
an); an);
...@@ -379,6 +404,7 @@ alarm_notify_dialog (time_t trigger, time_t occur_start, time_t occur_end, ...@@ -379,6 +404,7 @@ alarm_notify_dialog (time_t trigger, time_t occur_start, time_t occur_end,
gtk_widget_realize (an->dialog); gtk_widget_realize (an->dialog);
gnome_win_hints_set_state (an->dialog, WIN_STATE_STICKY); gnome_win_hints_set_state (an->dialog, WIN_STATE_STICKY);
gnome_win_hints_set_layer (an->dialog, WIN_LAYER_ONTOP);
gnome_window_icon_set_from_file (GTK_WINDOW (an->dialog), EVOLUTION_ICONSDIR "/alarm.png"); gnome_window_icon_set_from_file (GTK_WINDOW (an->dialog), EVOLUTION_ICONSDIR "/alarm.png");
gtk_widget_show (an->dialog); gtk_widget_show (an->dialog);
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include "alarm.h" #include "alarm.h"
#include "alarm-notify-dialog.h" #include "alarm-notify-dialog.h"
#include "alarm-queue.h" #include "alarm-queue.h"
#include "config-data.h"
#include "save.h" #include "save.h"
...@@ -120,10 +121,13 @@ static void ...@@ -120,10 +121,13 @@ static void
queue_midnight_refresh (void) queue_midnight_refresh (void)
{ {
time_t midnight; time_t midnight;
icaltimezone *zone;
g_assert (midnight_refresh_id == NULL); g_assert (midnight_refresh_id == NULL);
midnight = time_day_end (time (NULL)); zone = config_data_get_timezone ();
midnight = time_day_end_with_zone (time (NULL), zone);
midnight_refresh_id = alarm_add (midnight, midnight_refresh_cb, NULL, NULL); midnight_refresh_id = alarm_add (midnight, midnight_refresh_cb, NULL, NULL);
if (!midnight_refresh_id) { if (!midnight_refresh_id) {
...@@ -347,11 +351,6 @@ load_alarms (ClientAlarms *ca, time_t start, time_t end) ...@@ -347,11 +351,6 @@ load_alarms (ClientAlarms *ca, time_t start, time_t end)
comp_alarms = cal_client_get_alarms_in_range (ca->client, start, end); comp_alarms = cal_client_get_alarms_in_range (ca->client, start, end);
/* All of the last day's alarms should have already triggered and should
* have been removed, so we should have no pending components.
*/
g_assert (g_hash_table_size (ca->uid_alarms_hash) == 0);
for (l = comp_alarms; l; l = l->next) { for (l = comp_alarms; l; l = l->next) {
CalComponentAlarms *alarms; CalComponentAlarms *alarms;
...@@ -367,9 +366,14 @@ static void ...@@ -367,9 +366,14 @@ static void
load_alarms_for_today (ClientAlarms *ca) load_alarms_for_today (ClientAlarms *ca)
{ {
time_t now, day_end; time_t now, day_end;
icaltimezone *zone;
now = time (NULL); now = time (NULL);
day_end = time_day_end (now);
zone = config_data_get_timezone ();
day_end = time_day_end_with_zone (now, zone);
load_alarms (ca, now, day_end);
} }
/* Adds any alarms that should have occurred while the alarm daemon was not /* Adds any alarms that should have occurred while the alarm daemon was not
...@@ -460,13 +464,17 @@ obj_updated_cb (CalClient *client, const char *uid, gpointer data) ...@@ -460,13 +464,17 @@ obj_updated_cb (CalClient *client, const char *uid, gpointer data)
time_t now, day_end; time_t now, day_end;
CalComponentAlarms *alarms; CalComponentAlarms *alarms;
gboolean found; gboolean found;
icaltimezone *zone;
ca = data; ca = data;
remove_comp (ca, uid); remove_comp (ca, uid);
now = time (NULL); now = time (NULL);
day_end = time_day_end (now);
zone = config_data_get_timezone ();
day_end = time_day_end_with_zone (now, zone);
found = cal_client_get_alarms_for_object (ca->client, uid, now, day_end, &alarms); found = cal_client_get_alarms_for_object (ca->client, uid, now, day_end, &alarms);
......
...@@ -114,7 +114,9 @@ alarm_ready_cb (gpointer data) ...@@ -114,7 +114,9 @@ alarm_ready_cb (gpointer data)
return FALSE; return FALSE;
} }
/* Sets up a timeout for the next minute */ /* Sets up a timeout for the next minute. We do not need to be concerned with
* timezones here, as this is just a periodic check on the alarm queue.
*/
static void static void
setup_timeout (time_t now) setup_timeout (time_t now)
{ {
......
/* Evolution calendar - Configuration values for the alarm notification daemon
*
* Copyright (C) 2001 Ximian, Inc.
*
* Authors: Federico Mena-Quintero <federico@ximian.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "config-data.h"
#include "save.h"
/* Whether we have initied ourselves by reading the data from the configuration engine */
static gboolean inited;
/* Configuration values */
static icaltimezone *local_timezone;
static gboolean use_24_hour_format;
/* Copied from ../calendar-config.c; returns whether the locale has 'am' and
* 'pm' strings defined.
*/
static gboolean
locale_supports_12_hour_format (void)
{
char s[16];
time_t t = 0;
strftime (s, sizeof s, "%p", gmtime (&t));
return s[0] != '\0';
}
/* Ensures that the configuration values have been read */
static void
ensure_inited (void)
{
Bonobo_ConfigDatabase db;
char *location;
if (inited)
return;
inited = TRUE;
db = get_config_db ();
if (db == CORBA_OBJECT_NIL) {
/* This sucks */
local_timezone = icaltimezone_get_utc_timezone ();
/* This sucks as well */
use_24_hour_format = TRUE;
return;
}
location = bonobo_config_get_string (db, "/Calendar/Display/Timezone", NULL);
if (location) {
local_timezone = icaltimezone_get_builtin_timezone (location);
g_free (location);
} else
local_timezone = icaltimezone_get_utc_timezone ();
if (locale_supports_12_hour_format ()) {
/* Wasn't the whole point of a configuration engine *NOT* to
* have apps specify their own stupid defaults everywhere, but
* just in a schema file?
*/
use_24_hour_format = bonobo_config_get_boolean_with_default (
db,
"/Calendar/Display/Use24HourFormat", FALSE, NULL);
} else
use_24_hour_format = TRUE;
discard_config_db (db);
}
icaltimezone *
config_data_get_timezone (void)
{
ensure_inited ();
return local_timezone;
}
gboolean
config_data_get_24_hour_format (void)
{
ensure_inited ();
return use_24_hour_format;
}
/* Evolution calendar - Configuration values for the alarm notification daemon
*
* Copyright (C) 2001 Ximian, Inc.
*
* Authors: Federico Mena-Quintero <federico@ximian.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef CONFIG_DATA_H
#define CONFIG_DATA_H
#include <glib.h>
#include <ical.h>
icaltimezone *config_data_get_timezone (void);
gboolean config_data_get_24_hour_format (void);
#endif
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include <bonobo/bonobo-arg.h> #include <bonobo/bonobo-arg.h>
#include <bonobo/bonobo-exception.h> #include <bonobo/bonobo-exception.h>
#include <bonobo/bonobo-moniker-util.h> #include <bonob