aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog36
-rw-r--r--calendar/cal-util/cal-recur.c98
-rw-r--r--calendar/cal-util/test-recur.c21
-rw-r--r--calendar/gui/Makefile.am2
-rw-r--r--calendar/gui/calendar-commands.c24
-rw-r--r--calendar/gui/calendar-commands.h12
-rw-r--r--calendar/gui/calendar-component.c13
-rw-r--r--calendar/gui/calendar-component.h2
-rw-r--r--calendar/gui/calendar-config.c405
-rw-r--r--calendar/gui/calendar-config.h113
-rw-r--r--calendar/gui/component-factory.c13
-rw-r--r--calendar/gui/component-factory.h2
-rw-r--r--calendar/gui/dialogs/Makefile.am8
-rw-r--r--calendar/gui/dialogs/cal-prefs-dialog.c464
-rw-r--r--calendar/gui/dialogs/cal-prefs-dialog.glade1243
-rw-r--r--calendar/gui/dialogs/cal-prefs-dialog.glade.h67
-rw-r--r--calendar/gui/dialogs/cal-prefs-dialog.h69
-rw-r--r--calendar/gui/e-day-view-time-item.c16
-rw-r--r--calendar/gui/e-day-view.c61
-rw-r--r--calendar/gui/e-day-view.h21
-rw-r--r--calendar/gui/e-week-view.c132
-rw-r--r--calendar/gui/gnome-cal.c149
-rw-r--r--calendar/gui/gnome-cal.h9
-rw-r--r--calendar/gui/main.c3
-rw-r--r--calendar/gui/popup-menu.c2
25 files changed, 2846 insertions, 139 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 57a8bba284..23f2562519 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,39 @@
+2000-10-11 Damon Chaplin <damon@helixcode.com>
+
+ * gui/main.c (main): call calendar_config_write_on_exit() to write
+ out some special config settings (as the mail component does).
+
+ * gui/calendar-commands.c (properties_cmd): changed to use the new
+ preferences dialog.
+ (update_all_config_settings): new function to iterate over all the
+ calendars and update the config settings.
+
+ * gui/dialogs/cal-prefs-dialog.glade: preferences dialog.
+
+ * gui/dialogs/cal-prefs-dialog.[hc]: new files for the preferences
+ dialog.
+
+ * gui/calendar-config.[hc]: new files to handle loading/saving config
+ settings.
+
+ * cal-util/cal-recur.c: fixed bug in YEARLY when no filters were set,
+ plus minor changes.
+
+ * cal-util/test-recur.c: updated.
+
+ * gui/e-day-view-time-item.c:
+ * gui/popup-menu.c: update to #include <gal/widgets/e-gui-utils.h>
+
+ * gui/component-factory.c (owner_set_cb): called calendar_config_init.
+ (owner_set_cb):
+ (owner_unset_cb): updated the prototypes.
+
+ * gui/main.c (main): added call to calendar_config_write_on_exit().
+
+ * gui/component-factory.h:
+ * gui/component-factory.c (owner_set_cb): added global evolution_dir
+ just like the mail component, so we know we to store config stuff.
+
2000-10-11 Christopher James Lahey <clahey@helixcode.com>
* gui/e-calendar-table.c: Fixed the column elements here.
diff --git a/calendar/cal-util/cal-recur.c b/calendar/cal-util/cal-recur.c
index 1fdb515502..74a0dbf6f7 100644
--- a/calendar/cal-util/cal-recur.c
+++ b/calendar/cal-util/cal-recur.c
@@ -1082,6 +1082,12 @@ generate_instances_for_chunk (CalComponent *comp,
start_tm.tm_isdst = -1;
start_time = mktime (&start_tm);
+ if (start_time == -1) {
+ g_warning ("mktime failed - time_t out of range?");
+ finished = TRUE;
+ break;
+ }
+
if (start_time < comp_dtstart
|| (interval_end_time != -1
&& start_time >= interval_end_time))
@@ -1107,6 +1113,12 @@ generate_instances_for_chunk (CalComponent *comp,
end_tm.tm_isdst = -1;
end_time = mktime (&end_tm);
+ if (end_time == -1) {
+ g_warning ("mktime failed - time_t out of range?");
+ finished = TRUE;
+ break;
+ }
+
if (end_time < interval_start_time)
continue;
@@ -1426,12 +1438,18 @@ cal_obj_generate_set_yearly (RecurData *recur_data,
occs_arrays[num_occs_arrays++] = occs;
}
- /* Add all the arrays together. */
- occs = occs_arrays[0];
- for (i = 1; i < num_occs_arrays; i++) {
- occs2 = occs_arrays[i];
- g_array_append_vals (occs, occs2->data, occs2->len);
- g_array_free (occs2, TRUE);
+ /* Add all the arrays together. If no filters were used we just
+ create an array with one element. */
+ if (num_occs_arrays > 0) {
+ occs = occs_arrays[0];
+ for (i = 1; i < num_occs_arrays; i++) {
+ occs2 = occs_arrays[i];
+ g_array_append_vals (occs, occs2->data, occs2->len);
+ g_array_free (occs2, TRUE);
+ }
+ } else {
+ occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime));
+ g_array_append_vals (occs, occ, 1);
}
/* Now expand BYHOUR, BYMINUTE & BYSECOND. */
@@ -1720,6 +1738,7 @@ cal_obj_remove_exceptions (GArray *occs,
for (i = 0; i < occs_len; i++) {
occ = &g_array_index (occs, CalObjTime, i);
keep_occ = TRUE;
+
/* If the occurrence is a duplicate of the previous one, skip
it. */
if (prev_occ
@@ -1747,7 +1766,9 @@ cal_obj_remove_exceptions (GArray *occs,
to one that matches or follows this
occurrence. */
while (ex_occ) {
- cmp = cal_obj_date_only_compare_func (ex_occ, occ);
+ cmp = cal_obj_time_compare_func (ex_occ, occ);
+ /* I'm pretty sure this is wrong. */
+ /*cmp = cal_obj_date_only_compare_func (ex_occ, occ);*/
if (cmp > 0)
break;
@@ -3257,41 +3278,50 @@ cal_obj_time_compare_func (const void *arg1,
const void *arg2)
{
CalObjTime *cotime1, *cotime2;
+ gint retval;
cotime1 = (CalObjTime*) arg1;
cotime2 = (CalObjTime*) arg2;
if (cotime1->year < cotime2->year)
- return -1;
- if (cotime1->year > cotime2->year)
- return 1;
-
- if (cotime1->month < cotime2->month)
- return -1;
- if (cotime1->month > cotime2->month)
- return 1;
+ retval = -1;
+ else if (cotime1->year > cotime2->year)
+ retval = 1;
+
+ else if (cotime1->month < cotime2->month)
+ retval = -1;
+ else if (cotime1->month > cotime2->month)
+ retval = 1;
+
+ else if (cotime1->day < cotime2->day)
+ retval = -1;
+ else if (cotime1->day > cotime2->day)
+ retval = 1;
+
+ else if (cotime1->hour < cotime2->hour)
+ retval = -1;
+ else if (cotime1->hour > cotime2->hour)
+ retval = 1;
+
+ else if (cotime1->minute < cotime2->minute)
+ retval = -1;
+ else if (cotime1->minute > cotime2->minute)
+ retval = 1;
+
+ else if (cotime1->second < cotime2->second)
+ retval = -1;
+ else if (cotime1->second > cotime2->second)
+ retval = 1;
- if (cotime1->day < cotime2->day)
- return -1;
- if (cotime1->day > cotime2->day)
- return 1;
-
- if (cotime1->hour < cotime2->hour)
- return -1;
- if (cotime1->hour > cotime2->hour)
- return 1;
-
- if (cotime1->minute < cotime2->minute)
- return -1;
- if (cotime1->minute > cotime2->minute)
- return 1;
+ else
+ retval = 0;
- if (cotime1->second < cotime2->second)
- return -1;
- if (cotime1->second > cotime2->second)
- return 1;
+#if 0
+ g_print ("%s - ", cal_obj_time_to_string (cotime1));
+ g_print ("%s : %i\n", cal_obj_time_to_string (cotime2), retval);
+#endif
- return 0;
+ return retval;
}
static gint
diff --git a/calendar/cal-util/test-recur.c b/calendar/cal-util/test-recur.c
index 01a1719903..620e65c185 100644
--- a/calendar/cal-util/test-recur.c
+++ b/calendar/cal-util/test-recur.c
@@ -33,8 +33,12 @@
#include <cal-util/cal-recur.h>
+/* Since events can recur infinitely, we set a limit to the number of
+ occurrences we output. */
+#define MAX_OCCURRENCES 1000
+
static void usage (void);
-static icalcomponent* scan_vcs_file (char *filename);
+static icalcomponent* scan_ics_file (char *filename);
static char* get_line (char *s,
size_t size,
void *data);
@@ -59,7 +63,7 @@ main (int argc,
filename = argv[1];
- icalcomp = scan_vcs_file (filename);
+ icalcomp = scan_ics_file (filename);
if (icalcomp)
generate_occurrences (icalcomp);
@@ -76,7 +80,7 @@ usage (void)
static icalcomponent*
-scan_vcs_file (char *filename)
+scan_ics_file (char *filename)
{
FILE *fp;
icalcomponent *icalcomp;
@@ -115,6 +119,7 @@ generate_occurrences (icalcomponent *icalcomp)
{
icalcomponent *tmp_icalcomp;
CalComponent *comp;
+ gint occurrences;
for (tmp_icalcomp = icalcomponent_get_first_component (icalcomp, ICAL_ANY_COMPONENT);
tmp_icalcomp;
@@ -137,7 +142,9 @@ generate_occurrences (icalcomponent *icalcomp)
g_print ("%s\n\n", icalcomponent_as_ical_string (tmp_icalcomp));
cal_recur_generate_instances (comp, -1, -1,
- occurrence_cb, NULL);
+ occurrence_cb, &occurrences);
+
+ g_print ("%s\n\n", icalcomponent_as_ical_string (tmp_icalcomp));
}
}
@@ -149,6 +156,9 @@ occurrence_cb (CalComponent *comp,
gpointer data)
{
char start[32], finish[32];
+ gint *occurrences;
+
+ occurrences = (gint*) data;
strcpy (start, ctime (&instance_start));
start[24] = '\0';
@@ -157,5 +167,6 @@ occurrence_cb (CalComponent *comp,
g_print ("%s - %s\n", start, finish);
- return TRUE;
+ (*occurrences)++;
+ return (*occurrences == MAX_OCCURRENCES) ? FALSE : TRUE;
}
diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am
index bd32e28ef3..191273eded 100644
--- a/calendar/gui/Makefile.am
+++ b/calendar/gui/Makefile.am
@@ -48,6 +48,8 @@ glade_messages = event-editor-dialog.glade.h
evolution_calendar_SOURCES = \
alarm.c \
alarm.h \
+ calendar-config.c \
+ calendar-config.h \
calendar-commands.c \
calendar-commands.h \
calendar-model.c \
diff --git a/calendar/gui/calendar-commands.c b/calendar/gui/calendar-commands.c
index 676d3944de..0467932c38 100644
--- a/calendar/gui/calendar-commands.c
+++ b/calendar/gui/calendar-commands.c
@@ -23,6 +23,7 @@
#include "gnome-cal.h"
#include "calendar-commands.h"
#include "print.h"
+#include "dialogs/cal-prefs-dialog.h"
#include "dayview.xpm"
#include "workweekview.xpm"
@@ -95,6 +96,9 @@ CalendarAlarm alarm_defaults[4] = {
};
#endif
+/* We have one global preferences dialog. */
+static CalPrefsDialog *preferences_dialog = NULL;
+
static void
init_username (void)
{
@@ -215,6 +219,20 @@ file_print_cb (BonoboUIHandler *uih, void *data, const char *path)
print (gcal, FALSE);
}
+
+/* This iterates over each calendar telling them to update their config
+ settings. */
+void
+update_all_config_settings (void)
+{
+ GList *l;
+
+ for (l = all_calendars; l; l = l->next)
+ gnome_calendar_update_config_settings (GNOME_CALENDAR (l->data), FALSE);
+}
+
+
+/* These are all for the old config code and will eventually be removed. */
void
time_format_changed (void)
{
@@ -451,8 +469,10 @@ save_as_calendar_cmd (BonoboUIHandler *uih, void *user_data, const char *path)
static void
properties_cmd (BonoboUIHandler *uih, void *user_data, const char *path)
{
- GnomeCalendar *gcal = GNOME_CALENDAR (user_data);
- properties (GTK_WIDGET (gcal));
+ if (!preferences_dialog)
+ preferences_dialog = cal_prefs_dialog_new ();
+ else
+ cal_prefs_dialog_show (preferences_dialog);
}
diff --git a/calendar/gui/calendar-commands.h b/calendar/gui/calendar-commands.h
index 944d540f93..f63c29e1fc 100644
--- a/calendar/gui/calendar-commands.h
+++ b/calendar/gui/calendar-commands.h
@@ -66,6 +66,15 @@ extern gboolean enable_snooze;
extern guint snooze_secs;
extern const guint MAX_SNOOZE_SECS;
+
+
+/* This tells all the calendars to reload the config settings. */
+void update_all_config_settings (void);
+
+/*
+ * FIXME: These are for the old config code and will be removed eventually.
+ */
+
/* Creates and runs the preferences dialog box */
void properties (GtkWidget *toplevel);
@@ -80,6 +89,9 @@ void colors_changed (void);
/* Asks for all todo lists to reflect the accurate properties */
void todo_properties_changed(void);
+
+
+
/* Creates and runs the Go-to date dialog */
void goto_dialog (GnomeCalendar *gcal);
diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c
index 351beee6b3..e47c8cf4af 100644
--- a/calendar/gui/calendar-component.c
+++ b/calendar/gui/calendar-component.c
@@ -27,6 +27,7 @@
#include <executive-summary/evolution-services/executive-summary-component.h>
#include "component-factory.h"
#include "control-factory.h"
+#include "calendar-config.h"
#include "calendar-summary.h"
@@ -36,7 +37,7 @@
static BonoboGenericFactory *factory = NULL;
static BonoboGenericFactory *summary_factory = NULL;
-static char *evolution_dir;
+char *evolution_dir;
static const EvolutionShellComponentFolderType folder_types[] = {
{ "calendar", "evolution-calendar.png" },
@@ -70,18 +71,18 @@ static gint owner_count = 0;
static void
owner_set_cb (EvolutionShellComponent *shell_component,
- Evolution_Shell shell_interface,
- const char *evolution_homedir)
+ EvolutionShellClient *shell_client,
+ const char *evolution_homedir,
+ gpointer user_data)
{
evolution_dir = g_strdup (evolution_homedir);
+ calendar_config_init ();
owner_count ++;
}
static void
owner_unset_cb (EvolutionShellComponent *shell_component,
- Evolution_Shell shell_interface,
- EvolutionShellClient shell_client,
- void *data)
+ gpointer user_data)
{
g_free (evolution_dir);
owner_count --;
diff --git a/calendar/gui/calendar-component.h b/calendar/gui/calendar-component.h
index f83a849452..8e5cd6605f 100644
--- a/calendar/gui/calendar-component.h
+++ b/calendar/gui/calendar-component.h
@@ -24,6 +24,8 @@
#ifndef _COMPONENT_FACTORY_H_
#define _COMPONENT_FACTORY_H_
+extern char *evolution_dir;
+
void component_factory_init (void);
#endif /* _COMPONENT_FACTORY_H_ */
diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c
new file mode 100644
index 0000000000..6664ca775d
--- /dev/null
+++ b/calendar/gui/calendar-config.c
@@ -0,0 +1,405 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * Author :
+ * Damon Chaplin <damon@helixcode.com>
+ *
+ * Copyright 2000, Helix Code, Inc.
+ *
+ * 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
+ */
+
+/*
+ * calendar-config.c - functions to load/save/get/set user settings.
+ */
+
+#include <config.h>
+#include <gnome.h>
+#include "component-factory.h"
+#include "calendar-config.h"
+
+
+typedef struct
+{
+ CalWeekdays working_days;
+ gboolean use_24_hour_format;
+ gint week_start_day;
+ gint day_start_hour;
+ gint day_start_minute;
+ gint day_end_hour;
+ gint day_end_minute;
+ gint time_divisions;
+ gboolean dnav_show_week_no;
+ gfloat hpane_pos;
+ gfloat vpane_pos;
+ gfloat month_hpane_pos;
+ gfloat month_vpane_pos;
+ gboolean compress_weekend;
+ gboolean show_event_end;
+} CalendarConfig;
+
+
+static CalendarConfig *config = NULL;
+
+static void config_read (void);
+
+
+void
+calendar_config_init (void)
+{
+ if (config)
+ return;
+
+ config = g_new0 (CalendarConfig, 1);
+
+ config_read ();
+}
+
+
+static void
+config_read (void)
+{
+ gchar *prefix;
+ gboolean is_default;
+
+ /* 'Display' settings. */
+ prefix = g_strdup_printf ("=%s/config/Calendar=/Display/",
+ evolution_dir);
+ gnome_config_push_prefix (prefix);
+ g_free (prefix);
+
+ config->working_days = gnome_config_get_int_with_default ("WorkingDays", &is_default);
+ if (is_default) {
+ config->working_days = CAL_MONDAY | CAL_TUESDAY
+ | CAL_WEDNESDAY | CAL_THURSDAY | CAL_FRIDAY;
+ }
+ config->use_24_hour_format = gnome_config_get_bool ("Use24HourFormat=0");
+ config->week_start_day = gnome_config_get_int ("WeekStartDay=1");
+ config->day_start_hour = gnome_config_get_int ("DayStartHour=9");
+ config->day_start_minute = gnome_config_get_int ("DayStartMinute=0");
+ config->day_end_hour = gnome_config_get_int ("DayEndHour=17");
+ config->day_end_minute = gnome_config_get_int ("DayEndMinute=0");
+ config->time_divisions = gnome_config_get_int ("TimeDivisions=30");
+ config->hpane_pos = gnome_config_get_float ("HPanePosition=1");
+ config->vpane_pos = gnome_config_get_float ("VPanePosition=1");
+ config->month_hpane_pos = gnome_config_get_float ("MonthHPanePosition=0");
+ config->month_vpane_pos = gnome_config_get_float ("MonthVPanePosition=0");
+ config->compress_weekend = gnome_config_get_bool ("CompressWeekend=1");
+ config->show_event_end = gnome_config_get_bool ("ShowEventEndTime=1");
+
+ gnome_config_pop_prefix ();
+
+
+ /* 'DateNavigator' settings. */
+ prefix = g_strdup_printf ("=%s/config/Calendar=/DateNavigator/",
+ evolution_dir);
+ gnome_config_push_prefix (prefix);
+ g_free (prefix);
+
+ config->dnav_show_week_no = gnome_config_get_bool ("ShowWeekNumbers=0");
+
+ gnome_config_pop_prefix ();
+
+
+ gnome_config_sync ();
+}
+
+
+void
+calendar_config_write (void)
+{
+ gchar *prefix;
+
+ /* 'Display' settings. */
+ prefix = g_strdup_printf ("=%s/config/Calendar=/Display/",
+ evolution_dir);
+ gnome_config_push_prefix (prefix);
+ g_free (prefix);
+
+ gnome_config_set_int ("WorkingDays", config->working_days);
+ gnome_config_set_bool ("Use24HourFormat", config->use_24_hour_format);
+ gnome_config_set_int ("WeekStartDay", config->week_start_day);
+ gnome_config_set_int ("DayStartHour", config->day_start_hour);
+ gnome_config_set_int ("DayStartMinute", config->day_start_minute);
+ gnome_config_set_int ("DayEndHour", config->day_end_hour);
+ gnome_config_set_int ("DayEndMinute", config->day_end_minute);
+ gnome_config_set_bool ("CompressWeekend", config->compress_weekend);
+ gnome_config_set_bool ("ShowEventEndTime", config->show_event_end);
+
+ gnome_config_pop_prefix ();
+
+
+ /* 'DateNavigator' settings. */
+ prefix = g_strdup_printf ("=%s/config/Calendar=/DateNavigator/",
+ evolution_dir);
+ gnome_config_push_prefix (prefix);
+ g_free (prefix);
+
+ gnome_config_set_bool ("ShowWeekNumbers", config->dnav_show_week_no);
+
+ gnome_config_pop_prefix ();
+
+
+ gnome_config_sync ();
+}
+
+
+void
+calendar_config_write_on_exit (void)
+{
+ gchar *prefix;
+
+ /* 'Display' settings. */
+ prefix = g_strdup_printf ("=%s/config/Calendar=/Display/",
+ evolution_dir);
+ gnome_config_push_prefix (prefix);
+ g_free (prefix);
+
+ gnome_config_set_int ("TimeDivisions", config->time_divisions);
+ gnome_config_set_float ("HPanePosition", config->hpane_pos);
+ gnome_config_set_float ("VPanePosition", config->vpane_pos);
+ gnome_config_set_float ("MonthHPanePosition", config->month_hpane_pos);
+ gnome_config_set_float ("MonthVPanePosition", config->month_vpane_pos);
+
+ gnome_config_pop_prefix ();
+
+
+ gnome_config_sync ();
+}
+
+
+/*
+ * Calendar Settings.
+ */
+
+/* Whether we use 24-hour format or 12-hour format (AM/PM). */
+gboolean
+calendar_config_get_24_hour_format (void)
+{
+ return config->use_24_hour_format;
+}
+
+
+void
+calendar_config_set_24_hour_format (gboolean use_24_hour)
+{
+ config->use_24_hour_format = use_24_hour;
+}
+
+
+/* The start day of the week (0 = Sun to 6 = Mon). */
+gint
+calendar_config_get_week_start_day (void)
+{
+ return config->week_start_day;
+}
+
+
+void
+calendar_config_set_week_start_day (gint week_start_day)
+{
+ config->week_start_day = week_start_day;
+}
+
+
+/* The start and end times of the work-day. */
+gint
+calendar_config_get_day_start_hour (void)
+{
+ return config->day_start_hour;
+}
+
+
+void
+calendar_config_set_day_start_hour (gint day_start_hour)
+{
+ config->day_start_hour = day_start_hour;
+}
+
+
+gint
+calendar_config_get_day_start_minute (void)
+{
+ return config->day_start_minute;
+}
+
+
+void
+calendar_config_set_day_start_minute (gint day_start_min)
+{
+ config->day_start_minute = day_start_min;
+}
+
+
+gint
+calendar_config_get_day_end_hour (void)
+{
+ return config->day_end_hour;
+}
+
+
+void
+calendar_config_set_day_end_hour (gint day_end_hour)
+{
+ config->day_end_hour = day_end_hour;
+}
+
+
+gint
+calendar_config_get_day_end_minute (void)
+{
+ return config->day_end_minute;
+}
+
+
+void
+calendar_config_set_day_end_minute (gint day_end_min)
+{
+ config->day_end_minute = day_end_min;
+}
+
+
+/* The time divisions in the Day/Work-Week view in minutes (5/10/15/30/60). */
+gint
+calendar_config_get_time_divisions (void)
+{
+ return config->time_divisions;
+}
+
+
+void
+calendar_config_set_time_divisions (gint divisions)
+{
+ config->time_divisions = divisions;
+}
+
+
+/* Whether we show week numbers in the Date Navigator. */
+gboolean
+calendar_config_get_dnav_show_week_no (void)
+{
+ return config->dnav_show_week_no;
+}
+
+
+void
+calendar_config_set_dnav_show_week_no (gboolean show_week_no)
+{
+ config->dnav_show_week_no = show_week_no;
+}
+
+
+/* The positions of the panes in the normal and month views. */
+gfloat
+calendar_config_get_hpane_pos (void)
+{
+ return config->hpane_pos;
+}
+
+
+void
+calendar_config_set_hpane_pos (gfloat hpane_pos)
+{
+ config->hpane_pos = hpane_pos;
+}
+
+
+gfloat
+calendar_config_get_vpane_pos (void)
+{
+ return config->vpane_pos;
+}
+
+
+void
+calendar_config_set_vpane_pos (gfloat vpane_pos)
+{
+ config->vpane_pos = vpane_pos;
+}
+
+
+gfloat
+calendar_config_get_month_hpane_pos (void)
+{
+ return config->month_hpane_pos;
+}
+
+
+void
+calendar_config_set_month_hpane_pos (gfloat hpane_pos)
+{
+ config->month_hpane_pos = hpane_pos;
+}
+
+
+gfloat
+calendar_config_get_month_vpane_pos (void)
+{
+ return config->month_vpane_pos;
+}
+
+
+void
+calendar_config_set_month_vpane_pos (gfloat vpane_pos)
+{
+ config->month_vpane_pos = vpane_pos;
+}
+
+
+/* Whether we compress the weekend in the week/month views. */
+gboolean
+calendar_config_get_compress_weekend (void)
+{
+ return config->compress_weekend;
+}
+
+
+void
+calendar_config_set_compress_weekend (gboolean compress)
+{
+ config->compress_weekend = compress;
+}
+
+
+/* Whether we show event end times. */
+gboolean
+calendar_config_get_show_event_end (void)
+{
+ return config->show_event_end;
+}
+
+
+void
+calendar_config_set_show_event_end (gboolean show_end)
+{
+ config->show_event_end = show_end;
+}
+
+
+/* The working days of the week, a bit-wise combination of flags. */
+CalWeekdays
+calendar_config_get_working_days (void)
+{
+ return config->working_days;
+}
+
+
+void
+calendar_config_set_working_days (CalWeekdays days)
+{
+ config->working_days = days;
+}
+
diff --git a/calendar/gui/calendar-config.h b/calendar/gui/calendar-config.h
new file mode 100644
index 0000000000..a636e3f185
--- /dev/null
+++ b/calendar/gui/calendar-config.h
@@ -0,0 +1,113 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * Author :
+ * Damon Chaplin <damon@helixcode.com>
+ *
+ * Copyright 2000, Helix Code, Inc.
+ *
+ * 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
+ */
+
+/*
+ * calendar-config.h - functions to load/save/get/set user settings.
+ */
+
+#ifndef _CALENDAR_CONFIG_H_
+#define _CALENDAR_CONFIG_H_
+
+
+/* These are used to get/set the working days in the week. The bit-flags are
+ combined together. The bits must be from 0 (Sun) to 6 (Sat) to match the
+ day values used by localtime etc. */
+typedef enum
+{
+ CAL_SUNDAY = 1 << 0,
+ CAL_MONDAY = 1 << 1,
+ CAL_TUESDAY = 1 << 2,
+ CAL_WEDNESDAY = 1 << 3,
+ CAL_THURSDAY = 1 << 4,
+ CAL_FRIDAY = 1 << 5,
+ CAL_SATURDAY = 1 << 6
+} CalWeekdays;
+
+
+
+void calendar_config_init (void);
+void calendar_config_write (void);
+void calendar_config_write_on_exit (void);
+
+
+/*
+ * Calendar Settings.
+ */
+
+/* The working days of the week, a bit-wise combination of flags. */
+CalWeekdays calendar_config_get_working_days (void);
+void calendar_config_set_working_days (CalWeekdays days);
+
+/* The start day of the week (0 = Sun to 6 = Sat). */
+gint calendar_config_get_week_start_day (void);
+void calendar_config_set_week_start_day (gint week_start_day);
+
+/* The start and end times of the work-day. */
+gint calendar_config_get_day_start_hour (void);
+void calendar_config_set_day_start_hour (gint day_start_hour);
+
+gint calendar_config_get_day_start_minute (void);
+void calendar_config_set_day_start_minute (gint day_start_min);
+
+gint calendar_config_get_day_end_hour (void);
+void calendar_config_set_day_end_hour (gint day_end_hour);
+
+gint calendar_config_get_day_end_minute (void);
+void calendar_config_set_day_end_minute (gint day_end_min);
+
+/* Whether we use 24-hour format or 12-hour format (AM/PM). */
+gboolean calendar_config_get_24_hour_format (void);
+void calendar_config_set_24_hour_format (gboolean use_24_hour);
+
+/* The time divisions in the Day/Work-Week view in minutes (5/10/15/30/60). */
+gint calendar_config_get_time_divisions (void);
+void calendar_config_set_time_divisions (gint divisions);
+
+/* Whether we show event end times. */
+gboolean calendar_config_get_show_event_end (void);
+void calendar_config_set_show_event_end (gboolean show_end);
+
+/* Whether we compress the weekend in the week/month views. */
+gboolean calendar_config_get_compress_weekend (void);
+void calendar_config_set_compress_weekend (gboolean compress);
+
+/* Whether we show week numbers in the Date Navigator. */
+gboolean calendar_config_get_dnav_show_week_no (void);
+void calendar_config_set_dnav_show_week_no (gboolean show_week_no);
+
+/* The positions of the panes in the normal and month views. */
+gfloat calendar_config_get_hpane_pos (void);
+void calendar_config_set_hpane_pos (gfloat hpane_pos);
+
+gfloat calendar_config_get_vpane_pos (void);
+void calendar_config_set_vpane_pos (gfloat vpane_pos);
+
+gfloat calendar_config_get_month_hpane_pos (void);
+void calendar_config_set_month_hpane_pos (gfloat hpane_pos);
+
+gfloat calendar_config_get_month_vpane_pos (void);
+void calendar_config_set_month_vpane_pos (gfloat vpane_pos);
+
+
+#endif /* _CALENDAR_CONFIG_H_ */
diff --git a/calendar/gui/component-factory.c b/calendar/gui/component-factory.c
index 351beee6b3..e47c8cf4af 100644
--- a/calendar/gui/component-factory.c
+++ b/calendar/gui/component-factory.c
@@ -27,6 +27,7 @@
#include <executive-summary/evolution-services/executive-summary-component.h>
#include "component-factory.h"
#include "control-factory.h"
+#include "calendar-config.h"
#include "calendar-summary.h"
@@ -36,7 +37,7 @@
static BonoboGenericFactory *factory = NULL;
static BonoboGenericFactory *summary_factory = NULL;
-static char *evolution_dir;
+char *evolution_dir;
static const EvolutionShellComponentFolderType folder_types[] = {
{ "calendar", "evolution-calendar.png" },
@@ -70,18 +71,18 @@ static gint owner_count = 0;
static void
owner_set_cb (EvolutionShellComponent *shell_component,
- Evolution_Shell shell_interface,
- const char *evolution_homedir)
+ EvolutionShellClient *shell_client,
+ const char *evolution_homedir,
+ gpointer user_data)
{
evolution_dir = g_strdup (evolution_homedir);
+ calendar_config_init ();
owner_count ++;
}
static void
owner_unset_cb (EvolutionShellComponent *shell_component,
- Evolution_Shell shell_interface,
- EvolutionShellClient shell_client,
- void *data)
+ gpointer user_data)
{
g_free (evolution_dir);
owner_count --;
diff --git a/calendar/gui/component-factory.h b/calendar/gui/component-factory.h
index f83a849452..8e5cd6605f 100644
--- a/calendar/gui/component-factory.h
+++ b/calendar/gui/component-factory.h
@@ -24,6 +24,8 @@
#ifndef _COMPONENT_FACTORY_H_
#define _COMPONENT_FACTORY_H_
+extern char *evolution_dir;
+
void component_factory_init (void);
#endif /* _COMPONENT_FACTORY_H_ */
diff --git a/calendar/gui/dialogs/Makefile.am b/calendar/gui/dialogs/Makefile.am
index 98646769c1..b39c2a7eac 100644
--- a/calendar/gui/dialogs/Makefile.am
+++ b/calendar/gui/dialogs/Makefile.am
@@ -16,15 +16,19 @@ noinst_LIBRARIES = libcal-dialogs.a
libcal_dialogs_a_SOURCES = \
alarm-notify-dialog.c \
alarm-notify-dialog.h \
+ cal-prefs-dialog.c \
+ cal-prefs-dialog.h \
task-editor.c \
task-editor.h
glade_DATA = \
alarm-notify.glade \
+ cal-prefs-dialog.glade \
task-editor-dialog.glade
-glade_messages = \
- alarm-notify.glade.h \
+glade_messages = \
+ alarm-notify.glade.h \
+ cal-prefs-dialog.glade.h \
task-editor-dialog.glade.h
EXTRA_DIST = \
diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c
new file mode 100644
index 0000000000..9a50db60b6
--- /dev/null
+++ b/calendar/gui/dialogs/cal-prefs-dialog.c
@@ -0,0 +1,464 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * Author :
+ * Damon Chaplin <damon@helixcode.com>
+ *
+ * Copyright 2000, Helix Code, Inc.
+ *
+ * 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
+ */
+
+/*
+ * CalPrefsDialog - a GtkObject which handles a libglade-loaded dialog
+ * to edit the calendar preference settings.
+ */
+
+#include <config.h>
+#include <gnome.h>
+#include <glade/glade.h>
+#include <gal/util/e-util.h>
+#include <e-util/e-dialog-widgets.h>
+#include <widgets/misc/e-dateedit.h>
+#include "cal-prefs-dialog.h"
+#include "../calendar-config.h"
+#include "../calendar-commands.h"
+
+
+typedef struct {
+ /* Glade XML data */
+ GladeXML *xml;
+
+ GtkWidget *dialog;
+
+ GtkWidget *working_days[7];
+ GtkWidget *week_start_day;
+ GtkWidget *start_of_day;
+ GtkWidget *end_of_day;
+ GtkWidget *use_12_hour;
+ GtkWidget *use_24_hour;
+ GtkWidget *time_divisions;
+ GtkWidget *show_end_times;
+ GtkWidget *compress_weekend;
+ GtkWidget *dnav_show_week_no;
+} CalPrefsDialogPrivate;
+
+static const int week_start_day_map[] = {
+ 1, 2, 3, 4, 5, 6, 0, -1
+};
+
+static const int time_division_map[] = {
+ 60, 30, 15, 10, 5, -1
+};
+
+static void cal_prefs_dialog_class_init (CalPrefsDialogClass *class);
+static void cal_prefs_dialog_init (CalPrefsDialog *prefs);
+static gboolean get_widgets (CalPrefsDialog *prefs);
+static void cal_prefs_dialog_destroy (GtkObject *object);
+static void cal_prefs_dialog_init_widgets (CalPrefsDialog *prefs);
+static void cal_prefs_dialog_button_clicked (GtkWidget *dialog,
+ gint button,
+ CalPrefsDialog *prefs);
+static void cal_prefs_dialog_use_24_hour_toggled(GtkWidget *button,
+ CalPrefsDialog *prefs);
+static void cal_prefs_dialog_show_config (CalPrefsDialog *prefs);
+static void cal_prefs_dialog_update_config (CalPrefsDialog *prefs);
+
+GtkWidget* cal_prefs_dialog_create_time_edit (void);
+
+static GtkObjectClass *parent_class;
+
+E_MAKE_TYPE (cal_prefs_dialog, "CalPrefsDialog", CalPrefsDialog,
+ cal_prefs_dialog_class_init, cal_prefs_dialog_init,
+ GTK_TYPE_OBJECT)
+
+
+static void
+cal_prefs_dialog_class_init (CalPrefsDialogClass *class)
+{
+ GtkObjectClass *object_class;
+
+ object_class = (GtkObjectClass *) class;
+
+ parent_class = gtk_type_class (GTK_TYPE_OBJECT);
+
+ object_class->destroy = cal_prefs_dialog_destroy;
+}
+
+
+static void
+cal_prefs_dialog_init (CalPrefsDialog *prefs)
+{
+ CalPrefsDialogPrivate *priv;
+
+ priv = g_new0 (CalPrefsDialogPrivate, 1);
+ prefs->priv = priv;
+
+}
+
+
+/**
+ * cal_prefs_dialog_new:
+ * @Returns: a new #CalPrefsDialog.
+ *
+ * Creates a new #CalPrefsDialog.
+ **/
+CalPrefsDialog *
+cal_prefs_dialog_new (void)
+{
+ CalPrefsDialog *prefs;
+
+ prefs = CAL_PREFS_DIALOG (gtk_type_new (cal_prefs_dialog_get_type ()));
+ return cal_prefs_dialog_construct (prefs);
+}
+
+
+/**
+ * cal_prefs_dialog_construct:
+ * @prefs: A #CalPrefsDialog.
+ *
+ * Constructs a task editor by loading its Glade XML file.
+ *
+ * Return value: The same object as @prefs, or NULL if the widgets could not be
+ * created. In the latter case, the task editor will automatically be
+ * destroyed.
+ **/
+CalPrefsDialog *
+cal_prefs_dialog_construct (CalPrefsDialog *prefs)
+{
+ CalPrefsDialogPrivate *priv;
+
+ g_return_val_if_fail (IS_CAL_PREFS_DIALOG (prefs), NULL);
+
+ priv = prefs->priv;
+
+ /* Load the content widgets */
+
+ priv->xml = glade_xml_new (EVOLUTION_GLADEDIR "/cal-prefs-dialog.glade", NULL);
+ if (!priv->xml) {
+ g_message ("cal_prefs_dialog_construct(): Could not load the Glade XML file!");
+ goto error;
+ }
+
+ if (!get_widgets (prefs)) {
+ g_message ("cal_prefs_dialog_construct(): Could not find all widgets in the XML file!");
+ goto error;
+ }
+
+ cal_prefs_dialog_init_widgets (prefs);
+
+ cal_prefs_dialog_show_config (prefs);
+
+ gtk_widget_show (priv->dialog);
+
+ return prefs;
+
+ error:
+
+ gtk_object_unref (GTK_OBJECT (prefs));
+ return NULL;
+}
+
+
+/* Gets the widgets from the XML file and returns if they are all available.
+ */
+static gboolean
+get_widgets (CalPrefsDialog *prefs)
+{
+ CalPrefsDialogPrivate *priv;
+
+ priv = prefs->priv;
+
+#define GW(name) glade_xml_get_widget (priv->xml, name)
+
+ priv->dialog = GW ("cal-prefs-dialog");
+
+ /* The indices must match the mktime() values. */
+ priv->working_days[0] = GW ("sun_button");
+ priv->working_days[1] = GW ("mon_button");
+ priv->working_days[2] = GW ("tue_button");
+ priv->working_days[3] = GW ("wed_button");
+ priv->working_days[4] = GW ("thu_button");
+ priv->working_days[5] = GW ("fri_button");
+ priv->working_days[6] = GW ("sat_button");
+
+ priv->week_start_day = GW ("first_day_of_week");
+ priv->start_of_day = GW ("start_of_day");
+ priv->end_of_day = GW ("end_of_day");
+ priv->use_12_hour = GW ("use_12_hour");
+ priv->use_24_hour = GW ("use_24_hour");
+ priv->time_divisions = GW ("time_divisions");
+ priv->show_end_times = GW ("show_end_times");
+ priv->compress_weekend = GW ("compress_weekend");
+ priv->dnav_show_week_no = GW ("dnav_show_week_no");
+
+#undef GW
+
+ return (priv->dialog
+ && priv->working_days[0]
+ && priv->working_days[1]
+ && priv->working_days[2]
+ && priv->working_days[3]
+ && priv->working_days[4]
+ && priv->working_days[5]
+ && priv->working_days[6]
+ && priv->week_start_day
+ && priv->start_of_day
+ && priv->end_of_day
+ && priv->use_12_hour
+ && priv->use_24_hour
+ && priv->time_divisions
+ && priv->show_end_times
+ && priv->compress_weekend
+ && priv->dnav_show_week_no);
+}
+
+
+static void
+cal_prefs_dialog_destroy (GtkObject *object)
+{
+ CalPrefsDialog *prefs;
+ CalPrefsDialogPrivate *priv;
+
+ g_return_if_fail (IS_CAL_PREFS_DIALOG (object));
+
+ prefs = CAL_PREFS_DIALOG (object);
+ priv = prefs->priv;
+
+
+ g_free (priv);
+ prefs->priv = NULL;
+
+ if (GTK_OBJECT_CLASS (parent_class)->destroy)
+ (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
+}
+
+
+/* Called by libglade to create our custom EDateEdit widgets. */
+GtkWidget *
+cal_prefs_dialog_create_time_edit (void)
+{
+ GtkWidget *dedit;
+
+ dedit = e_date_edit_new ();
+
+ e_date_edit_set_time_popup_range (E_DATE_EDIT (dedit), 0, 24);
+ e_date_edit_set_show_date (E_DATE_EDIT (dedit), FALSE);
+
+ return dedit;
+}
+
+
+void
+cal_prefs_dialog_show (CalPrefsDialog *prefs)
+{
+ CalPrefsDialogPrivate *priv;
+
+ g_return_if_fail (IS_CAL_PREFS_DIALOG (prefs));
+
+ priv = prefs->priv;
+
+ /* If the dialog is already show just raise it, otherwise refresh the
+ config settings and show it. */
+ if (GTK_WIDGET_MAPPED (priv->dialog)) {
+ gdk_window_raise (priv->dialog->window);
+ } else {
+ cal_prefs_dialog_show_config (prefs);
+ gtk_widget_show (priv->dialog);
+ }
+}
+
+
+/* Connects any necessary signal handlers. */
+static void
+cal_prefs_dialog_init_widgets (CalPrefsDialog *prefs)
+{
+ CalPrefsDialogPrivate *priv;
+
+ priv = prefs->priv;
+
+ gtk_signal_connect (GTK_OBJECT (priv->dialog), "clicked",
+ GTK_SIGNAL_FUNC (cal_prefs_dialog_button_clicked),
+ prefs);
+
+ gtk_signal_connect (GTK_OBJECT (priv->use_24_hour), "toggled",
+ GTK_SIGNAL_FUNC (cal_prefs_dialog_use_24_hour_toggled),
+ prefs);
+}
+
+
+static void
+cal_prefs_dialog_button_clicked (GtkWidget *dialog,
+ gint button,
+ CalPrefsDialog *prefs)
+{
+ CalPrefsDialogPrivate *priv;
+
+ g_return_if_fail (IS_CAL_PREFS_DIALOG (prefs));
+
+ priv = prefs->priv;
+
+ /* OK & Apply buttons update the config settings. */
+ if (button == 0 || button == 1)
+ cal_prefs_dialog_update_config (prefs);
+
+ /* OK & Close buttons close the dialog. */
+ if (button == 0 || button == 2)
+ gtk_widget_hide (priv->dialog);
+}
+
+
+static void
+cal_prefs_dialog_use_24_hour_toggled (GtkWidget *button,
+ CalPrefsDialog *prefs)
+{
+ CalPrefsDialogPrivate *priv;
+ gboolean use_24_hour;
+
+ priv = prefs->priv;
+
+ g_print ("In cal_prefs_dialog_use_24_hour_toggled\n");
+
+ use_24_hour = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->use_24_hour));
+
+ e_date_edit_set_use_24_hour_format (E_DATE_EDIT (priv->start_of_day),
+ use_24_hour);
+ e_date_edit_set_use_24_hour_format (E_DATE_EDIT (priv->end_of_day),
+ use_24_hour);
+}
+
+
+/* Shows the current config settings in the dialog. */
+static void
+cal_prefs_dialog_show_config (CalPrefsDialog *prefs)
+{
+ CalPrefsDialogPrivate *priv;
+ CalWeekdays working_days;
+ gint mask, day, week_start_day, time_divisions;
+
+ priv = prefs->priv;
+
+ /* Working Days. */
+ working_days = calendar_config_get_working_days ();
+ mask = 1 << 0;
+ for (day = 0; day < 7; day++) {
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->working_days[day]), (working_days & mask) ? TRUE : FALSE);
+ mask <<= 1;
+ }
+
+ /* Week Start Day. */
+ week_start_day = calendar_config_get_week_start_day ();
+ e_dialog_option_menu_set (priv->week_start_day, week_start_day,
+ week_start_day_map);
+
+ /* Start of Day. */
+ e_date_edit_set_time_of_day (E_DATE_EDIT (priv->start_of_day),
+ calendar_config_get_day_start_hour (),
+ calendar_config_get_day_start_minute ());
+
+ /* End of Day. */
+ e_date_edit_set_time_of_day (E_DATE_EDIT (priv->end_of_day),
+ calendar_config_get_day_end_hour (),
+ calendar_config_get_day_end_minute ());
+
+ /* 12/24 Hour Format. */
+ if (calendar_config_get_24_hour_format ())
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->use_24_hour), TRUE);
+ else
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->use_12_hour), TRUE);
+
+ /* Time Divisions. */
+ time_divisions = calendar_config_get_time_divisions ();
+ e_dialog_option_menu_set (priv->time_divisions, time_divisions,
+ time_division_map);
+
+ /* Show Appointment End Times. */
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->show_end_times),
+ calendar_config_get_show_event_end ());
+
+ /* Compress Weekend. */
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->compress_weekend), calendar_config_get_compress_weekend ());
+
+ /* Date Navigator - Show Week Numbers. */
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->dnav_show_week_no), calendar_config_get_dnav_show_week_no ());
+}
+
+
+/* Updates the config values based on the settings in the dialog. */
+static void
+cal_prefs_dialog_update_config (CalPrefsDialog *prefs)
+{
+ CalPrefsDialogPrivate *priv;
+ CalWeekdays working_days;
+ gint mask, day, week_start_day, time_divisions, hour, minute;
+
+ priv = prefs->priv;
+
+ /* Working Days. */
+ working_days = 0;
+ mask = 1 << 0;
+ for (day = 0; day < 7; day++) {
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->working_days[day])))
+ working_days |= mask;
+ mask <<= 1;
+ }
+ calendar_config_set_working_days (working_days);
+
+ /* Week Start Day. */
+ week_start_day = e_dialog_option_menu_get (priv->week_start_day,
+ week_start_day_map);
+ calendar_config_set_week_start_day (week_start_day);
+
+ /* Start of Day. */
+ if (e_date_edit_get_time_of_day (E_DATE_EDIT (priv->start_of_day),
+ &hour, &minute)) {
+ calendar_config_set_day_start_hour (hour);
+ calendar_config_set_day_start_minute (minute);
+ } else {
+ /* FIXME: Show error dialog? */
+ g_warning ("Couldn't parse start of day");
+ }
+
+ /* End of Day. */
+ if (e_date_edit_get_time_of_day (E_DATE_EDIT (priv->end_of_day),
+ &hour, &minute)) {
+ calendar_config_set_day_end_hour (hour);
+ calendar_config_set_day_end_minute (minute);
+ } else {
+ /* FIXME: Show error dialog? */
+ g_warning ("Couldn't parse end of day");
+ }
+
+ /* 12/24 Hour Format. */
+ calendar_config_set_24_hour_format (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->use_24_hour)));
+
+ /* Time Divisions. */
+ time_divisions = e_dialog_option_menu_get (priv->time_divisions,
+ time_division_map);
+ calendar_config_set_time_divisions (time_divisions);
+
+ /* Show Appointment End Times. */
+ calendar_config_set_show_event_end (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->show_end_times)));
+
+ /* Compress Weekend. */
+ calendar_config_set_compress_weekend (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->compress_weekend)));
+
+ /* Date Navigator - Show Week Numbers. */
+ calendar_config_set_dnav_show_week_no (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->dnav_show_week_no)));
+
+ calendar_config_write ();
+ update_all_config_settings ();
+}
diff --git a/calendar/gui/dialogs/cal-prefs-dialog.glade b/calendar/gui/dialogs/cal-prefs-dialog.glade
new file mode 100644
index 0000000000..c0e225764b
--- /dev/null
+++ b/calendar/gui/dialogs/cal-prefs-dialog.glade
@@ -0,0 +1,1243 @@
+<?xml version="1.0"?>
+<GTK-Interface>
+
+<project>
+ <name>preferences</name>
+ <program_name>preferences</program_name>
+ <directory></directory>
+ <source_directory>src</source_directory>
+ <pixmaps_directory>pixmaps</pixmaps_directory>
+ <language>C</language>
+ <gnome_support>True</gnome_support>
+ <gettext_support>True</gettext_support>
+ <output_translatable_strings>True</output_translatable_strings>
+ <translatable_strings_file>cal-prefs-dialog.glade.h</translatable_strings_file>
+</project>
+
+<widget>
+ <class>GnomeDialog</class>
+ <name>cal-prefs-dialog</name>
+ <title>Calendar Preferences</title>
+ <type>GTK_WINDOW_TOPLEVEL</type>
+ <position>GTK_WIN_POS_NONE</position>
+ <modal>False</modal>
+ <allow_shrink>False</allow_shrink>
+ <allow_grow>False</allow_grow>
+ <auto_shrink>False</auto_shrink>
+ <auto_close>False</auto_close>
+ <hide_on_close>True</hide_on_close>
+
+ <widget>
+ <class>GtkVBox</class>
+ <child_name>GnomeDialog:vbox</child_name>
+ <name>vbox1</name>
+ <homogeneous>False</homogeneous>
+ <spacing>8</spacing>
+ <child>
+ <padding>4</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkHButtonBox</class>
+ <child_name>GnomeDialog:action_area</child_name>
+ <name>hbuttonbox1</name>
+ <layout_style>GTK_BUTTONBOX_END</layout_style>
+ <spacing>8</spacing>
+ <child_min_width>85</child_min_width>
+ <child_min_height>27</child_min_height>
+ <child_ipad_x>7</child_ipad_x>
+ <child_ipad_y>0</child_ipad_y>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>True</fill>
+ <pack>GTK_PACK_END</pack>
+ </child>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>button1</name>
+ <can_default>True</can_default>
+ <can_focus>True</can_focus>
+ <stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
+ </widget>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>button2</name>
+ <can_default>True</can_default>
+ <can_focus>True</can_focus>
+ <stock_button>GNOME_STOCK_BUTTON_APPLY</stock_button>
+ </widget>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>button3</name>
+ <can_default>True</can_default>
+ <can_focus>True</can_focus>
+ <stock_button>GNOME_STOCK_BUTTON_CLOSE</stock_button>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkNotebook</class>
+ <name>notebook1</name>
+ <can_focus>True</can_focus>
+ <show_tabs>True</show_tabs>
+ <show_border>True</show_border>
+ <tab_pos>GTK_POS_TOP</tab_pos>
+ <scrollable>False</scrollable>
+ <tab_hborder>2</tab_hborder>
+ <tab_vborder>2</tab_vborder>
+ <popup_enable>False</popup_enable>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkVBox</class>
+ <name>vbox8</name>
+ <border_width>4</border_width>
+ <homogeneous>False</homogeneous>
+ <spacing>6</spacing>
+
+ <widget>
+ <class>GtkFrame</class>
+ <name>frame9</name>
+ <label>Work week</label>
+ <label_xalign>0</label_xalign>
+ <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkVBox</class>
+ <name>vbox9</name>
+ <border_width>4</border_width>
+ <homogeneous>False</homogeneous>
+ <spacing>3</spacing>
+
+ <widget>
+ <class>GtkHBox</class>
+ <name>hbox8</name>
+ <homogeneous>True</homogeneous>
+ <spacing>0</spacing>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkCheckButton</class>
+ <name>mon_button</name>
+ <can_focus>True</can_focus>
+ <label>Mon</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>True</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkCheckButton</class>
+ <name>tue_button</name>
+ <can_focus>True</can_focus>
+ <label>Tue</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>True</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkCheckButton</class>
+ <name>wed_button</name>
+ <can_focus>True</can_focus>
+ <label>Wed</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>True</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkCheckButton</class>
+ <name>thu_button</name>
+ <can_focus>True</can_focus>
+ <label>Thu</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>True</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkCheckButton</class>
+ <name>fri_button</name>
+ <can_focus>True</can_focus>
+ <label>Fri</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>True</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkCheckButton</class>
+ <name>sat_button</name>
+ <can_focus>True</can_focus>
+ <label>Sat</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>True</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkCheckButton</class>
+ <name>sun_button</name>
+ <can_focus>True</can_focus>
+ <label>Sun</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>True</fill>
+ </child>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkHBox</class>
+ <name>hbox9</name>
+ <homogeneous>False</homogeneous>
+ <spacing>4</spacing>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label16</name>
+ <label>First day of week:</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkOptionMenu</class>
+ <name>first_day_of_week</name>
+ <can_focus>True</can_focus>
+ <items>Monday
+Tuesday
+Wednesday
+Thursday
+Friday
+Saturday
+Sunday
+</items>
+ <initial_choice>0</initial_choice>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkHBox</class>
+ <name>hbox11</name>
+ <homogeneous>False</homogeneous>
+ <spacing>4</spacing>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label17</name>
+ <label>Start of day:</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>Custom</class>
+ <name>start_of_day</name>
+ <creation_function>cal_prefs_dialog_create_time_edit</creation_function>
+ <int1>0</int1>
+ <int2>0</int2>
+ <last_modification_time>Tue, 10 Oct 2000 15:12:12 GMT</last_modification_time>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>True</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label18</name>
+ <label>End of day:</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>Custom</class>
+ <name>end_of_day</name>
+ <creation_function>cal_prefs_dialog_create_time_edit</creation_function>
+ <int1>0</int1>
+ <int2>0</int2>
+ <last_modification_time>Tue, 10 Oct 2000 15:12:21 GMT</last_modification_time>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>True</fill>
+ </child>
+ </widget>
+ </widget>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkFrame</class>
+ <name>frame10</name>
+ <label>Display options</label>
+ <label_xalign>0</label_xalign>
+ <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkTable</class>
+ <name>table4</name>
+ <border_width>4</border_width>
+ <rows>4</rows>
+ <columns>3</columns>
+ <homogeneous>False</homogeneous>
+ <row_spacing>0</row_spacing>
+ <column_spacing>4</column_spacing>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label19</name>
+ <label>Time divisions:</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>7.45058e-09</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>1</top_attach>
+ <bottom_attach>2</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label20</name>
+ <label>Time format:</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>0</top_attach>
+ <bottom_attach>1</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkCheckButton</class>
+ <name>show_end_times</name>
+ <can_focus>True</can_focus>
+ <label>Show appointment end times</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>3</right_attach>
+ <top_attach>2</top_attach>
+ <bottom_attach>3</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>True</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkCheckButton</class>
+ <name>compress_weekend</name>
+ <can_focus>True</can_focus>
+ <label>Compress weekends</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>3</right_attach>
+ <top_attach>3</top_attach>
+ <bottom_attach>4</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>True</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkHBox</class>
+ <name>hbox10</name>
+ <homogeneous>True</homogeneous>
+ <spacing>4</spacing>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>3</right_attach>
+ <top_attach>0</top_attach>
+ <bottom_attach>1</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+
+ <widget>
+ <class>GtkRadioButton</class>
+ <name>use_12_hour</name>
+ <can_focus>True</can_focus>
+ <label>12 hour (am/pm)</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <group>time_format_group</group>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>True</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkRadioButton</class>
+ <name>use_24_hour</name>
+ <can_focus>True</can_focus>
+ <label>24 hour</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <group>time_format_group</group>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>True</fill>
+ </child>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkAlignment</class>
+ <name>alignment4</name>
+ <xalign>7.45058e-09</xalign>
+ <yalign>0.5</yalign>
+ <xscale>0</xscale>
+ <yscale>1</yscale>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>2</right_attach>
+ <top_attach>1</top_attach>
+ <bottom_attach>2</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+
+ <widget>
+ <class>GtkOptionMenu</class>
+ <name>time_divisions</name>
+ <can_focus>True</can_focus>
+ <items>60 minutes
+30 minutes
+15 minutes
+10 minutes
+05 minutes
+</items>
+ <initial_choice>0</initial_choice>
+ </widget>
+ </widget>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkFrame</class>
+ <name>frame11</name>
+ <label>Date navigator options</label>
+ <label_xalign>0</label_xalign>
+ <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkCheckButton</class>
+ <name>dnav_show_week_no</name>
+ <border_width>4</border_width>
+ <can_focus>True</can_focus>
+ <label>Show week numbers</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ </widget>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <child_name>Notebook:tab</child_name>
+ <name>label7</name>
+ <label>Calendar</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+
+ <widget>
+ <class>GtkVBox</class>
+ <name>vbox3</name>
+ <border_width>4</border_width>
+ <homogeneous>False</homogeneous>
+ <spacing>4</spacing>
+
+ <widget>
+ <class>GtkHBox</class>
+ <name>hbox4</name>
+ <homogeneous>False</homogeneous>
+ <spacing>0</spacing>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkFrame</class>
+ <name>frame3</name>
+ <label>Show</label>
+ <label_xalign>0</label_xalign>
+ <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkVBox</class>
+ <name>vbox4</name>
+ <border_width>4</border_width>
+ <homogeneous>False</homogeneous>
+ <spacing>0</spacing>
+
+ <widget>
+ <class>GtkCheckButton</class>
+ <name>checkbutton1</name>
+ <can_focus>True</can_focus>
+ <label>Due Date</label>
+ <active>True</active>
+ <draw_indicator>True</draw_indicator>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkCheckButton</class>
+ <name>checkbutton2</name>
+ <can_focus>True</can_focus>
+ <label>Time Until Due</label>
+ <active>True</active>
+ <draw_indicator>True</draw_indicator>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkCheckButton</class>
+ <name>checkbutton3</name>
+ <can_focus>True</can_focus>
+ <label>Priority</label>
+ <active>True</active>
+ <draw_indicator>True</draw_indicator>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkFrame</class>
+ <name>frame4</name>
+ <label>Highlight</label>
+ <label_xalign>0</label_xalign>
+ <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkVBox</class>
+ <name>vbox5</name>
+ <border_width>4</border_width>
+ <homogeneous>False</homogeneous>
+ <spacing>0</spacing>
+
+ <widget>
+ <class>GtkCheckButton</class>
+ <name>checkbutton4</name>
+ <can_focus>True</can_focus>
+ <label>Overdue Items</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkCheckButton</class>
+ <name>checkbutton5</name>
+ <can_focus>True</can_focus>
+ <label>Items Due Today</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkCheckButton</class>
+ <name>checkbutton6</name>
+ <can_focus>True</can_focus>
+ <label>Items Not Yet Due</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+ </widget>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkFrame</class>
+ <name>frame5</name>
+ <label>Colors</label>
+ <label_xalign>0</label_xalign>
+ <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkTable</class>
+ <name>table3</name>
+ <border_width>4</border_width>
+ <rows>3</rows>
+ <columns>2</columns>
+ <homogeneous>False</homogeneous>
+ <row_spacing>4</row_spacing>
+ <column_spacing>4</column_spacing>
+
+ <widget>
+ <class>GnomeColorPicker</class>
+ <name>colorpicker1</name>
+ <can_focus>True</can_focus>
+ <dither>True</dither>
+ <use_alpha>False</use_alpha>
+ <title>Pick a color</title>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>2</right_attach>
+ <top_attach>0</top_attach>
+ <bottom_attach>1</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>False</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GnomeColorPicker</class>
+ <name>colorpicker2</name>
+ <can_focus>True</can_focus>
+ <dither>True</dither>
+ <use_alpha>False</use_alpha>
+ <title>Pick a color</title>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>2</right_attach>
+ <top_attach>1</top_attach>
+ <bottom_attach>2</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>False</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GnomeColorPicker</class>
+ <name>colorpicker3</name>
+ <can_focus>True</can_focus>
+ <dither>True</dither>
+ <use_alpha>False</use_alpha>
+ <title>Pick a color</title>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>2</right_attach>
+ <top_attach>2</top_attach>
+ <bottom_attach>3</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>False</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkAlignment</class>
+ <name>alignment1</name>
+ <xalign>1</xalign>
+ <yalign>0.5</yalign>
+ <xscale>1</xscale>
+ <yscale>1</yscale>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>0</top_attach>
+ <bottom_attach>1</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label8</name>
+ <label>Items Not Yet Due:</label>
+ <justify>GTK_JUSTIFY_RIGHT</justify>
+ <wrap>False</wrap>
+ <xalign>1</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkAlignment</class>
+ <name>alignment2</name>
+ <xalign>1</xalign>
+ <yalign>0.5</yalign>
+ <xscale>1</xscale>
+ <yscale>1</yscale>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>1</top_attach>
+ <bottom_attach>2</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label9</name>
+ <label>Items Due Today:</label>
+ <justify>GTK_JUSTIFY_RIGHT</justify>
+ <wrap>True</wrap>
+ <xalign>1</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkAlignment</class>
+ <name>alignment3</name>
+ <xalign>1</xalign>
+ <yalign>0.5</yalign>
+ <xscale>1</xscale>
+ <yscale>1</yscale>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>2</top_attach>
+ <bottom_attach>3</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label10</name>
+ <label>Overdue Items:</label>
+ <justify>GTK_JUSTIFY_RIGHT</justify>
+ <wrap>False</wrap>
+ <xalign>1</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+ </widget>
+ </widget>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <child_name>Notebook:tab</child_name>
+ <name>label11</name>
+ <label>TaskPad</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+
+ <widget>
+ <class>GtkVBox</class>
+ <name>vbox6</name>
+ <homogeneous>False</homogeneous>
+ <spacing>0</spacing>
+
+ <widget>
+ <class>GtkFrame</class>
+ <name>frame6</name>
+ <border_width>4</border_width>
+ <label>Defaults</label>
+ <label_xalign>0</label_xalign>
+ <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
+ <child>
+ <padding>4</padding>
+ <expand>False</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkHBox</class>
+ <name>hbox5</name>
+ <border_width>4</border_width>
+ <homogeneous>False</homogeneous>
+ <spacing>0</spacing>
+
+ <widget>
+ <class>GtkCheckButton</class>
+ <name>checkbutton7</name>
+ <border_width>2</border_width>
+ <can_focus>True</can_focus>
+ <label>Remind me of all appointments</label>
+ <active>True</active>
+ <draw_indicator>True</draw_indicator>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkSpinButton</class>
+ <name>spinbutton1</name>
+ <can_focus>True</can_focus>
+ <climb_rate>1</climb_rate>
+ <digits>0</digits>
+ <numeric>False</numeric>
+ <update_policy>GTK_UPDATE_ALWAYS</update_policy>
+ <snap>False</snap>
+ <wrap>False</wrap>
+ <value>1</value>
+ <lower>0</lower>
+ <upper>100</upper>
+ <step>1</step>
+ <page>10</page>
+ <page_size>10</page_size>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label12</name>
+ <label>minutes before they occur.</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>3</xpad>
+ <ypad>0</ypad>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkFrame</class>
+ <name>frame7</name>
+ <border_width>4</border_width>
+ <label>Visual Alarms</label>
+ <label_xalign>0</label_xalign>
+ <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
+ <child>
+ <padding>4</padding>
+ <expand>False</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkCheckButton</class>
+ <name>checkbutton8</name>
+ <border_width>4</border_width>
+ <can_focus>True</can_focus>
+ <label>Beep when alarm windows appear.</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkFrame</class>
+ <name>frame8</name>
+ <border_width>4</border_width>
+ <label>Audio Alarms</label>
+ <label_xalign>0</label_xalign>
+ <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
+ <child>
+ <padding>4</padding>
+ <expand>False</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkVBox</class>
+ <name>vbox7</name>
+ <border_width>4</border_width>
+ <homogeneous>False</homogeneous>
+ <spacing>4</spacing>
+
+ <widget>
+ <class>GtkHBox</class>
+ <name>hbox6</name>
+ <homogeneous>False</homogeneous>
+ <spacing>0</spacing>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkCheckButton</class>
+ <name>checkbutton9</name>
+ <can_focus>True</can_focus>
+ <label>Alarms timeout after</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkSpinButton</class>
+ <name>spinbutton2</name>
+ <can_focus>True</can_focus>
+ <climb_rate>1</climb_rate>
+ <digits>0</digits>
+ <numeric>False</numeric>
+ <update_policy>GTK_UPDATE_ALWAYS</update_policy>
+ <snap>False</snap>
+ <wrap>False</wrap>
+ <value>5</value>
+ <lower>0</lower>
+ <upper>100</upper>
+ <step>1</step>
+ <page>10</page>
+ <page_size>10</page_size>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label13</name>
+ <label>seconds.</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkHBox</class>
+ <name>hbox7</name>
+ <homogeneous>False</homogeneous>
+ <spacing>0</spacing>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkCheckButton</class>
+ <name>checkbutton10</name>
+ <can_focus>True</can_focus>
+ <label>Enable snoozing for</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkSpinButton</class>
+ <name>spinbutton3</name>
+ <can_focus>True</can_focus>
+ <climb_rate>1</climb_rate>
+ <digits>0</digits>
+ <numeric>False</numeric>
+ <update_policy>GTK_UPDATE_ALWAYS</update_policy>
+ <snap>False</snap>
+ <wrap>False</wrap>
+ <value>600</value>
+ <lower>0</lower>
+ <upper>1000</upper>
+ <step>1</step>
+ <page>10</page>
+ <page_size>10</page_size>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label14</name>
+ <label>seconds.</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+ </widget>
+ </widget>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <child_name>Notebook:tab</child_name>
+ <name>label15</name>
+ <label>Reminders</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+ </widget>
+ </widget>
+</widget>
+
+</GTK-Interface>
diff --git a/calendar/gui/dialogs/cal-prefs-dialog.glade.h b/calendar/gui/dialogs/cal-prefs-dialog.glade.h
new file mode 100644
index 0000000000..0a29d11999
--- /dev/null
+++ b/calendar/gui/dialogs/cal-prefs-dialog.glade.h
@@ -0,0 +1,67 @@
+/*
+ * Translatable strings file generated by Glade.
+ * Add this file to your project's POTFILES.in.
+ * DO NOT compile it as part of your application.
+ */
+
+gchar *s = N_("Calendar Preferences");
+gchar *s = N_("Work week");
+gchar *s = N_("Mon");
+gchar *s = N_("Tue");
+gchar *s = N_("Wed");
+gchar *s = N_("Thu");
+gchar *s = N_("Fri");
+gchar *s = N_("Sat");
+gchar *s = N_("Sun");
+gchar *s = N_("First day of week:");
+gchar *s = N_("Monday");
+gchar *s = N_("Tuesday");
+gchar *s = N_("Wednesday");
+gchar *s = N_("Thursday");
+gchar *s = N_("Friday");
+gchar *s = N_("Saturday");
+gchar *s = N_("Sunday");
+gchar *s = N_("Start of day:");
+gchar *s = N_("End of day:");
+gchar *s = N_("Display options");
+gchar *s = N_("Time divisions:");
+gchar *s = N_("Time format:");
+gchar *s = N_("Show appointment end times");
+gchar *s = N_("Compress weekends");
+gchar *s = N_("12 hour (am/pm)");
+gchar *s = N_("24 hour");
+gchar *s = N_("60 minutes");
+gchar *s = N_("30 minutes");
+gchar *s = N_("15 minutes");
+gchar *s = N_("10 minutes");
+gchar *s = N_("05 minutes");
+gchar *s = N_("Date navigator options");
+gchar *s = N_("Show week numbers");
+gchar *s = N_("Calendar");
+gchar *s = N_("Show");
+gchar *s = N_("Due Date");
+gchar *s = N_("Time Until Due");
+gchar *s = N_("Priority");
+gchar *s = N_("Highlight");
+gchar *s = N_("Overdue Items");
+gchar *s = N_("Items Due Today");
+gchar *s = N_("Items Not Yet Due");
+gchar *s = N_("Colors");
+gchar *s = N_("Pick a color");
+gchar *s = N_("Pick a color");
+gchar *s = N_("Pick a color");
+gchar *s = N_("Items Not Yet Due:");
+gchar *s = N_("Items Due Today:");
+gchar *s = N_("Overdue Items:");
+gchar *s = N_("TaskPad");
+gchar *s = N_("Defaults");
+gchar *s = N_("Remind me of all appointments");
+gchar *s = N_("minutes before they occur.");
+gchar *s = N_("Visual Alarms");
+gchar *s = N_("Beep when alarm windows appear.");
+gchar *s = N_("Audio Alarms");
+gchar *s = N_("Alarms timeout after");
+gchar *s = N_("seconds.");
+gchar *s = N_("Enable snoozing for");
+gchar *s = N_("seconds.");
+gchar *s = N_("Reminders");
diff --git a/calendar/gui/dialogs/cal-prefs-dialog.h b/calendar/gui/dialogs/cal-prefs-dialog.h
new file mode 100644
index 0000000000..52f115e0ac
--- /dev/null
+++ b/calendar/gui/dialogs/cal-prefs-dialog.h
@@ -0,0 +1,69 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * Author :
+ * Damon Chaplin <damon@helixcode.com>
+ *
+ * Copyright 2000, Helix Code, Inc.
+ *
+ * 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
+ */
+
+/*
+ * CalPrefsDialog - a GtkObject which handles a libglade-loaded dialog
+ * to edit the calendar preference settings.
+ */
+
+#ifndef _CAL_PREFS_DIALOG_H_
+#define _CAL_PREFS_DIALOG_H_
+
+#include <gtk/gtkobject.h>
+#include <libgnome/gnome-defs.h>
+
+BEGIN_GNOME_DECLS
+
+
+#define CAL_PREFS_DIALOG(obj) GTK_CHECK_CAST (obj, cal_prefs_dialog_get_type (), CalPrefsDialog)
+#define CAL_PREFS_DIALOG_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, cal_prefs_dialog_get_type (), CalPrefsDialogClass)
+#define IS_CAL_PREFS_DIALOG(obj) GTK_CHECK_TYPE (obj, cal_prefs_dialog_get_type ())
+
+
+typedef struct _CalPrefsDialog CalPrefsDialog;
+typedef struct _CalPrefsDialogClass CalPrefsDialogClass;
+
+struct _CalPrefsDialog
+{
+ GtkObject object;
+
+ /* Private data */
+ gpointer priv;
+};
+
+struct _CalPrefsDialogClass
+{
+ GtkObjectClass parent_class;
+};
+
+
+GtkType cal_prefs_dialog_get_type (void);
+CalPrefsDialog* cal_prefs_dialog_construct (CalPrefsDialog *prefs);
+CalPrefsDialog* cal_prefs_dialog_new (void);
+
+void cal_prefs_dialog_show (CalPrefsDialog *prefs);
+
+END_GNOME_DECLS
+
+#endif /* _CAL_PREFS_DIALOG_H_ */
diff --git a/calendar/gui/e-day-view-time-item.c b/calendar/gui/e-day-view-time-item.c
index 49720456f3..219f61d10f 100644
--- a/calendar/gui/e-day-view-time-item.c
+++ b/calendar/gui/e-day-view-time-item.c
@@ -29,8 +29,9 @@
#include <config.h>
#include <gnome.h>
+#include <gal/widgets/e-gui-utils.h>
#include "e-day-view-time-item.h"
-#include "../../e-util/e-gui-utils.h"
+#include "calendar-config.h"
/* The spacing between items in the time column. GRID_X_PAD is the space down
@@ -261,6 +262,12 @@ e_day_view_time_item_draw (GnomeCanvasItem *canvas_item,
}
hour = day_view->first_hour_shown;
+ if (day_view->use_24_hour_format) {
+ if (hour == 0 || hour == 12)
+ hour = 12;
+ else
+ hour %= 12;
+ }
hour_y = large_font->ascent + 2; /* FIXME */
minute = day_view->first_minute_shown;
min_y = small_font->ascent + 2; /* FIXME */
@@ -316,6 +323,12 @@ e_day_view_time_item_draw (GnomeCanvasItem *canvas_item,
minute += day_view->mins_per_row;
if (minute >= 60) {
hour++;
+ if (day_view->use_24_hour_format) {
+ if (hour == 0 || hour == 12)
+ hour = 12;
+ else
+ hour %= 12;
+ }
minute -= 60;
}
}
@@ -428,6 +441,7 @@ e_day_view_time_item_on_set_divisions (GtkWidget *item,
divisions = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (item),
"divisions"));
e_day_view_set_mins_per_row (day_view, divisions);
+ calendar_config_set_time_divisions (divisions);
}
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index d6905959e7..f8a3002e2c 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -1969,6 +1969,67 @@ e_day_view_set_working_days (EDayView *day_view,
}
+/* The start and end time of the working day. This only affects the background
+ colors. */
+void
+e_day_view_get_working_day (EDayView *day_view,
+ gint *start_hour,
+ gint *start_minute,
+ gint *end_hour,
+ gint *end_minute)
+{
+ g_return_if_fail (E_IS_DAY_VIEW (day_view));
+
+ *start_hour = day_view->work_day_start_hour;
+ *start_minute = day_view->work_day_start_minute;
+ *end_hour = day_view->work_day_end_hour;
+ *end_minute = day_view->work_day_end_minute;
+}
+
+
+void
+e_day_view_set_working_day (EDayView *day_view,
+ gint start_hour,
+ gint start_minute,
+ gint end_hour,
+ gint end_minute)
+{
+ g_return_if_fail (E_IS_DAY_VIEW (day_view));
+
+ day_view->work_day_start_hour = start_hour;
+ day_view->work_day_start_minute = start_minute;
+ day_view->work_day_end_hour = end_hour;
+ day_view->work_day_end_minute = end_minute;
+
+ gtk_widget_queue_draw (day_view->main_canvas);
+}
+
+
+/* Whether we use 12-hour of 24-hour format. */
+gboolean
+e_day_view_get_24_hour_format (EDayView *day_view)
+{
+ g_return_val_if_fail (E_IS_DAY_VIEW (day_view), FALSE);
+
+ return day_view->use_24_hour_format;
+}
+
+
+void
+e_day_view_set_24_hour_format (EDayView *day_view,
+ gboolean use_24_hour)
+{
+ g_return_if_fail (E_IS_DAY_VIEW (day_view));
+
+ if (day_view->use_24_hour_format != use_24_hour) {
+ day_view->use_24_hour_format = use_24_hour;
+
+ /* FIXME: Eventually we need to do a re-layout. */
+ gtk_widget_queue_draw (day_view->main_canvas);
+ }
+}
+
+
static gboolean
e_day_view_update_scroll_regions (EDayView *day_view)
{
diff --git a/calendar/gui/e-day-view.h b/calendar/gui/e-day-view.h
index 09dc3e6f41..bf72d47f46 100644
--- a/calendar/gui/e-day-view.h
+++ b/calendar/gui/e-day-view.h
@@ -279,6 +279,9 @@ struct _EDayView
gint work_day_end_hour;
gint work_day_end_minute;
+ /* Whether we use 12-hour of 24-hour format. */
+ gboolean use_24_hour_format;
+
/* This is set to TRUE when the widget is created, so it scrolls to
the start of the working day when first shown. */
gboolean scroll_to_work_day;
@@ -494,7 +497,23 @@ EDayViewDays e_day_view_get_working_days (EDayView *day_view);
void e_day_view_set_working_days (EDayView *day_view,
EDayViewDays days);
-
+/* The start and end time of the working day. This only affects the background
+ colors. */
+void e_day_view_get_working_day (EDayView *day_view,
+ gint *start_hour,
+ gint *start_minute,
+ gint *end_hour,
+ gint *end_minute);
+void e_day_view_set_working_day (EDayView *day_view,
+ gint start_hour,
+ gint start_minute,
+ gint end_hour,
+ gint end_minute);
+
+/* Whether we use 12-hour of 24-hour format. */
+gboolean e_day_view_get_24_hour_format (EDayView *day_view);
+void e_day_view_set_24_hour_format (EDayView *day_view,
+ gboolean use_24_hour);
/*
* Internal functions called by the associated canvas items.
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index 33071fa4c9..ab38f92c1a 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -564,63 +564,14 @@ static void
e_week_view_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
{
EWeekView *week_view;
- gint width, height, time_width;
gdouble old_x2, old_y2, new_x2, new_y2;
- GdkFont *font;
week_view = E_WEEK_VIEW (widget);
- font = widget->style->font;
(*GTK_WIDGET_CLASS (parent_class)->size_allocate) (widget, allocation);
e_week_view_recalc_cell_sizes (week_view);
- /* Calculate the number of rows of events in each cell, for the large
- cells and the compressed weekend cells. */
- if (week_view->multi_week_view) {
- week_view->events_y_offset = E_WEEK_VIEW_DATE_T_PAD
- + font->ascent + font->descent
- + E_WEEK_VIEW_DATE_B_PAD;
- } else {
- week_view->events_y_offset = E_WEEK_VIEW_DATE_T_PAD
- + font->ascent + font->descent
- + E_WEEK_VIEW_DATE_LINE_T_PAD + 1
- + E_WEEK_VIEW_DATE_LINE_B_PAD;
- }
-
- height = week_view->row_heights[0];
- week_view->rows_per_cell = (height * 2 - week_view->events_y_offset)
- / (week_view->row_height + E_WEEK_VIEW_EVENT_Y_SPACING);
- week_view->rows_per_cell = MIN (week_view->rows_per_cell,
- E_WEEK_VIEW_MAX_ROWS_PER_CELL);
-
- week_view->rows_per_compressed_cell =
- (height - week_view->events_y_offset)
- / (week_view->row_height + E_WEEK_VIEW_EVENT_Y_SPACING);
- week_view->rows_per_compressed_cell = MIN (week_view->rows_per_compressed_cell,
- E_WEEK_VIEW_MAX_ROWS_PER_CELL);
-
- /* Determine which time format to use, based on the width of the cells.
- We only allow the time to take up about half of the width. */
- width = week_view->col_widths[0];
-
- week_view->time_format = E_WEEK_VIEW_TIME_NONE;
- if (week_view->use_small_font && week_view->small_font) {
- time_width = week_view->digit_width * 2
- + week_view->small_digit_width * 2;
- if (width / 2 > time_width * 2 + week_view->space_width)
- week_view->time_format = E_WEEK_VIEW_TIME_BOTH_SMALL_MIN;
- else if (width / 2 > time_width)
- week_view->time_format = E_WEEK_VIEW_TIME_START_SMALL_MIN;
- } else {
- time_width = week_view->digit_width * 4
- + week_view->colon_width;
- if (width / 2 > time_width * 2 + week_view->space_width)
- week_view->time_format = E_WEEK_VIEW_TIME_BOTH;
- else if (width / 2 > time_width)
- week_view->time_format = E_WEEK_VIEW_TIME_START;
- }
-
/* Set the scroll region of the top canvas to its allocated size. */
gnome_canvas_get_scroll_region (GNOME_CANVAS (week_view->titles_canvas),
NULL, NULL, &old_x2, &old_y2);
@@ -652,8 +603,11 @@ e_week_view_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
static void
e_week_view_recalc_cell_sizes (EWeekView *week_view)
{
- gfloat width, height, offset;
+ gfloat canvas_width, canvas_height, offset;
gint row, col;
+ GtkWidget *widget;
+ GdkFont *font;
+ gint width, height, time_width;
if (week_view->multi_week_view) {
week_view->rows = week_view->weeks_shown * 2;
@@ -668,12 +622,12 @@ e_week_view_recalc_cell_sizes (EWeekView *week_view)
number of columns, to make it easy to get the column widths.
We also add one to the width so that the right border of the last
column is off the edge of the displayed area. */
- width = week_view->main_canvas->allocation.width + 1;
- width /= week_view->columns;
+ canvas_width = week_view->main_canvas->allocation.width + 1;
+ canvas_width /= week_view->columns;
offset = 0;
for (col = 0; col <= week_view->columns; col++) {
week_view->col_offsets[col] = floor (offset + 0.5);
- offset += width;
+ offset += canvas_width;
}
/* Calculate the cell widths based on the offsets. */
@@ -683,12 +637,12 @@ e_week_view_recalc_cell_sizes (EWeekView *week_view)
}
/* Now do the same for the row heights. */
- height = week_view->main_canvas->allocation.height + 1;
- height /= week_view->rows;
+ canvas_height = week_view->main_canvas->allocation.height + 1;
+ canvas_height /= week_view->rows;
offset = 0;
for (row = 0; row <= week_view->rows; row++) {
week_view->row_offsets[row] = floor (offset + 0.5);
- offset += height;
+ offset += canvas_height;
}
/* Calculate the cell heights based on the offsets. */
@@ -696,6 +650,60 @@ e_week_view_recalc_cell_sizes (EWeekView *week_view)
week_view->row_heights[row] = week_view->row_offsets[row + 1]
- week_view->row_offsets[row];
}
+
+
+ /* If the font hasn't been set yet just return. */
+ widget = GTK_WIDGET (week_view);
+ if (!widget->style || ! widget->style->font)
+ return;
+
+ font = widget->style->font;
+
+ /* Calculate the number of rows of events in each cell, for the large
+ cells and the compressed weekend cells. */
+ if (week_view->multi_week_view) {
+ week_view->events_y_offset = E_WEEK_VIEW_DATE_T_PAD
+ + font->ascent + font->descent
+ + E_WEEK_VIEW_DATE_B_PAD;
+ } else {
+ week_view->events_y_offset = E_WEEK_VIEW_DATE_T_PAD
+ + font->ascent + font->descent
+ + E_WEEK_VIEW_DATE_LINE_T_PAD + 1
+ + E_WEEK_VIEW_DATE_LINE_B_PAD;
+ }
+
+ height = week_view->row_heights[0];
+ week_view->rows_per_cell = (height * 2 - week_view->events_y_offset)
+ / (week_view->row_height + E_WEEK_VIEW_EVENT_Y_SPACING);
+ week_view->rows_per_cell = MIN (week_view->rows_per_cell,
+ E_WEEK_VIEW_MAX_ROWS_PER_CELL);
+
+ week_view->rows_per_compressed_cell =
+ (height - week_view->events_y_offset)
+ / (week_view->row_height + E_WEEK_VIEW_EVENT_Y_SPACING);
+ week_view->rows_per_compressed_cell = MIN (week_view->rows_per_compressed_cell,
+ E_WEEK_VIEW_MAX_ROWS_PER_CELL);
+
+ /* Determine which time format to use, based on the width of the cells.
+ We only allow the time to take up about half of the width. */
+ width = week_view->col_widths[0];
+
+ week_view->time_format = E_WEEK_VIEW_TIME_NONE;
+ if (week_view->use_small_font && week_view->small_font) {
+ time_width = week_view->digit_width * 2
+ + week_view->small_digit_width * 2;
+ if (width / 2 > time_width * 2 + week_view->space_width)
+ week_view->time_format = E_WEEK_VIEW_TIME_BOTH_SMALL_MIN;
+ else if (width / 2 > time_width)
+ week_view->time_format = E_WEEK_VIEW_TIME_START_SMALL_MIN;
+ } else {
+ time_width = week_view->digit_width * 4
+ + week_view->colon_width;
+ if (width / 2 > time_width * 2 + week_view->space_width)
+ week_view->time_format = E_WEEK_VIEW_TIME_BOTH;
+ else if (width / 2 > time_width)
+ week_view->time_format = E_WEEK_VIEW_TIME_START;
+ }
}
@@ -1175,10 +1183,6 @@ e_week_view_recalc_day_starts (EWeekView *week_view,
tmp_time = lower;
week_view->day_starts[0] = tmp_time;
for (day = 1; day <= num_days; day++) {
- /* FIXME: There is a bug in time_add_day(). */
-#if 0
- g_print ("Day:%i - %s\n", day, ctime (&tmp_time));
-#endif
tmp_time = time_add_day (tmp_time, 1);
week_view->day_starts[day] = tmp_time;
}
@@ -1297,7 +1301,9 @@ e_week_view_set_compress_weekend (EWeekView *week_view,
if (!week_view->multi_week_view)
return;
- /* FIXME: Need to update layout. */
+ e_week_view_recalc_cell_sizes (week_view);
+ week_view->events_need_reshape = TRUE;
+ e_week_view_check_layout (week_view);
}
@@ -1567,7 +1573,7 @@ e_week_view_on_button_press (GtkWidget *widget,
{
gint x, y, day;
-#if 1
+#if 0
g_print ("In e_week_view_on_button_press\n");
#endif
@@ -1589,8 +1595,6 @@ e_week_view_on_button_press (GtkWidget *widget,
if (week_view->pressed_event_num != -1)
return FALSE;
- g_print ("In e_week_view_on_button_press 2\n");
-
/* Convert the mouse position to a week & day. */
x = event->x;
y = event->y;
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 876af5fe28..83e9c75bfe 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -25,6 +25,7 @@
#include "event-editor.h"
#include "gnome-cal.h"
#include "calendar-commands.h"
+#include "calendar-config.h"
@@ -136,6 +137,7 @@ static void gnome_calendar_update_date_navigator (GnomeCalendar *gcal);
static void gnome_calendar_on_date_navigator_style_set (GtkWidget *widget,
GtkStyle *previous_style,
gpointer data);
+static void gnome_calendar_update_paned_quanta (GnomeCalendar *gcal);
static void gnome_calendar_on_date_navigator_size_allocate (GtkWidget *widget,
GtkAllocation *allocation,
gpointer data);
@@ -274,6 +276,8 @@ setup_widgets (GnomeCalendar *gcal)
gtk_widget_show (priv->month_view);
gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook),
priv->month_view, gtk_label_new (""));
+
+ gnome_calendar_update_config_settings (gcal, TRUE);
}
/* Object initialization function for the gnome calendar */
@@ -296,14 +300,6 @@ gnome_calendar_init (GnomeCalendar *gcal)
priv->selection_start_time = time_day_begin (time (NULL));
priv->selection_end_time = time_add_day (priv->selection_start_time, 1);
- /* Set the default pane positions. These will eventually come from
- gconf settings. They are multiples of calendar month widths &
- heights in the date navigator. */
- priv->hpane_pos = 1.0;
- priv->vpane_pos = 1.0;
- priv->hpane_pos_month_view = 0.0;
- priv->vpane_pos_month_view = 1.0;
-
setup_widgets (gcal);
}
@@ -1606,9 +1602,119 @@ gnome_calendar_tag_calendar (GnomeCalendar *gcal, ECalendar *ecal)
}
+/* Tells the calendar to reload all config settings.
+ If initializing is TRUE it sets the pane positions as well. (We don't
+ want to reset the pane positions after the user clicks 'Apply' in the
+ preferences dialog.) */
+void
+gnome_calendar_update_config_settings (GnomeCalendar *gcal,
+ gboolean initializing)
+{
+ GnomeCalendarPrivate *priv;
+ CalWeekdays working_days;
+ gint week_start_day, time_divisions;
+ gint start_hour, start_minute, end_hour, end_minute;
+ gboolean use_24_hour, show_event_end, compress_weekend;
+ gboolean dnav_show_week_no;
+
+ g_return_if_fail (GNOME_IS_CALENDAR (gcal));
+
+ priv = gcal->priv;
+
+ working_days = calendar_config_get_working_days ();
+ /* CalWeekdays and EDayViewDays use the same bit-masks, so we can
+ use the same value. */
+ e_day_view_set_working_days (E_DAY_VIEW (priv->day_view),
+ (EDayViewDays) working_days);
+ e_day_view_set_working_days (E_DAY_VIEW (priv->work_week_view),
+ (EDayViewDays) working_days);
+
+ /* Note that this is 0 (Sun) to 6 (Sat). */
+ week_start_day = calendar_config_get_week_start_day ();
+ /* FIXME: Add support for these. */
+#if 0
+ e_day_view_set_week_start_day (E_DAY_VIEW (priv->day_view),
+ week_start_day);
+ e_day_view_set_week_start_day (E_DAY_VIEW (priv->work_week_view),
+ week_start_day);
+ e_week_view_set_week_start_day (E_WEEK_VIEW (priv->week_view),
+ week_start_day);
+ e_week_view_set_week_start_day (E_WEEK_VIEW (priv->month_view),
+ week_start_day);
+#endif
+ gnome_canvas_item_set (GNOME_CANVAS_ITEM (E_CALENDAR (priv->date_navigator)->calitem),
+ "week_start_day", (week_start_day + 6) % 7,
+ NULL);
+
+ start_hour = calendar_config_get_day_start_hour ();
+ start_minute = calendar_config_get_day_start_minute ();
+ end_hour = calendar_config_get_day_end_hour ();
+ end_minute = calendar_config_get_day_end_minute ();
+ e_day_view_set_working_day (E_DAY_VIEW (priv->day_view),
+ start_hour, start_minute,
+ end_hour, end_minute);
+ e_day_view_set_working_day (E_DAY_VIEW (priv->work_week_view),
+ start_hour, start_minute,
+ end_hour, end_minute);
+
+ use_24_hour = calendar_config_get_24_hour_format ();
+ e_day_view_set_24_hour_format (E_DAY_VIEW (priv->day_view),
+ use_24_hour);
+ e_day_view_set_24_hour_format (E_DAY_VIEW (priv->work_week_view),
+ use_24_hour);
+ /* FIXME: Add support for these. */
+#if 0
+ e_week_view_set_24_hour_format (E_WEEK_VIEW (priv->week_view),
+ use_24_hour);
+ e_week_view_set_24_hour_format (E_WEEK_VIEW (priv->month_view),
+ use_24_hour);
+#endif
+
+ time_divisions = calendar_config_get_time_divisions ();
+ e_day_view_set_mins_per_row (E_DAY_VIEW (priv->day_view),
+ time_divisions);
+ e_day_view_set_mins_per_row (E_DAY_VIEW (priv->work_week_view),
+ time_divisions);
+
+ show_event_end = calendar_config_get_show_event_end ();
+ /* FIXME: Add support for these. */
+#if 0
+ e_day_view_set_show_event_end (E_DAY_VIEW (priv->day_view),
+ show_event_end);
+ e_day_view_set_show_event_end (E_DAY_VIEW (priv->work_week_view),
+ show_event_end);
+ e_week_view_set_show_event_end (E_WEEK_VIEW (priv->week_view),
+ show_event_end);
+ e_week_view_set_show_event_end (E_WEEK_VIEW (priv->month_view),
+ show_event_end);
+#endif
+
+ compress_weekend = calendar_config_get_compress_weekend ();
+ e_week_view_set_compress_weekend (E_WEEK_VIEW (priv->month_view),
+ compress_weekend);
+
+ dnav_show_week_no = calendar_config_get_dnav_show_week_no ();
+ gnome_canvas_item_set (GNOME_CANVAS_ITEM (E_CALENDAR (priv->date_navigator)->calitem),
+ "show_week_numbers", dnav_show_week_no,
+ NULL);
+
+ if (initializing) {
+ priv->hpane_pos = calendar_config_get_hpane_pos ();
+ priv->vpane_pos = calendar_config_get_vpane_pos ();
+ priv->hpane_pos_month_view = calendar_config_get_month_hpane_pos ();
+ priv->vpane_pos_month_view = calendar_config_get_month_vpane_pos ();
+ } else {
+ gnome_calendar_update_paned_quanta (gcal);
+ }
+}
+
+
+/*
+ * FIXME: These are for the old config code and will be removed eventually.
+ */
+
/* This is called when the day begin & end times, the AM/PM flag, or the
- week_starts_on_monday flags are changed.
- FIXME: Which of these options do we want the new views to support? */
+ week_starts_on_monday flags are changed. */
void
gnome_calendar_time_format_changed (GnomeCalendar *gcal)
{
@@ -1641,6 +1747,8 @@ gnome_calendar_todo_properties_changed (GnomeCalendar *gcal)
}
+
+
void
gnome_calendar_set_selected_time_range (GnomeCalendar *gcal,
time_t start_time,
@@ -2005,21 +2113,23 @@ gnome_calendar_on_date_navigator_style_set (GtkWidget *widget,
GtkStyle *previous_style,
gpointer data)
{
- GnomeCalendar *gcal;
+ gnome_calendar_update_paned_quanta (GNOME_CALENDAR (data));
+}
+
+
+static void
+gnome_calendar_update_paned_quanta (GnomeCalendar *gcal)
+{
GnomeCalendarPrivate *priv;
- ECalendar *ecal;
gint row_height, col_width;
gint top_border, bottom_border, left_border, right_border;
- ecal = E_CALENDAR (widget);
-
- gcal = GNOME_CALENDAR (data);
priv = gcal->priv;
e_calendar_get_border_size (priv->date_navigator,
&top_border, &bottom_border,
&left_border, &right_border);
- gtk_object_get (GTK_OBJECT (ecal->calitem),
+ gtk_object_get (GTK_OBJECT (priv->date_navigator->calitem),
"row_height", &row_height,
"column_width", &col_width,
NULL);
@@ -2085,12 +2195,17 @@ gnome_calendar_on_date_navigator_size_allocate (GtkWidget *widget,
hpane_pos = (gfloat) width / col_width;
vpane_pos = (gfloat) height / row_height;
- if (priv->current_view_type == VIEW_MONTH && !priv->range_selected) {
+ if (priv->current_view_type == VIEW_MONTH
+ && !priv->range_selected) {
priv->hpane_pos_month_view = hpane_pos;
priv->vpane_pos_month_view = vpane_pos;
+ calendar_config_set_month_hpane_pos (hpane_pos);
+ calendar_config_set_month_vpane_pos (vpane_pos);
} else {
priv->hpane_pos = hpane_pos;
priv->vpane_pos = vpane_pos;
+ calendar_config_set_hpane_pos (hpane_pos);
+ calendar_config_set_vpane_pos (vpane_pos);
}
}
}
diff --git a/calendar/gui/gnome-cal.h b/calendar/gui/gnome-cal.h
index 53b547581e..2474e92bea 100644
--- a/calendar/gui/gnome-cal.h
+++ b/calendar/gui/gnome-cal.h
@@ -97,6 +97,14 @@ void gnome_calendar_get_current_time_range (GnomeCalendar *gcal,
time_t *start_time,
time_t *end_time);
+/* Tells the calendar to reload all config settings. initializing should be
+ TRUE when we are setting the config settings for the first time. */
+void gnome_calendar_update_config_settings (GnomeCalendar *gcal,
+ gboolean initializing);
+
+/*
+ * FIXME: These are for the old config code and will be removed eventually.
+ */
/* Notifies the calendar that the time format has changed and it must update
all its views */
@@ -111,6 +119,7 @@ void gnome_calendar_colors_changed (GnomeCalendar *gcal);
void gnome_calendar_todo_properties_changed (GnomeCalendar *gcal);
+
void gnome_calendar_set_view_buttons (GnomeCalendar *gcal,
GtkWidget *day_button,
GtkWidget *work_week_button,
diff --git a/calendar/gui/main.c b/calendar/gui/main.c
index 3016d9cb70..2faba00781 100644
--- a/calendar/gui/main.c
+++ b/calendar/gui/main.c
@@ -78,6 +78,9 @@ main (int argc, char **argv)
e_itip_control_factory_init ();
bonobo_main ();
+
+ calendar_config_write_on_exit ();
+
fprintf (stderr, "main(): Out of bonobo_main(), we are dying cleanly. Have a nice day.\n");
return 0;
diff --git a/calendar/gui/popup-menu.c b/calendar/gui/popup-menu.c
index a90c38d490..86821dcb4b 100644
--- a/calendar/gui/popup-menu.c
+++ b/calendar/gui/popup-menu.c
@@ -8,7 +8,7 @@
#include <config.h>
#include <gnome.h>
#include "popup-menu.h"
-#include "../../e-util/e-gui-utils.h"
+#include <gal/widgets/e-gui-utils.h>
void