[evolution] Move calendar preferences to the calendar module.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Move calendar preferences to the calendar module.
- Date: Thu, 4 Nov 2010 18:20:35 +0000 (UTC)
commit 1f17dab6b0d9c5413dea38dcc95e7a7bb5b4bd9b
Author: Matthew Barnes <mbarnes redhat com>
Date: Tue Nov 2 11:49:38 2010 -0400
Move calendar preferences to the calendar module.
Continue replacing the use of calendar-config functions with GObject
property bindings to EShellSettings properties.
calendar/gui/Makefile.am | 45 -
calendar/gui/calendar-config-keys.h | 3 -
calendar/gui/calendar-config.c | 453 +----
calendar/gui/calendar-config.h | 69 -
calendar/gui/comp-util.c | 39 +-
calendar/gui/comp-util.h | 16 +-
calendar/gui/dialogs/Makefile.am | 164 +-
calendar/gui/dialogs/cal-prefs-dialog.h | 113 -
calendar/gui/dialogs/comp-editor-util.c | 6 +-
calendar/gui/dialogs/comp-editor-util.h | 5 +-
calendar/gui/dialogs/comp-editor.c | 308 +++-
calendar/gui/dialogs/comp-editor.h | 28 +
calendar/gui/dialogs/delete-comp.c | 12 +-
calendar/gui/dialogs/e-send-options-utils.c | 6 +-
calendar/gui/dialogs/e-send-options-utils.h | 11 +-
calendar/gui/dialogs/event-editor.c | 2 +-
calendar/gui/dialogs/event-page.c | 105 +-
calendar/gui/dialogs/event-page.h | 4 +-
calendar/gui/dialogs/recurrence-page.c | 54 +-
calendar/gui/dialogs/recurrence-page.h | 7 +-
calendar/gui/dialogs/schedule-page.c | 12 +-
calendar/gui/dialogs/task-details-page.c | 23 +-
calendar/gui/dialogs/task-page.c | 29 +-
calendar/gui/e-cal-component-preview.c | 49 +-
calendar/gui/e-cal-component-preview.h | 12 +-
calendar/gui/e-cal-config.c | 7 +-
calendar/gui/e-cal-config.h | 2 +-
calendar/gui/e-cal-model.c | 436 ++++-
calendar/gui/e-cal-model.h | 47 +-
calendar/gui/e-calendar-view.c | 90 +-
calendar/gui/e-calendar-view.h | 5 +
calendar/gui/e-date-time-list.c | 525 ++--
calendar/gui/e-date-time-list.h | 80 +-
calendar/gui/e-day-view-main-item.c | 107 +-
calendar/gui/e-day-view-time-item.c | 38 +-
calendar/gui/e-day-view-top-item.c | 28 +-
calendar/gui/e-day-view.c | 567 ++---
calendar/gui/e-day-view.h | 30 -
calendar/gui/e-itip-control.c | 2604 --------------------
calendar/gui/e-itip-control.h | 77 -
calendar/gui/e-itip-control.ui | 464 ----
calendar/gui/e-meeting-store.c | 142 ++-
calendar/gui/e-meeting-store.h | 16 +
calendar/gui/e-meeting-time-sel-item.c | 108 +-
calendar/gui/e-memo-table.c | 13 +-
calendar/gui/e-task-table.c | 10 +-
calendar/gui/e-week-view-event-item.c | 37 +-
calendar/gui/ea-day-view-main-item.c | 7 +-
calendar/gui/goto.c | 4 +-
calendar/gui/itip-utils.c | 82 +-
calendar/gui/print.c | 381 ++--
calendar/gui/print.h | 22 +-
e-util/e-util-enums.h | 4 +-
modules/calendar/Makefile.am | 39 +
.../calendar}/apps_evolution_calendar.schemas.in | 68 +-
modules/calendar/e-cal-config-comp-editor.c | 100 +
modules/calendar/e-cal-config-comp-editor.h | 30 +
modules/calendar/e-cal-config-meeting-store.c | 15 +
modules/calendar/e-cal-config-model.c | 45 +
modules/calendar/e-cal-config-view.c | 31 +-
modules/calendar/e-cal-shell-backend.c | 98 +-
modules/calendar/e-cal-shell-backend.h | 5 +
modules/calendar/e-cal-shell-migrate.c | 30 +-
modules/calendar/e-cal-shell-settings.c | 95 +-
modules/calendar/e-cal-shell-sidebar.c | 27 +-
modules/calendar/e-cal-shell-view-actions.c | 7 +-
modules/calendar/e-cal-shell-view-memopad.c | 12 +-
modules/calendar/e-cal-shell-view-taskpad.c | 12 +-
.../calendar/e-calendar-preferences.c | 572 +++---
modules/calendar/e-calendar-preferences.h | 89 +
.../calendar/e-calendar-preferences.ui | 0
modules/calendar/e-memo-shell-backend.c | 59 +-
modules/calendar/e-memo-shell-backend.h | 5 +
modules/calendar/e-memo-shell-content.c | 13 +-
modules/calendar/e-memo-shell-migrate.c | 38 +-
modules/calendar/e-memo-shell-sidebar.c | 27 +-
modules/calendar/e-memo-shell-view-actions.c | 12 +-
modules/calendar/e-memo-shell-view-private.c | 2 -
modules/calendar/e-task-shell-backend.c | 59 +-
modules/calendar/e-task-shell-backend.h | 5 +
modules/calendar/e-task-shell-content.c | 12 +-
modules/calendar/e-task-shell-migrate.c | 38 +-
modules/calendar/e-task-shell-sidebar.c | 27 +-
modules/calendar/e-task-shell-view-actions.c | 12 +-
modules/calendar/e-task-shell-view-private.c | 2 -
modules/calendar/evolution-module-calendar.c | 6 +
plugins/itip-formatter/itip-formatter.c | 33 +-
87 files changed, 3464 insertions(+), 5669 deletions(-)
---
diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am
index a168582..a74d4a1 100644
--- a/calendar/gui/Makefile.am
+++ b/calendar/gui/Makefile.am
@@ -75,7 +75,6 @@ libevolution_calendar_la_CPPFLAGS = \
$(CAMEL_CFLAGS)
ui_DATA = \
- e-itip-control.ui \
goto-dialog.ui
etspec_DATA = \
@@ -132,8 +131,6 @@ libevolution_calendar_la_SOURCES = \
e-day-view-top-item.h \
e-day-view.c \
e-day-view.h \
- e-itip-control.c \
- e-itip-control.h \
e-meeting-attendee.c \
e-meeting-attendee.h \
e-meeting-list-view.c \
@@ -233,51 +230,9 @@ libevolution_calendar_la_LIBADD = \
libevolution_calendar_la_LDFLAGS = $(NO_UNDEFINED)
- INTLTOOL_SERVER_RULE@
-
-# GConf schemas
-
-schemadir = $(GCONF_SCHEMA_FILE_DIR)
-schema_in_files = apps_evolution_calendar.schemas.in
-schema_DATA = $(schema_in_files:.schemas.in=.schemas)
-
- INTLTOOL_SCHEMAS_RULE@
-
EXTRA_DIST = \
$(ui_DATA) \
- $(schema_in_files) \
$(etspec_DATA) \
$(search_files)
-CLEANFILES = $(BUILT_SOURCES)
-
-DISTCLEANFILES = $(schema_DATA)
-
-if GCONF_SCHEMAS_INSTALL
-
-if OS_WIN32
-install-data-local:
- if test -z "$(DESTDIR)" ; then \
- for p in $(schema_DATA) ; do \
- (echo set GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE); \
- echo $(GCONFTOOL) --makefile-install-rule $$p) >_temp.bat; \
- cmd /c _temp.bat; \
- rm _temp.bat; \
- done \
- fi
-else
-install-data-local:
- if test -z "$(DESTDIR)" ; then \
- for p in $(schema_DATA) ; do \
- GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) \
- $(GCONFTOOL) --makefile-install-rule $$p; \
- done \
- fi
-endif
-
-endif
-
-dist-hook:
- cd $(distdir); rm -f $(BUILT_SOURCES)
-
-include $(top_srcdir)/git.mk
diff --git a/calendar/gui/calendar-config-keys.h b/calendar/gui/calendar-config-keys.h
index 1dc43a6..09c5347 100644
--- a/calendar/gui/calendar-config-keys.h
+++ b/calendar/gui/calendar-config-keys.h
@@ -31,7 +31,6 @@ G_BEGIN_DECLS
#define CALENDAR_CONFIG_TIMEZONE CALENDAR_CONFIG_PREFIX "/display/timezone"
#define CALENDAR_CONFIG_SELECTED_CALENDARS CALENDAR_CONFIG_PREFIX "/display/selected_calendars"
#define CALENDAR_CONFIG_24HOUR CALENDAR_CONFIG_PREFIX "/display/use_24hour_format"
-#define CALENDAR_CONFIG_WEEK_START CALENDAR_CONFIG_PREFIX "/display/week_start_day"
#define CALENDAR_CONFIG_DAY_START_HOUR CALENDAR_CONFIG_PREFIX "/display/day_start_hour"
#define CALENDAR_CONFIG_DAY_START_MINUTE CALENDAR_CONFIG_PREFIX "/display/day_start_minute"
#define CALENDAR_CONFIG_DAY_END_HOUR CALENDAR_CONFIG_PREFIX "/display/day_end_hour"
@@ -71,8 +70,6 @@ G_BEGIN_DECLS
#define CALENDAR_CONFIG_BA_REMINDER_INTERVAL CALENDAR_CONFIG_PREFIX "/other/ba_reminder_interval"
#define CALENDAR_CONFIG_BA_REMINDER_UNITS CALENDAR_CONFIG_PREFIX "/other/ba_reminder_units"
-#define CALENDAR_CONFIG_DEF_RECUR_COUNT CALENDAR_CONFIG_PREFIX "/other/def_recur_count"
-
/* drawing of events */
#define CALENDAR_CONFIG_DISPLAY_EVENTS_GRADIENT CALENDAR_CONFIG_PREFIX "/display/events_gradient"
#define CALENDAR_CONFIG_DISPLAY_EVENTS_ALPHA CALENDAR_CONFIG_PREFIX "/display/events_transparency"
diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c
index a572ac0..b5f57ce 100644
--- a/calendar/gui/calendar-config.c
+++ b/calendar/gui/calendar-config.c
@@ -41,8 +41,6 @@
#include "calendar-config.h"
static GConfClient *config = NULL;
-static gboolean display_events_gradient = TRUE;
-static gfloat display_events_alpha = 1.0;
static void
do_cleanup (void)
@@ -61,9 +59,6 @@ calendar_config_init (void)
g_atexit ((GVoidFunc) do_cleanup);
gconf_client_add_dir (config, CALENDAR_CONFIG_PREFIX, GCONF_CLIENT_PRELOAD_RECURSIVE, NULL);
-
- display_events_gradient = gconf_client_get_bool (config, CALENDAR_CONFIG_DISPLAY_EVENTS_GRADIENT, NULL);
- display_events_alpha = gconf_client_get_float (config, CALENDAR_CONFIG_DISPLAY_EVENTS_ALPHA, NULL);
}
void
@@ -88,62 +83,10 @@ calendar_config_locale_supports_12_hour_format (void)
return s[0] != '\0';
}
-/* Returns the string representation of a units value */
-static const gchar *
-units_to_string (EDurationType units)
-{
- switch (units) {
- case E_DURATION_DAYS:
- return "days";
-
- case E_DURATION_HOURS:
- return "hours";
-
- case E_DURATION_MINUTES:
- return "minutes";
-
- default:
- g_return_val_if_reached (NULL);
- }
-}
-
-/* opposite function to 'units_to_string' */
-static EDurationType
-string_to_units (const gchar *units)
-{
- EDurationType res;
-
- if (units && !strcmp (units, "days"))
- res = E_DURATION_DAYS;
- else if (units && !strcmp (units, "hours"))
- res = E_DURATION_HOURS;
- else
- res = E_DURATION_MINUTES;
-
- return res;
-}
-
/*
* Calendar Settings.
*/
-/* The current list of calendars selected */
-GSList *
-calendar_config_get_calendars_selected (void)
-{
- calendar_config_init ();
-
- return gconf_client_get_list (config, CALENDAR_CONFIG_SELECTED_CALENDARS, GCONF_VALUE_STRING, NULL);
-}
-
-void
-calendar_config_set_calendars_selected (GSList *selected)
-{
- calendar_config_init ();
-
- gconf_client_set_list (config, CALENDAR_CONFIG_SELECTED_CALENDARS, GCONF_VALUE_STRING, selected, NULL);
-}
-
static gchar *
calendar_config_get_timezone_stored (void)
{
@@ -204,97 +147,6 @@ calendar_config_get_24_hour_format (void)
return TRUE;
}
-/* The start day of the week (0 = Sun to 6 = Mon). */
-gint
-calendar_config_get_week_start_day (void)
-{
- calendar_config_init ();
-
- return gconf_client_get_int (config, CALENDAR_CONFIG_WEEK_START, NULL);
-}
-
-/* The start and end times of the work-day. */
-gint
-calendar_config_get_day_start_hour (void)
-{
- calendar_config_init ();
-
- return gconf_client_get_int (config, CALENDAR_CONFIG_DAY_START_HOUR, NULL);
-}
-
-void
-calendar_config_set_day_start_hour (gint day_start_hour)
-{
- calendar_config_init ();
-
- gconf_client_set_int (config, CALENDAR_CONFIG_DAY_START_HOUR, day_start_hour, NULL);
-}
-
-gint
-calendar_config_get_day_start_minute (void)
-{
- calendar_config_init ();
-
- return gconf_client_get_int (config, CALENDAR_CONFIG_DAY_START_MINUTE, NULL);
-}
-
-void
-calendar_config_set_day_start_minute (gint day_start_min)
-{
- calendar_config_init ();
-
- gconf_client_set_int (config, CALENDAR_CONFIG_DAY_START_MINUTE, day_start_min, NULL);
-}
-
-gint
-calendar_config_get_day_end_hour (void)
-{
- calendar_config_init ();
-
- return gconf_client_get_int (config, CALENDAR_CONFIG_DAY_END_HOUR, NULL);
-}
-
-void
-calendar_config_set_day_end_hour (gint day_end_hour)
-{
- calendar_config_init ();
-
- gconf_client_set_int (config, CALENDAR_CONFIG_DAY_END_HOUR, day_end_hour, NULL);
-}
-
-gint
-calendar_config_get_day_end_minute (void)
-{
- calendar_config_init ();
-
- return gconf_client_get_int (config, CALENDAR_CONFIG_DAY_END_MINUTE, NULL);
-}
-
-void
-calendar_config_set_day_end_minute (gint day_end_min)
-{
- calendar_config_init ();
-
- gconf_client_set_int (config, CALENDAR_CONFIG_DAY_END_MINUTE, day_end_min, NULL);
-}
-
-/* The time divisions in the Day/Work-Week view in minutes (5/10/15/30/60). */
-gint
-calendar_config_get_time_divisions (void)
-{
- calendar_config_init ();
-
- return gconf_client_get_int (config, CALENDAR_CONFIG_TIME_DIVISIONS, NULL);
-}
-
-void
-calendar_config_set_time_divisions (gint divisions)
-{
- calendar_config_init ();
-
- gconf_client_set_int (config, CALENDAR_CONFIG_TIME_DIVISIONS, divisions, NULL);
-}
-
/* Scroll in a month view by a week, not by a month */
gboolean
calendar_config_get_month_scroll_by_week (void)
@@ -304,14 +156,6 @@ calendar_config_get_month_scroll_by_week (void)
return gconf_client_get_bool (config, CALENDAR_CONFIG_MONTH_SCROLL_BY_WEEK, NULL);
}
-void
-calendar_config_set_month_scroll_by_week (gboolean value)
-{
- calendar_config_init ();
-
- gconf_client_set_bool (config, CALENDAR_CONFIG_MONTH_SCROLL_BY_WEEK, value, NULL);
-}
-
guint
calendar_config_add_notification_month_scroll_by_week (GConfClientNotifyFunc func, gpointer data)
{
@@ -324,53 +168,8 @@ calendar_config_add_notification_month_scroll_by_week (GConfClientNotifyFunc fun
return id;
}
-/* The current list of task lists selected */
-GSList *
-calendar_config_get_tasks_selected (void)
-{
- calendar_config_init ();
-
- return gconf_client_get_list (config, CALENDAR_CONFIG_TASKS_SELECTED_TASKS, GCONF_VALUE_STRING, NULL);
-}
-
-void
-calendar_config_set_tasks_selected (GSList *selected)
-{
- calendar_config_init ();
-
- gconf_client_set_list (config, CALENDAR_CONFIG_TASKS_SELECTED_TASKS, GCONF_VALUE_STRING, selected, NULL);
-}
-
-/***************************************/
-
-/* The current list of memo lists selected */
-GSList *
-calendar_config_get_memos_selected (void)
-{
- calendar_config_init ();
-
- return gconf_client_get_list (config, CALENDAR_CONFIG_MEMOS_SELECTED_MEMOS, GCONF_VALUE_STRING, NULL);
-}
-
-void
-calendar_config_set_memos_selected (GSList *selected)
-{
- calendar_config_init ();
-
- gconf_client_set_list (config, CALENDAR_CONFIG_MEMOS_SELECTED_MEMOS, GCONF_VALUE_STRING, selected, NULL);
-}
-
/***************************************/
-/* Whether we compress the weekend in the week/month views. */
-gboolean
-calendar_config_get_compress_weekend (void)
-{
- calendar_config_init ();
-
- return gconf_client_get_bool (config, CALENDAR_CONFIG_COMPRESS_WEEKEND, NULL);
-}
-
/* The working days of the week, a bit-wise combination of flags. */
CalWeekdays
calendar_config_get_working_days (void)
@@ -389,15 +188,7 @@ calendar_config_get_hide_completed_tasks (void)
return gconf_client_get_bool (config, CALENDAR_CONFIG_TASKS_HIDE_COMPLETED, NULL);
}
-void
-calendar_config_set_hide_completed_tasks (gboolean hide)
-{
- calendar_config_init ();
-
- gconf_client_set_bool (config, CALENDAR_CONFIG_TASKS_HIDE_COMPLETED, hide, NULL);
-}
-
-EDurationType
+static EDurationType
calendar_config_get_hide_completed_tasks_units (void)
{
gchar *units;
@@ -419,215 +210,6 @@ calendar_config_get_hide_completed_tasks_units (void)
return cu;
}
-void
-calendar_config_set_hide_completed_tasks_units (EDurationType cu)
-{
- gchar *units;
-
- calendar_config_init ();
-
- switch (cu) {
- case E_DURATION_MINUTES :
- units = g_strdup ("minutes");
- break;
- case E_DURATION_HOURS :
- units = g_strdup ("hours");
- break;
- default :
- units = g_strdup ("days");
- }
-
- gconf_client_set_string (config, CALENDAR_CONFIG_TASKS_HIDE_COMPLETED_UNITS, units, NULL);
-
- g_free (units);
-}
-
-gint
-calendar_config_get_hide_completed_tasks_value (void)
-{
- calendar_config_init ();
-
- return gconf_client_get_int (config, CALENDAR_CONFIG_TASKS_HIDE_COMPLETED_VALUE, NULL);
-}
-
-void
-calendar_config_set_hide_completed_tasks_value (gint value)
-{
- calendar_config_init ();
-
- gconf_client_set_int (config, CALENDAR_CONFIG_TASKS_HIDE_COMPLETED_VALUE, value, NULL);
-}
-
-/**
- * calendar_config_get_confirm_delete:
- *
- * Queries the configuration value for whether a confirmation dialog is
- * presented when deleting calendar/tasks items.
- *
- * Return value: Whether confirmation is required when deleting items.
- **/
-gboolean
-calendar_config_get_confirm_delete (void)
-{
- calendar_config_init ();
-
- return gconf_client_get_bool (config, CALENDAR_CONFIG_PROMPT_DELETE, NULL);
-}
-
-/**
- * calendar_config_get_use_default_reminder:
- *
- * Queries whether new appointments should be created with a default reminder.
- *
- * Return value: Boolean value indicating whether new appointments should be
- * created with a default reminder from the values of
- * calendar_config_get_default_reminder_interval() and
- * calendar_config_get_default_reminder_units().
- **/
-gboolean
-calendar_config_get_use_default_reminder (void)
-{
- calendar_config_init ();
-
- return gconf_client_get_bool (config, CALENDAR_CONFIG_DEFAULT_REMINDER, NULL);
-}
-
-/**
- * calendar_config_set_use_default_reminder:
- * @value: Whether to create new appointments with a default reminder.
- *
- * Sets whether newly-created appointments should get a default reminder set
- * them.
- **/
-void
-calendar_config_set_use_default_reminder (gboolean value)
-{
- calendar_config_init ();
-
- gconf_client_set_bool (config, CALENDAR_CONFIG_DEFAULT_REMINDER, value, NULL);
-}
-
-/**
- * calendar_config_get_default_reminder_interval:
- *
- * Queries the interval for the default reminder of newly-created
- * appointments, i.e. 5 in "5 minutes".
- *
- * Return value: Interval for default reminders.
- **/
-gint
-calendar_config_get_default_reminder_interval (void)
-{
- calendar_config_init ();
-
- return gconf_client_get_int (config, CALENDAR_CONFIG_DEFAULT_REMINDER_INTERVAL, NULL);
-}
-
-/**
- * calendar_config_set_default_reminder_interval:
- * @interval: Interval value, e.g. 5 for "5 minutes".
- *
- * Sets the interval that should be used for the default reminder in new
- * appointments.
- **/
-void
-calendar_config_set_default_reminder_interval (gint interval)
-{
- calendar_config_init ();
-
- gconf_client_set_int (config, CALENDAR_CONFIG_DEFAULT_REMINDER_INTERVAL, interval, NULL);
-}
-
-/**
- * calendar_config_get_default_reminder_units:
- *
- * Queries the units of time in which default reminders should be created for
- * new appointments, e.g. E_DURATION_MINUTES for "5 minutes".
- *
- * Return value: Time units for default reminders.
- **/
-EDurationType
-calendar_config_get_default_reminder_units (void)
-{
- gchar *units;
- EDurationType cu;
-
- calendar_config_init ();
-
- units = gconf_client_get_string (config, CALENDAR_CONFIG_DEFAULT_REMINDER_UNITS, NULL);
- cu = string_to_units (units);
- g_free (units);
-
- return cu;
-}
-
-/**
- * calendar_config_set_default_reminder_units:
- * @units: Time units, e.g. E_DURATION_MINUTES for "5 minutes".
- *
- * Sets the units to be used for default reminders in new appointments.
- **/
-void
-calendar_config_set_default_reminder_units (EDurationType units)
-{
- calendar_config_init ();
-
- gconf_client_set_string (config, CALENDAR_CONFIG_DEFAULT_REMINDER_UNITS, units_to_string (units), NULL);
-}
-
-/**
- * calendar_config_get_ba_reminder:
- * Retrieves setup of the Birthdays & Anniversaries reminder.
- *
- * @interval: Retrieves the interval setup for the reminder; can be NULL.
- * @units: Retrieves units for the interval; can be NULL.
- *
- * Returns whether the reminder is on or off. The values for interval and/or units
- * are retrieved even when returns FALSE.
- **/
-gboolean
-calendar_config_get_ba_reminder (gint *interval, EDurationType *units)
-{
- calendar_config_init ();
-
- if (interval) {
- *interval = gconf_client_get_int (config, CALENDAR_CONFIG_BA_REMINDER_INTERVAL, NULL);
- }
-
- if (units) {
- gchar *str;
-
- str = gconf_client_get_string (config, CALENDAR_CONFIG_BA_REMINDER_UNITS, NULL);
- *units = string_to_units (str);
- g_free (str);
- }
-
- return gconf_client_get_bool (config, CALENDAR_CONFIG_BA_REMINDER, NULL);
-}
-
-/**
- * calendar_config_set_ba_reminder:
- * Stores new values for Birthdays & Anniversaries reminder to GConf. Only those, which are not NULL.
- *
- * @enabled: The enabled state; can be NULL.
- * @interval: The reminder interval; can be NULL.
- * @units: The units of the reminder; can be NULL.
- **/
-void
-calendar_config_set_ba_reminder (gboolean *enabled, gint *interval, EDurationType *units)
-{
- calendar_config_init ();
-
- if (enabled)
- gconf_client_set_bool (config, CALENDAR_CONFIG_BA_REMINDER, *enabled, NULL);
-
- if (interval)
- gconf_client_set_int (config, CALENDAR_CONFIG_BA_REMINDER_INTERVAL, *interval, NULL);
-
- if (units)
- gconf_client_set_string (config, CALENDAR_CONFIG_BA_REMINDER_UNITS, units_to_string (*units), NULL);
-}
-
/**
* calendar_config_get_hide_completed_tasks_sexp:
*
@@ -646,7 +228,7 @@ calendar_config_get_hide_completed_tasks_sexp (gboolean get_completed)
gint value;
units = calendar_config_get_hide_completed_tasks_units ();
- value = calendar_config_get_hide_completed_tasks_value ();
+ value = gconf_client_get_int (config, CALENDAR_CONFIG_TASKS_HIDE_COMPLETED_VALUE, NULL);
if (value == 0) {
/* If the value is 0, we want to hide completed tasks
@@ -852,34 +434,3 @@ calendar_config_add_notification_day_second_zone (GConfClientNotifyFunc func, gp
return id;
}
-
-/* default count for recurring events */
-gint
-calendar_config_get_default_count (void)
-{
- gint res;
-
- calendar_config_init ();
-
- res = gconf_client_get_int (config, CALENDAR_CONFIG_DEF_RECUR_COUNT, NULL);
- if (res <= 0 && res != -1)
- res = 2;
-
- return res;
-}
-
-gboolean
-calendar_config_get_display_events_gradient (void)
-{
- calendar_config_init ();
-
- return display_events_gradient;
-}
-
-gfloat
-calendar_config_get_display_events_alpha (void)
-{
- calendar_config_init ();
-
- return display_events_alpha;
-}
diff --git a/calendar/gui/calendar-config.h b/calendar/gui/calendar-config.h
index 8f41276..d8cbb32 100644
--- a/calendar/gui/calendar-config.h
+++ b/calendar/gui/calendar-config.h
@@ -54,77 +54,20 @@ void calendar_config_remove_notification (guint id);
* Calendar Settings.
*/
-/* The current list of calendars selected */
-GSList *calendar_config_get_calendars_selected (void);
-void calendar_config_set_calendars_selected (GSList *selected);
-
/* The current timezone, e.g. "Europe/London". */
icaltimezone *calendar_config_get_icaltimezone (void);
/* The working days of the week, a bit-wise combination of flags. */
CalWeekdays calendar_config_get_working_days (void);
-/* The start day of the week (0 = Sun to 6 = Sat). */
-gint calendar_config_get_week_start_day (void);
-
-/* 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);
-/* 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 compress the weekend in the week/month views. */
-gboolean calendar_config_get_compress_weekend (void);
-
-/* The current list of task lists selected */
-GSList *calendar_config_get_tasks_selected (void);
-void calendar_config_set_tasks_selected (GSList *selected);
-
-/* The current list of memo lists selected */
-GSList *calendar_config_get_memos_selected (void);
-void calendar_config_set_memos_selected (GSList *selected);
-
/* Settings to hide completed tasks. */
gboolean calendar_config_get_hide_completed_tasks (void);
-void calendar_config_set_hide_completed_tasks (gboolean hide);
-
-EDurationType
- calendar_config_get_hide_completed_tasks_units (void);
-void calendar_config_set_hide_completed_tasks_units (EDurationType units);
-
-gint calendar_config_get_hide_completed_tasks_value (void);
-void calendar_config_set_hide_completed_tasks_value (gint value);
gchar * calendar_config_get_hide_completed_tasks_sexp (gboolean get_completed);
-/* Confirmation options */
-gboolean calendar_config_get_confirm_delete (void);
-
-/* Default reminder options */
-gboolean calendar_config_get_use_default_reminder (void);
-void calendar_config_set_use_default_reminder (gboolean value);
-
-gint calendar_config_get_default_reminder_interval (void);
-void calendar_config_set_default_reminder_interval (gint interval);
-
-EDurationType
- calendar_config_get_default_reminder_units (void);
-void calendar_config_set_default_reminder_units (EDurationType units);
-
/* Returns TRUE if the locale has 'am' and 'pm' strings defined, i.e. it
supports 12-hour time format. */
gboolean calendar_config_locale_supports_12_hour_format (void);
@@ -139,20 +82,8 @@ gchar * calendar_config_get_day_second_zone (void);
void calendar_config_select_day_second_zone (void);
guint calendar_config_add_notification_day_second_zone (GConfClientNotifyFunc func, gpointer data);
-/* Birthdays & Anniversaries reminder settings */
-gboolean calendar_config_get_ba_reminder (gint *interval, EDurationType *units);
-void calendar_config_set_ba_reminder (gboolean *enabled, gint *interval, EDurationType *units);
-
/* Scroll in a month view by a week, not by a month */
gboolean calendar_config_get_month_scroll_by_week (void);
-void calendar_config_set_month_scroll_by_week (gboolean value);
guint calendar_config_add_notification_month_scroll_by_week (GConfClientNotifyFunc func, gpointer data);
-/* default count for recurring events */
-gint calendar_config_get_default_count (void);
-
-/* event drawing customization, one-time read on start only */
-gboolean calendar_config_get_display_events_gradient (void);
-gfloat calendar_config_get_display_events_alpha (void);
-
#endif /* _CALENDAR_CONFIG_H_ */
diff --git a/calendar/gui/comp-util.c b/calendar/gui/comp-util.c
index d0182a0..7dae182 100644
--- a/calendar/gui/comp-util.c
+++ b/calendar/gui/comp-util.c
@@ -285,12 +285,14 @@ is_icalcomp_on_the_server (icalcomponent *icalcomp, ECal *client)
* Return value: A newly-created calendar component.
**/
ECalComponent *
-cal_comp_event_new_with_defaults (ECal *client, gboolean all_day)
+cal_comp_event_new_with_defaults (ECal *client,
+ gboolean all_day,
+ gboolean use_default_reminder,
+ gint default_reminder_interval,
+ EDurationType default_reminder_units)
{
icalcomponent *icalcomp;
ECalComponent *comp;
- gint interval;
- EDurationType units;
ECalComponentAlarm *alarm;
icalproperty *icalprop;
ECalComponentAlarmTrigger trigger;
@@ -305,12 +307,9 @@ cal_comp_event_new_with_defaults (ECal *client, gboolean all_day)
e_cal_component_set_new_vtype (comp, E_CAL_COMPONENT_EVENT);
}
- if (all_day || !calendar_config_get_use_default_reminder ())
+ if (all_day || !use_default_reminder)
return comp;
- interval = calendar_config_get_default_reminder_interval ();
- units = calendar_config_get_default_reminder_units ();
-
alarm = e_cal_component_alarm_new ();
/* We don't set the description of the alarm; we'll copy it from the
@@ -330,21 +329,21 @@ cal_comp_event_new_with_defaults (ECal *client, gboolean all_day)
trigger.u.rel_duration.is_neg = TRUE;
- switch (units) {
+ switch (default_reminder_units) {
case E_DURATION_MINUTES:
- trigger.u.rel_duration.minutes = interval;
+ trigger.u.rel_duration.minutes = default_reminder_interval;
break;
case E_DURATION_HOURS:
- trigger.u.rel_duration.hours = interval;
+ trigger.u.rel_duration.hours = default_reminder_interval;
break;
case E_DURATION_DAYS:
- trigger.u.rel_duration.days = interval;
+ trigger.u.rel_duration.days = default_reminder_interval;
break;
default:
- g_warning ("wrong units %d\n", units);
+ g_warning ("wrong units %d\n", default_reminder_units);
}
e_cal_component_alarm_set_trigger (alarm, trigger);
@@ -356,18 +355,22 @@ cal_comp_event_new_with_defaults (ECal *client, gboolean all_day)
}
ECalComponent *
-cal_comp_event_new_with_current_time (ECal *client, gboolean all_day)
+cal_comp_event_new_with_current_time (ECal *client,
+ gboolean all_day,
+ icaltimezone *zone,
+ gboolean use_default_reminder,
+ gint default_reminder_interval,
+ EDurationType default_reminder_units)
{
ECalComponent *comp;
struct icaltimetype itt;
ECalComponentDateTime dt;
- icaltimezone *zone;
-
- comp = cal_comp_event_new_with_defaults (client, all_day);
- g_return_val_if_fail (comp, NULL);
+ comp = cal_comp_event_new_with_defaults (
+ client, all_day, use_default_reminder,
+ default_reminder_interval, default_reminder_units);
+ g_return_val_if_fail (comp != NULL, NULL);
- zone = calendar_config_get_icaltimezone ();
if (all_day) {
itt = icaltime_from_timet_with_zone (time (NULL), 1, zone);
diff --git a/calendar/gui/comp-util.h b/calendar/gui/comp-util.h
index 7b1bf28..0467f31 100644
--- a/calendar/gui/comp-util.h
+++ b/calendar/gui/comp-util.h
@@ -28,6 +28,7 @@
#include <gtk/gtk.h>
#include <libecal/e-cal-component.h>
#include <libecal/e-cal.h>
+#include <e-util/e-util-enums.h>
struct _EShell;
@@ -47,8 +48,19 @@ gboolean cal_comp_is_on_server (ECalComponent *comp,
ECal *client);
gboolean is_icalcomp_on_the_server (icalcomponent *icalcomp, ECal *client);
-ECalComponent *cal_comp_event_new_with_defaults (ECal *client, gboolean all_day);
-ECalComponent *cal_comp_event_new_with_current_time (ECal *client, gboolean all_day);
+ECalComponent * cal_comp_event_new_with_defaults
+ (ECal *client,
+ gboolean all_day,
+ gboolean use_default_reminder,
+ gint default_reminder_interval,
+ EDurationType default_reminder_units);
+ECalComponent * cal_comp_event_new_with_current_time
+ (ECal *client,
+ gboolean all_day,
+ icaltimezone *zone,
+ gboolean use_default_reminder,
+ gint default_reminder_interval,
+ EDurationType default_reminder_units);
ECalComponent *cal_comp_task_new_with_defaults (ECal *client);
ECalComponent *cal_comp_memo_new_with_defaults (ECal *client);
diff --git a/calendar/gui/dialogs/Makefile.am b/calendar/gui/dialogs/Makefile.am
index 0bd89de..38e0c47 100644
--- a/calendar/gui/dialogs/Makefile.am
+++ b/calendar/gui/dialogs/Makefile.am
@@ -20,101 +20,97 @@ libcal_dialogs_la_CPPFLAGS = \
ecalendarincludedir = $(privincludedir)/calendar/gui/dialogs
-ecalendarinclude_HEADERS = \
- comp-editor-page.h \
- comp-editor.h \
- alarm-dialog.h \
- alarm-list-dialog.h \
- cal-prefs-dialog.h \
- calendar-setup.h \
- cancel-comp.h \
- changed-comp.h \
- comp-editor-util.h \
- copy-source-dialog.h \
- delete-comp.h \
- delete-error.h \
- e-delegate-dialog.h \
- e-send-options-utils.h \
- event-editor.h \
- event-page.h \
- memo-editor.h \
- memo-page.h \
- recurrence-page.h \
- recur-comp.h \
- save-comp.h \
- schedule-page.h \
- select-source-dialog.h \
- send-comp.h \
- task-editor.h \
- task-details-page.h \
- task-page.h
+ecalendarinclude_HEADERS = \
+ comp-editor-page.h \
+ comp-editor.h \
+ alarm-dialog.h \
+ alarm-list-dialog.h \
+ calendar-setup.h \
+ cancel-comp.h \
+ changed-comp.h \
+ comp-editor-util.h \
+ copy-source-dialog.h \
+ delete-comp.h \
+ delete-error.h \
+ e-delegate-dialog.h \
+ e-send-options-utils.h \
+ event-editor.h \
+ event-page.h \
+ memo-editor.h \
+ memo-page.h \
+ recurrence-page.h \
+ recur-comp.h \
+ save-comp.h \
+ schedule-page.h \
+ select-source-dialog.h \
+ send-comp.h \
+ task-editor.h \
+ task-details-page.h \
+ task-page.h
libcal_dialogs_la_LIBADD = \
$(top_builddir)/addressbook/util/libeabutil.la \
$(CAMEL_LIBS) \
$(GNOME_PLATFORM_LIBS)
-libcal_dialogs_la_SOURCES = \
- $(IDL_GENERATED) \
- alarm-dialog.c \
- alarm-dialog.h \
- alarm-list-dialog.c \
- alarm-list-dialog.h \
- cal-prefs-dialog.c \
- cal-prefs-dialog.h \
- calendar-setup.c \
- calendar-setup.h \
- cancel-comp.c \
- cancel-comp.h \
- changed-comp.c \
- changed-comp.h \
- comp-editor.c \
- comp-editor.h \
- comp-editor-page.c \
- comp-editor-page.h \
- comp-editor-util.c \
- comp-editor-util.h \
- copy-source-dialog.c \
- copy-source-dialog.h \
- delete-comp.c \
- delete-comp.h \
- delete-error.c \
- delete-error.h \
- e-delegate-dialog.c \
- e-delegate-dialog.h \
- e-send-options-utils.c \
- e-send-options-utils.h \
- event-editor.c \
- event-editor.h \
- event-page.c \
- event-page.h \
- memo-editor.c \
- memo-editor.h \
- memo-page.c \
- memo-page.h \
- recurrence-page.c \
- recurrence-page.h \
- recur-comp.c \
- recur-comp.h \
- save-comp.c \
- save-comp.h \
- schedule-page.c \
- schedule-page.h \
- select-source-dialog.c \
- select-source-dialog.h \
- send-comp.c \
- send-comp.h \
- task-editor.c \
- task-editor.h \
- task-details-page.c \
- task-details-page.h \
- task-page.c \
+libcal_dialogs_la_SOURCES = \
+ $(IDL_GENERATED) \
+ alarm-dialog.c \
+ alarm-dialog.h \
+ alarm-list-dialog.c \
+ alarm-list-dialog.h \
+ calendar-setup.c \
+ calendar-setup.h \
+ cancel-comp.c \
+ cancel-comp.h \
+ changed-comp.c \
+ changed-comp.h \
+ comp-editor.c \
+ comp-editor.h \
+ comp-editor-page.c \
+ comp-editor-page.h \
+ comp-editor-util.c \
+ comp-editor-util.h \
+ copy-source-dialog.c \
+ copy-source-dialog.h \
+ delete-comp.c \
+ delete-comp.h \
+ delete-error.c \
+ delete-error.h \
+ e-delegate-dialog.c \
+ e-delegate-dialog.h \
+ e-send-options-utils.c \
+ e-send-options-utils.h \
+ event-editor.c \
+ event-editor.h \
+ event-page.c \
+ event-page.h \
+ memo-editor.c \
+ memo-editor.h \
+ memo-page.c \
+ memo-page.h \
+ recurrence-page.c \
+ recurrence-page.h \
+ recur-comp.c \
+ recur-comp.h \
+ save-comp.c \
+ save-comp.h \
+ schedule-page.c \
+ schedule-page.h \
+ select-source-dialog.c \
+ select-source-dialog.h \
+ send-comp.c \
+ send-comp.h \
+ task-editor.c \
+ task-editor.h \
+ task-details-page.c \
+ task-details-page.h \
+ task-page.c \
task-page.h
ui_DATA = \
alarm-dialog.ui \
alarm-list-dialog.ui \
- cal-prefs-dialog.ui \
e-delegate-dialog.ui \
event-page.ui \
memo-page.ui \
diff --git a/calendar/gui/dialogs/comp-editor-util.c b/calendar/gui/dialogs/comp-editor-util.c
index 69ec171..a29d757 100644
--- a/calendar/gui/dialogs/comp-editor-util.c
+++ b/calendar/gui/dialogs/comp-editor-util.c
@@ -33,7 +33,6 @@
#include <libedataserver/e-time-utils.h>
#include <libecal/e-cal-time-util.h>
#include "widgets/misc/e-dateedit.h"
-#include "../calendar-config.h"
#include "../itip-utils.h"
#include <shell/e-shell.h>
#include "comp-editor-util.h"
@@ -147,14 +146,15 @@ comp_editor_new_date_edit (gboolean show_date,
FIXME: Should probably use the timezone from somewhere in the component
rather than the current timezone. */
struct tm
-comp_editor_get_current_time (GObject *object, gpointer data)
+comp_editor_get_current_time (EDateEdit *date_edit,
+ CompEditor *editor)
{
icaltimezone *zone;
struct icaltimetype tt;
struct tm tmp_tm = { 0 };
/* Get the current timezone. */
- zone = calendar_config_get_icaltimezone ();
+ zone = comp_editor_get_timezone (editor);
tt = icaltime_from_timet_with_zone (time (NULL), FALSE, zone);
diff --git a/calendar/gui/dialogs/comp-editor-util.h b/calendar/gui/dialogs/comp-editor-util.h
index 07ba65a..a4ecc46 100644
--- a/calendar/gui/dialogs/comp-editor-util.h
+++ b/calendar/gui/dialogs/comp-editor-util.h
@@ -26,8 +26,9 @@
#define _COMP_EDITOR_UTIL_H_
#include <gtk/gtk.h>
-#include "comp-editor-page.h"
+#include "comp-editor.h"
#include "../e-meeting-attendee.h"
+#include <misc/e-dateedit.h>
void comp_editor_dates (CompEditorPageDates *date, ECalComponent *comp);
void comp_editor_free_dates (CompEditorPageDates *dates);
@@ -38,7 +39,7 @@ GtkWidget * comp_editor_new_date_edit (gboolean show_date,
gboolean show_time,
gboolean make_time_insensitive);
-struct tm comp_editor_get_current_time (GObject *object, gpointer data);
+struct tm comp_editor_get_current_time (EDateEdit *date_edit, CompEditor *editor);
gchar *comp_editor_strip_categories (const gchar *categories);
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index af5b23d..1714ef4 100644
--- a/calendar/gui/dialogs/comp-editor.c
+++ b/calendar/gui/dialogs/comp-editor.c
@@ -38,6 +38,7 @@
#include <e-util/e-util.h>
#include <e-util/e-alert-sink.h>
#include <e-util/e-dialog-utils.h>
+#include <e-util/e-extensible.h>
#include <e-util/e-util-private.h>
#include <e-util/gconf-bridge.h>
#include <shell/e-shell.h>
@@ -112,6 +113,14 @@ struct _CompEditorPrivate {
below */
CompEditorFlags flags;
+ icaltimezone *zone;
+ gboolean use_24_hour_format;
+
+ gint work_day_end_hour;
+ gint work_day_end_minute;
+ gint work_day_start_hour;
+ gint work_day_start_minute;
+
gboolean changed;
gboolean needs_send;
@@ -131,7 +140,13 @@ enum {
PROP_FLAGS,
PROP_FOCUS_TRACKER,
PROP_SHELL,
- PROP_SUMMARY
+ PROP_SUMMARY,
+ PROP_TIMEZONE,
+ PROP_USE_24_HOUR_FORMAT,
+ PROP_WORK_DAY_END_HOUR,
+ PROP_WORK_DAY_END_MINUTE,
+ PROP_WORK_DAY_START_HOUR,
+ PROP_WORK_DAY_START_MINUTE
};
static const gchar *ui =
@@ -731,11 +746,12 @@ action_print_cb (GtkAction *action,
CompEditor *editor)
{
CompEditorPrivate *priv = editor->priv;
- GtkPrintOperationAction print_action;
ECalComponent *comp;
GList *l;
icalcomponent *component;
icalcomponent *clone;
+ icaltimezone *zone;
+ gboolean use_24_hour_format;
comp = e_cal_component_new ();
component = e_cal_component_get_icalcomponent (priv->comp);
@@ -745,8 +761,12 @@ action_print_cb (GtkAction *action,
for (l = priv->pages; l != NULL; l = l->next)
comp_editor_page_fill_component (l->data, comp);
- print_action = GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG;
- print_comp (comp, priv->client, print_action);
+ zone = comp_editor_get_timezone (editor);
+ use_24_hour_format = comp_editor_get_use_24_hour_format (editor);
+
+ print_comp (
+ comp, priv->client, zone, use_24_hour_format,
+ GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG);
g_object_unref (comp);
}
@@ -756,11 +776,12 @@ action_print_preview_cb (GtkAction *action,
CompEditor *editor)
{
CompEditorPrivate *priv = editor->priv;
- GtkPrintOperationAction print_action;
ECalComponent *comp;
GList *l;
icalcomponent *component;
icalcomponent *clone;
+ icaltimezone *zone;
+ gboolean use_24_hour_format;
comp = e_cal_component_new ();
component = e_cal_component_get_icalcomponent (priv->comp);
@@ -770,8 +791,12 @@ action_print_preview_cb (GtkAction *action,
for (l = priv->pages; l != NULL; l = l->next)
comp_editor_page_fill_component (l->data, comp);
- print_action = GTK_PRINT_OPERATION_ACTION_PREVIEW;
- print_comp (comp, priv->client, print_action);
+ zone = comp_editor_get_timezone (editor);
+ use_24_hour_format = comp_editor_get_use_24_hour_format (editor);
+
+ print_comp (
+ comp, priv->client, zone, use_24_hour_format,
+ GTK_PRINT_OPERATION_ACTION_PREVIEW);
g_object_unref (comp);
}
@@ -1271,6 +1296,42 @@ comp_editor_set_property (GObject *object,
COMP_EDITOR (object),
g_value_get_string (value));
return;
+
+ case PROP_TIMEZONE:
+ comp_editor_set_timezone (
+ COMP_EDITOR (object),
+ g_value_get_pointer (value));
+ return;
+
+ case PROP_USE_24_HOUR_FORMAT:
+ comp_editor_set_use_24_hour_format (
+ COMP_EDITOR (object),
+ g_value_get_boolean (value));
+ return;
+
+ case PROP_WORK_DAY_END_HOUR:
+ comp_editor_set_work_day_end_hour (
+ COMP_EDITOR (object),
+ g_value_get_int (value));
+ return;
+
+ case PROP_WORK_DAY_END_MINUTE:
+ comp_editor_set_work_day_end_minute (
+ COMP_EDITOR (object),
+ g_value_get_int (value));
+ return;
+
+ case PROP_WORK_DAY_START_HOUR:
+ comp_editor_set_work_day_start_hour (
+ COMP_EDITOR (object),
+ g_value_get_int (value));
+ return;
+
+ case PROP_WORK_DAY_START_MINUTE:
+ comp_editor_set_work_day_start_minute (
+ COMP_EDITOR (object),
+ g_value_get_int (value));
+ return;
}
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -1318,6 +1379,42 @@ comp_editor_get_property (GObject *object,
value, comp_editor_get_summary (
COMP_EDITOR (object)));
return;
+
+ case PROP_TIMEZONE:
+ g_value_set_pointer (
+ value, comp_editor_get_timezone (
+ COMP_EDITOR (object)));
+ return;
+
+ case PROP_USE_24_HOUR_FORMAT:
+ g_value_set_boolean (
+ value, comp_editor_get_use_24_hour_format (
+ COMP_EDITOR (object)));
+ return;
+
+ case PROP_WORK_DAY_END_HOUR:
+ g_value_set_int (
+ value, comp_editor_get_work_day_end_hour (
+ COMP_EDITOR (object)));
+ return;
+
+ case PROP_WORK_DAY_END_MINUTE:
+ g_value_set_int (
+ value, comp_editor_get_work_day_end_minute (
+ COMP_EDITOR (object)));
+ return;
+
+ case PROP_WORK_DAY_START_HOUR:
+ g_value_set_int (
+ value, comp_editor_get_work_day_start_hour (
+ COMP_EDITOR (object)));
+ return;
+
+ case PROP_WORK_DAY_START_MINUTE:
+ g_value_set_int (
+ value, comp_editor_get_work_day_start_minute (
+ COMP_EDITOR (object)));
+ return;
}
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -1605,14 +1702,81 @@ comp_editor_class_init (CompEditorClass *class)
NULL,
G_PARAM_READWRITE));
- signals[OBJECT_CREATED] =
- g_signal_new ("object_created",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (CompEditorClass, object_created),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ g_object_class_install_property (
+ object_class,
+ PROP_TIMEZONE,
+ g_param_spec_pointer (
+ "timezone",
+ "Time Zone",
+ NULL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_USE_24_HOUR_FORMAT,
+ g_param_spec_boolean (
+ "use-24-hour-format",
+ "Use 24-hour Format",
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_WORK_DAY_END_HOUR,
+ g_param_spec_int (
+ "work-day-end-hour",
+ "Work Day End Hour",
+ NULL,
+ 0,
+ 23,
+ 0,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_WORK_DAY_END_MINUTE,
+ g_param_spec_int (
+ "work-day-end-minute",
+ "Work Day End Minute",
+ NULL,
+ 0,
+ 59,
+ 0,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_WORK_DAY_START_HOUR,
+ g_param_spec_int (
+ "work-day-start-hour",
+ "Work Day Start Hour",
+ NULL,
+ 0,
+ 23,
+ 0,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_WORK_DAY_START_MINUTE,
+ g_param_spec_int (
+ "work-day-start-minute",
+ "Work Day Start Minute",
+ NULL,
+ 0,
+ 59,
+ 0,
+ G_PARAM_READWRITE));
+
+ signals[OBJECT_CREATED] = g_signal_new (
+ "object_created",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (CompEditorClass, object_created),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
}
static void
@@ -2091,6 +2255,120 @@ comp_editor_get_summary (CompEditor *editor)
return editor->priv->summary;
}
+icaltimezone *
+comp_editor_get_timezone (CompEditor *editor)
+{
+ g_return_val_if_fail (IS_COMP_EDITOR (editor), NULL);
+
+ return editor->priv->zone;
+}
+
+void
+comp_editor_set_timezone (CompEditor *editor,
+ icaltimezone *zone)
+{
+ g_return_if_fail (IS_COMP_EDITOR (editor));
+
+ editor->priv->zone = zone;
+
+ g_object_notify (G_OBJECT (editor), "timezone");
+}
+
+gboolean
+comp_editor_get_use_24_hour_format (CompEditor *editor)
+{
+ g_return_val_if_fail (IS_COMP_EDITOR (editor), FALSE);
+
+ return editor->priv->use_24_hour_format;
+}
+
+void
+comp_editor_set_use_24_hour_format (CompEditor *editor,
+ gboolean use_24_hour_format)
+{
+ g_return_if_fail (IS_COMP_EDITOR (editor));
+
+ editor->priv->use_24_hour_format = use_24_hour_format;
+
+ g_object_notify (G_OBJECT (editor), "use-24-hour-format");
+}
+
+gint
+comp_editor_get_work_day_end_hour (CompEditor *editor)
+{
+ g_return_val_if_fail (IS_COMP_EDITOR (editor), 0);
+
+ return editor->priv->work_day_end_hour;
+}
+
+void
+comp_editor_set_work_day_end_hour (CompEditor *editor,
+ gint work_day_end_hour)
+{
+ g_return_if_fail (IS_COMP_EDITOR (editor));
+
+ editor->priv->work_day_end_hour = work_day_end_hour;
+
+ g_object_notify (G_OBJECT (editor), "work-day-end-hour");
+}
+
+gint
+comp_editor_get_work_day_end_minute (CompEditor *editor)
+{
+ g_return_val_if_fail (IS_COMP_EDITOR (editor), 0);
+
+ return editor->priv->work_day_end_minute;
+}
+
+void
+comp_editor_set_work_day_end_minute (CompEditor *editor,
+ gint work_day_end_minute)
+{
+ g_return_if_fail (IS_COMP_EDITOR (editor));
+
+ editor->priv->work_day_end_minute = work_day_end_minute;
+
+ g_object_notify (G_OBJECT (editor), "work-day-end-minute");
+}
+
+gint
+comp_editor_get_work_day_start_hour (CompEditor *editor)
+{
+ g_return_val_if_fail (IS_COMP_EDITOR (editor), 0);
+
+ return editor->priv->work_day_start_hour;
+}
+
+void
+comp_editor_set_work_day_start_hour (CompEditor *editor,
+ gint work_day_start_hour)
+{
+ g_return_if_fail (IS_COMP_EDITOR (editor));
+
+ editor->priv->work_day_start_hour = work_day_start_hour;
+
+ g_object_notify (G_OBJECT (editor), "work-day-start-hour");
+}
+
+gint
+comp_editor_get_work_day_start_minute (CompEditor *editor)
+{
+ g_return_val_if_fail (IS_COMP_EDITOR (editor), 0);
+
+ return editor->priv->work_day_start_minute;
+}
+
+void
+comp_editor_set_work_day_start_minute (CompEditor *editor,
+ gint work_day_start_minute)
+{
+ g_return_if_fail (IS_COMP_EDITOR (editor));
+
+ editor->priv->work_day_start_minute = work_day_start_minute;
+
+ g_object_notify (G_OBJECT (editor), "work-day-start-minute");
+}
+
/**
* comp_editor_set_changed:
* @editor: A component editor
diff --git a/calendar/gui/dialogs/comp-editor.h b/calendar/gui/dialogs/comp-editor.h
index 09ced8f..591300f 100644
--- a/calendar/gui/dialogs/comp-editor.h
+++ b/calendar/gui/dialogs/comp-editor.h
@@ -123,6 +123,34 @@ EShell * comp_editor_get_shell (CompEditor *editor);
void comp_editor_set_summary (CompEditor *editor,
const gchar *summary);
const gchar * comp_editor_get_summary (CompEditor *editor);
+icaltimezone * comp_editor_get_timezone (CompEditor *editor);
+void comp_editor_set_timezone (CompEditor *editor,
+ icaltimezone *zone);
+gboolean comp_editor_get_use_24_hour_format
+ (CompEditor *editor);
+void comp_editor_set_use_24_hour_format
+ (CompEditor *editor,
+ gboolean use_24_hour_format);
+gint comp_editor_get_work_day_end_hour
+ (CompEditor *editor);
+void comp_editor_set_work_day_end_hour
+ (CompEditor *editor,
+ gint work_day_end_hour);
+gint comp_editor_get_work_day_end_minute
+ (CompEditor *editor);
+void comp_editor_set_work_day_end_minute
+ (CompEditor *editor,
+ gint work_day_end_minute);
+gint comp_editor_get_work_day_start_hour
+ (CompEditor *editor);
+void comp_editor_set_work_day_start_hour
+ (CompEditor *editor,
+ gint work_day_start_hour);
+gint comp_editor_get_work_day_start_minute
+ (CompEditor *editor);
+void comp_editor_set_work_day_start_minute
+ (CompEditor *editor,
+ gint work_day_start_minute);
void comp_editor_append_page (CompEditor *editor,
CompEditorPage *page,
const gchar *label,
diff --git a/calendar/gui/dialogs/delete-comp.c b/calendar/gui/dialogs/delete-comp.c
index ecdaf58..b0ccb95 100644
--- a/calendar/gui/dialogs/delete-comp.c
+++ b/calendar/gui/dialogs/delete-comp.c
@@ -28,7 +28,6 @@
#include <glib/gi18n.h>
#include "e-util/e-alert-dialog.h"
-#include "../calendar-config.h"
#include "delete-comp.h"
@@ -57,9 +56,10 @@
**/
gboolean
delete_component_dialog (ECalComponent *comp,
- gboolean consider_as_untitled,
- gint n_comps, ECalComponentVType vtype,
- GtkWidget *widget)
+ gboolean consider_as_untitled,
+ gint n_comps,
+ ECalComponentVType vtype,
+ GtkWidget *widget)
{
const gchar *id;
gchar *arg0 = NULL;
@@ -74,12 +74,8 @@ delete_component_dialog (ECalComponent *comp,
g_return_val_if_fail (vtype != E_CAL_COMPONENT_NO_TYPE, FALSE);
}
- g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
- if (!calendar_config_get_confirm_delete ())
- return TRUE;
-
if (comp) {
ECalComponentText summary;
diff --git a/calendar/gui/dialogs/e-send-options-utils.c b/calendar/gui/dialogs/e-send-options-utils.c
index c56caab..b21352d 100644
--- a/calendar/gui/dialogs/e-send-options-utils.c
+++ b/calendar/gui/dialogs/e-send-options-utils.c
@@ -23,7 +23,6 @@
*/
#include "e-send-options-utils.h"
-#include "../calendar-config.h"
#include <glib.h>
#include <string.h>
@@ -151,7 +150,9 @@ e_send_options_utils_set_default_data (ESendOptionsDialog *sod, ESource *source,
}
void
-e_send_options_utils_fill_component (ESendOptionsDialog *sod, ECalComponent *comp)
+e_send_options_utils_fill_component (ESendOptionsDialog *sod,
+ ECalComponent *comp,
+ icaltimezone *zone)
{
gint i = 1;
icalproperty *prop;
@@ -189,7 +190,6 @@ e_send_options_utils_fill_component (ESendOptionsDialog *sod, ECalComponent *com
struct icaltimetype temp;
gchar *str;
- icaltimezone *zone = calendar_config_get_icaltimezone ();
temp = icaltime_from_timet_with_zone (gopts->delay_until, FALSE, zone);
str = icaltime_as_ical_string_r (temp);
diff --git a/calendar/gui/dialogs/e-send-options-utils.h b/calendar/gui/dialogs/e-send-options-utils.h
index d6852b8..c1a63a2 100644
--- a/calendar/gui/dialogs/e-send-options-utils.h
+++ b/calendar/gui/dialogs/e-send-options-utils.h
@@ -29,6 +29,13 @@
#include <libecal/e-cal-component.h>
#include <libedataserver/e-source-list.h>
-void e_send_options_utils_set_default_data (ESendOptionsDialog *sod, ESource *source, const gchar *type);
-void e_send_options_utils_fill_component (ESendOptionsDialog *sod, ECalComponent *comp);
+void e_send_options_utils_set_default_data
+ (ESendOptionsDialog *sod,
+ ESource *source,
+ const gchar *type);
+void e_send_options_utils_fill_component
+ (ESendOptionsDialog *sod,
+ ECalComponent *comp,
+ icaltimezone *zone);
+
#endif
diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c
index ad3c963..11dbe13 100644
--- a/calendar/gui/dialogs/event-editor.c
+++ b/calendar/gui/dialogs/event-editor.c
@@ -330,7 +330,7 @@ event_editor_constructor (GType type,
content_area =
gtk_dialog_get_content_area (GTK_DIALOG (priv->recur_window));
- priv->recur_page = recurrence_page_new (editor);
+ priv->recur_page = recurrence_page_new (priv->model, editor);
page = COMP_EDITOR_PAGE (priv->recur_page);
if (!e_shell_get_express_mode (shell)) {
gtk_container_add (
diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c
index 0418c7f..32c2c18 100644
--- a/calendar/gui/dialogs/event-page.c
+++ b/calendar/gui/dialogs/event-page.c
@@ -40,7 +40,6 @@
#include "misc/e-send-options.h"
#include "misc/e-buffer-tagger.h"
#include <libecal/e-cal-time-util.h>
-#include "../calendar-config.h"
#include "../e-timezone-entry.h"
#include "e-util/e-util.h"
@@ -166,7 +165,7 @@ struct _EventPagePrivate {
GtkWidget *attendees_label;
/* ListView stuff */
- EMeetingStore *model;
+ EMeetingStore *meeting_store;
EMeetingListView *list_view;
gint row;
@@ -380,7 +379,9 @@ set_all_day (EventPage *epage, gboolean all_day)
}
static void
-update_time (EventPage *epage, ECalComponentDateTime *start_date, ECalComponentDateTime *end_date)
+update_time (EventPage *epage,
+ ECalComponentDateTime *start_date,
+ ECalComponentDateTime *end_date)
{
EventPagePrivate *priv = epage->priv;
CompEditor *editor;
@@ -431,7 +432,8 @@ update_time (EventPage *epage, ECalComponentDateTime *start_date, ECalComponentD
timezone, so that if the user toggles the 'All Day Event' checkbox
the event uses the current timezone rather than none at all. */
if (all_day_event)
- start_zone = calendar_config_get_icaltimezone ();
+ start_zone = e_meeting_store_get_timezone (
+ epage->priv->meeting_store);
g_signal_handlers_block_matched (priv->start_time, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, epage);
g_signal_handlers_block_matched (priv->end_time, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, epage);
@@ -457,7 +459,7 @@ update_time (EventPage *epage, ECalComponentDateTime *start_date, ECalComponentD
if (start_zone)
e_timezone_entry_set_timezone (E_TIMEZONE_ENTRY (priv->start_timezone),
start_zone);
- def_zone = calendar_config_get_icaltimezone ();
+ def_zone = e_meeting_store_get_timezone (epage->priv->meeting_store);
if (!def_zone || !start_zone || strcmp (icaltimezone_get_tzid (def_zone), icaltimezone_get_tzid (start_zone)))
homezone = FALSE;
@@ -1126,7 +1128,7 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
a = get_current_account (epage);
if (a != NULL) {
- priv->ia = e_meeting_store_add_attendee_with_defaults (priv->model);
+ priv->ia = e_meeting_store_add_attendee_with_defaults (priv->meeting_store);
g_object_ref (priv->ia);
if (!(backend_addr && *backend_addr) || !g_ascii_strcasecmp (backend_addr, a->id->address)) {
@@ -1403,8 +1405,10 @@ event_page_fill_component (CompEditorPage *page, ECalComponent *comp)
e_cal_component_set_transparency (comp, busy ? E_CAL_COMPONENT_TRANSP_OPAQUE : E_CAL_COMPONENT_TRANSP_TRANSPARENT);
/* send options */
- if (priv->sendoptions_shown && priv->sod)
- e_send_options_utils_fill_component (priv->sod, comp);
+ if (priv->sendoptions_shown && priv->sod) {
+ icaltimezone *zone = comp_editor_get_timezone (editor);
+ e_send_options_utils_fill_component (priv->sod, comp, zone);
+ }
/* Alarm */
e_cal_component_remove_all_alarms (comp);
@@ -1491,7 +1495,7 @@ event_page_fill_component (CompEditorPage *page, ECalComponent *comp)
break;
case ALARM_USER_TIME:
- switch (calendar_config_get_default_reminder_units ()) {
+ switch (e_meeting_store_get_default_reminder_units (priv->meeting_store)) {
case E_DURATION_DAYS:
trigger.u.rel_duration.days = priv->alarm_interval;
break;
@@ -1559,7 +1563,7 @@ event_page_fill_component (CompEditorPage *page, ECalComponent *comp)
g_free (sentby);
}
- if (e_meeting_store_count_actual_attendees (priv->model) < 1) {
+ if (e_meeting_store_count_actual_attendees (priv->meeting_store) < 1) {
e_notice (priv->main, GTK_MESSAGE_ERROR,
_("At least one attendee is required."));
return FALSE;
@@ -1568,7 +1572,7 @@ event_page_fill_component (CompEditorPage *page, ECalComponent *comp)
if (flags & COMP_EDITOR_DELEGATE) {
GSList *attendee_list, *l;
gint i;
- const GPtrArray *attendees = e_meeting_store_get_attendees (priv->model);
+ const GPtrArray *attendees = e_meeting_store_get_attendees (priv->meeting_store);
e_cal_component_get_attendee_list (priv->comp, &attendee_list);
@@ -1595,7 +1599,7 @@ event_page_fill_component (CompEditorPage *page, ECalComponent *comp)
e_cal_component_set_attendee_list (comp, attendee_list);
e_cal_component_free_attendee_list (attendee_list);
} else
- set_attendees (comp, e_meeting_store_get_attendees (priv->model));
+ set_attendees (comp, e_meeting_store_get_attendees (priv->meeting_store));
}
return TRUE;
@@ -1767,7 +1771,7 @@ add_clicked_cb (GtkButton *btn, EventPage *epage)
editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage));
flags = comp_editor_get_flags (editor);
- attendee = e_meeting_store_add_attendee_with_defaults (epage->priv->model);
+ attendee = e_meeting_store_add_attendee_with_defaults (epage->priv->meeting_store);
if (flags & COMP_EDITOR_DELEGATE) {
e_meeting_attendee_set_delfrom (attendee, g_strdup_printf ("MAILTO:%s", epage->priv->user_add));
@@ -1837,7 +1841,7 @@ remove_attendee (EventPage *epage, EMeetingAttendee *ia)
if (e_meeting_attendee_is_set_delfrom (ia)) {
EMeetingAttendee *ib;
- ib = e_meeting_store_find_attendee (priv->model, e_meeting_attendee_get_delfrom (ia), &pos);
+ ib = e_meeting_store_find_attendee (priv->meeting_store, e_meeting_attendee_get_delfrom (ia), &pos);
if (ib != NULL) {
e_meeting_attendee_set_delto (ib, NULL);
@@ -1857,11 +1861,11 @@ remove_attendee (EventPage *epage, EMeetingAttendee *ia)
}
if (e_meeting_attendee_get_delto (ia) != NULL)
- ib = e_meeting_store_find_attendee (priv->model, e_meeting_attendee_get_delto (ia), NULL);
+ ib = e_meeting_store_find_attendee (priv->meeting_store, e_meeting_attendee_get_delto (ia), NULL);
comp_editor_manage_new_attendees (priv->comp, ia, FALSE);
e_meeting_list_view_remove_attendee_from_name_selector (priv->list_view, ia);
- e_meeting_store_remove_attendee (priv->model, ia);
+ e_meeting_store_remove_attendee (priv->meeting_store, ia);
ia = ib;
}
@@ -1885,7 +1889,7 @@ remove_clicked_cb (GtkButton *btn, EventPage *epage)
priv = epage->priv;
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->list_view));
- model = GTK_TREE_MODEL (priv->model);
+ model = GTK_TREE_MODEL (priv->meeting_store);
if (!(paths = gtk_tree_selection_get_selected_rows (selection, &model ))) {
g_warning ("Could not get a selection to delete.");
return;
@@ -1895,10 +1899,10 @@ remove_clicked_cb (GtkButton *btn, EventPage *epage)
for (tmp = paths; tmp; tmp=tmp->next) {
path = tmp->data;
- gtk_tree_model_get_iter (GTK_TREE_MODEL (priv->model), &iter, path);
+ gtk_tree_model_get_iter (GTK_TREE_MODEL (priv->meeting_store), &iter, path);
- gtk_tree_model_get (GTK_TREE_MODEL (priv->model), &iter, E_MEETING_STORE_ADDRESS_COL, &address, -1);
- ia = e_meeting_store_find_attendee (priv->model, address, NULL);
+ gtk_tree_model_get (GTK_TREE_MODEL (priv->meeting_store), &iter, E_MEETING_STORE_ADDRESS_COL, &address, -1);
+ ia = e_meeting_store_find_attendee (priv->meeting_store, address, NULL);
g_free (address);
if (!ia) {
g_warning ("Cannot delete attendee\n");
@@ -1912,10 +1916,10 @@ remove_clicked_cb (GtkButton *btn, EventPage *epage)
}
/* Select closest item after removal */
- valid_iter = gtk_tree_model_get_iter (GTK_TREE_MODEL (priv->model), &iter, path);
+ valid_iter = gtk_tree_model_get_iter (GTK_TREE_MODEL (priv->meeting_store), &iter, path);
if (!valid_iter) {
gtk_tree_path_prev (path);
- valid_iter = gtk_tree_model_get_iter (GTK_TREE_MODEL (priv->model), &iter, path);
+ valid_iter = gtk_tree_model_get_iter (GTK_TREE_MODEL (priv->meeting_store), &iter, path);
}
if (valid_iter) {
@@ -1963,7 +1967,7 @@ attendee_added_cb (EMeetingListView *emlv,
gtk_widget_set_sensitive (priv->add, FALSE);
gtk_widget_set_sensitive (priv->edit, FALSE);
- delegator = e_meeting_store_find_attendee (priv->model, priv->user_add, NULL);
+ delegator = e_meeting_store_find_attendee (priv->meeting_store, priv->user_add, NULL);
g_return_if_fail (delegator != NULL);
e_meeting_attendee_set_delto (delegator, g_strdup (e_meeting_attendee_get_address (ia)));
@@ -1983,7 +1987,7 @@ list_view_event (EMeetingListView *list_view, GdkEvent *event, EventPage *epage)
if (event->type == GDK_2BUTTON_PRESS && flags & COMP_EDITOR_USER_ORG) {
EMeetingAttendee *attendee;
- attendee = e_meeting_store_add_attendee_with_defaults (priv->model);
+ attendee = e_meeting_store_add_attendee_with_defaults (priv->meeting_store);
if (flags & COMP_EDITOR_DELEGATE) {
e_meeting_attendee_set_delfrom (attendee, g_strdup_printf ("MAILTO:%s", epage->priv->user_add));
@@ -2081,8 +2085,10 @@ event_page_set_all_day_event (EventPage *epage, gboolean all_day)
/* The event is within one day, so we set the event
start to the start of the working day, and the end
to one hour later. */
- start_tt.hour = calendar_config_get_day_start_hour ();
- start_tt.minute = calendar_config_get_day_start_minute ();
+ start_tt.hour =
+ comp_editor_get_work_day_start_hour (editor);
+ start_tt.minute =
+ comp_editor_get_work_day_start_minute (editor);
start_tt.second = 0;
end_tt = start_tt;
@@ -2271,7 +2277,7 @@ get_widgets (EventPage *epage)
priv->attendee_box = GW ("attendee-box");
priv->org_cal_label = GW ("org-cal-label");
- priv->list_view = e_meeting_list_view_new (priv->model);
+ priv->list_view = e_meeting_list_view_new (priv->meeting_store);
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
@@ -2630,7 +2636,7 @@ source_changed_cb (ESourceComboBox *source_combo_box, EventPage *epage)
if (client) {
icaltimezone *zone;
- zone = calendar_config_get_icaltimezone ();
+ zone = e_meeting_store_get_timezone (epage->priv->meeting_store);
e_cal_set_default_timezone (client, zone, NULL);
}
@@ -2743,7 +2749,7 @@ alarm_changed_cb (GtkWidget *widget,
case ALARM_USER_TIME:
e_alarm_list_clear (priv->alarm_list_store);
- switch (calendar_config_get_default_reminder_units ()) {
+ switch (e_meeting_store_get_default_reminder_units (priv->meeting_store)) {
case E_DURATION_DAYS:
trigger.u.rel_duration.days = priv->alarm_interval;
break;
@@ -2859,12 +2865,16 @@ init_widgets (EventPage *epage)
/* Make sure the EDateEdit widgets use our timezones to get the
current time. */
- e_date_edit_set_get_time_callback (E_DATE_EDIT (priv->start_time),
- (EDateEditGetTimeCallback) comp_editor_get_current_time,
- epage, NULL);
- e_date_edit_set_get_time_callback (E_DATE_EDIT (priv->end_time),
- (EDateEditGetTimeCallback) comp_editor_get_current_time,
- epage, NULL);
+ e_date_edit_set_get_time_callback (
+ E_DATE_EDIT (priv->start_time),
+ (EDateEditGetTimeCallback) comp_editor_get_current_time,
+ g_object_ref (editor),
+ (GDestroyNotify) g_object_unref);
+ e_date_edit_set_get_time_callback (
+ E_DATE_EDIT (priv->end_time),
+ (EDateEditGetTimeCallback) comp_editor_get_current_time,
+ g_object_ref (editor),
+ (GDestroyNotify) g_object_unref);
/* Generic informative messages */
gtk_widget_hide (priv->info_hbox);
@@ -2987,8 +2997,12 @@ init_widgets (EventPage *epage)
g_signal_connect (priv->minute_selector, "value-changed", G_CALLBACK (minute_sel_changed), epage);
/* Add the user defined time if necessary */
- priv->alarm_units = calendar_config_get_default_reminder_units ();
- priv->alarm_interval = calendar_config_get_default_reminder_interval ();
+ priv->alarm_units =
+ e_meeting_store_get_default_reminder_units (
+ priv->meeting_store);
+ priv->alarm_interval =
+ e_meeting_store_get_default_reminder_interval (
+ priv->meeting_store);
combo_label = NULL;
switch (priv->alarm_units) {
@@ -3057,7 +3071,7 @@ init_widgets (EventPage *epage)
G_CALLBACK (comp_editor_page_changed), epage);
/* Set the default timezone, so the timezone entry may be hidden. */
- zone = calendar_config_get_icaltimezone ();
+ zone = e_meeting_store_get_timezone (priv->meeting_store);
e_timezone_entry_set_default_timezone (E_TIMEZONE_ENTRY (priv->start_timezone), zone);
e_timezone_entry_set_default_timezone (E_TIMEZONE_ENTRY (priv->end_timezone), zone);
@@ -3137,15 +3151,15 @@ event_page_select_organizer (EventPage *epage, const gchar *backend_address)
* created.
**/
EventPage *
-event_page_construct (EventPage *epage, EMeetingStore *model)
+event_page_construct (EventPage *epage,
+ EMeetingStore *meeting_store)
{
EventPagePrivate *priv;
EIterator *it;
EAccount *a;
priv = epage->priv;
- g_object_ref (model);
- priv->model = model;
+ priv->meeting_store = g_object_ref (meeting_store);
/* Make sure our custom widget classes are registered with
* GType before we load the GtkBuilder definition file. */
@@ -3210,12 +3224,13 @@ event_page_construct (EventPage *epage, EMeetingStore *model)
* not be created.
**/
EventPage *
-event_page_new (EMeetingStore *model, CompEditor *editor)
+event_page_new (EMeetingStore *meeting_store,
+ CompEditor *editor)
{
EventPage *epage;
epage = g_object_new (TYPE_EVENT_PAGE, "editor", editor, NULL);
- if (!event_page_construct (epage, model)) {
+ if (!event_page_construct (epage, meeting_store)) {
g_object_unref (epage);
g_return_val_if_reached (NULL);
}
@@ -3298,7 +3313,7 @@ event_page_add_attendee (EventPage *epage, EMeetingAttendee *attendee)
e_meeting_attendee_set_delfrom (attendee, g_strdup_printf ("MAILTO:%s", epage->priv->user_add));
}
- e_meeting_store_add_attendee (priv->model, attendee);
+ e_meeting_store_add_attendee (priv->meeting_store, attendee);
e_meeting_list_view_add_attendee_to_name_selector (E_MEETING_LIST_VIEW (priv->list_view), attendee);
}
@@ -3317,7 +3332,7 @@ event_page_remove_all_attendees (EventPage *epage)
priv = epage->priv;
- e_meeting_store_remove_all_attendees (priv->model);
+ e_meeting_store_remove_all_attendees (priv->meeting_store);
e_meeting_list_view_remove_all_attendees_from_name_selector (E_MEETING_LIST_VIEW (priv->list_view));
}
diff --git a/calendar/gui/dialogs/event-page.h b/calendar/gui/dialogs/event-page.h
index 3cfff34..04665eb 100644
--- a/calendar/gui/dialogs/event-page.h
+++ b/calendar/gui/dialogs/event-page.h
@@ -70,8 +70,8 @@ struct _EventPageClass {
GType event_page_get_type (void);
EventPage * event_page_construct (EventPage *epage,
- EMeetingStore *model);
-EventPage * event_page_new (EMeetingStore *model,
+ EMeetingStore *meeting_store);
+EventPage * event_page_new (EMeetingStore *meeting_store,
CompEditor *editor);
ECalComponent * event_page_get_cancel_comp (EventPage *page);
void event_page_show_options (EventPage *page);
diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c
index f5ef574..dd8cda9 100644
--- a/calendar/gui/dialogs/recurrence-page.c
+++ b/calendar/gui/dialogs/recurrence-page.c
@@ -36,7 +36,6 @@
#include <misc/e-dateedit.h>
#include <libecal/e-cal-recur.h>
#include <libecal/e-cal-time-util.h>
-#include "../calendar-config.h"
#include "../tag-calendar.h"
#include "../weekday-picker.h"
#include "comp-editor-util.h"
@@ -190,6 +189,9 @@ struct _RecurrencePagePrivate {
/* For the recurrence preview, the actual widget */
GtkWidget *preview_calendar;
+
+ /* This just holds some settings we need */
+ EMeetingStore *meeting_store;
};
@@ -324,6 +326,11 @@ recurrence_page_dispose (GObject *object)
priv->exception_list_store = NULL;
}
+ if (priv->meeting_store != NULL) {
+ g_object_unref (priv->meeting_store);
+ priv->meeting_store = NULL;
+ }
+
/* Chain up to parent's dispose() method. */
G_OBJECT_CLASS (recurrence_page_parent_class)->dispose (object);
}
@@ -436,7 +443,7 @@ clear_widgets (RecurrencePage *rpage)
g_signal_handlers_unblock_matched (priv->interval_unit_combo, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage);
priv->ending_date_tt = icaltime_today ();
- priv->ending_count = calendar_config_get_default_count ();
+ priv->ending_count = 2;
g_signal_handlers_block_matched (priv->ending_combo, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage);
e_dialog_combo_box_set (priv->ending_combo,
@@ -672,7 +679,7 @@ simple_recur_to_comp (RecurrencePage *rpage, ECalComponent *comp)
r.interval = gtk_spin_button_get_value_as_int (
GTK_SPIN_BUTTON (priv->interval_value));
r.week_start = ICAL_SUNDAY_WEEKDAY
- + calendar_config_get_week_start_day ();
+ + e_meeting_store_get_week_start_day (priv->meeting_store);
/* Frequency-specific data */
@@ -947,6 +954,7 @@ make_weekly_special (RecurrencePage *rpage)
GtkWidget *hbox;
GtkWidget *label;
WeekdayPicker *wp;
+ gint week_start_day;
priv = rpage->priv;
@@ -972,7 +980,8 @@ make_weekly_special (RecurrencePage *rpage)
/* Set the weekdays */
- weekday_picker_set_week_start_day (wp, calendar_config_get_week_start_day ());
+ week_start_day = e_meeting_store_get_week_start_day (priv->meeting_store);
+ weekday_picker_set_week_start_day (wp, week_start_day);
weekday_picker_set_days (wp, priv->weekday_day_mask);
g_signal_connect_swapped (
@@ -1381,9 +1390,11 @@ make_ending_until_special (RecurrencePage *rpage)
/* Make sure the EDateEdit widget uses our timezones to get the
current time. */
- e_date_edit_set_get_time_callback (de,
- (EDateEditGetTimeCallback) comp_editor_get_current_time,
- rpage, NULL);
+ e_date_edit_set_get_time_callback (
+ de,
+ (EDateEditGetTimeCallback) comp_editor_get_current_time,
+ g_object_ref (editor),
+ (GDestroyNotify) g_object_unref);
}
/* Creates the special contents for the occurrence count case */
@@ -1504,7 +1515,7 @@ fill_ending_date (RecurrencePage *rpage, struct icalrecurrencetype *r)
e_cal_component_get_dtstart (priv->comp, &dt);
if (dt.value->is_date)
- to_zone = calendar_config_get_icaltimezone ();
+ to_zone = e_meeting_store_get_timezone (priv->meeting_store);
else if (dt.tzid == NULL)
to_zone = icaltimezone_get_utc_timezone ();
else
@@ -2282,9 +2293,11 @@ init_widgets (RecurrencePage *rpage)
priv->preview_calendar);
gtk_widget_show (priv->preview_calendar);
- e_calendar_item_set_get_time_callback (ecal->calitem,
- (ECalendarItemGetTimeCallback) comp_editor_get_current_time,
- rpage, NULL);
+ e_calendar_item_set_get_time_callback (
+ ecal->calitem,
+ (ECalendarItemGetTimeCallback) comp_editor_get_current_time,
+ g_object_ref (editor),
+ (GDestroyNotify) g_object_unref);
/* Recurrence types */
@@ -2334,6 +2347,11 @@ init_widgets (RecurrencePage *rpage)
gtk_tree_view_set_model (GTK_TREE_VIEW (priv->exception_list),
GTK_TREE_MODEL (priv->exception_list_store));
+ g_object_bind_property (
+ editor, "use-24-hour-format",
+ priv->exception_list_store, "use-24-hour-format",
+ G_BINDING_SYNC_CREATE);
+
/* View */
column = gtk_tree_view_column_new ();
gtk_tree_view_column_set_title (column, _("Date/Time"));
@@ -2356,11 +2374,15 @@ init_widgets (RecurrencePage *rpage)
* created.
**/
RecurrencePage *
-recurrence_page_construct (RecurrencePage *rpage)
+recurrence_page_construct (RecurrencePage *rpage,
+ EMeetingStore *meeting_store)
{
- RecurrencePagePrivate *priv = rpage->priv;
+ RecurrencePagePrivate *priv;
CompEditor *editor;
+ priv = rpage->priv;
+ priv->meeting_store = g_object_ref (meeting_store);
+
editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (rpage));
priv->builder = gtk_builder_new ();
@@ -2390,14 +2412,16 @@ recurrence_page_construct (RecurrencePage *rpage)
* be created.
**/
RecurrencePage *
-recurrence_page_new (CompEditor *editor)
+recurrence_page_new (EMeetingStore *meeting_store,
+ CompEditor *editor)
{
RecurrencePage *rpage;
+ g_return_val_if_fail (E_IS_MEETING_STORE (meeting_store), NULL);
g_return_val_if_fail (IS_COMP_EDITOR (editor), NULL);
rpage = g_object_new (TYPE_RECURRENCE_PAGE, "editor", editor, NULL);
- if (!recurrence_page_construct (rpage)) {
+ if (!recurrence_page_construct (rpage, meeting_store)) {
g_object_unref (rpage);
g_return_val_if_reached (NULL);
}
diff --git a/calendar/gui/dialogs/recurrence-page.h b/calendar/gui/dialogs/recurrence-page.h
index 1dce00d..709b5ae 100644
--- a/calendar/gui/dialogs/recurrence-page.h
+++ b/calendar/gui/dialogs/recurrence-page.h
@@ -32,6 +32,7 @@
#include "comp-editor.h"
#include "comp-editor-page.h"
+#include "../e-meeting-store.h"
/* Standard GObject macros */
#define TYPE_RECURRENCE_PAGE \
@@ -68,8 +69,10 @@ struct _RecurrencePageClass {
};
GType recurrence_page_get_type (void);
-RecurrencePage *recurrence_page_construct (RecurrencePage *rpage);
-RecurrencePage *recurrence_page_new (CompEditor *editor);
+RecurrencePage *recurrence_page_construct (RecurrencePage *rpage,
+ EMeetingStore *meeting_store);
+RecurrencePage *recurrence_page_new (EMeetingStore *meeting_store,
+ CompEditor *editor);
G_END_DECLS
diff --git a/calendar/gui/dialogs/schedule-page.c b/calendar/gui/dialogs/schedule-page.c
index efc6795..4d23488 100644
--- a/calendar/gui/dialogs/schedule-page.c
+++ b/calendar/gui/dialogs/schedule-page.c
@@ -34,7 +34,6 @@
#include <e-util/e-dialog-widgets.h>
#include <e-util/e-util-private.h>
#include <misc/e-dateedit.h>
-#include "../calendar-config.h"
#include "../e-meeting-time-sel.h"
#include "../itip-utils.h"
#include "comp-editor-util.h"
@@ -385,11 +384,12 @@ schedule_page_construct (SchedulePage *spage, EMeetingStore *ems)
/* Selector */
priv->sel = E_MEETING_TIME_SELECTOR (e_meeting_time_selector_new (ems));
gtk_widget_set_size_request ((GtkWidget *) priv->sel, -1, 400);
- e_meeting_time_selector_set_working_hours (priv->sel,
- calendar_config_get_day_start_hour (),
- calendar_config_get_day_start_minute (),
- calendar_config_get_day_end_hour (),
- calendar_config_get_day_end_minute ());
+ e_meeting_time_selector_set_working_hours (
+ priv->sel,
+ comp_editor_get_work_day_start_hour (editor),
+ comp_editor_get_work_day_start_minute (editor),
+ comp_editor_get_work_day_end_hour (editor),
+ comp_editor_get_work_day_end_minute (editor));
gtk_widget_show (GTK_WIDGET (priv->sel));
gtk_box_pack_start (GTK_BOX (priv->main), GTK_WIDGET (priv->sel), TRUE, TRUE, 6);
diff --git a/calendar/gui/dialogs/task-details-page.c b/calendar/gui/dialogs/task-details-page.c
index ec63458..43f38a2 100644
--- a/calendar/gui/dialogs/task-details-page.c
+++ b/calendar/gui/dialogs/task-details-page.c
@@ -33,7 +33,6 @@
#include <glib/gi18n.h>
#include <misc/e-dateedit.h>
#include <misc/e-url-entry.h>
-#include "../calendar-config.h"
#include "../e-timezone-entry.h"
#include "comp-editor-util.h"
#include "task-details-page.h"
@@ -227,12 +226,15 @@ task_details_page_fill_widgets (CompEditorPage *page,
gint *priority_value, *percent = NULL;
TaskEditorPriority priority;
icalproperty_status status;
+ CompEditor *editor;
const gchar *url;
struct icaltimetype *completed = NULL;
tdpage = TASK_DETAILS_PAGE (page);
priv = tdpage->priv;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (tdpage));
+
/* Clean the screen */
clear_widgets (tdpage);
@@ -274,7 +276,7 @@ task_details_page_fill_widgets (CompEditorPage *page,
/* Completed is in UTC, but that would confuse the user, so
we convert it to local time. */
utc_zone = icaltimezone_get_utc_timezone ();
- zone = calendar_config_get_icaltimezone ();
+ zone = comp_editor_get_timezone (editor);
icaltimezone_convert_time (completed, utc_zone, zone);
@@ -316,14 +318,18 @@ task_details_page_fill_component (CompEditorPage *page,
struct icaltimetype icalcomplete, icaltoday;
icalproperty_status status;
TaskEditorPriority priority;
+ CompEditor *editor;
gint priority_value, percent;
gchar *url;
gboolean date_set;
- icaltimezone *zone = calendar_config_get_icaltimezone ();
+ icaltimezone *zone;
tdpage = TASK_DETAILS_PAGE (page);
priv = tdpage->priv;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (tdpage));
+ zone = comp_editor_get_timezone (editor);
+
/* Percent Complete. */
percent = gtk_spin_button_get_value_as_int (
GTK_SPIN_BUTTON (priv->percent_complete));
@@ -661,14 +667,19 @@ init_widgets (TaskDetailsPage *tdpage)
{
TaskDetailsPagePrivate *priv;
GtkAdjustment *adjustment;
+ CompEditor *editor;
priv = tdpage->priv;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (tdpage));
+
/* Make sure the EDateEdit widgets use our timezones to get the
current time. */
- e_date_edit_set_get_time_callback (E_DATE_EDIT (priv->completed_date),
- (EDateEditGetTimeCallback) comp_editor_get_current_time,
- tdpage, NULL);
+ e_date_edit_set_get_time_callback (
+ E_DATE_EDIT (priv->completed_date),
+ (EDateEditGetTimeCallback) comp_editor_get_current_time,
+ g_object_ref (editor),
+ (GDestroyNotify) g_object_unref);
/* These are created by hand, so hook the mnemonics manually */
gtk_label_set_mnemonic_widget (
diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c
index 68fa61c..9b2df7d 100644
--- a/calendar/gui/dialogs/task-page.c
+++ b/calendar/gui/dialogs/task-page.c
@@ -40,7 +40,6 @@
#include <e-util/e-dialog-utils.h>
#include "common/authentication.h"
#include "../e-timezone-entry.h"
-#include "../calendar-config.h"
#include "comp-editor.h"
#include "comp-editor-util.h"
#include "e-send-options-utils.h"
@@ -588,7 +587,7 @@ task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
e_cal_component_free_text_list (l);
e_buffer_tagger_update_tags (GTK_TEXT_VIEW (priv->description));
- default_zone = calendar_config_get_icaltimezone ();
+ default_zone = comp_editor_get_timezone (editor);
/* Due Date. */
e_cal_component_get_due (comp, &d);
@@ -938,8 +937,10 @@ task_page_fill_component (CompEditorPage *page, ECalComponent *comp)
e_cal_component_set_classification (comp, classification);
/* send options */
- if (priv->sendoptions_shown && priv->sod)
- e_send_options_utils_fill_component (priv->sod, comp);
+ if (priv->sendoptions_shown && priv->sod) {
+ icaltimezone *zone = comp_editor_get_timezone (editor);
+ e_send_options_utils_fill_component (priv->sod, comp, zone);
+ }
/* Categories */
cat = e_dialog_editable_get (priv->categories);
@@ -1726,7 +1727,7 @@ source_changed_cb (ESourceComboBox *source_combo_box, TaskPage *tpage)
if (client) {
icaltimezone *zone;
- zone = calendar_config_get_icaltimezone ();
+ zone = comp_editor_get_timezone (editor);
e_cal_set_default_timezone (client, zone, NULL);
}
@@ -1842,12 +1843,16 @@ init_widgets (TaskPage *tpage)
/* Make sure the EDateEdit widgets use our timezones to get the
current time. */
- e_date_edit_set_get_time_callback (E_DATE_EDIT (priv->start_date),
- (EDateEditGetTimeCallback) comp_editor_get_current_time,
- tpage, NULL);
- e_date_edit_set_get_time_callback (E_DATE_EDIT (priv->due_date),
- (EDateEditGetTimeCallback) comp_editor_get_current_time,
- tpage, NULL);
+ e_date_edit_set_get_time_callback (
+ E_DATE_EDIT (priv->start_date),
+ (EDateEditGetTimeCallback) comp_editor_get_current_time,
+ g_object_ref (editor),
+ (GDestroyNotify) g_object_unref);
+ e_date_edit_set_get_time_callback (
+ E_DATE_EDIT (priv->due_date),
+ (EDateEditGetTimeCallback) comp_editor_get_current_time,
+ g_object_ref (editor),
+ (GDestroyNotify) g_object_unref);
/* Generic informative messages */
gtk_widget_hide (priv->info_hbox);
@@ -1931,7 +1936,7 @@ init_widgets (TaskPage *tpage)
g_signal_connect (priv->list_view, "attendee_added", G_CALLBACK (attendee_added_cb), tpage);
/* Set the default timezone, so the timezone entry may be hidden. */
- zone = calendar_config_get_icaltimezone ();
+ zone = comp_editor_get_timezone (editor);
e_timezone_entry_set_default_timezone (E_TIMEZONE_ENTRY (priv->timezone), zone);
action = comp_editor_get_action (editor, "view-time-zone");
diff --git a/calendar/gui/e-cal-component-preview.c b/calendar/gui/e-cal-component-preview.c
index da7e853..dc23153 100644
--- a/calendar/gui/e-cal-component-preview.c
+++ b/calendar/gui/e-cal-component-preview.c
@@ -33,15 +33,12 @@
#include <libedataserver/e-time-utils.h>
#include <e-util/e-util.h>
#include <e-util/e-categories-config.h>
-#include "calendar-config.h"
#define E_CAL_COMPONENT_PREVIEW_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
((obj), E_TYPE_CAL_COMPONENT_PREVIEW, ECalComponentPreviewPrivate))
struct _ECalComponentPreviewPrivate {
- icaltimezone *zone;
-
/* information about currently showing component in a preview;
if it didn't change then the preview is not updated */
gchar *cal_uid;
@@ -132,7 +129,8 @@ update_comp_info (ECalComponentPreview *preview,
static gchar *
timet_to_str_with_zone (ECalComponentDateTime *dt,
ECal *ecal,
- icaltimezone *default_zone)
+ icaltimezone *default_zone,
+ gboolean use_24_hour_format)
{
struct icaltimetype itt;
icaltimezone *zone;
@@ -154,8 +152,9 @@ timet_to_str_with_zone (ECalComponentDateTime *dt,
icaltimezone_convert_time (&itt, zone, default_zone);
tm = icaltimetype_to_tm (&itt);
- e_time_format_date_and_time (&tm, calendar_config_get_24_hour_format (),
- FALSE, FALSE, buf, sizeof (buf));
+ e_time_format_date_and_time (
+ &tm, use_24_hour_format,
+ FALSE, FALSE, buf, sizeof (buf));
return g_locale_to_utf8 (buf, -1, NULL, NULL, NULL);
}
@@ -164,7 +163,8 @@ static void
cal_component_preview_write_html (GString *buffer,
ECal *ecal,
ECalComponent *comp,
- icaltimezone *default_zone)
+ icaltimezone *default_zone,
+ gboolean use_24_hour_format)
{
ECalComponentText text;
ECalComponentDateTime dt;
@@ -239,7 +239,8 @@ cal_component_preview_write_html (GString *buffer,
/* write start date */
e_cal_component_get_dtstart (comp, &dt);
if (dt.value != NULL) {
- str = timet_to_str_with_zone (&dt, ecal, default_zone);
+ str = timet_to_str_with_zone (
+ &dt, ecal, default_zone, use_24_hour_format);
g_string_append_printf (
buffer, "<TR><TD VALIGN=\"TOP\" ALIGN=\"RIGHT\">"
"<B>%s</B></TD><TD>%s</TD></TR>",
@@ -252,7 +253,8 @@ cal_component_preview_write_html (GString *buffer,
/* write end date */
e_cal_component_get_dtend (comp, &dt);
if (dt.value != NULL) {
- str = timet_to_str_with_zone (&dt, ecal, default_zone);
+ str = timet_to_str_with_zone (
+ &dt, ecal, default_zone, use_24_hour_format);
g_string_append_printf (
buffer, "<TR><TD VALIGN=\"TOP\" ALIGN=\"RIGHT\">"
"<B>%s</B></TD><TD>%s</TD></TR>",
@@ -265,7 +267,8 @@ cal_component_preview_write_html (GString *buffer,
/* write Due Date */
e_cal_component_get_due (comp, &dt);
if (dt.value != NULL) {
- str = timet_to_str_with_zone (&dt, ecal, default_zone);
+ str = timet_to_str_with_zone (
+ &dt, ecal, default_zone, use_24_hour_format);
g_string_append_printf (
buffer, "<TR><TD VALIGN=\"TOP\" ALIGN=\"RIGHT\">"
"<B>%s</B></TD><TD>%s</TD></TR>",
@@ -402,8 +405,6 @@ static void
cal_component_preview_init (ECalComponentPreview *preview)
{
preview->priv = E_CAL_COMPONENT_PREVIEW_GET_PRIVATE (preview);
-
- preview->priv->zone = icaltimezone_get_utc_timezone ();
}
GType
@@ -439,28 +440,12 @@ e_cal_component_preview_new (void)
return g_object_new (E_TYPE_CAL_COMPONENT_PREVIEW, NULL);
}
-icaltimezone *
-e_cal_component_preview_get_default_timezone (ECalComponentPreview *preview)
-{
- g_return_val_if_fail (E_IS_CAL_COMPONENT_PREVIEW (preview), NULL);
-
- return preview->priv->zone;
-}
-
-void
-e_cal_component_preview_set_default_timezone (ECalComponentPreview *preview,
- icaltimezone *zone)
-{
- g_return_if_fail (E_IS_CAL_COMPONENT_PREVIEW (preview));
- g_return_if_fail (zone != NULL);
-
- preview->priv->zone = zone;
-}
-
void
e_cal_component_preview_display (ECalComponentPreview *preview,
ECal *ecal,
- ECalComponent *comp)
+ ECalComponent *comp,
+ icaltimezone *zone,
+ gboolean use_24_hour_format)
{
GString *buffer;
@@ -476,7 +461,7 @@ e_cal_component_preview_display (ECalComponentPreview *preview,
buffer = g_string_sized_new (4096);
cal_component_preview_write_html (
- buffer, ecal, comp, preview->priv->zone);
+ buffer, ecal, comp, zone, use_24_hour_format);
e_web_view_load_string (E_WEB_VIEW (preview), buffer->str);
g_string_free (buffer, TRUE);
}
diff --git a/calendar/gui/e-cal-component-preview.h b/calendar/gui/e-cal-component-preview.h
index 89888af..f713df7 100644
--- a/calendar/gui/e-cal-component-preview.h
+++ b/calendar/gui/e-cal-component-preview.h
@@ -62,19 +62,17 @@ struct _ECalComponentPreviewClass {
EWebViewClass parent_class;
/* Notification signals */
- void (* selection_changed) (ECalComponentPreview *preview, gint n_selected);
+ void (*selection_changed) (ECalComponentPreview *preview,
+ gint n_selected);
};
GType e_cal_component_preview_get_type (void);
GtkWidget * e_cal_component_preview_new (void);
-icaltimezone * e_cal_component_preview_get_default_timezone
- (ECalComponentPreview *preview);
-void e_cal_component_preview_set_default_timezone
- (ECalComponentPreview *preview,
- icaltimezone *zone);
void e_cal_component_preview_display (ECalComponentPreview *preview,
ECal *ecal,
- ECalComponent *comp);
+ ECalComponent *comp,
+ icaltimezone *zone,
+ gboolean use_24_hour_format);
void e_cal_component_preview_clear (ECalComponentPreview *preview);
G_END_DECLS
diff --git a/calendar/gui/e-cal-config.c b/calendar/gui/e-cal-config.c
index 0454706..10dc316 100644
--- a/calendar/gui/e-cal-config.c
+++ b/calendar/gui/e-cal-config.c
@@ -56,7 +56,6 @@ ecp_target_free (EConfig *ec, EConfigTarget *t)
}
break; }
case EC_CONFIG_TARGET_PREFS: {
- /* ECalConfigTargetPrefs *s = (ECalConfigTargetPrefs *)t; */
break; }
}
}
@@ -155,13 +154,11 @@ e_cal_config_target_new_source (ECalConfig *ecp, struct _ESource *source)
}
ECalConfigTargetPrefs *
-e_cal_config_target_new_prefs (ECalConfig *ecp, struct _GConfClient *gconf)
+e_cal_config_target_new_prefs (ECalConfig *ecp)
{
ECalConfigTargetPrefs *t = e_config_target_new (&ecp->config, EC_CONFIG_TARGET_PREFS, sizeof (*t));
- t->gconf = gconf;
- if (gconf)
- g_object_ref (gconf);
+ t->gconf = gconf_client_get_default ();
return t;
}
diff --git a/calendar/gui/e-cal-config.h b/calendar/gui/e-cal-config.h
index 30e12bb..68dca3e 100644
--- a/calendar/gui/e-cal-config.h
+++ b/calendar/gui/e-cal-config.h
@@ -69,7 +69,7 @@ GType e_cal_config_get_type (void);
ECalConfig *e_cal_config_new (gint type, const gchar *menuid);
ECalConfigTargetSource *e_cal_config_target_new_source (ECalConfig *ecp, struct _ESource *source);
-ECalConfigTargetPrefs *e_cal_config_target_new_prefs (ECalConfig *ecp, struct _GConfClient *gconf);
+ECalConfigTargetPrefs *e_cal_config_target_new_prefs (ECalConfig *ecp);
G_END_DECLS
diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c
index ddea112..294b54c 100644
--- a/calendar/gui/e-cal-model.c
+++ b/calendar/gui/e-cal-model.c
@@ -36,8 +36,9 @@
#include "e-cal-model.h"
#include "itip-utils.h"
#include "misc.h"
-#include "e-util/e-extensible.h"
#include "e-util/e-util.h"
+#include "e-util/e-extensible.h"
+#include "e-util/e-util-enumtypes.h"
#define E_CAL_MODEL_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
@@ -87,13 +88,30 @@ struct _ECalModelPrivate {
/* Whether we display dates in 24-hour format. */
gboolean use_24_hour_format;
+ /* Whether to compress weekends into one cell. */
+ gboolean compress_weekend;
+
/* First day of the week: 0 (Monday) to 6 (Sunday) */
gint week_start_day;
+ /* Work day timespan */
+ gint work_day_start_hour;
+ gint work_day_start_minute;
+ gint work_day_end_hour;
+ gint work_day_end_minute;
+
/* callback, to retrieve start time for newly added rows by click-to-add */
ECalModelDefaultTimeFunc get_default_time;
gpointer get_default_time_user_data;
+ /* Default reminder for events */
+ gboolean use_default_reminder;
+ gint default_reminder_interval;
+ EDurationType default_reminder_units;
+
+ /* Ask user to confirm before deleting components. */
+ gboolean confirm_delete;
+
gboolean in_added;
gboolean in_modified;
gboolean in_removed;
@@ -126,10 +144,19 @@ static void remove_client (ECalModel *model, ECalModelClient *client_data);
enum {
PROP_0,
+ PROP_COMPRESS_WEEKEND,
+ PROP_CONFIRM_DELETE,
PROP_DEFAULT_CLIENT,
+ PROP_DEFAULT_REMINDER_INTERVAL,
+ PROP_DEFAULT_REMINDER_UNITS,
PROP_TIMEZONE,
PROP_USE_24_HOUR_FORMAT,
- PROP_WEEK_START_DAY
+ PROP_USE_DEFAULT_REMINDER,
+ PROP_WEEK_START_DAY,
+ PROP_WORK_DAY_END_HOUR,
+ PROP_WORK_DAY_END_MINUTE,
+ PROP_WORK_DAY_START_HOUR,
+ PROP_WORK_DAY_START_MINUTE
};
enum {
@@ -160,12 +187,36 @@ cal_model_set_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
+ case PROP_COMPRESS_WEEKEND:
+ e_cal_model_set_compress_weekend (
+ E_CAL_MODEL (object),
+ g_value_get_boolean (value));
+ return;
+
+ case PROP_CONFIRM_DELETE:
+ e_cal_model_set_confirm_delete (
+ E_CAL_MODEL (object),
+ g_value_get_boolean (value));
+ return;
+
case PROP_DEFAULT_CLIENT:
e_cal_model_set_default_client (
E_CAL_MODEL (object),
g_value_get_object (value));
return;
+ case PROP_DEFAULT_REMINDER_INTERVAL:
+ e_cal_model_set_default_reminder_interval (
+ E_CAL_MODEL (object),
+ g_value_get_int (value));
+ return;
+
+ case PROP_DEFAULT_REMINDER_UNITS:
+ e_cal_model_set_default_reminder_units (
+ E_CAL_MODEL (object),
+ g_value_get_enum (value));
+ return;
+
case PROP_TIMEZONE:
e_cal_model_set_timezone (
E_CAL_MODEL (object),
@@ -178,11 +229,41 @@ cal_model_set_property (GObject *object,
g_value_get_boolean (value));
return;
+ case PROP_USE_DEFAULT_REMINDER:
+ e_cal_model_set_use_default_reminder (
+ E_CAL_MODEL (object),
+ g_value_get_boolean (value));
+ return;
+
case PROP_WEEK_START_DAY:
e_cal_model_set_week_start_day (
E_CAL_MODEL (object),
g_value_get_int (value));
return;
+
+ case PROP_WORK_DAY_END_HOUR:
+ e_cal_model_set_work_day_end_hour (
+ E_CAL_MODEL (object),
+ g_value_get_int (value));
+ return;
+
+ case PROP_WORK_DAY_END_MINUTE:
+ e_cal_model_set_work_day_end_minute (
+ E_CAL_MODEL (object),
+ g_value_get_int (value));
+ return;
+
+ case PROP_WORK_DAY_START_HOUR:
+ e_cal_model_set_work_day_start_hour (
+ E_CAL_MODEL (object),
+ g_value_get_int (value));
+ return;
+
+ case PROP_WORK_DAY_START_MINUTE:
+ e_cal_model_set_work_day_start_minute (
+ E_CAL_MODEL (object),
+ g_value_get_int (value));
+ return;
}
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -195,6 +276,20 @@ cal_model_get_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
+ case PROP_COMPRESS_WEEKEND:
+ g_value_set_boolean (
+ value,
+ e_cal_model_get_compress_weekend (
+ E_CAL_MODEL (object)));
+ return;
+
+ case PROP_CONFIRM_DELETE:
+ g_value_set_boolean (
+ value,
+ e_cal_model_get_confirm_delete (
+ E_CAL_MODEL (object)));
+ return;
+
case PROP_DEFAULT_CLIENT:
g_value_set_object (
value,
@@ -202,6 +297,20 @@ cal_model_get_property (GObject *object,
E_CAL_MODEL (object)));
return;
+ case PROP_DEFAULT_REMINDER_INTERVAL:
+ g_value_set_int (
+ value,
+ e_cal_model_get_default_reminder_interval (
+ E_CAL_MODEL (object)));
+ return;
+
+ case PROP_DEFAULT_REMINDER_UNITS:
+ g_value_set_enum (
+ value,
+ e_cal_model_get_default_reminder_units (
+ E_CAL_MODEL (object)));
+ return;
+
case PROP_TIMEZONE:
g_value_set_pointer (
value,
@@ -216,12 +325,47 @@ cal_model_get_property (GObject *object,
E_CAL_MODEL (object)));
return;
+ case PROP_USE_DEFAULT_REMINDER:
+ g_value_set_boolean (
+ value,
+ e_cal_model_get_use_default_reminder (
+ E_CAL_MODEL (object)));
+ return;
+
case PROP_WEEK_START_DAY:
g_value_set_int (
value,
e_cal_model_get_week_start_day (
E_CAL_MODEL (object)));
return;
+
+ case PROP_WORK_DAY_END_HOUR:
+ g_value_set_int (
+ value,
+ e_cal_model_get_work_day_end_hour (
+ E_CAL_MODEL (object)));
+ return;
+
+ case PROP_WORK_DAY_END_MINUTE:
+ g_value_set_int (
+ value,
+ e_cal_model_get_work_day_end_minute (
+ E_CAL_MODEL (object)));
+ return;
+
+ case PROP_WORK_DAY_START_HOUR:
+ g_value_set_int (
+ value,
+ e_cal_model_get_work_day_start_hour (
+ E_CAL_MODEL (object)));
+ return;
+
+ case PROP_WORK_DAY_START_MINUTE:
+ g_value_set_int (
+ value,
+ e_cal_model_get_work_day_start_minute (
+ E_CAL_MODEL (object)));
+ return;
}
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -335,6 +479,26 @@ e_cal_model_class_init (ECalModelClass *class)
g_object_class_install_property (
object_class,
+ PROP_COMPRESS_WEEKEND,
+ g_param_spec_boolean (
+ "compress-weekend",
+ "Compress Weekend",
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_CONFIRM_DELETE,
+ g_param_spec_boolean (
+ "confirm-delete",
+ "Confirm Delete",
+ NULL,
+ TRUE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
PROP_DEFAULT_CLIENT,
g_param_spec_object (
"default-client",
@@ -345,6 +509,29 @@ e_cal_model_class_init (ECalModelClass *class)
g_object_class_install_property (
object_class,
+ PROP_DEFAULT_REMINDER_INTERVAL,
+ g_param_spec_int (
+ "default-reminder-interval",
+ "Default Reminder Interval",
+ NULL,
+ G_MININT,
+ G_MAXINT,
+ 0,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_DEFAULT_REMINDER_UNITS,
+ g_param_spec_enum (
+ "default-reminder-units",
+ "Default Reminder Units",
+ NULL,
+ E_TYPE_DURATION_TYPE,
+ E_DURATION_MINUTES,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
PROP_TIMEZONE,
g_param_spec_pointer (
"timezone",
@@ -364,6 +551,16 @@ e_cal_model_class_init (ECalModelClass *class)
g_object_class_install_property (
object_class,
+ PROP_USE_DEFAULT_REMINDER,
+ g_param_spec_boolean (
+ "use-default-reminder",
+ "Use Default Reminder",
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
PROP_WEEK_START_DAY,
g_param_spec_int (
"week-start-day",
@@ -374,6 +571,54 @@ e_cal_model_class_init (ECalModelClass *class)
0,
G_PARAM_READWRITE));
+ g_object_class_install_property (
+ object_class,
+ PROP_WORK_DAY_END_HOUR,
+ g_param_spec_int (
+ "work-day-end-hour",
+ "Work Day End Hour",
+ NULL,
+ 0,
+ 23,
+ 0,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_WORK_DAY_END_MINUTE,
+ g_param_spec_int (
+ "work-day-end-minute",
+ "Work Day End Minute",
+ NULL,
+ 0,
+ 59,
+ 0,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_WORK_DAY_START_HOUR,
+ g_param_spec_int (
+ "work-day-start-hour",
+ "Work Day Start Hour",
+ NULL,
+ 0,
+ 23,
+ 0,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_WORK_DAY_START_MINUTE,
+ g_param_spec_int (
+ "work-day-start-minute",
+ "Work Day Start Minute",
+ NULL,
+ 0,
+ 59,
+ 0,
+ G_PARAM_READWRITE));
+
signals[TIME_RANGE_CHANGED] =
g_signal_new ("time_range_changed",
G_TYPE_FROM_CLASS (class),
@@ -1351,26 +1596,39 @@ ecm_get_color_for_component (ECalModel *model, ECalModelComponent *comp_data)
return assigned_colors[first_empty].color;
}
+gboolean
+e_cal_model_get_confirm_delete (ECalModel *model)
+{
+ g_return_val_if_fail (E_IS_CAL_MODEL (model), FALSE);
+
+ return model->priv->confirm_delete;
+}
+
+void
+e_cal_model_set_confirm_delete (ECalModel *model,
+ gboolean confirm_delete)
+{
+ g_return_if_fail (E_IS_CAL_MODEL (model));
+
+ model->priv->confirm_delete = confirm_delete;
+
+ g_object_notify (G_OBJECT (model), "confirm-delete");
+}
+
icalcomponent_kind
e_cal_model_get_component_kind (ECalModel *model)
{
- ECalModelPrivate *priv;
-
g_return_val_if_fail (E_IS_CAL_MODEL (model), ICAL_NO_COMPONENT);
- priv = model->priv;
- return priv->kind;
+ return model->priv->kind;
}
void
e_cal_model_set_component_kind (ECalModel *model, icalcomponent_kind kind)
{
- ECalModelPrivate *priv;
-
g_return_if_fail (E_IS_CAL_MODEL (model));
- priv = model->priv;
- priv->kind = kind;
+ model->priv->kind = kind;
}
ECalModelFlags
@@ -1420,6 +1678,25 @@ e_cal_model_set_timezone (ECalModel *model,
old_zone, zone);
}
+gboolean
+e_cal_model_get_compress_weekend (ECalModel *model)
+{
+ g_return_val_if_fail (E_IS_CAL_MODEL (model), FALSE);
+
+ return model->priv->compress_weekend;
+}
+
+void
+e_cal_model_set_compress_weekend (ECalModel *model,
+ gboolean compress_weekend)
+{
+ g_return_if_fail (E_IS_CAL_MODEL (model));
+
+ model->priv->compress_weekend = compress_weekend;
+
+ g_object_notify (G_OBJECT (model), "compress-weekend");
+}
+
void
e_cal_model_set_default_category (ECalModel *model,
const gchar *default_category)
@@ -1430,6 +1707,44 @@ e_cal_model_set_default_category (ECalModel *model,
model->priv->default_category = g_strdup (default_category);
}
+gint
+e_cal_model_get_default_reminder_interval (ECalModel *model)
+{
+ g_return_val_if_fail (E_IS_CAL_MODEL (model), 0);
+
+ return model->priv->default_reminder_interval;
+}
+
+void
+e_cal_model_set_default_reminder_interval (ECalModel *model,
+ gint default_reminder_interval)
+{
+ g_return_if_fail (E_IS_CAL_MODEL (model));
+
+ model->priv->default_reminder_interval = default_reminder_interval;
+
+ g_object_notify (G_OBJECT (model), "default-reminder-interval");
+}
+
+EDurationType
+e_cal_model_get_default_reminder_units (ECalModel *model)
+{
+ g_return_val_if_fail (E_IS_CAL_MODEL (model), 0);
+
+ return model->priv->default_reminder_units;
+}
+
+void
+e_cal_model_set_default_reminder_units (ECalModel *model,
+ EDurationType default_reminder_units)
+{
+ g_return_if_fail (E_IS_CAL_MODEL (model));
+
+ model->priv->default_reminder_units = default_reminder_units;
+
+ g_object_notify (G_OBJECT (model), "default-reminder-units");
+}
+
gboolean
e_cal_model_get_use_24_hour_format (ECalModel *model)
{
@@ -1456,6 +1771,25 @@ e_cal_model_set_use_24_hour_format (ECalModel *model,
g_object_notify (G_OBJECT (model), "use-24-hour-format");
}
+gboolean
+e_cal_model_get_use_default_reminder (ECalModel *model)
+{
+ g_return_val_if_fail (E_IS_CAL_MODEL (model), FALSE);
+
+ return model->priv->use_default_reminder;
+}
+
+void
+e_cal_model_set_use_default_reminder (ECalModel *model,
+ gboolean use_default_reminder)
+{
+ g_return_if_fail (E_IS_CAL_MODEL (model));
+
+ model->priv->use_default_reminder = use_default_reminder;
+
+ g_object_notify (G_OBJECT (model), "use-default-reminder");
+}
+
gint
e_cal_model_get_week_start_day (ECalModel *model)
{
@@ -1480,6 +1814,82 @@ e_cal_model_set_week_start_day (ECalModel *model,
g_object_notify (G_OBJECT (model), "week-start-day");
}
+gint
+e_cal_model_get_work_day_end_hour (ECalModel *model)
+{
+ g_return_val_if_fail (E_IS_CAL_MODEL (model), 0);
+
+ return model->priv->work_day_end_hour;
+}
+
+void
+e_cal_model_set_work_day_end_hour (ECalModel *model,
+ gint work_day_end_hour)
+{
+ g_return_if_fail (E_IS_CAL_MODEL (model));
+
+ model->priv->work_day_end_hour = work_day_end_hour;
+
+ g_object_notify (G_OBJECT (model), "work-day-end-hour");
+}
+
+gint
+e_cal_model_get_work_day_end_minute (ECalModel *model)
+{
+ g_return_val_if_fail (E_IS_CAL_MODEL (model), 0);
+
+ return model->priv->work_day_end_minute;
+}
+
+void
+e_cal_model_set_work_day_end_minute (ECalModel *model,
+ gint work_day_end_minute)
+{
+ g_return_if_fail (E_IS_CAL_MODEL (model));
+
+ model->priv->work_day_end_minute = work_day_end_minute;
+
+ g_object_notify (G_OBJECT (model), "work-day-end-minute");
+}
+
+gint
+e_cal_model_get_work_day_start_hour (ECalModel *model)
+{
+ g_return_val_if_fail (E_IS_CAL_MODEL (model), 0);
+
+ return model->priv->work_day_start_hour;
+}
+
+void
+e_cal_model_set_work_day_start_hour (ECalModel *model,
+ gint work_day_start_hour)
+{
+ g_return_if_fail (E_IS_CAL_MODEL (model));
+
+ model->priv->work_day_start_hour = work_day_start_hour;
+
+ g_object_notify (G_OBJECT (model), "work-day-start-hour");
+}
+
+gint
+e_cal_model_get_work_day_start_minute (ECalModel *model)
+{
+ g_return_val_if_fail (E_IS_CAL_MODEL (model), 0);
+
+ return model->priv->work_day_start_minute;
+}
+
+void
+e_cal_model_set_work_day_start_minute (ECalModel *model,
+ gint work_day_start_minute)
+{
+ g_return_if_fail (E_IS_CAL_MODEL (model));
+
+ model->priv->work_day_start_minute = work_day_start_minute;
+
+ g_object_notify (G_OBJECT (model), "work-day-start-minute");
+}
+
ECal *
e_cal_model_get_default_client (ECalModel *model)
{
@@ -2558,7 +2968,11 @@ e_cal_model_create_component_with_defaults (ECalModel *model, gboolean all_day)
switch (priv->kind) {
case ICAL_VEVENT_COMPONENT :
- comp = cal_comp_event_new_with_defaults (client, all_day);
+ comp = cal_comp_event_new_with_defaults (
+ client, all_day,
+ e_cal_model_get_use_default_reminder (model),
+ e_cal_model_get_default_reminder_interval (model),
+ e_cal_model_get_default_reminder_units (model));
break;
case ICAL_VTODO_COMPONENT :
comp = cal_comp_task_new_with_defaults (client);
diff --git a/calendar/gui/e-cal-model.h b/calendar/gui/e-cal-model.h
index ec883a7..db744d3 100644
--- a/calendar/gui/e-cal-model.h
+++ b/calendar/gui/e-cal-model.h
@@ -26,6 +26,7 @@
#ifndef E_CAL_MODEL_H
#define E_CAL_MODEL_H
+#include <e-util/e-util-enums.h>
#include <table/e-table-model.h>
#include <libecal/e-cal.h>
#include "e-cell-date-edit-text.h"
@@ -185,22 +186,66 @@ icalcomponent_kind
e_cal_model_get_component_kind (ECalModel *model);
void e_cal_model_set_component_kind (ECalModel *model,
icalcomponent_kind kind);
+gboolean e_cal_model_get_confirm_delete (ECalModel *model);
+void e_cal_model_set_confirm_delete (ECalModel *model,
+ gboolean confirm_delete);
ECalModelFlags e_cal_model_get_flags (ECalModel *model);
void e_cal_model_set_flags (ECalModel *model,
ECalModelFlags flags);
icaltimezone * e_cal_model_get_timezone (ECalModel *model);
void e_cal_model_set_timezone (ECalModel *model,
icaltimezone *zone);
-void e_cal_model_set_default_category (ECalModel *model,
+gboolean e_cal_model_get_compress_weekend
+ (ECalModel *model);
+void e_cal_model_set_compress_weekend
+ (ECalModel *model,
+ gboolean compress_weekend);
+void e_cal_model_set_default_category
+ (ECalModel *model,
const gchar *default_cat);
+gint e_cal_model_get_default_reminder_interval
+ (ECalModel *model);
+void e_cal_model_set_default_reminder_interval
+ (ECalModel *model,
+ gint def_reminder_interval);
+EDurationType e_cal_model_get_default_reminder_units
+ (ECalModel *model);
+void e_cal_model_set_default_reminder_units
+ (ECalModel *model,
+ EDurationType def_reminder_units);
gboolean e_cal_model_get_use_24_hour_format
(ECalModel *model);
void e_cal_model_set_use_24_hour_format
(ECalModel *model,
gboolean use24);
+gboolean e_cal_model_get_use_default_reminder
+ (ECalModel *model);
+void e_cal_model_set_use_default_reminder
+ (ECalModel *model,
+ gboolean use_def_reminder);
gint e_cal_model_get_week_start_day (ECalModel *model);
void e_cal_model_set_week_start_day (ECalModel *model,
gint week_start_day);
+gint e_cal_model_get_work_day_end_hour
+ (ECalModel *model);
+void e_cal_model_set_work_day_end_hour
+ (ECalModel *model,
+ gint work_day_end_hour);
+gint e_cal_model_get_work_day_end_minute
+ (ECalModel *model);
+void e_cal_model_set_work_day_end_minute
+ (ECalModel *model,
+ gint work_day_end_minute);
+gint e_cal_model_get_work_day_start_hour
+ (ECalModel *model);
+void e_cal_model_set_work_day_start_hour
+ (ECalModel *model,
+ gint work_day_start_hour);
+gint e_cal_model_get_work_day_start_minute
+ (ECalModel *model);
+void e_cal_model_set_work_day_start_minute
+ (ECalModel *model,
+ gint work_day_start_minute);
ECal * e_cal_model_get_default_client (ECalModel *model);
void e_cal_model_set_default_client (ECalModel *model,
ECal *client);
diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c
index 94f4579..a9e6d68 100644
--- a/calendar/gui/e-calendar-view.c
+++ b/calendar/gui/e-calendar-view.c
@@ -44,7 +44,6 @@
#include <shell/e-shell.h>
#include "common/authentication.h"
-#include "calendar-config.h"
#include "comp-util.h"
#include "ea-calendar.h"
#include "e-cal-model-calendar.h"
@@ -76,8 +75,8 @@ struct _ECalendarViewPrivate {
/* The calendar model we are monitoring */
ECalModel *model;
- /* The default category */
gchar *default_category;
+ gint time_divisions;
GtkTargetList *copy_target_list;
GtkTargetList *paste_target_list;
@@ -87,7 +86,8 @@ enum {
PROP_0,
PROP_COPY_TARGET_LIST,
PROP_MODEL,
- PROP_PASTE_TARGET_LIST
+ PROP_PASTE_TARGET_LIST,
+ PROP_TIME_DIVISIONS
};
/* FIXME Why are we emitting these event signals here? Can't the model just be listened to? */
@@ -168,14 +168,17 @@ static void
calendar_view_delete_event (ECalendarView *cal_view,
ECalendarViewEvent *event)
{
+ ECalModel *model;
ECalComponent *comp;
ECalComponentVType vtype;
- gboolean delete = FALSE;
+ gboolean delete = TRUE;
GError *error = NULL;
if (!is_comp_data_valid (event))
return;
+ model = e_calendar_view_get_model (cal_view);
+
comp = e_cal_component_new ();
e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
vtype = e_cal_component_get_vtype (comp);
@@ -214,8 +217,9 @@ calendar_view_delete_event (ECalendarView *cal_view,
}
}
}
- } else
- delete = delete_component_dialog (comp, FALSE, 1, vtype, GTK_WIDGET (cal_view));
+ } else if (e_cal_model_get_confirm_delete (model))
+ delete = delete_component_dialog (
+ comp, FALSE, 1, vtype, GTK_WIDGET (cal_view));
if (delete) {
const gchar *uid;
@@ -270,6 +274,12 @@ calendar_view_set_property (GObject *object,
E_CALENDAR_VIEW (object),
g_value_get_object (value));
return;
+
+ case PROP_TIME_DIVISIONS:
+ e_calendar_view_set_time_divisions (
+ E_CALENDAR_VIEW (object),
+ g_value_get_int (value));
+ return;
}
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -299,6 +309,12 @@ calendar_view_get_property (GObject *object,
value, e_calendar_view_get_paste_target_list (
E_CALENDAR_VIEW (object)));
return;
+
+ case PROP_TIME_DIVISIONS:
+ g_value_set_int (
+ value, e_calendar_view_get_time_divisions (
+ E_CALENDAR_VIEW (object)));
+ return;
}
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -632,7 +648,7 @@ clipboard_get_calendar_data (ECalendarView *cal_view,
if (!icalcomp)
return;
- default_zone = calendar_config_get_icaltimezone ();
+ default_zone = e_cal_model_get_timezone (cal_view->priv->model);
client = e_cal_model_get_default_client (cal_view->priv->model);
/* check the type of the component */
@@ -800,6 +816,18 @@ e_calendar_view_class_init (ECalendarViewClass *class)
PROP_PASTE_TARGET_LIST,
"paste-target-list");
+ g_object_class_install_property (
+ object_class,
+ PROP_TIME_DIVISIONS,
+ g_param_spec_int (
+ "time-divisions",
+ "Time Divisions",
+ NULL,
+ G_MININT,
+ G_MAXINT,
+ 30,
+ G_PARAM_READWRITE));
+
signals[POPUP_EVENT] = g_signal_new (
"popup-event",
G_TYPE_FROM_CLASS (class),
@@ -895,6 +923,9 @@ e_calendar_view_init (ECalendarView *calendar_view)
calendar_view->priv = E_CALENDAR_VIEW_GET_PRIVATE (calendar_view);
+ /* Set this early to avoid a divide-by-zero during init. */
+ calendar_view->priv->time_divisions = 30;
+
target_list = gtk_target_list_new (NULL, 0);
e_target_list_add_calendar_targets (target_list, 0);
calendar_view->priv->copy_target_list = target_list;
@@ -971,7 +1002,7 @@ e_calendar_view_add_event (ECalendarView *cal_view, ECal *client, time_t dtstart
/* copy & paste from top canvas to main canvas */
gint time_divisions;
- time_divisions = calendar_config_get_time_divisions ();
+ time_divisions = e_calendar_view_get_time_divisions (cal_view);
ic_dur = icaldurationtype_from_int (time_divisions * 60);
}
@@ -1136,6 +1167,25 @@ e_calendar_view_get_paste_target_list (ECalendarView *cal_view)
return cal_view->priv->paste_target_list;
}
+gint
+e_calendar_view_get_time_divisions (ECalendarView *cal_view)
+{
+ g_return_val_if_fail (E_IS_CALENDAR_VIEW (cal_view), 0);
+
+ return cal_view->priv->time_divisions;
+}
+
+void
+e_calendar_view_set_time_divisions (ECalendarView *cal_view,
+ gint time_divisions)
+{
+ g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
+
+ cal_view->priv->time_divisions = time_divisions;
+
+ g_object_notify (G_OBJECT (cal_view), "time-divisions");
+}
+
GList *
e_calendar_view_get_selected_events (ECalendarView *cal_view)
{
@@ -1213,12 +1263,15 @@ void
e_calendar_view_delete_selected_occurrence (ECalendarView *cal_view)
{
GList *selected;
+ ECalModel *model;
ECalComponent *comp;
ECalendarViewEvent *event;
ECalComponentVType vtype;
- gboolean delete = FALSE;
+ gboolean delete = TRUE;
GError *error = NULL;
+ model = e_calendar_view_get_model (cal_view);
+
selected = e_calendar_view_get_selected_events (cal_view);
if (!selected)
return;
@@ -1258,8 +1311,9 @@ e_calendar_view_delete_selected_occurrence (ECalendarView *cal_view)
}
}
}
- } else
- delete = delete_component_dialog (comp, FALSE, 1, vtype, GTK_WIDGET (cal_view));
+ } else if (e_cal_model_get_confirm_delete (model))
+ delete = delete_component_dialog (
+ comp, FALSE, 1, vtype, GTK_WIDGET (cal_view));
if (delete) {
const gchar *uid;
@@ -1466,13 +1520,19 @@ e_calendar_view_new_appointment_for (ECalendarView *cal_view,
* to the 'day begins' from preferences in other selected day.
*/
void
-e_calendar_view_new_appointment_full (ECalendarView *cal_view, gboolean all_day, gboolean meeting, gboolean no_past_date)
+e_calendar_view_new_appointment_full (ECalendarView *cal_view,
+ gboolean all_day,
+ gboolean meeting,
+ gboolean no_past_date)
{
+ ECalModel *model;
time_t dtstart, dtend, now;
gboolean do_rounding = FALSE;
g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
+ model = e_calendar_view_get_model (cal_view);
+
now = time (NULL);
if (!e_calendar_view_get_selected_time_range (cal_view, &dtstart, &dtend)) {
@@ -1490,7 +1550,7 @@ e_calendar_view_new_appointment_full (ECalendarView *cal_view, gboolean all_day,
/* time in this cases; dtstart should be a midnight in this case */
if (do_rounding || (!all_day && (dtend - dtstart) == (60 * 60 * 24))) {
struct tm local = *localtime (&now);
- gint time_div = calendar_config_get_time_divisions ();
+ gint time_div = e_calendar_view_get_time_divisions (cal_view);
gint hours, mins;
if (!time_div) /* Possible if your gconf values aren't so nice */
@@ -1507,8 +1567,8 @@ e_calendar_view_new_appointment_full (ECalendarView *cal_view, gboolean all_day,
mins = (mins - (mins % time_div));
} else {
/* other day than today */
- hours = calendar_config_get_day_start_hour ();
- mins = calendar_config_get_day_start_minute ();
+ hours = e_cal_model_get_work_day_start_hour (model);
+ mins = e_cal_model_get_work_day_start_minute (model);
}
dtstart = dtstart + (60 * 60 * hours) + (mins * 60);
diff --git a/calendar/gui/e-calendar-view.h b/calendar/gui/e-calendar-view.h
index 1b3759e..7804eed 100644
--- a/calendar/gui/e-calendar-view.h
+++ b/calendar/gui/e-calendar-view.h
@@ -163,6 +163,11 @@ const gchar * e_calendar_view_get_default_category
void e_calendar_view_set_default_category
(ECalendarView *cal_view,
const gchar *category);
+gint e_calendar_view_get_time_divisions
+ (ECalendarView *cal_view);
+void e_calendar_view_set_time_divisions
+ (ECalendarView *cal_view,
+ gint time_divisions);
void e_calendar_view_set_status_message
(ECalendarView *cal_view,
const gchar *message,
diff --git a/calendar/gui/e-date-time-list.c b/calendar/gui/e-date-time-list.c
index ab343a1..0b6afa3 100644
--- a/calendar/gui/e-date-time-list.c
+++ b/calendar/gui/e-date-time-list.c
@@ -26,133 +26,57 @@
#include <libedataserver/e-time-utils.h>
#include "e-date-time-list.h"
#include <libecal/e-cal-time-util.h>
-#include "calendar-config.h"
+
+/* XXX Was it really necessary to implement a custom GtkTreeModel for a
+ * one-column list store? There's no mention of why this was done. */
#define G_LIST(x) ((GList *) x)
#define E_DATE_TIME_LIST_IS_SORTED(list) (E_DATE_TIME_LIST (list)->sort_column_id != -2)
#define IS_VALID_ITER(dt_list, iter) (iter!= NULL && iter->user_data != NULL && \
dt_list->stamp == iter->stamp)
-static GType column_types[E_DATE_TIME_LIST_NUM_COLUMNS];
+enum {
+ PROP_0,
+ PROP_USE_24_HOUR_FORMAT
+};
-static void e_date_time_list_init (EDateTimeList *file_list);
-static void e_date_time_list_class_init (EDateTimeListClass *class);
-static void e_date_time_list_tree_model_init (GtkTreeModelIface *iface);
-static void e_date_time_list_finalize (GObject *object);
-static GtkTreeModelFlags e_date_time_list_get_flags (GtkTreeModel *tree_model);
-static gint e_date_time_list_get_n_columns (GtkTreeModel *tree_model);
-static GType e_date_time_list_get_column_type (GtkTreeModel *tree_model,
- gint index);
-static gboolean e_date_time_list_get_iter (GtkTreeModel *tree_model,
- GtkTreeIter *iter,
- GtkTreePath *path);
-static GtkTreePath *e_date_time_list_get_path (GtkTreeModel *tree_model,
- GtkTreeIter *iter);
-static void e_date_time_list_get_value (GtkTreeModel *tree_model,
- GtkTreeIter *iter,
- gint column,
- GValue *value);
-static gboolean e_date_time_list_iter_next (GtkTreeModel *tree_model,
- GtkTreeIter *iter);
-static gboolean e_date_time_list_iter_children (GtkTreeModel *tree_model,
- GtkTreeIter *iter,
- GtkTreeIter *parent);
-static gboolean e_date_time_list_iter_has_child (GtkTreeModel *tree_model,
- GtkTreeIter *iter);
-static gint e_date_time_list_iter_n_children (GtkTreeModel *tree_model,
- GtkTreeIter *iter);
-static gboolean e_date_time_list_iter_nth_child (GtkTreeModel *tree_model,
- GtkTreeIter *iter,
- GtkTreeIter *parent,
- gint n);
-static gboolean e_date_time_list_iter_parent (GtkTreeModel *tree_model,
- GtkTreeIter *iter,
- GtkTreeIter *child);
-
-static GObjectClass *parent_class = NULL;
-
-GType
-e_date_time_list_get_type (void)
-{
- static GType date_time_list_type = 0;
-
- if (!date_time_list_type) {
- static const GTypeInfo date_time_list_info =
- {
- sizeof (EDateTimeListClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) e_date_time_list_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EDateTimeList),
- 0,
- (GInstanceInitFunc) e_date_time_list_init,
- };
-
- static const GInterfaceInfo tree_model_info =
- {
- (GInterfaceInitFunc) e_date_time_list_tree_model_init,
- NULL,
- NULL
- };
-
- column_types[E_DATE_TIME_LIST_COLUMN_DESCRIPTION] = G_TYPE_STRING;
+static GType column_types[E_DATE_TIME_LIST_NUM_COLUMNS];
- date_time_list_type = g_type_register_static (G_TYPE_OBJECT, "EDateTimeList",
- &date_time_list_info, 0);
- g_type_add_interface_static (date_time_list_type,
- GTK_TYPE_TREE_MODEL,
- &tree_model_info);
- }
+static void e_date_time_list_tree_model_init (GtkTreeModelIface *iface);
- return date_time_list_type;
-}
+G_DEFINE_TYPE_WITH_CODE (
+ EDateTimeList, e_date_time_list, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (
+ GTK_TYPE_TREE_MODEL, e_date_time_list_tree_model_init))
static void
-e_date_time_list_class_init (EDateTimeListClass *class)
+free_datetime (ECalComponentDateTime *datetime)
{
- GObjectClass *object_class;
-
- parent_class = g_type_class_peek_parent (class);
- object_class = (GObjectClass*) class;
-
- object_class->finalize = e_date_time_list_finalize;
+ g_free (datetime->value);
+ if (datetime->tzid)
+ g_free ((gchar *) datetime->tzid);
+ g_free (datetime);
}
-static void
-e_date_time_list_tree_model_init (GtkTreeModelIface *iface)
+static ECalComponentDateTime *
+copy_datetime (const ECalComponentDateTime *datetime)
{
- iface->get_flags = e_date_time_list_get_flags;
- iface->get_n_columns = e_date_time_list_get_n_columns;
- iface->get_column_type = e_date_time_list_get_column_type;
- iface->get_iter = e_date_time_list_get_iter;
- iface->get_path = e_date_time_list_get_path;
- iface->get_value = e_date_time_list_get_value;
- iface->iter_next = e_date_time_list_iter_next;
- iface->iter_children = e_date_time_list_iter_children;
- iface->iter_has_child = e_date_time_list_iter_has_child;
- iface->iter_n_children = e_date_time_list_iter_n_children;
- iface->iter_nth_child = e_date_time_list_iter_nth_child;
- iface->iter_parent = e_date_time_list_iter_parent;
-}
+ ECalComponentDateTime *datetime_copy;
-static void
-e_date_time_list_init (EDateTimeList *date_time_list)
-{
- date_time_list->stamp = g_random_int ();
- date_time_list->columns_dirty = FALSE;
- date_time_list->list = NULL;
-}
+ datetime_copy = g_new0 (ECalComponentDateTime, 1);
+ datetime_copy->value = g_new (struct icaltimetype, 1);
+ *datetime_copy->value = *datetime->value;
-EDateTimeList *
-e_date_time_list_new (void)
-{
- EDateTimeList *date_time_list;
+ if (datetime->tzid)
+ datetime_copy->tzid = g_strdup (datetime->tzid);
- date_time_list = E_DATE_TIME_LIST (g_object_new (e_date_time_list_get_type (), NULL));
+ return datetime_copy;
+}
- return date_time_list;
+static gint
+compare_datetime (const ECalComponentDateTime *datetime1, const ECalComponentDateTime *datetime2)
+{
+ return icaltime_compare (*datetime1->value, *datetime2->value);
}
static void
@@ -217,16 +141,74 @@ row_updated (EDateTimeList *date_time_list, gint n)
gtk_tree_path_free (path);
}
+/* Builds a static string out of an exception date */
+static gchar *
+get_exception_string (EDateTimeList *date_time_list,
+ ECalComponentDateTime *dt)
+{
+ static gchar buf[256];
+ struct tm tmp_tm;
+ gboolean use_24_hour_format;
+
+ use_24_hour_format =
+ e_date_time_list_get_use_24_hour_format (date_time_list);
+
+ tmp_tm.tm_year = dt->value->year - 1900;
+ tmp_tm.tm_mon = dt->value->month - 1;
+ tmp_tm.tm_mday = dt->value->day;
+ tmp_tm.tm_hour = dt->value->hour;
+ tmp_tm.tm_min = dt->value->minute;
+ tmp_tm.tm_sec = dt->value->second;
+ tmp_tm.tm_isdst = -1;
+
+ tmp_tm.tm_wday = time_day_of_week (dt->value->day,
+ dt->value->month - 1,
+ dt->value->year);
+
+ e_time_format_date_and_time (
+ &tmp_tm, use_24_hour_format,
+ FALSE, FALSE, buf, sizeof (buf));
+
+ return buf;
+}
+
+static void
+date_time_list_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_USE_24_HOUR_FORMAT:
+ e_date_time_list_set_use_24_hour_format (
+ E_DATE_TIME_LIST (object),
+ g_value_get_boolean (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
static void
-e_date_time_list_finalize (GObject *object)
+date_time_list_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- if (G_OBJECT_CLASS (parent_class)->finalize)
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
+ switch (property_id) {
+ case PROP_USE_24_HOUR_FORMAT:
+ g_value_set_boolean (
+ value,
+ e_date_time_list_get_use_24_hour_format (
+ E_DATE_TIME_LIST (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
-/* Fulfill the GtkTreeModel requirements */
static GtkTreeModelFlags
-e_date_time_list_get_flags (GtkTreeModel *tree_model)
+date_time_list_get_flags (GtkTreeModel *tree_model)
{
g_return_val_if_fail (E_IS_DATE_TIME_LIST (tree_model), 0);
@@ -234,7 +216,7 @@ e_date_time_list_get_flags (GtkTreeModel *tree_model)
}
static gint
-e_date_time_list_get_n_columns (GtkTreeModel *tree_model)
+date_time_list_get_n_columns (GtkTreeModel *tree_model)
{
EDateTimeList *date_time_list = (EDateTimeList *) tree_model;
@@ -245,8 +227,8 @@ e_date_time_list_get_n_columns (GtkTreeModel *tree_model)
}
static GType
-e_date_time_list_get_column_type (GtkTreeModel *tree_model,
- gint index)
+date_time_list_get_column_type (GtkTreeModel *tree_model,
+ gint index)
{
EDateTimeList *date_time_list = (EDateTimeList *) tree_model;
@@ -258,105 +240,10 @@ e_date_time_list_get_column_type (GtkTreeModel *tree_model,
return column_types[index];
}
-const ECalComponentDateTime *
-e_date_time_list_get_date_time (EDateTimeList *date_time_list, GtkTreeIter *iter)
-{
- g_return_val_if_fail (IS_VALID_ITER (date_time_list, iter), NULL);
-
- return G_LIST (iter->user_data)->data;
-}
-
-static void
-free_datetime (ECalComponentDateTime *datetime)
-{
- g_free (datetime->value);
- if (datetime->tzid)
- g_free ((gchar *) datetime->tzid);
- g_free (datetime);
-}
-
-static ECalComponentDateTime *
-copy_datetime (const ECalComponentDateTime *datetime)
-{
- ECalComponentDateTime *datetime_copy;
-
- datetime_copy = g_new0 (ECalComponentDateTime, 1);
- datetime_copy->value = g_new (struct icaltimetype, 1);
- *datetime_copy->value = *datetime->value;
-
- if (datetime->tzid)
- datetime_copy->tzid = g_strdup (datetime->tzid);
-
- return datetime_copy;
-}
-
-static gint
-compare_datetime (const ECalComponentDateTime *datetime1, const ECalComponentDateTime *datetime2)
-{
- return icaltime_compare (*datetime1->value, *datetime2->value);
-}
-
-void
-e_date_time_list_set_date_time (EDateTimeList *date_time_list, GtkTreeIter *iter,
- const ECalComponentDateTime *datetime)
-{
- ECalComponentDateTime *datetime_old;
-
- g_return_if_fail (IS_VALID_ITER (date_time_list, iter));
-
- datetime_old = G_LIST (iter->user_data)->data;
- free_datetime (datetime_old);
- G_LIST (iter->user_data)->data = copy_datetime (datetime);
- row_updated (date_time_list, g_list_position (date_time_list->list, G_LIST (iter->user_data)));
-}
-
-void
-e_date_time_list_append (EDateTimeList *date_time_list, GtkTreeIter *iter,
- const ECalComponentDateTime *datetime)
-{
- g_return_if_fail (datetime != NULL);
-
- if (g_list_find_custom (date_time_list->list, datetime, (GCompareFunc)compare_datetime) == NULL) {
- date_time_list->list = g_list_append (date_time_list->list, copy_datetime (datetime));
- row_added (date_time_list, g_list_length (date_time_list->list) - 1);
- }
-
- if (iter) {
- iter->user_data = g_list_last (date_time_list->list);
- iter->stamp = date_time_list->stamp;
- }
-}
-
-void
-e_date_time_list_remove (EDateTimeList *date_time_list, GtkTreeIter *iter)
-{
- gint n;
-
- g_return_if_fail (IS_VALID_ITER (date_time_list, iter));
-
- n = g_list_position (date_time_list->list, G_LIST (iter->user_data));
- free_datetime ((ECalComponentDateTime *) G_LIST (iter->user_data)->data);
- date_time_list->list = g_list_delete_link (date_time_list->list, G_LIST (iter->user_data));
- row_deleted (date_time_list, n);
-}
-
-void
-e_date_time_list_clear (EDateTimeList *date_time_list)
-{
- GList *l;
-
- all_rows_deleted (date_time_list);
-
- for (l = date_time_list->list; l; l = g_list_next (l)) {
- free_datetime ((ECalComponentDateTime *) l->data);
- }
-
- g_list_free (date_time_list->list);
- date_time_list->list = NULL;
-}
-
static gboolean
-e_date_time_list_get_iter (GtkTreeModel *tree_model, GtkTreeIter *iter, GtkTreePath *path)
+date_time_list_get_iter (GtkTreeModel *tree_model,
+ GtkTreeIter *iter,
+ GtkTreePath *path)
{
EDateTimeList *date_time_list = (EDateTimeList *) tree_model;
GList *l;
@@ -381,8 +268,8 @@ e_date_time_list_get_iter (GtkTreeModel *tree_model, GtkTreeIter *iter, GtkTreeP
}
static GtkTreePath *
-e_date_time_list_get_path (GtkTreeModel *tree_model,
- GtkTreeIter *iter)
+date_time_list_get_path (GtkTreeModel *tree_model,
+ GtkTreeIter *iter)
{
EDateTimeList *date_time_list = (EDateTimeList *) tree_model;
GtkTreePath *retval;
@@ -397,36 +284,11 @@ e_date_time_list_get_path (GtkTreeModel *tree_model,
return retval;
}
-/* Builds a static string out of an exception date */
-static gchar *
-get_exception_string (ECalComponentDateTime *dt)
-{
- static gchar buf[256];
- struct tm tmp_tm;
-
- tmp_tm.tm_year = dt->value->year - 1900;
- tmp_tm.tm_mon = dt->value->month - 1;
- tmp_tm.tm_mday = dt->value->day;
- tmp_tm.tm_hour = dt->value->hour;
- tmp_tm.tm_min = dt->value->minute;
- tmp_tm.tm_sec = dt->value->second;
- tmp_tm.tm_isdst = -1;
-
- tmp_tm.tm_wday = time_day_of_week (dt->value->day,
- dt->value->month - 1,
- dt->value->year);
-
- e_time_format_date_and_time (&tmp_tm, calendar_config_get_24_hour_format (),
- FALSE, FALSE, buf, sizeof (buf));
-
- return buf;
-}
-
static void
-e_date_time_list_get_value (GtkTreeModel *tree_model,
- GtkTreeIter *iter,
- gint column,
- GValue *value)
+date_time_list_get_value (GtkTreeModel *tree_model,
+ GtkTreeIter *iter,
+ gint column,
+ GValue *value)
{
EDateTimeList *date_time_list = E_DATE_TIME_LIST (tree_model);
ECalComponentDateTime *datetime;
@@ -451,15 +313,15 @@ e_date_time_list_get_value (GtkTreeModel *tree_model,
switch (column) {
case E_DATE_TIME_LIST_COLUMN_DESCRIPTION:
- str = get_exception_string (datetime);
+ str = get_exception_string (date_time_list, datetime);
g_value_set_string (value, str);
break;
}
}
static gboolean
-e_date_time_list_iter_next (GtkTreeModel *tree_model,
- GtkTreeIter *iter)
+date_time_list_iter_next (GtkTreeModel *tree_model,
+ GtkTreeIter *iter)
{
GList *l;
@@ -480,9 +342,9 @@ e_date_time_list_iter_next (GtkTreeModel *tree_model,
}
static gboolean
-e_date_time_list_iter_children (GtkTreeModel *tree_model,
- GtkTreeIter *iter,
- GtkTreeIter *parent)
+date_time_list_iter_children (GtkTreeModel *tree_model,
+ GtkTreeIter *iter,
+ GtkTreeIter *parent)
{
EDateTimeList *date_time_list = E_DATE_TIME_LIST (tree_model);
@@ -502,16 +364,16 @@ e_date_time_list_iter_children (GtkTreeModel *tree_model,
}
static gboolean
-e_date_time_list_iter_has_child (GtkTreeModel *tree_model,
- GtkTreeIter *iter)
+date_time_list_iter_has_child (GtkTreeModel *tree_model,
+ GtkTreeIter *iter)
{
g_return_val_if_fail (IS_VALID_ITER (E_DATE_TIME_LIST (tree_model), iter), FALSE);
return FALSE;
}
static gint
-e_date_time_list_iter_n_children (GtkTreeModel *tree_model,
- GtkTreeIter *iter)
+date_time_list_iter_n_children (GtkTreeModel *tree_model,
+ GtkTreeIter *iter)
{
EDateTimeList *date_time_list = E_DATE_TIME_LIST (tree_model);
@@ -525,10 +387,10 @@ e_date_time_list_iter_n_children (GtkTreeModel *tree_model,
}
static gboolean
-e_date_time_list_iter_nth_child (GtkTreeModel *tree_model,
- GtkTreeIter *iter,
- GtkTreeIter *parent,
- gint n)
+date_time_list_iter_nth_child (GtkTreeModel *tree_model,
+ GtkTreeIter *iter,
+ GtkTreeIter *parent,
+ gint n)
{
EDateTimeList *date_time_list = E_DATE_TIME_LIST (tree_model);
@@ -553,9 +415,148 @@ e_date_time_list_iter_nth_child (GtkTreeModel *tree_model,
}
static gboolean
-e_date_time_list_iter_parent (GtkTreeModel *tree_model,
- GtkTreeIter *iter,
- GtkTreeIter *child)
+date_time_list_iter_parent (GtkTreeModel *tree_model,
+ GtkTreeIter *iter,
+ GtkTreeIter *child)
{
return FALSE;
}
+
+static void
+e_date_time_list_class_init (EDateTimeListClass *class)
+{
+ GObjectClass *object_class;
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = date_time_list_set_property;
+ object_class->get_property = date_time_list_get_property;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_USE_24_HOUR_FORMAT,
+ g_param_spec_boolean (
+ "use-24-hour-format",
+ "Use 24-hour Format",
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ column_types[E_DATE_TIME_LIST_COLUMN_DESCRIPTION] = G_TYPE_STRING;
+}
+
+static void
+e_date_time_list_init (EDateTimeList *date_time_list)
+{
+ date_time_list->stamp = g_random_int ();
+ date_time_list->columns_dirty = FALSE;
+ date_time_list->list = NULL;
+}
+
+static void
+e_date_time_list_tree_model_init (GtkTreeModelIface *iface)
+{
+ iface->get_flags = date_time_list_get_flags;
+ iface->get_n_columns = date_time_list_get_n_columns;
+ iface->get_column_type = date_time_list_get_column_type;
+ iface->get_iter = date_time_list_get_iter;
+ iface->get_path = date_time_list_get_path;
+ iface->get_value = date_time_list_get_value;
+ iface->iter_next = date_time_list_iter_next;
+ iface->iter_children = date_time_list_iter_children;
+ iface->iter_has_child = date_time_list_iter_has_child;
+ iface->iter_n_children = date_time_list_iter_n_children;
+ iface->iter_nth_child = date_time_list_iter_nth_child;
+ iface->iter_parent = date_time_list_iter_parent;
+}
+
+EDateTimeList *
+e_date_time_list_new (void)
+{
+ return g_object_new (E_TYPE_DATE_TIME_LIST, NULL);
+}
+
+const ECalComponentDateTime *
+e_date_time_list_get_date_time (EDateTimeList *date_time_list, GtkTreeIter *iter)
+{
+ g_return_val_if_fail (IS_VALID_ITER (date_time_list, iter), NULL);
+
+ return G_LIST (iter->user_data)->data;
+}
+
+void
+e_date_time_list_set_date_time (EDateTimeList *date_time_list, GtkTreeIter *iter,
+ const ECalComponentDateTime *datetime)
+{
+ ECalComponentDateTime *datetime_old;
+
+ g_return_if_fail (IS_VALID_ITER (date_time_list, iter));
+
+ datetime_old = G_LIST (iter->user_data)->data;
+ free_datetime (datetime_old);
+ G_LIST (iter->user_data)->data = copy_datetime (datetime);
+ row_updated (date_time_list, g_list_position (date_time_list->list, G_LIST (iter->user_data)));
+}
+
+gboolean
+e_date_time_list_get_use_24_hour_format (EDateTimeList *date_time_list)
+{
+ g_return_val_if_fail (E_IS_DATE_TIME_LIST (date_time_list), FALSE);
+
+ return date_time_list->use_24_hour_format;
+}
+
+void
+e_date_time_list_set_use_24_hour_format (EDateTimeList *date_time_list,
+ gboolean use_24_hour_format)
+{
+ g_return_if_fail (E_IS_DATE_TIME_LIST (date_time_list));
+
+ date_time_list->use_24_hour_format = use_24_hour_format;
+
+ g_object_notify (G_OBJECT (date_time_list), "use-24-hour-format");
+}
+
+void
+e_date_time_list_append (EDateTimeList *date_time_list, GtkTreeIter *iter,
+ const ECalComponentDateTime *datetime)
+{
+ g_return_if_fail (datetime != NULL);
+
+ if (g_list_find_custom (date_time_list->list, datetime, (GCompareFunc)compare_datetime) == NULL) {
+ date_time_list->list = g_list_append (date_time_list->list, copy_datetime (datetime));
+ row_added (date_time_list, g_list_length (date_time_list->list) - 1);
+ }
+
+ if (iter) {
+ iter->user_data = g_list_last (date_time_list->list);
+ iter->stamp = date_time_list->stamp;
+ }
+}
+
+void
+e_date_time_list_remove (EDateTimeList *date_time_list, GtkTreeIter *iter)
+{
+ gint n;
+
+ g_return_if_fail (IS_VALID_ITER (date_time_list, iter));
+
+ n = g_list_position (date_time_list->list, G_LIST (iter->user_data));
+ free_datetime ((ECalComponentDateTime *) G_LIST (iter->user_data)->data);
+ date_time_list->list = g_list_delete_link (date_time_list->list, G_LIST (iter->user_data));
+ row_deleted (date_time_list, n);
+}
+
+void
+e_date_time_list_clear (EDateTimeList *date_time_list)
+{
+ GList *l;
+
+ all_rows_deleted (date_time_list);
+
+ for (l = date_time_list->list; l; l = g_list_next (l)) {
+ free_datetime ((ECalComponentDateTime *) l->data);
+ }
+
+ g_list_free (date_time_list->list);
+ date_time_list->list = NULL;
+}
diff --git a/calendar/gui/e-date-time-list.h b/calendar/gui/e-date-time-list.h
index cdf279a..e0bbf1e 100644
--- a/calendar/gui/e-date-time-list.h
+++ b/calendar/gui/e-date-time-list.h
@@ -29,29 +29,37 @@
#include <gtk/gtk.h>
#include <libecal/e-cal-component.h>
-G_BEGIN_DECLS
+/* Standard GObject macros */
+#define E_TYPE_DATE_TIME_LIST \
+ (e_date_time_list_get_type ())
+#define E_DATE_TIME_LIST(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_DATE_TIME_LIST, EDateTimeList))
+#define E_DATE_TIME_LIST_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_DATE_TIME_LIST, EDateTimeListClass))
+#define E_IS_DATE_TIME_LIST(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_DATE_TIME_LIST))
+#define E_IS_DATE_TIME_LIST_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_DATE_TIME_LIST))
+#define E_DATE_TIME_LIST_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_DATE_TIME_LIST, EDateTimeListClass))
-#define E_TYPE_DATE_TIME_LIST (e_date_time_list_get_type ())
-#define E_DATE_TIME_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_DATE_TIME_LIST, EDateTimeList))
-#define E_DATE_TIME_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_DATE_TIME_LIST, EDateTimeListClass))
-#define E_IS_DATE_TIME_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_DATE_TIME_LIST))
-#define E_IS_DATE_TIME_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_DATE_TIME_LIST))
-#define E_DATE_TIME_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TYPE_DATE_TIME_LIST, EDateTimeListClass))
+G_BEGIN_DECLS
-typedef struct _EDateTimeList EDateTimeList;
-typedef struct _EDateTimeListClass EDateTimeListClass;
+typedef struct _EDateTimeList EDateTimeList;
+typedef struct _EDateTimeListClass EDateTimeListClass;
-typedef enum
-{
+typedef enum {
E_DATE_TIME_LIST_COLUMN_DESCRIPTION,
-
E_DATE_TIME_LIST_NUM_COLUMNS
-}
-EDateTimeListColumnType;
+} EDateTimeListColumnType;
-struct _EDateTimeList
-{
- GObject parent;
+struct _EDateTimeList {
+ GObject parent;
/* Private */
@@ -59,27 +67,33 @@ struct _EDateTimeList
GList *list;
guint columns_dirty : 1;
+
+ gboolean use_24_hour_format;
};
-struct _EDateTimeListClass
-{
+struct _EDateTimeListClass {
GObjectClass parent_class;
};
-GType e_date_time_list_get_type (void);
-EDateTimeList *e_date_time_list_new (void);
-
-const ECalComponentDateTime *e_date_time_list_get_date_time (EDateTimeList *date_time_list,
- GtkTreeIter *iter);
-void e_date_time_list_set_date_time (EDateTimeList *date_time_list,
- GtkTreeIter *iter,
- const ECalComponentDateTime *datetime);
-void e_date_time_list_append (EDateTimeList *date_time_list,
- GtkTreeIter *iter,
- const ECalComponentDateTime *datetime);
-void e_date_time_list_remove (EDateTimeList *date_time_list,
- GtkTreeIter *iter);
-void e_date_time_list_clear (EDateTimeList *date_time_list);
+GType e_date_time_list_get_type (void);
+EDateTimeList * e_date_time_list_new (void);
+const ECalComponentDateTime *
+ e_date_time_list_get_date_time (EDateTimeList *date_time_list,
+ GtkTreeIter *iter);
+void e_date_time_list_set_date_time (EDateTimeList *date_time_list,
+ GtkTreeIter *iter,
+ const ECalComponentDateTime *datetime);
+gboolean e_date_time_list_get_use_24_hour_format
+ (EDateTimeList *date_time_list);
+void e_date_time_list_set_use_24_hour_format
+ (EDateTimeList *date_time_list,
+ gboolean use_24_hour_format);
+void e_date_time_list_append (EDateTimeList *date_time_list,
+ GtkTreeIter *iter,
+ const ECalComponentDateTime *datetime);
+void e_date_time_list_remove (EDateTimeList *date_time_list,
+ GtkTreeIter *iter);
+void e_date_time_list_clear (EDateTimeList *date_time_list);
G_END_DECLS
diff --git a/calendar/gui/e-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c
index 08793c9..98c1515 100644
--- a/calendar/gui/e-day-view-main-item.c
+++ b/calendar/gui/e-day-view-main-item.c
@@ -39,7 +39,6 @@
#include "ea-calendar.h"
#include "e-calendar-view.h"
#include "comp-util.h"
-#include "calendar-config.h"
/* backward-compatibility cruft */
#include "e-util/gtk-compat.h"
@@ -100,12 +99,17 @@ day_view_main_item_draw_long_events_in_vbars (EDayViewMainItem *main_item,
{
EDayView *day_view;
EDayViewEvent *event;
+ ECalendarView *cal_view;
+ gint time_divisions;
gint event_num, start_day, end_day, day, bar_y1, bar_y2, grid_x;
cairo_t *cr = NULL;
GdkColor bg_color;
day_view = e_day_view_main_item_get_day_view (main_item);
+ cal_view = E_CALENDAR_VIEW (day_view);
+ time_divisions = e_calendar_view_get_time_divisions (cal_view);
+
for (event_num = 0; event_num < day_view->long_events->len; event_num++) {
gboolean first = TRUE;
event = &g_array_index (day_view->long_events, EDayViewEvent, event_num);
@@ -136,13 +140,13 @@ day_view_main_item_draw_long_events_in_vbars (EDayViewMainItem *main_item,
if (event->start <= day_view->day_starts[day]) {
bar_y1 = 0;
} else {
- bar_y1 = event->start_minute * day_view->row_height / day_view->mins_per_row - y;
+ bar_y1 = event->start_minute * day_view->row_height / time_divisions - y;
}
if (event->end >= day_view->day_starts[day + 1]) {
bar_y2 = height;
} else {
- bar_y2 = event->end_minute * day_view->row_height / day_view->mins_per_row - y;
+ bar_y2 = event->end_minute * day_view->row_height / time_divisions - y;
}
if (bar_y1 < height && bar_y2 > 0 && bar_y2 > bar_y1 && can_draw_in_region (draw_region, grid_x, bar_y1, E_DAY_VIEW_BAR_WIDTH - 2, bar_y2 - bar_y1)) {
@@ -191,6 +195,8 @@ day_view_main_item_draw_day_event (EDayViewMainItem *main_item,
EDayView *day_view;
EDayViewEvent *event;
ECalModel *model;
+ ECalendarView *cal_view;
+ gint time_divisions;
gint item_x, item_y, item_w, item_h, bar_y1, bar_y2;
GdkColor bg_color;
ECalComponent *comp;
@@ -205,8 +211,6 @@ day_view_main_item_draw_day_event (EDayViewMainItem *main_item,
guint16 red, green, blue;
gint i;
gdouble radius, x0, y0, rect_height, rect_width, text_x_offset = 0.0;
- gfloat alpha;
- gboolean gradient;
gdouble cc = 65535.0;
gdouble date_fraction;
gboolean short_event = FALSE, resize_flag = FALSE, is_editing;
@@ -223,7 +227,10 @@ day_view_main_item_draw_day_event (EDayViewMainItem *main_item,
gint row_y;
day_view = e_day_view_main_item_get_day_view (main_item);
- model = e_calendar_view_get_model (E_CALENDAR_VIEW (day_view));
+
+ cal_view = E_CALENDAR_VIEW (day_view);
+ model = e_calendar_view_get_model (cal_view);
+ time_divisions = e_calendar_view_get_time_divisions (cal_view);
/* If the event is currently being dragged, don't draw it. It will
be drawn in the special drag items. */
@@ -246,9 +253,6 @@ day_view_main_item_draw_day_event (EDayViewMainItem *main_item,
gdk_cairo_set_source_color (cr,
&day_view->colors[E_DAY_VIEW_COLOR_EVENT_VBAR]);
- gradient = calendar_config_get_display_events_gradient ();
- alpha = calendar_config_get_display_events_alpha ();
-
font_options = get_font_options ();
if (!is_array_index_in_bounds (day_view->events[day], event_num)) {
@@ -441,7 +445,7 @@ day_view_main_item_draw_day_event (EDayViewMainItem *main_item,
draw_curved_rectangle (cr, x0, y0, rect_width, rect_height, radius);
- cairo_set_source_rgba (cr, 1, 1, 1, alpha);
+ cairo_set_source_rgba (cr, 1, 1, 1, 1.0);
cairo_fill (cr);
cairo_restore (cr);
@@ -478,10 +482,11 @@ day_view_main_item_draw_day_event (EDayViewMainItem *main_item,
date_fraction = rect_height / day_view->row_height;
interval = event->end_minute - event->start_minute;
- if ((interval/day_view->mins_per_row) >= 2)
+ if ((interval / time_divisions) >= 2)
short_event = FALSE;
- else if ((interval%day_view->mins_per_row)==0) {
- if (((event->end_minute%day_view->mins_per_row) == 0) || ((event->start_minute%day_view->mins_per_row) == 0))
+ else if ((interval % time_divisions) == 0) {
+ if (((event->end_minute % time_divisions) == 0) ||
+ ((event->start_minute % time_divisions) == 0))
short_event = TRUE;
}
else
@@ -490,25 +495,20 @@ day_view_main_item_draw_day_event (EDayViewMainItem *main_item,
if (is_editing)
short_event = TRUE;
- if (gradient) {
- pat = cairo_pattern_create_linear (item_x + E_DAY_VIEW_BAR_WIDTH + 1.75, item_y + 7.75,
- item_x + E_DAY_VIEW_BAR_WIDTH + 1.75, item_y + item_h - 7.75);
- if (!short_event) {
- cairo_pattern_add_color_stop_rgba (pat, 1, red/cc, green/cc, blue/cc, 0.8);
- cairo_pattern_add_color_stop_rgba (pat, 1/(date_fraction + (rect_height/18)), red/cc, green/cc, blue/cc, 0.8);
- cairo_pattern_add_color_stop_rgba (pat, 1/(date_fraction + (rect_height/18)), red/cc, green/cc, blue/cc, 0.4);
- cairo_pattern_add_color_stop_rgba (pat, 1, red/cc, green/cc, blue/cc, 0.8);
- } else {
- cairo_pattern_add_color_stop_rgba (pat, 1, red/cc, green/cc, blue/cc, 0.8);
- cairo_pattern_add_color_stop_rgba (pat, 0, red/cc, green/cc, blue/cc, 0.4);
- }
- cairo_set_source (cr, pat);
- cairo_fill_preserve (cr);
- cairo_pattern_destroy (pat);
+ pat = cairo_pattern_create_linear (item_x + E_DAY_VIEW_BAR_WIDTH + 1.75, item_y + 7.75,
+ item_x + E_DAY_VIEW_BAR_WIDTH + 1.75, item_y + item_h - 7.75);
+ if (!short_event) {
+ cairo_pattern_add_color_stop_rgba (pat, 1, red/cc, green/cc, blue/cc, 0.8);
+ cairo_pattern_add_color_stop_rgba (pat, 1/(date_fraction + (rect_height/18)), red/cc, green/cc, blue/cc, 0.8);
+ cairo_pattern_add_color_stop_rgba (pat, 1/(date_fraction + (rect_height/18)), red/cc, green/cc, blue/cc, 0.4);
+ cairo_pattern_add_color_stop_rgba (pat, 1, red/cc, green/cc, blue/cc, 0.8);
} else {
- cairo_set_source_rgba (cr, red/cc, green/cc, blue/cc, 0.8);
- cairo_fill_preserve (cr);
+ cairo_pattern_add_color_stop_rgba (pat, 1, red/cc, green/cc, blue/cc, 0.8);
+ cairo_pattern_add_color_stop_rgba (pat, 0, red/cc, green/cc, blue/cc, 0.4);
}
+ cairo_set_source (cr, pat);
+ cairo_fill_preserve (cr);
+ cairo_pattern_destroy (pat);
cairo_set_source_rgba (cr, red/cc, green/cc, blue/cc, 0.2);
cairo_set_line_width (cr, 0.5);
@@ -530,8 +530,8 @@ day_view_main_item_draw_day_event (EDayViewMainItem *main_item,
/* Draw the vertical colored bar showing when the appointment
begins & ends. */
- bar_y1 = event->start_minute * day_view->row_height / day_view->mins_per_row - y;
- bar_y2 = event->end_minute * day_view->row_height / day_view->mins_per_row - y;
+ bar_y1 = event->start_minute * day_view->row_height / time_divisions - y;
+ bar_y2 = event->end_minute * day_view->row_height / time_divisions - y;
scroll_flag = bar_y2;
@@ -588,9 +588,9 @@ day_view_main_item_draw_day_event (EDayViewMainItem *main_item,
}
if (bar_y2 > scroll_flag)
- event->end_minute += day_view->mins_per_row;
+ event->end_minute += time_divisions;
else if (bar_y2 < scroll_flag)
- event->end_minute -= day_view->mins_per_row;
+ event->end_minute -= time_divisions;
comp = e_cal_component_new ();
e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
@@ -735,9 +735,9 @@ day_view_main_item_draw_day_event (EDayViewMainItem *main_item,
if (!short_event)
{
- if (event->start_minute % day_view->mins_per_row != 0
+ if (event->start_minute % time_divisions != 0
|| (day_view->show_event_end_times
- && event->end_minute % day_view->mins_per_row != 0)) {
+ && event->end_minute % time_divisions != 0)) {
offset = day_view->first_hour_shown * 60
+ day_view->first_minute_shown;
show_span = TRUE;
@@ -747,7 +747,7 @@ day_view_main_item_draw_day_event (EDayViewMainItem *main_item,
start_minute = offset + event->start_minute;
end_minute = offset + event->end_minute;
- format_time = (((end_minute - start_minute)/day_view->mins_per_row) >= 2) ? TRUE : FALSE;
+ format_time = (((end_minute - start_minute) / time_divisions) >= 2) ? TRUE : FALSE;
start_hour = start_minute / 60;
start_minute = start_minute % 60;
@@ -865,12 +865,17 @@ day_view_main_item_draw_events_in_vbars (EDayViewMainItem *main_item,
{
EDayView *day_view;
EDayViewEvent *event;
+ ECalendarView *cal_view;
+ gint time_divisions;
gint grid_x, event_num, bar_y, bar_h;
cairo_t *cr = NULL;
GdkColor bg_color;
day_view = e_day_view_main_item_get_day_view (main_item);
+ cal_view = E_CALENDAR_VIEW (day_view);
+ time_divisions = e_calendar_view_get_time_divisions (cal_view);
+
grid_x = day_view->day_offsets[day] + 1 - x;
/* Draw the busy times corresponding to the events in the day. */
@@ -886,8 +891,8 @@ day_view_main_item_draw_events_in_vbars (EDayViewMainItem *main_item,
continue;
}
- bar_y = event->start_minute * day_view->row_height / day_view->mins_per_row;
- bar_h = event->end_minute * day_view->row_height / day_view->mins_per_row - bar_y;
+ bar_y = event->start_minute * day_view->row_height / time_divisions;
+ bar_h = event->end_minute * day_view->row_height / time_divisions - bar_y;
bar_y -= y;
/* Skip it if it isn't visible. */
@@ -1005,6 +1010,13 @@ day_view_main_item_draw (GnomeCanvasItem *canvas_item,
{
EDayViewMainItem *main_item;
EDayView *day_view;
+ ECalendarView *cal_view;
+ ECalModel *model;
+ gint time_divisions;
+ gint work_day_start_hour;
+ gint work_day_start_minute;
+ gint work_day_end_hour;
+ gint work_day_end_minute;
gint row, row_y, grid_x1, grid_x2;
gint day, grid_y1, grid_y2;
gint work_day_start_y, work_day_end_y;
@@ -1023,6 +1035,15 @@ day_view_main_item_draw (GnomeCanvasItem *canvas_item,
day_view = e_day_view_main_item_get_day_view (main_item);
g_return_if_fail (day_view != NULL);
+ cal_view = E_CALENDAR_VIEW (day_view);
+ time_divisions = e_calendar_view_get_time_divisions (cal_view);
+
+ model = e_calendar_view_get_model (cal_view);
+ work_day_start_hour = e_cal_model_get_work_day_start_hour (model);
+ work_day_start_minute = e_cal_model_get_work_day_start_minute (model);
+ work_day_end_hour = e_cal_model_get_work_day_end_hour (model);
+ work_day_end_minute = e_cal_model_get_work_day_end_minute (model);
+
rect.x = 0;
rect.y = 0;
rect.width = width;
@@ -1030,8 +1051,10 @@ day_view_main_item_draw (GnomeCanvasItem *canvas_item,
draw_region = gdk_region_rectangle (&rect);
/* Paint the background colors. */
- work_day_start_y = e_day_view_convert_time_to_position (day_view, day_view->work_day_start_hour, day_view->work_day_start_minute) - y;
- work_day_end_y = e_day_view_convert_time_to_position (day_view, day_view->work_day_end_hour, day_view->work_day_end_minute) - y;
+ work_day_start_y = e_day_view_convert_time_to_position (
+ day_view, work_day_start_hour, work_day_start_minute) - y;
+ work_day_end_y = e_day_view_convert_time_to_position (
+ day_view, work_day_end_hour, work_day_end_minute) - y;
today_tt = icaltime_from_timet_with_zone (time (NULL), FALSE,
e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)));
@@ -1220,7 +1243,7 @@ day_view_main_item_draw (GnomeCanvasItem *canvas_item,
grid_x1 = day_view->day_offsets[day] - x + E_DAY_VIEW_BAR_WIDTH;
grid_x2 = day_view->day_offsets[day + 1] - x - 1;
- marcus_bains_y = (time_now.hour * 60 + time_now.minute) * day_view->row_height / day_view->mins_per_row - y;
+ marcus_bains_y = (time_now.hour * 60 + time_now.minute) * day_view->row_height / time_divisions - y;
cairo_set_line_width (cr, 1.5);
cairo_move_to (cr, grid_x1, marcus_bains_y);
cairo_line_to (cr, grid_x2, marcus_bains_y);
diff --git a/calendar/gui/e-day-view-time-item.c b/calendar/gui/e-day-view-time-item.c
index e163e27..35a8e3e 100644
--- a/calendar/gui/e-day-view-time-item.c
+++ b/calendar/gui/e-day-view-time-item.c
@@ -87,7 +87,7 @@ static gint e_day_view_time_item_event (GnomeCanvasItem *item,
GdkEvent *event);
static void e_day_view_time_item_increment_time (gint *hour,
gint *minute,
- gint mins_per_row);
+ gint time_divisions);
static void e_day_view_time_item_show_popup_menu (EDayViewTimeItem *time_item,
GdkEvent *event);
static void e_day_view_time_item_on_set_divisions (GtkWidget *item,
@@ -285,10 +285,12 @@ edvti_draw_zone (GnomeCanvasItem *canvas_item,
{
EDayView *day_view;
EDayViewTimeItem *time_item;
+ ECalendarView *cal_view;
ECalModel *model;
GtkStyle *style;
const gchar *suffix;
gchar buffer[64], *midnight_day = NULL, *midnight_month = NULL;
+ gint time_divisions;
gint hour, display_hour, minute, row;
gint row_y, start_y, large_hour_y_offset, small_font_y_offset;
gint long_line_x1, long_line_x2, short_line_x1;
@@ -309,7 +311,9 @@ edvti_draw_zone (GnomeCanvasItem *canvas_item,
day_view = e_day_view_time_item_get_day_view (time_item);
g_return_if_fail (day_view != NULL);
- model = e_calendar_view_get_model (E_CALENDAR_VIEW (day_view));
+ cal_view = E_CALENDAR_VIEW (day_view);
+ model = e_calendar_view_get_model (cal_view);
+ time_divisions = e_calendar_view_get_time_divisions (cal_view);
style = gtk_widget_get_style (GTK_WIDGET (day_view));
small_font_desc = style->font_desc;
@@ -327,7 +331,7 @@ edvti_draw_zone (GnomeCanvasItem *canvas_item,
long_line_x1 = (use_zone ? 0 : E_DVTMI_TIME_GRID_X_PAD) - x + x_offset;
long_line_x2 = time_item->priv->column_width - E_DVTMI_TIME_GRID_X_PAD - x - (use_zone ? E_DVTMI_TIME_GRID_X_PAD : 0) + x_offset;
- if (day_view->mins_per_row == 60) {
+ if (time_divisions == 60) {
/* The right edge of the complete time string in 60-min
divisions, e.g. "14:00" or "2 pm". */
minute_x2 = long_line_x2 - E_DVTMI_60_MIN_X_PAD;
@@ -437,7 +441,7 @@ edvti_draw_zone (GnomeCanvasItem *canvas_item,
mb_color = day_view->colors[E_DAY_VIEW_COLOR_MARCUS_BAINS_LINE];
time_now = icaltime_current_time_with_zone (e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)));
- marcus_bains_y = (time_now.hour * 60 + time_now.minute) * day_view->row_height / day_view->mins_per_row - y;
+ marcus_bains_y = (time_now.hour * 60 + time_now.minute) * day_view->row_height / time_divisions - y;
cairo_set_line_width (cr, 1.5);
cairo_move_to (cr, long_line_x1 - (use_zone ? E_DVTMI_TIME_GRID_X_PAD : 0), marcus_bains_y);
cairo_line_to (cr, long_line_x2, marcus_bains_y);
@@ -461,13 +465,13 @@ edvti_draw_zone (GnomeCanvasItem *canvas_item,
for (row = 0, row_y = 0 - y;
row < day_view->rows && row_y < height;
row++, row_y += day_view->row_height) {
- gboolean show_midnight_date = use_zone && hour == 0 && (minute == 0 || day_view->mins_per_row == 60) && midnight_day && midnight_month;
+ gboolean show_midnight_date = use_zone && hour == 0 && (minute == 0 || time_divisions == 60) && midnight_day && midnight_month;
/* If the row is above the first row we want to draw just
increment the time and skip to the next row. */
if (row_y < start_y) {
e_day_view_time_item_increment_time (&hour, &minute,
- day_view->mins_per_row);
+ time_divisions);
continue;
}
@@ -477,7 +481,7 @@ edvti_draw_zone (GnomeCanvasItem *canvas_item,
&display_hour,
&suffix, &suffix_width);
- if (day_view->mins_per_row == 60) {
+ if (time_divisions == 60) {
/* 60 minute intervals - draw a long horizontal line
between hours and display as one long string,
e.g. "14:00" or "2 pm". */
@@ -568,7 +572,7 @@ edvti_draw_zone (GnomeCanvasItem *canvas_item,
/* Normally we display the minute in each
interval, but when using 30-minute intervals
we don't display the '30'. */
- if (day_view->mins_per_row != 30 || minute != 30) {
+ if (time_divisions != 30 || minute != 30) {
/* In 12-hour format we display 'am' or 'pm'
instead of '00'. */
if (show_midnight_date)
@@ -600,7 +604,7 @@ edvti_draw_zone (GnomeCanvasItem *canvas_item,
}
e_day_view_time_item_increment_time (&hour, &minute,
- day_view->mins_per_row);
+ time_divisions);
}
pango_font_metrics_unref (large_font_metrics);
@@ -631,14 +635,14 @@ e_day_view_time_item_draw (GnomeCanvasItem *canvas_item,
}
/* Increment the time by the 5/10/15/30/60 minute interval.
- Note that mins_per_row is never > 60, so we never have to
+ Note that time_divisions is never > 60, so we never have to
worry about adding more than 60 minutes. */
static void
e_day_view_time_item_increment_time (gint *hour,
gint *minute,
- gint mins_per_row)
+ gint time_divisions)
{
- *minute += mins_per_row;
+ *minute += time_divisions;
if (*minute >= 60) {
*minute -= 60;
/* Currently we never wrap around to the next day, but
@@ -728,6 +732,7 @@ e_day_view_time_item_show_popup_menu (EDayViewTimeItem *time_item,
{
static gint divisions[] = { 60, 30, 15, 10, 5 };
EDayView *day_view;
+ ECalendarView *cal_view;
GtkWidget *menu, *item, *submenu;
gchar buffer[256];
GSList *group = NULL, *recent_zones, *s;
@@ -737,7 +742,8 @@ e_day_view_time_item_show_popup_menu (EDayViewTimeItem *time_item,
day_view = e_day_view_time_item_get_day_view (time_item);
g_return_if_fail (day_view != NULL);
- current_divisions = e_day_view_get_mins_per_row (day_view);
+ cal_view = E_CALENDAR_VIEW (day_view);
+ current_divisions = e_calendar_view_get_time_divisions (cal_view);
menu = gtk_menu_new ();
@@ -832,6 +838,7 @@ e_day_view_time_item_on_set_divisions (GtkWidget *item,
EDayViewTimeItem *time_item)
{
EDayView *day_view;
+ ECalendarView *cal_view;
gint divisions;
day_view = e_day_view_time_item_get_day_view (time_item);
@@ -841,8 +848,9 @@ e_day_view_time_item_on_set_divisions (GtkWidget *item,
return;
divisions = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (item), "divisions"));
- e_day_view_set_mins_per_row (day_view, divisions);
- calendar_config_set_time_divisions (divisions);
+
+ cal_view = E_CALENDAR_VIEW (day_view);
+ e_calendar_view_set_time_divisions (cal_view, divisions);
}
static void
diff --git a/calendar/gui/e-day-view-top-item.c b/calendar/gui/e-day-view-top-item.c
index 1703467..c58f057 100644
--- a/calendar/gui/e-day-view-top-item.c
+++ b/calendar/gui/e-day-view-top-item.c
@@ -34,7 +34,6 @@
#include <libecal/e-cal-time-util.h>
#include <libedataserver/e-data-server-util.h>
#include <libedataserver/e-categories.h>
-#include "calendar-config.h"
#include "e-calendar-view.h"
#include "e-day-view-top-item.h"
@@ -174,16 +173,11 @@ day_view_top_item_draw_long_event (EDayViewTopItem *top_item,
cairo_pattern_t *pat;
guint16 red, green, blue;
gdouble cc = 65535.0;
- gboolean gradient;
- gfloat alpha;
gdouble x0, y0, rect_height, rect_width, radius;
day_view = e_day_view_top_item_get_day_view (top_item);
model = e_calendar_view_get_model (E_CALENDAR_VIEW (day_view));
- gradient = calendar_config_get_display_events_gradient ();
- alpha = calendar_config_get_display_events_alpha ();
-
/* If the event is currently being dragged, don't draw it. It will
be drawn in the special drag items. */
if (day_view->drag_event_day == E_DAY_VIEW_LONG_EVENT
@@ -245,7 +239,7 @@ day_view_top_item_draw_long_event (EDayViewTopItem *top_item,
draw_curved_rectangle (cr, x0, y0, rect_width, rect_height, radius);
- cairo_set_source_rgba (cr, 1, 1, 1, alpha);
+ cairo_set_source_rgba (cr, 1, 1, 1, 1.0);
cairo_fill_preserve (cr);
cairo_restore (cr);
@@ -280,18 +274,14 @@ day_view_top_item_draw_long_event (EDayViewTopItem *top_item,
draw_curved_rectangle (cr, x0, y0, rect_width, rect_height, radius);
- if (gradient) {
- pat = cairo_pattern_create_linear (item_x - x + 5.5, item_y + 2.5 - y,
- item_x - x + 5, item_y - y + item_h + 7.5);
- cairo_pattern_add_color_stop_rgba (pat, 1, red/cc, green/cc, blue/cc, 0.8);
- cairo_pattern_add_color_stop_rgba (pat, 0, red/cc, green/cc, blue/cc, 0.4);
- cairo_set_source (cr, pat);
- cairo_fill_preserve (cr);
- cairo_pattern_destroy (pat);
- } else {
- cairo_set_source_rgba (cr, red/cc, green/cc, blue/cc, 0.8);
- cairo_fill_preserve (cr);
- }
+ pat = cairo_pattern_create_linear (item_x - x + 5.5, item_y + 2.5 - y,
+ item_x - x + 5, item_y - y + item_h + 7.5);
+ cairo_pattern_add_color_stop_rgba (pat, 1, red/cc, green/cc, blue/cc, 0.8);
+ cairo_pattern_add_color_stop_rgba (pat, 0, red/cc, green/cc, blue/cc, 0.4);
+ cairo_set_source (cr, pat);
+ cairo_fill_preserve (cr);
+ cairo_pattern_destroy (pat);
+
cairo_set_source_rgba (cr, red/cc, green/cc, blue/cc, 0);
cairo_set_line_width (cr, 0.5);
cairo_stroke (cr);
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index 1482398..f81afae 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -51,7 +51,6 @@
#include "print.h"
#include "comp-util.h"
#include "itip-utils.h"
-#include "calendar-config.h"
#include "goto.h"
#include "e-cal-model-calendar.h"
#include "e-day-view-time-item.h"
@@ -430,17 +429,43 @@ enum {
PROP_MARCUS_BAINS_SHOW_LINE,
PROP_MARCUS_BAINS_DAY_VIEW_COLOR,
PROP_MARCUS_BAINS_TIME_BAR_COLOR,
- PROP_MINS_PER_ROW,
- PROP_WORK_DAY_END_HOUR,
- PROP_WORK_DAY_END_MINUTE,
- PROP_WORK_DAY_START_HOUR,
- PROP_WORK_DAY_START_MINUTE,
PROP_WORKING_DAYS
};
G_DEFINE_TYPE (EDayView, e_day_view, E_TYPE_CALENDAR_VIEW)
static void
+day_view_notify_time_divisions_cb (EDayView *day_view)
+{
+ gint day;
+
+ e_day_view_recalc_num_rows (day_view);
+
+ /* If we aren't visible, we'll sort it out later. */
+ if (!E_CALENDAR_VIEW (day_view)->in_focus) {
+ e_day_view_free_events (day_view);
+ day_view->requires_update = TRUE;
+ return;
+ }
+
+ for (day = 0; day < E_DAY_VIEW_MAX_DAYS; day++)
+ day_view->need_layout[day] = TRUE;
+
+ /* We need to update all the day event labels since the start & end
+ times may or may not be on row boundaries any more. */
+ e_day_view_foreach_event (day_view,
+ e_day_view_set_show_times_cb, NULL);
+
+ /* We must layout the events before updating the scroll region, since
+ that will result in a redraw which would crash otherwise. */
+ e_day_view_check_layout (day_view);
+ gtk_widget_queue_draw (day_view->time_canvas);
+ gtk_widget_queue_draw (day_view->main_canvas);
+
+ e_day_view_update_scroll_regions (day_view);
+}
+
+static void
day_view_notify_week_start_day_cb (EDayView *day_view)
{
/* XXX Write a EWorkWeekView subclass, like EMonthView. */
@@ -474,36 +499,6 @@ day_view_set_property (GObject *object,
g_value_get_string (value));
return;
- case PROP_MINS_PER_ROW:
- e_day_view_set_mins_per_row (
- E_DAY_VIEW (object),
- g_value_get_int (value));
- return;
-
- case PROP_WORK_DAY_END_HOUR:
- e_day_view_set_work_day_end_hour (
- E_DAY_VIEW (object),
- g_value_get_int (value));
- return;
-
- case PROP_WORK_DAY_END_MINUTE:
- e_day_view_set_work_day_end_minute (
- E_DAY_VIEW (object),
- g_value_get_int (value));
- return;
-
- case PROP_WORK_DAY_START_HOUR:
- e_day_view_set_work_day_start_hour (
- E_DAY_VIEW (object),
- g_value_get_int (value));
- return;
-
- case PROP_WORK_DAY_START_MINUTE:
- e_day_view_set_work_day_start_minute (
- E_DAY_VIEW (object),
- g_value_get_int (value));
- return;
-
case PROP_WORKING_DAYS:
e_day_view_set_working_days (
E_DAY_VIEW (object),
@@ -542,41 +537,6 @@ day_view_get_property (GObject *object,
E_DAY_VIEW (object)));
return;
- case PROP_MINS_PER_ROW:
- g_value_set_int (
- value,
- e_day_view_get_mins_per_row (
- E_DAY_VIEW (object)));
- return;
-
- case PROP_WORK_DAY_END_HOUR:
- g_value_set_int (
- value,
- e_day_view_get_work_day_end_hour (
- E_DAY_VIEW (object)));
- return;
-
- case PROP_WORK_DAY_END_MINUTE:
- g_value_set_int (
- value,
- e_day_view_get_work_day_end_minute (
- E_DAY_VIEW (object)));
- return;
-
- case PROP_WORK_DAY_START_HOUR:
- g_value_set_int (
- value,
- e_day_view_get_work_day_start_hour (
- E_DAY_VIEW (object)));
- return;
-
- case PROP_WORK_DAY_START_MINUTE:
- g_value_set_int (
- value,
- e_day_view_get_work_day_start_minute (
- E_DAY_VIEW (object)));
- return;
-
case PROP_WORKING_DAYS:
g_value_set_int (
value,
@@ -591,16 +551,39 @@ day_view_get_property (GObject *object,
static void
day_view_constructed (GObject *object)
{
+ EDayView *day_view;
ECalModel *model;
+ day_view = E_DAY_VIEW (object);
+
/* Chain up to parent's constructed() method. */
G_OBJECT_CLASS (e_day_view_parent_class)->constructed (object);
- model = e_calendar_view_get_model (E_CALENDAR_VIEW (object));
+ model = e_calendar_view_get_model (E_CALENDAR_VIEW (day_view));
+
+ g_signal_connect_swapped (
+ model, "notify::time-divisions",
+ G_CALLBACK (day_view_notify_time_divisions_cb), day_view);
g_signal_connect_swapped (
model, "notify::week-start-day",
- G_CALLBACK (day_view_notify_week_start_day_cb), object);
+ G_CALLBACK (day_view_notify_week_start_day_cb), day_view);
+
+ g_signal_connect_swapped (
+ model, "notify::work-day-start-hour",
+ G_CALLBACK (gtk_widget_queue_draw), day_view->main_canvas);
+
+ g_signal_connect_swapped (
+ model, "notify::work-day-start-minute",
+ G_CALLBACK (gtk_widget_queue_draw), day_view->main_canvas);
+
+ g_signal_connect_swapped (
+ model, "notify::work-day-end-hour",
+ G_CALLBACK (gtk_widget_queue_draw), day_view->main_canvas);
+
+ g_signal_connect_swapped (
+ model, "notify::work-day-end-minute",
+ G_CALLBACK (gtk_widget_queue_draw), day_view->main_canvas);
}
static void
@@ -666,66 +649,6 @@ e_day_view_class_init (EDayViewClass *class)
NULL,
G_PARAM_READWRITE));
- g_object_class_install_property (
- object_class,
- PROP_MINS_PER_ROW,
- g_param_spec_int (
- "mins-per-row",
- "Minutes Per Row",
- NULL,
- 5, /* not a continuous range */
- 60, /* valid values: 5, 10, 15, 30, 60 */
- 30,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (
- object_class,
- PROP_WORK_DAY_END_HOUR,
- g_param_spec_int (
- "work-day-end-hour",
- "Work Day End Hour",
- NULL,
- G_MININT,
- G_MAXINT,
- 0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (
- object_class,
- PROP_WORK_DAY_END_MINUTE,
- g_param_spec_int (
- "work-day-end-minute",
- "Work Day End Minute",
- NULL,
- G_MININT,
- G_MAXINT,
- 0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (
- object_class,
- PROP_WORK_DAY_START_HOUR,
- g_param_spec_int (
- "work-day-start-hour",
- "Work Day Start Hour",
- NULL,
- G_MININT,
- G_MAXINT,
- 0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (
- object_class,
- PROP_WORK_DAY_START_MINUTE,
- g_param_spec_int (
- "work-day-start-minute",
- "Work Day Start Minute",
- NULL,
- G_MININT,
- G_MAXINT,
- 0,
- G_PARAM_READWRITE));
-
/* FIXME Make this a real GFlags type. */
g_object_class_install_property (
object_class,
@@ -1024,7 +947,6 @@ e_day_view_init (EDayView *day_view)
day_view->work_week_view = FALSE;
day_view->days_shown = 1;
- day_view->mins_per_row = 30;
day_view->date_format = E_DAY_VIEW_DATE_FULL;
day_view->rows_in_top_display = 0;
@@ -1042,10 +964,6 @@ e_day_view_init (EDayView *day_view)
| E_DAY_VIEW_WEDNESDAY | E_DAY_VIEW_THURSDAY
| E_DAY_VIEW_FRIDAY;
- day_view->work_day_start_hour = 9;
- day_view->work_day_start_minute = 0;
- day_view->work_day_end_hour = 17;
- day_view->work_day_end_minute = 0;
day_view->show_event_end_times = TRUE;
day_view->scroll_to_work_day = TRUE;
@@ -1772,9 +1690,16 @@ e_day_view_style_set (GtkWidget *widget,
static void
e_day_view_recalc_main_canvas_size (EDayView *day_view)
{
+ ECalModel *model;
+ gint work_day_start_hour;
+ gint work_day_start_minute;
gint day, scroll_y;
gboolean need_reshape;
+ model = e_calendar_view_get_model (E_CALENDAR_VIEW (day_view));
+ work_day_start_hour = e_cal_model_get_work_day_start_hour (model);
+ work_day_start_minute = e_cal_model_get_work_day_start_minute (model);
+
/* Set the scroll region of the top canvas */
e_day_view_update_top_scroll (day_view, TRUE);
@@ -1785,7 +1710,8 @@ e_day_view_recalc_main_canvas_size (EDayView *day_view)
/* Scroll to the start of the working day, if this is the initial
allocation. */
if (day_view->scroll_to_work_day) {
- scroll_y = e_day_view_convert_time_to_position (day_view, day_view->work_day_start_hour, day_view->work_day_start_minute);
+ scroll_y = e_day_view_convert_time_to_position (
+ day_view, work_day_start_hour, work_day_start_minute);
gnome_canvas_scroll_to (GNOME_CANVAS (day_view->main_canvas),
0, scroll_y);
day_view->scroll_to_work_day = FALSE;
@@ -2165,9 +2091,11 @@ e_day_view_update_event_label (EDayView *day_view,
gint event_num)
{
EDayViewEvent *event;
+ ECalendarView *cal_view;
gboolean free_text = FALSE, editing_event = FALSE, short_event = FALSE;
const gchar *summary;
gchar *text;
+ gint time_divisions;
gint interval;
if (!is_array_index_in_bounds (day_view->events[day], event_num))
@@ -2188,10 +2116,14 @@ e_day_view_update_event_label (EDayView *day_view,
interval = event->end_minute - event->start_minute;
- if ((interval/day_view->mins_per_row) >= 2)
+ cal_view = E_CALENDAR_VIEW (day_view);
+ time_divisions = e_calendar_view_get_time_divisions (cal_view);
+
+ if ((interval / time_divisions) >= 2)
short_event = FALSE;
- else if ((interval%day_view->mins_per_row)==0) {
- if (((event->end_minute%day_view->mins_per_row)==0) || ((event->start_minute%day_view->mins_per_row)==0)) {
+ else if ((interval % time_divisions) == 0) {
+ if (((event->end_minute % time_divisions) == 0) ||
+ ((event->start_minute % time_divisions) == 0)) {
short_event = TRUE;
}
} else
@@ -2417,11 +2349,18 @@ e_day_view_set_selected_time_range_visible (EDayView *day_view,
time_t start_time,
time_t end_time)
{
+ ECalModel *model;
+ gint work_day_start_hour;
+ gint work_day_start_minute;
gint start_row, start_col, end_row, end_col;
gboolean need_redraw = FALSE, start_in_grid, end_in_grid;
g_return_if_fail (E_IS_DAY_VIEW (day_view));
+ model = e_calendar_view_get_model (E_CALENDAR_VIEW (day_view));
+ work_day_start_hour = e_cal_model_get_work_day_start_hour (model);
+ work_day_start_minute = e_cal_model_get_work_day_start_minute (model);
+
/* Set the selection. */
start_in_grid = e_day_view_convert_time_to_grid_position (day_view,
start_time,
@@ -2439,7 +2378,8 @@ e_day_view_set_selected_time_range_visible (EDayView *day_view,
|| (start_row == 0 && end_row == day_view->rows - 1)) {
end_col = start_col;
- start_row = e_day_view_convert_time_to_row (day_view, day_view->work_day_start_hour, day_view->work_day_start_minute);
+ start_row = e_day_view_convert_time_to_row (
+ day_view, work_day_start_hour, work_day_start_minute);
start_row = CLAMP (start_row, 0, day_view->rows - 1);
end_row = start_row;
}
@@ -2524,9 +2464,17 @@ e_day_view_set_selected_time_range (ECalendarView *cal_view,
time_t start_time,
time_t end_time)
{
+ ECalModel *model;
+ EDayView *day_view;
+ gint work_day_start_hour;
+ gint work_day_start_minute;
gint start_row, start_col, end_row, end_col;
gboolean need_redraw = FALSE, start_in_grid, end_in_grid;
- EDayView *day_view = E_DAY_VIEW (cal_view);
+
+ day_view = E_DAY_VIEW (cal_view);
+ model = e_calendar_view_get_model (cal_view);
+ work_day_start_hour = e_cal_model_get_work_day_start_hour (model);
+ work_day_start_minute = e_cal_model_get_work_day_start_minute (model);
/* Set the selection. */
start_in_grid = e_day_view_convert_time_to_grid_position (day_view,
@@ -2545,7 +2493,8 @@ e_day_view_set_selected_time_range (ECalendarView *cal_view,
|| (start_row == 0 && end_row == day_view->rows - 1)) {
end_col = start_col;
- start_row = e_day_view_convert_time_to_row (day_view, day_view->work_day_start_hour, day_view->work_day_start_minute);
+ start_row = e_day_view_convert_time_to_row (
+ day_view, work_day_start_hour, work_day_start_minute);
start_row = CLAMP (start_row, 0, day_view->rows - 1);
end_row = start_row;
}
@@ -2721,60 +2670,6 @@ e_day_view_set_days_shown (EDayView *day_view,
e_day_view_update_query (day_view);
}
-gint
-e_day_view_get_mins_per_row (EDayView *day_view)
-{
- g_return_val_if_fail (E_IS_DAY_VIEW (day_view), -1);
-
- return day_view->mins_per_row;
-}
-
-void
-e_day_view_set_mins_per_row (EDayView *day_view,
- gint mins_per_row)
-{
- gint day;
-
- g_return_if_fail (E_IS_DAY_VIEW (day_view));
-
- if (mins_per_row != 5 && mins_per_row != 10 && mins_per_row != 15
- && mins_per_row != 30 && mins_per_row != 60) {
- g_warning ("Invalid minutes per row setting");
- return;
- }
-
- if (day_view->mins_per_row == mins_per_row)
- return;
-
- day_view->mins_per_row = mins_per_row;
- e_day_view_recalc_num_rows (day_view);
-
- g_object_notify (G_OBJECT (day_view), "mins-per-row");
-
- /* If we aren't visible, we'll sort it out later. */
- if (!E_CALENDAR_VIEW (day_view)->in_focus) {
- e_day_view_free_events (day_view);
- day_view->requires_update = TRUE;
- return;
- }
-
- for (day = 0; day < E_DAY_VIEW_MAX_DAYS; day++)
- day_view->need_layout[day] = TRUE;
-
- /* We need to update all the day event labels since the start & end
- times may or may not be on row boundaries any more. */
- e_day_view_foreach_event (day_view,
- e_day_view_set_show_times_cb, NULL);
-
- /* We must layout the events before updating the scroll region, since
- that will result in a redraw which would crash otherwise. */
- e_day_view_check_layout (day_view);
- gtk_widget_queue_draw (day_view->time_canvas);
- gtk_widget_queue_draw (day_view->main_canvas);
-
- e_day_view_update_scroll_regions (day_view);
-}
-
/* This specifies the working days in the week. The value is a bitwise
combination of day flags. Defaults to Mon-Fri. */
EDayViewDays
@@ -2846,92 +2741,6 @@ e_day_view_recalc_work_week_days_shown (EDayView *day_view)
e_day_view_set_days_shown (day_view, days_shown);
}
-/* The start and end time of the working day. This only affects the background
- colors. */
-gint
-e_day_view_get_work_day_start_hour (EDayView *day_view)
-{
- g_return_val_if_fail (E_IS_DAY_VIEW (day_view), -1);
-
- return day_view->work_day_start_hour;
-}
-
-void
-e_day_view_set_work_day_start_hour (EDayView *day_view,
- gint work_day_start_hour)
-{
- g_return_if_fail (E_IS_DAY_VIEW (day_view));
-
- day_view->work_day_start_hour = work_day_start_hour;
-
- gtk_widget_queue_draw (day_view->main_canvas);
-
- g_object_notify (G_OBJECT (day_view), "work-day-start-hour");
-}
-
-gint
-e_day_view_get_work_day_start_minute (EDayView *day_view)
-{
- g_return_val_if_fail (E_IS_DAY_VIEW (day_view), -1);
-
- return day_view->work_day_start_minute;
-}
-
-void
-e_day_view_set_work_day_start_minute (EDayView *day_view,
- gint work_day_start_minute)
-{
- g_return_if_fail (E_IS_DAY_VIEW (day_view));
-
- day_view->work_day_start_minute = work_day_start_minute;
-
- gtk_widget_queue_draw (day_view->main_canvas);
-
- g_object_notify (G_OBJECT (day_view), "work-day-start-minute");
-}
-
-gint
-e_day_view_get_work_day_end_hour (EDayView *day_view)
-{
- g_return_val_if_fail (E_IS_DAY_VIEW (day_view), -1);
-
- return day_view->work_day_end_hour;
-}
-
-void
-e_day_view_set_work_day_end_hour (EDayView *day_view,
- gint work_day_end_hour)
-{
- g_return_if_fail (E_IS_DAY_VIEW (day_view));
-
- day_view->work_day_end_hour = work_day_end_hour;
-
- gtk_widget_queue_draw (day_view->main_canvas);
-
- g_object_notify (G_OBJECT (day_view), "work-day-end-hour");
-}
-
-gint
-e_day_view_get_work_day_end_minute (EDayView *day_view)
-{
- g_return_val_if_fail (E_IS_DAY_VIEW (day_view), -1);
-
- return day_view->work_day_end_minute;
-}
-
-void
-e_day_view_set_work_day_end_minute (EDayView *day_view,
- gint work_day_end_minute)
-{
- g_return_if_fail (E_IS_DAY_VIEW (day_view));
-
- day_view->work_day_end_minute = work_day_end_minute;
-
- gtk_widget_queue_draw (day_view->main_canvas);
-
- g_object_notify (G_OBJECT (day_view), "work-day-end-minute");
-}
-
/* Force a redraw of the Marcus Bains Lines */
void
e_day_view_marcus_bains_update (EDayView *day_view)
@@ -3124,13 +2933,18 @@ e_day_view_update_scroll_regions (EDayView *day_view)
static void
e_day_view_recalc_num_rows (EDayView *day_view)
{
+ ECalendarView *cal_view;
+ gint time_divisions;
gint hours, minutes, total_minutes;
+ cal_view = E_CALENDAR_VIEW (day_view);
+ time_divisions = e_calendar_view_get_time_divisions (cal_view);
+
hours = day_view->last_hour_shown - day_view->first_hour_shown;
/* This could be negative but it works out OK. */
minutes = day_view->last_minute_shown - day_view->first_minute_shown;
total_minutes = hours * 60 + minutes;
- day_view->rows = total_minutes / day_view->mins_per_row;
+ day_view->rows = total_minutes / time_divisions;
}
/* Converts an hour and minute to a row in the canvas. Note that if we aren't
@@ -3141,8 +2955,13 @@ e_day_view_convert_time_to_row (EDayView *day_view,
gint hour,
gint minute)
{
+ ECalendarView *cal_view;
+ gint time_divisions;
gint total_minutes, start_minute, offset;
+ cal_view = E_CALENDAR_VIEW (day_view);
+ time_divisions = e_calendar_view_get_time_divisions (cal_view);
+
total_minutes = hour * 60 + minute;
start_minute = day_view->first_hour_shown * 60
+ day_view->first_minute_shown;
@@ -3150,7 +2969,7 @@ e_day_view_convert_time_to_row (EDayView *day_view,
if (offset < 0)
return -1;
else
- return offset / day_view->mins_per_row;
+ return offset / time_divisions;
}
/* Converts an hour and minute to a y coordinate in the canvas. */
@@ -3159,14 +2978,19 @@ e_day_view_convert_time_to_position (EDayView *day_view,
gint hour,
gint minute)
{
+ ECalendarView *cal_view;
+ gint time_divisions;
gint total_minutes, start_minute, offset;
+ cal_view = E_CALENDAR_VIEW (day_view);
+ time_divisions = e_calendar_view_get_time_divisions (cal_view);
+
total_minutes = hour * 60 + minute;
start_minute = day_view->first_hour_shown * 60
+ day_view->first_minute_shown;
offset = total_minutes - start_minute;
- return offset * day_view->row_height / day_view->mins_per_row;
+ return offset * day_view->row_height / time_divisions;
}
static gboolean
@@ -3625,10 +3449,15 @@ e_day_view_on_event_click (EDayView *day_view,
gint event_y)
{
EDayViewEvent *event;
+ ECalendarView *cal_view;
GtkLayout *layout;
GdkWindow *window;
+ gint time_divisions;
gint tmp_day, row, start_row;
+ cal_view = E_CALENDAR_VIEW (day_view);
+ time_divisions = e_calendar_view_get_time_divisions (cal_view);
+
if (!is_array_index_in_bounds (day_view->events[day], event_num))
return;
@@ -3671,8 +3500,8 @@ e_day_view_on_event_click (EDayView *day_view,
day_view->resize_event_day = day;
day_view->resize_event_num = event_num;
day_view->resize_drag_pos = pos;
- day_view->resize_start_row = event->start_minute / day_view->mins_per_row;
- day_view->resize_end_row = (event->end_minute - 1) / day_view->mins_per_row;
+ day_view->resize_start_row = event->start_minute / time_divisions;
+ day_view->resize_end_row = (event->end_minute - 1) / time_divisions;
if (day_view->resize_end_row < day_view->resize_start_row)
day_view->resize_end_row = day_view->resize_start_row;
@@ -3698,7 +3527,7 @@ e_day_view_on_event_click (EDayView *day_view,
event_x, event_y,
&tmp_day, &row,
NULL);
- start_row = event->start_minute / day_view->mins_per_row;
+ start_row = event->start_minute / time_divisions;
day_view->drag_event_offset = row - start_row;
}
}
@@ -4754,9 +4583,14 @@ e_day_view_add_event (ECalComponent *comp,
void
e_day_view_check_layout (EDayView *day_view)
{
+ ECalendarView *cal_view;
+ gint time_divisions;
gint day, rows_in_top_display;
gint max_cols = -1;
+ cal_view = E_CALENDAR_VIEW (day_view);
+ time_divisions = e_calendar_view_get_time_divisions (cal_view);
+
/* Don't bother if we aren't visible. */
if (!E_CALENDAR_VIEW (day_view)->in_focus) {
e_day_view_free_events (day_view);
@@ -4771,11 +4605,13 @@ e_day_view_check_layout (EDayView *day_view)
if (day_view->need_layout[day]) {
gint cols;
- cols = e_day_view_layout_day_events (day_view->events[day],
- day_view->rows,
- day_view->mins_per_row,
- day_view->cols_per_row[day],
- day_view->days_shown == 1 ? -1 : E_DAY_VIEW_MULTI_DAY_MAX_COLUMNS);
+ cols = e_day_view_layout_day_events (
+ day_view->events[day],
+ day_view->rows,
+ time_divisions,
+ day_view->cols_per_row[day],
+ day_view->days_shown == 1 ? -1 :
+ E_DAY_VIEW_MULTI_DAY_MAX_COLUMNS);
max_cols = MAX (cols, max_cols);
}
@@ -5462,15 +5298,20 @@ e_day_view_key_press (GtkWidget *widget, GdkEventKey *event)
static void
e_day_view_goto_start_of_work_day (EDayView *day_view)
{
- g_return_if_fail (day_view!=NULL);
+ ECalModel *model;
+ gint work_day_start_hour;
+ gint work_day_start_minute;
+
+ model = e_calendar_view_get_model (E_CALENDAR_VIEW (day_view));
+ work_day_start_hour = e_cal_model_get_work_day_start_hour (model);
+ work_day_start_minute = e_cal_model_get_work_day_start_minute (model);
if (day_view->selection_in_top_canvas)
return;
else
day_view->selection_start_row =
- e_day_view_convert_time_to_row (day_view,
- day_view->work_day_start_hour,
- day_view->work_day_start_minute);
+ e_day_view_convert_time_to_row (
+ day_view, work_day_start_hour, work_day_start_minute);
day_view->selection_end_row = day_view->selection_start_row;
e_day_view_ensure_rows_visible (day_view,
@@ -5488,13 +5329,20 @@ e_day_view_goto_start_of_work_day (EDayView *day_view)
static void
e_day_view_goto_end_of_work_day (EDayView *day_view)
{
+ ECalModel *model;
+ gint work_day_end_hour;
+ gint work_day_end_minute;
+
+ model = e_calendar_view_get_model (E_CALENDAR_VIEW (day_view));
+ work_day_end_hour = e_cal_model_get_work_day_end_hour (model);
+ work_day_end_minute = e_cal_model_get_work_day_end_minute (model);
+
if (day_view->selection_in_top_canvas)
return;
else
day_view->selection_start_row =
- e_day_view_convert_time_to_row (day_view,
- day_view->work_day_end_hour-1,
- day_view->work_day_end_minute+30);
+ e_day_view_convert_time_to_row (
+ day_view, work_day_end_hour-1, work_day_end_minute+30);
day_view->selection_end_row = day_view->selection_start_row;
e_day_view_ensure_rows_visible (day_view,
@@ -5512,8 +5360,16 @@ e_day_view_goto_end_of_work_day (EDayView *day_view)
static void
e_day_view_change_duration_to_start_of_work_day (EDayView *day_view)
{
+ ECalModel *model;
+ gint work_day_start_hour;
+ gint work_day_start_minute;
+
g_return_if_fail (day_view != NULL);
+ model = e_calendar_view_get_model (E_CALENDAR_VIEW (day_view));
+ work_day_start_hour = e_cal_model_get_work_day_start_hour (model);
+ work_day_start_minute = e_cal_model_get_work_day_start_minute (model);
+
if (day_view->selection_in_top_canvas)
return;
else {
@@ -5521,9 +5377,7 @@ e_day_view_change_duration_to_start_of_work_day (EDayView *day_view)
gint work_start_row,selection_start_row;
work_start_row = e_day_view_convert_time_to_row (
- day_view,
- day_view->work_day_start_hour,
- day_view->work_day_start_minute);
+ day_view, work_day_start_hour, work_day_start_minute);
selection_start_row = day_view->selection_start_row;
if (selection_start_row < work_start_row)
day_view->selection_end_row = work_start_row - 1;
@@ -5545,17 +5399,23 @@ e_day_view_change_duration_to_start_of_work_day (EDayView *day_view)
static void
e_day_view_change_duration_to_end_of_work_day (EDayView *day_view)
{
+ ECalModel *model;
+ gint work_day_end_hour;
+ gint work_day_end_minute;
+
g_return_if_fail (day_view != NULL);
+ model = e_calendar_view_get_model (E_CALENDAR_VIEW (day_view));
+ work_day_end_hour = e_cal_model_get_work_day_end_hour (model);
+ work_day_end_minute = e_cal_model_get_work_day_end_minute (model);
+
if (day_view->selection_in_top_canvas)
return;
else {
gint work_end_row,selection_start_row;
work_end_row = e_day_view_convert_time_to_row (
- day_view,
- day_view->work_day_end_hour-1,
- day_view->work_day_end_minute+30);
+ day_view, work_day_end_hour-1, work_day_end_minute+30);
selection_start_row = day_view->selection_start_row;
if (selection_start_row <= work_end_row)
day_view->selection_end_row = work_end_row;
@@ -6471,10 +6331,12 @@ e_day_view_on_text_item_event (GnomeCanvasItem *item,
}
static gboolean
-e_day_view_event_move (ECalendarView *cal_view, ECalViewMoveDirection direction)
+e_day_view_event_move (ECalendarView *cal_view,
+ ECalViewMoveDirection direction)
{
EDayViewEvent *event;
EDayView *day_view;
+ gint time_divisions;
gint day, event_num, resize_start_row, resize_end_row;
time_t start_dt, end_dt;
struct icaltimetype start_time, end_time;
@@ -6483,6 +6345,8 @@ e_day_view_event_move (ECalendarView *cal_view, ECalViewMoveDirection direction)
day = day_view->editing_event_day;
event_num = day_view->editing_event_num;
+ time_divisions = e_calendar_view_get_time_divisions (cal_view);
+
if ((day == -1) || (day == E_DAY_VIEW_LONG_EVENT))
return FALSE;
@@ -6495,8 +6359,8 @@ e_day_view_event_move (ECalendarView *cal_view, ECalViewMoveDirection direction)
day_view->resize_event_num = event_num;
day_view->resize_bars_event_day = day;
day_view->resize_bars_event_num = event_num;
- resize_start_row = event->start_minute / day_view->mins_per_row;
- resize_end_row = (event->end_minute - 1) / day_view->mins_per_row;
+ resize_start_row = event->start_minute / time_divisions;
+ resize_end_row = (event->end_minute - 1) / time_divisions;
if (resize_end_row < resize_start_row)
resize_end_row = resize_start_row;
@@ -6642,6 +6506,8 @@ static void
e_day_view_change_event_end_time_up (EDayView *day_view)
{
EDayViewEvent *event;
+ ECalendarView *cal_view;
+ gint time_divisions;
gint day, event_num, resize_start_row, resize_end_row;
day = day_view->editing_event_day;
@@ -6652,14 +6518,17 @@ e_day_view_change_event_end_time_up (EDayView *day_view)
if (!is_array_index_in_bounds (day_view->events[day], event_num))
return;
+ cal_view = E_CALENDAR_VIEW (day_view);
+ time_divisions = e_calendar_view_get_time_divisions (cal_view);
+
event = &g_array_index (day_view->events[day], EDayViewEvent,
event_num);
day_view->resize_event_day = day;
day_view->resize_event_num = event_num;
day_view->resize_bars_event_day = day;
day_view->resize_bars_event_num = event_num;
- resize_start_row = event->start_minute / day_view->mins_per_row;
- resize_end_row = (event->end_minute - 1) / day_view->mins_per_row;
+ resize_start_row = event->start_minute / time_divisions;
+ resize_end_row = (event->end_minute - 1) / time_divisions;
if (resize_end_row < resize_start_row)
resize_end_row = resize_start_row;
if (resize_end_row == resize_start_row)
@@ -6676,8 +6545,13 @@ static void
e_day_view_change_event_end_time_down (EDayView *day_view)
{
EDayViewEvent *event;
+ ECalendarView *cal_view;
+ gint time_divisions;
gint day, event_num, resize_start_row, resize_end_row;
+ cal_view = E_CALENDAR_VIEW (day_view);
+ time_divisions = e_calendar_view_get_time_divisions (cal_view);
+
day = day_view->editing_event_day;
event_num = day_view->editing_event_num;
if ((day == -1) || (day == E_DAY_VIEW_LONG_EVENT))
@@ -6692,8 +6566,8 @@ e_day_view_change_event_end_time_down (EDayView *day_view)
day_view->resize_event_num = event_num;
day_view->resize_bars_event_day = day;
day_view->resize_bars_event_num = event_num;
- resize_start_row = event->start_minute / day_view->mins_per_row;
- resize_end_row = (event->end_minute - 1) / day_view->mins_per_row;
+ resize_start_row = event->start_minute / time_divisions;
+ resize_end_row = (event->end_minute - 1) / time_divisions;
if (resize_end_row < resize_start_row)
resize_end_row = resize_start_row;
if (resize_end_row == day_view->rows -1)
@@ -6954,14 +6828,19 @@ e_day_view_convert_grid_position_to_time (EDayView *day_view,
gint col,
gint row)
{
+ ECalendarView *cal_view;
+ gint time_divisions;
struct icaltimetype tt;
time_t val;
gint minutes;
+ cal_view = E_CALENDAR_VIEW (day_view);
+ time_divisions = e_calendar_view_get_time_divisions (cal_view);
+
/* Calulate the number of minutes since the start of the day. */
minutes = day_view->first_hour_shown * 60
+ day_view->first_minute_shown
- + row * day_view->mins_per_row;
+ + row * time_divisions;
/* A special case for midnight, where we can use the start of the
next day. */
@@ -6985,11 +6864,16 @@ e_day_view_convert_time_to_grid_position (EDayView *day_view,
gint *col,
gint *row)
{
+ ECalendarView *cal_view;
struct icaltimetype tt;
+ gint time_divisions;
gint day, minutes;
*col = *row = 0;
+ cal_view = E_CALENDAR_VIEW (day_view);
+ time_divisions = e_calendar_view_get_time_divisions (cal_view);
+
if (time < day_view->lower || time >= day_view->upper)
return FALSE;
@@ -7009,7 +6893,7 @@ e_day_view_convert_time_to_grid_position (EDayView *day_view,
minutes = tt.hour * 60 + tt.minute;
minutes -= day_view->first_hour_shown * 60 + day_view->first_minute_shown;
- *row = minutes / day_view->mins_per_row;
+ *row = minutes / time_divisions;
if (*row < 0 || *row >= day_view->rows)
return FALSE;
@@ -7151,8 +7035,10 @@ e_day_view_get_event_rows (EDayView *day_view,
gint *start_row_out,
gint *end_row_out)
{
- gint start_row, end_row;
+ ECalendarView *cal_view;
EDayViewEvent *event;
+ gint time_divisions;
+ gint start_row, end_row;
g_return_val_if_fail (day >= 0, FALSE);
g_return_val_if_fail (day < E_DAY_VIEW_LONG_EVENT, FALSE);
@@ -7161,10 +7047,13 @@ e_day_view_get_event_rows (EDayView *day_view,
if (!is_array_index_in_bounds (day_view->events[day], event_num))
return FALSE;
+ cal_view = E_CALENDAR_VIEW (day_view);
+ time_divisions = e_calendar_view_get_time_divisions (cal_view);
+
event = &g_array_index (day_view->events[day], EDayViewEvent,
event_num);
- start_row = event->start_minute / day_view->mins_per_row;
- end_row = (event->end_minute - 1) / day_view->mins_per_row;
+ start_row = event->start_minute / time_divisions;
+ end_row = (event->end_minute - 1) / time_divisions;
if (end_row < start_row)
end_row = start_row;
@@ -7653,10 +7542,15 @@ e_day_view_update_main_canvas_drag (EDayView *day_view,
gint day)
{
EDayViewEvent *event = NULL;
+ ECalendarView *cal_view;
+ gint time_divisions;
gint cols_in_row, start_col, num_columns, num_rows, start_row, end_row;
gdouble item_x, item_y, item_w, item_h;
gchar *text;
+ cal_view = E_CALENDAR_VIEW (day_view);
+ time_divisions = e_calendar_view_get_time_divisions (cal_view);
+
/* If the position hasn't changed, just return. */
if (day_view->drag_last_day == day
&& day_view->drag_last_row == row
@@ -7687,8 +7581,8 @@ e_day_view_update_main_canvas_drag (EDayView *day_view,
event = &g_array_index (day_view->events[day_view->drag_event_day],
EDayViewEvent,
day_view->drag_event_num);
- start_row = event->start_minute / day_view->mins_per_row;
- end_row = (event->end_minute - 1) / day_view->mins_per_row;
+ start_row = event->start_minute / time_divisions;
+ end_row = (event->end_minute - 1) / time_divisions;
if (end_row < start_row)
end_row = start_row;
@@ -7955,6 +7849,8 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget,
time_t dt;
gboolean all_day_event;
ECal *client;
+ ECalModel *model;
+ ECalendarView *cal_view;
gboolean drag_from_same_window;
const guchar *data;
gint format, length;
@@ -7968,7 +7864,9 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget,
else
drag_from_same_window = FALSE;
- client = e_cal_model_get_default_client (e_calendar_view_get_model (E_CALENDAR_VIEW (day_view)));
+ cal_view = E_CALENDAR_VIEW (day_view);
+ model = e_calendar_view_get_model (cal_view);
+ client = e_cal_model_get_default_client (model);
/* Note that we only support DnD within the EDayView at present. */
if (length >= 0 && format == 8 && day_view->drag_event_day != -1) {
@@ -8128,7 +8026,7 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget,
if (!icalcomp)
goto error;
- default_zone = calendar_config_get_icaltimezone ();
+ default_zone = e_cal_model_get_timezone (model);
/* check the type of the component */
kind = icalcomponent_isa (icalcomp);
@@ -8185,10 +8083,13 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget,
guint time,
EDayView *day_view)
{
+ ECalendarView *cal_view;
EDayViewEvent *event = NULL;
ECalendarViewPosition pos;
+ gint time_divisions;
gint day, row, start_row, end_row, num_rows, scroll_x, scroll_y;
gint start_offset, end_offset;
+ ECalModel *model;
ECalComponent *comp;
ECalComponentDateTime date;
struct icaltimetype itt;
@@ -8198,6 +8099,10 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget,
const guchar *data;
gint format, length;
+ cal_view = E_CALENDAR_VIEW (day_view);
+ model = e_calendar_view_get_model (cal_view);
+ time_divisions = e_calendar_view_get_time_divisions (cal_view);
+
data = gtk_selection_data_get_data (selection_data);
format = gtk_selection_data_get_format (selection_data);
length = gtk_selection_data_get_length (selection_data);
@@ -8252,17 +8157,17 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget,
row -= day_view->drag_event_offset;
/* Calculate time offset from start row. */
- start_row = event->start_minute / day_view->mins_per_row;
- end_row = (event->end_minute - 1) / day_view->mins_per_row;
+ start_row = event->start_minute / time_divisions;
+ end_row = (event->end_minute - 1) / time_divisions;
if (end_row < start_row)
end_row = start_row;
num_rows = end_row - start_row + 1;
- start_offset = event->start_minute % day_view->mins_per_row;
- end_offset = event->end_minute % day_view->mins_per_row;
+ start_offset = event->start_minute % time_divisions;
+ end_offset = event->end_minute % time_divisions;
if (end_offset != 0)
- end_offset = day_view->mins_per_row - end_offset;
+ end_offset = time_divisions - end_offset;
}
client = event->comp_data->client;
@@ -8348,7 +8253,7 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget,
if (!icalcomp)
goto error;
- default_zone = calendar_config_get_icaltimezone ();
+ default_zone = e_cal_model_get_timezone (model);
/* check the type of the component */
kind = icalcomponent_isa (icalcomp);
diff --git a/calendar/gui/e-day-view.h b/calendar/gui/e-day-view.h
index 04f4186..8728b24 100644
--- a/calendar/gui/e-day-view.h
+++ b/calendar/gui/e-day-view.h
@@ -275,9 +275,6 @@ struct _EDayView {
/* The ID of the timeout function for doing a new layout. */
gint layout_timeout_id;
- /* The number of minutes per row. 5, 10, 15, 30 or 60. */
- gint mins_per_row;
-
/* The number of rows needed, depending on the times shown and the
minutes per row. */
gint rows;
@@ -301,12 +298,6 @@ struct _EDayView {
/* Bitwise combination of working days. Defaults to Mon-Fri. */
EDayViewDays working_days;
- /* The start and end of the work day, rounded to the nearest row. */
- gint work_day_start_hour;
- gint work_day_start_minute;
- gint work_day_end_hour;
- gint work_day_end_minute;
-
/* Whether we show the Marcus Bains Line in the main canvas and time canvas. */
gboolean marcus_bains_show_line;
gchar *marcus_bains_day_view_color;
@@ -506,33 +497,12 @@ gint e_day_view_get_days_shown (EDayView *day_view);
void e_day_view_set_days_shown (EDayView *day_view,
gint days_shown);
-/* This specifies how many minutes are represented by one row in the display.
- It can be 60, 30, 15, 10 or 5. The default is 30. */
-gint e_day_view_get_mins_per_row (EDayView *day_view);
-void e_day_view_set_mins_per_row (EDayView *day_view,
- gint mins_per_row);
-
/* This specifies the working days in the week. The value is a bitwise
combination of day flags. Defaults to Mon-Fri. */
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. */
-gint e_day_view_get_work_day_start_hour (EDayView *day_view);
-void e_day_view_set_work_day_start_hour (EDayView *day_view,
- gint work_day_start_hour);
-gint e_day_view_get_work_day_start_minute (EDayView *day_view);
-void e_day_view_set_work_day_start_minute (EDayView *day_view,
- gint work_day_start_minute);
-gint e_day_view_get_work_day_end_hour (EDayView *day_view);
-void e_day_view_set_work_day_end_hour (EDayView *day_view,
- gint work_day_end_hour);
-gint e_day_view_get_work_day_end_minute (EDayView *day_view);
-void e_day_view_set_work_day_end_minute (EDayView *day_view,
- gint work_day_end_minute);
-
/* Whether we display the Marcus Bains Line in the main canvas and time
canvas. */
void e_day_view_marcus_bains_update (EDayView *day_view);
diff --git a/calendar/gui/e-meeting-store.c b/calendar/gui/e-meeting-store.c
index dd746e3..4893728 100644
--- a/calendar/gui/e-meeting-store.c
+++ b/calendar/gui/e-meeting-store.c
@@ -32,6 +32,7 @@
#include <libecal/e-cal-time-util.h>
#include <libedataserver/e-data-server-util.h>
#include <e-util/e-extensible.h>
+#include <e-util/e-util-enumtypes.h>
#include "itip-utils.h"
#include "e-meeting-utils.h"
#include "e-meeting-attendee.h"
@@ -51,6 +52,11 @@ struct _EMeetingStorePrivate {
ECal *client;
icaltimezone *zone;
+ gint default_reminder_interval;
+ EDurationType default_reminder_units;
+
+ gint week_start_day;
+
gchar *fb_uri;
GPtrArray *refresh_queue;
@@ -84,8 +90,11 @@ struct _EMeetingStoreQueueData {
enum {
PROP_0,
PROP_CLIENT,
+ PROP_DEFAULT_REMINDER_INTERVAL,
+ PROP_DEFAULT_REMINDER_UNITS,
PROP_FREE_BUSY_TEMPLATE,
- PROP_TIMEZONE
+ PROP_TIMEZONE,
+ PROP_WEEK_START_DAY
};
/* Forward Declarations */
@@ -580,6 +589,18 @@ meeting_store_set_property (GObject *object,
g_value_get_object (value));
return;
+ case PROP_DEFAULT_REMINDER_INTERVAL:
+ e_meeting_store_set_default_reminder_interval (
+ E_MEETING_STORE (object),
+ g_value_get_int (value));
+ return;
+
+ case PROP_DEFAULT_REMINDER_UNITS:
+ e_meeting_store_set_default_reminder_units (
+ E_MEETING_STORE (object),
+ g_value_get_enum (value));
+ return;
+
case PROP_FREE_BUSY_TEMPLATE:
e_meeting_store_set_free_busy_template (
E_MEETING_STORE (object),
@@ -591,6 +612,12 @@ meeting_store_set_property (GObject *object,
E_MEETING_STORE (object),
g_value_get_pointer (value));
return;
+
+ case PROP_WEEK_START_DAY:
+ e_meeting_store_set_week_start_day (
+ E_MEETING_STORE (object),
+ g_value_get_int (value));
+ return;
}
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -610,6 +637,20 @@ meeting_store_get_property (GObject *object,
E_MEETING_STORE (object)));
return;
+ case PROP_DEFAULT_REMINDER_INTERVAL:
+ g_value_set_int (
+ value,
+ e_meeting_store_get_default_reminder_interval (
+ E_MEETING_STORE (object)));
+ return;
+
+ case PROP_DEFAULT_REMINDER_UNITS:
+ g_value_set_enum (
+ value,
+ e_meeting_store_get_default_reminder_units (
+ E_MEETING_STORE (object)));
+ return;
+
case PROP_FREE_BUSY_TEMPLATE:
g_value_set_string (
value,
@@ -623,6 +664,13 @@ meeting_store_get_property (GObject *object,
e_meeting_store_get_timezone (
E_MEETING_STORE (object)));
return;
+
+ case PROP_WEEK_START_DAY:
+ g_value_set_int (
+ value,
+ e_meeting_store_get_week_start_day (
+ E_MEETING_STORE (object)));
+ return;
}
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -685,6 +733,29 @@ e_meeting_store_class_init (EMeetingStoreClass *class)
g_object_class_install_property (
object_class,
+ PROP_DEFAULT_REMINDER_INTERVAL,
+ g_param_spec_int (
+ "default-reminder-interval",
+ "Default Reminder Interval",
+ NULL,
+ G_MININT,
+ G_MAXINT,
+ 0,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_DEFAULT_REMINDER_UNITS,
+ g_param_spec_enum (
+ "default-reminder-units",
+ "Default Reminder Units",
+ NULL,
+ E_TYPE_DURATION_TYPE,
+ E_DURATION_MINUTES,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
PROP_FREE_BUSY_TEMPLATE,
g_param_spec_string (
"free-busy-template",
@@ -701,6 +772,18 @@ e_meeting_store_class_init (EMeetingStoreClass *class)
"Timezone",
NULL,
G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_WEEK_START_DAY,
+ g_param_spec_int (
+ "week-start-day",
+ "Week Start Day",
+ NULL,
+ 0, /* Monday */
+ 6, /* Sunday */
+ 0,
+ G_PARAM_READWRITE));
}
static void
@@ -752,6 +835,44 @@ e_meeting_store_set_client (EMeetingStore *store,
g_object_notify (G_OBJECT (store), "client");
}
+gint
+e_meeting_store_get_default_reminder_interval (EMeetingStore *store)
+{
+ g_return_val_if_fail (E_IS_MEETING_STORE (store), 0);
+
+ return store->priv->default_reminder_interval;
+}
+
+void
+e_meeting_store_set_default_reminder_interval (EMeetingStore *store,
+ gint default_reminder_interval)
+{
+ g_return_if_fail (E_IS_MEETING_STORE (store));
+
+ store->priv->default_reminder_interval = default_reminder_interval;
+
+ g_object_notify (G_OBJECT (store), "default-reminder-interval");
+}
+
+EDurationType
+e_meeting_store_get_default_reminder_units (EMeetingStore *store)
+{
+ g_return_val_if_fail (E_IS_MEETING_STORE (store), 0);
+
+ return store->priv->default_reminder_units;
+}
+
+void
+e_meeting_store_set_default_reminder_units (EMeetingStore *store,
+ EDurationType default_reminder_units)
+{
+ g_return_if_fail (E_IS_MEETING_STORE (store));
+
+ store->priv->default_reminder_units = default_reminder_units;
+
+ g_object_notify (G_OBJECT (store), "default-reminder-units");
+}
+
const gchar *
e_meeting_store_get_free_busy_template (EMeetingStore *store)
{
@@ -791,6 +912,25 @@ e_meeting_store_set_timezone (EMeetingStore *store,
g_object_notify (G_OBJECT (store), "timezone");
}
+gint
+e_meeting_store_get_week_start_day (EMeetingStore *store)
+{
+ g_return_val_if_fail (E_IS_MEETING_STORE (store), 0);
+
+ return store->priv->week_start_day;
+}
+
+void
+e_meeting_store_set_week_start_day (EMeetingStore *store,
+ gint week_start_day)
+{
+ g_return_if_fail (E_IS_MEETING_STORE (store));
+
+ store->priv->week_start_day = week_start_day;
+
+ g_object_notify (G_OBJECT (store), "week-start-day");
+}
+
static void
attendee_changed_cb (EMeetingAttendee *attendee, gpointer data)
{
diff --git a/calendar/gui/e-meeting-store.h b/calendar/gui/e-meeting-store.h
index 62287a7..3565657 100644
--- a/calendar/gui/e-meeting-store.h
+++ b/calendar/gui/e-meeting-store.h
@@ -25,6 +25,7 @@
#include <gtk/gtk.h>
#include <libecal/e-cal.h>
+#include <e-util/e-util-enums.h>
#include "e-meeting-attendee.h"
/* Standard GObject macros */
@@ -88,6 +89,16 @@ void e_meeting_store_set_value (EMeetingStore *meeting_store,
ECal * e_meeting_store_get_client (EMeetingStore *meeting_store);
void e_meeting_store_set_client (EMeetingStore *meeting_store,
ECal *client);
+gint e_meeting_store_get_default_reminder_interval
+ (EMeetingStore *meeting_store);
+void e_meeting_store_set_default_reminder_interval
+ (EMeetingStore *meeting_store,
+ gint default_reminder_interval);
+EDurationType e_meeting_store_get_default_reminder_units
+ (EMeetingStore *meeting_store);
+void e_meeting_store_set_default_reminder_units
+ (EMeetingStore *meeting_store,
+ EDurationType default_reminder_units);
const gchar * e_meeting_store_get_free_busy_template
(EMeetingStore *meeting_store);
void e_meeting_store_set_free_busy_template
@@ -96,6 +107,11 @@ void e_meeting_store_set_free_busy_template
icaltimezone * e_meeting_store_get_timezone (EMeetingStore *meeting_store);
void e_meeting_store_set_timezone (EMeetingStore *meeting_store,
icaltimezone *timezone);
+gint e_meeting_store_get_week_start_day
+ (EMeetingStore *meeting_store);
+void e_meeting_store_set_week_start_day
+ (EMeetingStore *meeting_store,
+ gint week_start_day);
void e_meeting_store_add_attendee (EMeetingStore *meeting_store,
EMeetingAttendee *attendee);
EMeetingAttendee *
diff --git a/calendar/gui/e-meeting-time-sel-item.c b/calendar/gui/e-meeting-time-sel-item.c
index f7c600c..b045912 100644
--- a/calendar/gui/e-meeting-time-sel-item.c
+++ b/calendar/gui/e-meeting-time-sel-item.c
@@ -203,19 +203,19 @@ static void
draw_strikeout_box (EMeetingTimeSelectorItem *mts_item, cairo_t *cr,
int x, int y, int width, int height)
{
- GnomeCanvas *canvas = GNOME_CANVAS_ITEM (mts_item)->canvas;
- EMeetingTimeSelector *mts = mts_item->mts;
+ GnomeCanvas *canvas = GNOME_CANVAS_ITEM (mts_item)->canvas;
+ EMeetingTimeSelector *mts = mts_item->mts;
- cairo_save (cr);
+ cairo_save (cr);
- cairo_rectangle (cr, x, y, width, height);
- cairo_clip (cr);
+ cairo_rectangle (cr, x, y, width, height);
+ cairo_clip (cr);
- cairo_translate (cr, -canvas->draw_xofs, -canvas->draw_yofs);
- cairo_set_source (cr, mts->no_info_pattern);
- cairo_paint (cr);
+ cairo_translate (cr, -canvas->draw_xofs, -canvas->draw_yofs);
+ cairo_set_source (cr, mts->no_info_pattern);
+ cairo_paint (cr);
- cairo_restore (cr);
+ cairo_restore (cr);
}
static void
@@ -382,9 +382,9 @@ e_meeting_time_selector_item_paint_day_top (EMeetingTimeSelectorItem *mts_item,
gint hour, hour_x, hour_y;
PangoLayout *layout;
- cairo_save (cr);
+ cairo_save (cr);
- cairo_set_line_width (cr, 1.0);
+ cairo_set_line_width (cr, 1.0);
mts = mts_item->mts;
@@ -395,36 +395,36 @@ e_meeting_time_selector_item_paint_day_top (EMeetingTimeSelectorItem *mts_item,
gdk_cairo_set_source_color (cr, &mts->grid_color);
cairo_move_to (cr, x + 0.5, y + 0.5);
- cairo_rel_line_to (cr, mts->day_width - 1, 0);
- cairo_stroke (cr);
+ cairo_rel_line_to (cr, mts->day_width - 1, 0);
+ cairo_stroke (cr);
gdk_cairo_set_source_color (cr, &mts->grid_shadow_color);
cairo_move_to (cr, x + 0.5, y + 1.5);
- cairo_rel_line_to (cr, mts->day_width - 1, 0);
- cairo_stroke (cr);
+ cairo_rel_line_to (cr, mts->day_width - 1, 0);
+ cairo_stroke (cr);
gdk_cairo_set_source_color (cr, &mts->grid_color);
y += mts->row_height;
- cairo_move_to (cr, x + 0.5, y + 0.5);
- cairo_rel_line_to (cr, mts->day_width - 1, 0);
+ cairo_move_to (cr, x + 0.5, y + 0.5);
+ cairo_rel_line_to (cr, mts->day_width - 1, 0);
y += mts->row_height;
- cairo_move_to (cr, x + 0.5, y + 0.5);
- cairo_rel_line_to (cr, mts->day_width - 1, 0);
+ cairo_move_to (cr, x + 0.5, y + 0.5);
+ cairo_rel_line_to (cr, mts->day_width - 1, 0);
/* Draw the vertical grid lines. */
for (grid_x = mts->col_width - 1;
grid_x < mts->day_width - mts->col_width;
grid_x += mts->col_width) {
- cairo_move_to (cr, x + grid_x + 0.5, mts->row_height * 2 - 1 - scroll_y + 0.5);
- cairo_line_to (cr, x + grid_x + 0.5, height + 0.5);
+ cairo_move_to (cr, x + grid_x + 0.5, mts->row_height * 2 - 1 - scroll_y + 0.5);
+ cairo_line_to (cr, x + grid_x + 0.5, height + 0.5);
}
grid_x = mts->day_width - 2;
- cairo_move_to (cr, x + grid_x + 0.5, 0.5);
- cairo_rel_line_to (cr, 0, height);
+ cairo_move_to (cr, x + grid_x + 0.5, 0.5);
+ cairo_rel_line_to (cr, 0, height);
grid_x++;
- cairo_move_to (cr, x + grid_x + 0.5, 0.5);
- cairo_rel_line_to (cr, 0, height);
- cairo_stroke (cr);
+ cairo_move_to (cr, x + grid_x + 0.5, 0.5);
+ cairo_rel_line_to (cr, 0, height);
+ cairo_stroke (cr);
/* Draw the date. Set a clipping rectangle so we don't draw over the
next day. */
@@ -443,36 +443,36 @@ e_meeting_time_selector_item_paint_day_top (EMeetingTimeSelectorItem *mts_item,
g_date_strftime (buffer, sizeof (buffer), format, date);
- cairo_save (cr);
+ cairo_save (cr);
- cairo_rectangle (cr, x, -scroll_y, mts->day_width - 2, mts->row_height - 2);
- cairo_clip (cr);
+ cairo_rectangle (cr, x, -scroll_y, mts->day_width - 2, mts->row_height - 2);
+ cairo_clip (cr);
pango_layout_set_text (layout, buffer, -1);
- cairo_move_to (cr, x + 2, 4 - scroll_y);
- pango_cairo_show_layout (cr, layout);
+ cairo_move_to (cr, x + 2, 4 - scroll_y);
+ pango_cairo_show_layout (cr, layout);
- cairo_restore (cr);
+ cairo_restore (cr);
/* Draw the hours. */
hour = mts->first_hour_shown;
hour_x = x + 2;
hour_y = mts->row_height + 4 - scroll_y;
while (hour < mts->last_hour_shown) {
- if (calendar_config_get_24_hour_format ())
+ if (e_meeting_time_selector_get_use_24_hour_format (mts))
pango_layout_set_text (layout, EMeetingTimeSelectorHours[hour], -1);
else
pango_layout_set_text (layout, EMeetingTimeSelectorHours12[hour], -1);
- cairo_move_to (cr, hour_x, hour_y);
- pango_cairo_show_layout (cr, layout);
+ cairo_move_to (cr, hour_x, hour_y);
+ pango_cairo_show_layout (cr, layout);
hour += mts->zoomed_out ? 3 : 1;
hour_x += mts->col_width;
}
g_object_unref (layout);
- cairo_restore (cr);
+ cairo_restore (cr);
}
/* This paints the colored bars representing busy periods for the combined
@@ -522,8 +522,8 @@ e_meeting_time_selector_item_paint_day (EMeetingTimeSelectorItem *mts_item,
EMeetingTimeSelector *mts;
gint grid_x, grid_y, attendee_index, unused_y;
- cairo_save (cr);
- cairo_set_line_width (cr, 1.0);
+ cairo_save (cr);
+ cairo_set_line_width (cr, 1.0);
mts = mts_item->mts;
@@ -545,9 +545,9 @@ e_meeting_time_selector_item_paint_day (EMeetingTimeSelectorItem *mts_item,
} else {
gdk_cairo_set_source_color (cr, &mts->grid_unused_color);
}
- cairo_move_to (cr, 0, grid_y);
- cairo_rel_line_to (cr, width, 0);
- cairo_stroke (cr);
+ cairo_move_to (cr, 0, grid_y);
+ cairo_rel_line_to (cr, width, 0);
+ cairo_stroke (cr);
attendee_index++;
}
@@ -560,14 +560,14 @@ e_meeting_time_selector_item_paint_day (EMeetingTimeSelectorItem *mts_item,
grid_x += mts->col_width)
{
cairo_move_to (cr, x + grid_x, 0);
- cairo_line_to (cr, x + grid_x, unused_y - 1);
+ cairo_line_to (cr, x + grid_x, unused_y - 1);
}
- cairo_stroke (cr);
+ cairo_stroke (cr);
- cairo_rectangle (cr,
- x + mts->day_width - 2, 0,
- 2, unused_y);
- cairo_fill (cr);
+ cairo_rectangle (cr,
+ x + mts->day_width - 2, 0,
+ 2, unused_y);
+ cairo_fill (cr);
}
if (unused_y < height) {
@@ -577,17 +577,17 @@ e_meeting_time_selector_item_paint_day (EMeetingTimeSelectorItem *mts_item,
grid_x += mts->col_width)
{
cairo_move_to (cr, x + grid_x, unused_y);
- cairo_line_to (cr, x + grid_x, height);
+ cairo_line_to (cr, x + grid_x, height);
}
- cairo_stroke (cr);
+ cairo_stroke (cr);
- cairo_rectangle (cr,
- x + mts->day_width - 2, unused_y,
- 2, height - unused_y);
- cairo_fill (cr);
+ cairo_rectangle (cr,
+ x + mts->day_width - 2, unused_y,
+ 2, height - unused_y);
+ cairo_fill (cr);
}
- cairo_restore (cr);
+ cairo_restore (cr);
}
/* This paints the colored bars representing busy periods for the individual
diff --git a/calendar/gui/e-memo-table.c b/calendar/gui/e-memo-table.c
index b634f92..802e90d 100644
--- a/calendar/gui/e-memo-table.c
+++ b/calendar/gui/e-memo-table.c
@@ -981,12 +981,15 @@ get_selected_comp (EMemoTable *memo_table)
static void
memo_table_delete_selection (ESelectable *selectable)
{
+ ECalModel *model;
EMemoTable *memo_table;
ECalComponent *comp = NULL;
ECalModelComponent *comp_data;
+ gboolean delete = TRUE;
gint n_selected;
memo_table = E_MEMO_TABLE (selectable);
+ model = e_memo_table_get_model (memo_table);
n_selected = e_table_selected_count (E_TABLE (memo_table));
if (n_selected <= 0)
@@ -1005,9 +1008,13 @@ memo_table_delete_selection (ESelectable *selectable)
comp, icalcomponent_new_clone (comp_data->icalcomp));
}
- if (delete_component_dialog (
- comp, FALSE, n_selected, E_CAL_COMPONENT_JOURNAL,
- GTK_WIDGET (memo_table)))
+ if (e_cal_model_get_confirm_delete (model))
+ delete = delete_component_dialog (
+ comp, FALSE, n_selected,
+ E_CAL_COMPONENT_JOURNAL,
+ GTK_WIDGET (memo_table));
+
+ if (delete)
delete_selected_components (memo_table);
/* free memory */
diff --git a/calendar/gui/e-task-table.c b/calendar/gui/e-task-table.c
index 0418734..fd6b2c1 100644
--- a/calendar/gui/e-task-table.c
+++ b/calendar/gui/e-task-table.c
@@ -1245,14 +1245,16 @@ check_for_retract (ECalComponent *comp, ECal *client)
static void
task_table_delete_selection (ESelectable *selectable)
{
+ ECalModel *model;
ETaskTable *task_table;
ECalModelComponent *comp_data;
ECalComponent *comp = NULL;
- gboolean delete = FALSE;
+ gboolean delete = TRUE;
gint n_selected;
GError *error = NULL;
task_table = E_TASK_TABLE (selectable);
+ model = e_task_table_get_model (task_table);
n_selected = e_table_selected_count (E_TABLE (task_table));
if (n_selected <= 0)
@@ -1302,11 +1304,11 @@ task_table_delete_selection (ESelectable *selectable)
}
}
- } else {
+ } else if (e_cal_model_get_confirm_delete (model))
delete = delete_component_dialog (
comp, FALSE, n_selected,
- E_CAL_COMPONENT_TODO, GTK_WIDGET (task_table));
- }
+ E_CAL_COMPONENT_TODO,
+ GTK_WIDGET (task_table));
if (delete)
delete_selected_components (task_table);
diff --git a/calendar/gui/e-week-view-event-item.c b/calendar/gui/e-week-view-event-item.c
index 1054770..569449f 100644
--- a/calendar/gui/e-week-view-event-item.c
+++ b/calendar/gui/e-week-view-event-item.c
@@ -35,7 +35,6 @@
#include <gtk/gtk.h>
#include "e-calendar-view.h"
-#include "calendar-config.h"
#include "comp-util.h"
#include <text/e-text.h>
@@ -731,7 +730,6 @@ week_view_event_item_draw (GnomeCanvasItem *canvas_item,
cairo_pattern_t *pat;
guint16 red, green, blue;
gdouble radius, cx0, cy0, rect_height, rect_width;
- gboolean gradient;
gdouble cc = 65535.0;
GdkRegion *draw_region;
GdkRectangle rect;
@@ -790,7 +788,6 @@ week_view_event_item_draw (GnomeCanvasItem *canvas_item,
}
cr = gdk_cairo_create (drawable);
- gradient = calendar_config_get_display_events_gradient ();
icon_y = y1 + E_WEEK_VIEW_EVENT_BORDER_HEIGHT + E_WEEK_VIEW_ICON_Y_PAD;
@@ -863,17 +860,12 @@ week_view_event_item_draw (GnomeCanvasItem *canvas_item,
cairo_save (cr);
draw_curved_rectangle (cr, cx0, cy0, rect_width, rect_height, radius);
- if (gradient) {
- pat = cairo_pattern_create_linear (rect_x + 2, y1 + 1, rect_x + 2, y2 - 7.25);
- cairo_pattern_add_color_stop_rgba (pat, 1, red/cc, green/cc, blue/cc, 0.8);
- cairo_pattern_add_color_stop_rgba (pat, 0, red/cc, green/cc, blue/cc, 0.4);
- cairo_set_source (cr, pat);
- cairo_fill_preserve (cr);
- cairo_pattern_destroy (pat);
- } else {
- cairo_set_source_rgba (cr, red/cc, green/cc, blue/cc, 0.8);
- cairo_fill_preserve (cr);
- }
+ pat = cairo_pattern_create_linear (rect_x + 2, y1 + 1, rect_x + 2, y2 - 7.25);
+ cairo_pattern_add_color_stop_rgba (pat, 1, red/cc, green/cc, blue/cc, 0.8);
+ cairo_pattern_add_color_stop_rgba (pat, 0, red/cc, green/cc, blue/cc, 0.4);
+ cairo_set_source (cr, pat);
+ cairo_fill_preserve (cr);
+ cairo_pattern_destroy (pat);
cairo_set_source_rgba (cr, red/cc, green/cc, blue/cc, 0.2);
cairo_set_line_width (cr, 0.5);
cairo_stroke (cr);
@@ -981,17 +973,12 @@ week_view_event_item_draw (GnomeCanvasItem *canvas_item,
cairo_save (cr);
draw_curved_rectangle (cr, cx0, cy0, rect_width, rect_height, radius);
- if (gradient) {
- pat = cairo_pattern_create_linear (rect_x + 2, y1 + 1, rect_x + 2, y2 - 7.25);
- cairo_pattern_add_color_stop_rgba (pat, 1, red/cc, green/cc, blue/cc, 0.8);
- cairo_pattern_add_color_stop_rgba (pat, 0, red/cc, green/cc, blue/cc, 0.4);
- cairo_set_source (cr, pat);
- cairo_fill_preserve (cr);
- cairo_pattern_destroy (pat);
- } else {
- cairo_set_source_rgba (cr, red/cc, green/cc, blue/cc, 0.8);
- cairo_fill_preserve (cr);
- }
+ pat = cairo_pattern_create_linear (rect_x + 2, y1 + 1, rect_x + 2, y2 - 7.25);
+ cairo_pattern_add_color_stop_rgba (pat, 1, red/cc, green/cc, blue/cc, 0.8);
+ cairo_pattern_add_color_stop_rgba (pat, 0, red/cc, green/cc, blue/cc, 0.4);
+ cairo_set_source (cr, pat);
+ cairo_fill_preserve (cr);
+ cairo_pattern_destroy (pat);
cairo_set_source_rgba (cr, red/cc, green/cc, blue/cc, 0.2);
cairo_set_line_width (cr, 0.5);
cairo_stroke (cr);
diff --git a/calendar/gui/ea-day-view-main-item.c b/calendar/gui/ea-day-view-main-item.c
index a4cb026..7d95e8f 100644
--- a/calendar/gui/ea-day-view-main-item.c
+++ b/calendar/gui/ea-day-view-main-item.c
@@ -553,7 +553,9 @@ ea_day_view_main_item_get_row_label (EaDayViewMainItem *ea_main_item,
GObject *g_obj;
EDayViewMainItem *main_item;
EDayView *day_view;
+ ECalendarView *cal_view;
const gchar *suffix;
+ gint time_divisions;
gint hour, minute, suffix_width;
g_return_val_if_fail (ea_main_item, 0);
@@ -566,9 +568,12 @@ ea_day_view_main_item_get_row_label (EaDayViewMainItem *ea_main_item,
main_item = E_DAY_VIEW_MAIN_ITEM (g_obj);
day_view = e_day_view_main_item_get_day_view (main_item);
+ cal_view = E_CALENDAR_VIEW (day_view);
+ time_divisions = e_calendar_view_get_time_divisions (cal_view);
+
hour = day_view->first_hour_shown;
minute = day_view->first_minute_shown;
- minute += row * day_view->mins_per_row;
+ minute += row * time_divisions;
hour = (hour + minute / 60) % 24;
minute %= 60;
diff --git a/calendar/gui/goto.c b/calendar/gui/goto.c
index fdb2264..bf24c3c 100644
--- a/calendar/gui/goto.c
+++ b/calendar/gui/goto.c
@@ -217,6 +217,7 @@ goto_dialog (GtkWindow *parent, GnomeCalendar *gcal)
time_t start_time;
struct icaltimetype tt;
icaltimezone *timezone;
+ gint week_start_day;
gint b;
if (dlg) {
@@ -262,7 +263,8 @@ goto_dialog (GtkWindow *parent, GnomeCalendar *gcal)
dlg->ecal->calitem->selection_end_day = tt.day;
/* Set week_start_day. Convert it to 0 (Mon) to 6 (Sun), which is what we use. */
- dlg->ecal->calitem->week_start_day = (calendar_config_get_week_start_day () + 6) % 7;
+ week_start_day = e_cal_model_get_week_start_day (model);
+ dlg->ecal->calitem->week_start_day = (week_start_day + 6) % 7;
gnome_canvas_item_grab_focus (GNOME_CANVAS_ITEM (dlg->ecal->calitem));
diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c
index 448d394..05b5f0a 100644
--- a/calendar/gui/itip-utils.c
+++ b/calendar/gui/itip-utils.c
@@ -32,7 +32,6 @@
#include <libecal/e-cal-time-util.h>
#include <libecal/e-cal-util.h>
#include <libsoup/soup.h>
-#include "calendar-config.h"
#include "itip-utils.h"
#include <time.h>
#include "dialogs/comp-editor-util.h"
@@ -279,18 +278,18 @@ itip_strip_mailto (const gchar *address)
}
static gchar *
-get_label (struct icaltimetype *tt)
+get_label (struct icaltimetype *tt,
+ gboolean use_24_hour_format)
{
- gchar buffer[1000];
- struct tm tmp_tm;
+ gchar buffer[1000];
+ struct tm tmp_tm;
tmp_tm = icaltimetype_to_tm (tt);
- e_time_format_date_and_time (&tmp_tm,
- calendar_config_get_24_hour_format (),
- FALSE, FALSE,
- buffer, 1000);
- return g_strdup (buffer);
+ e_time_format_date_and_time (
+ &tmp_tm, use_24_hour_format, FALSE, FALSE, buffer, 1000);
+
+ return g_strdup (buffer);
}
typedef struct {
@@ -771,7 +770,8 @@ comp_filename (ECalComponent *comp)
}
static gchar *
-comp_description (ECalComponent *comp)
+comp_description (ECalComponent *comp,
+ gboolean use_24_hour_format)
{
gchar *description;
ECalComponentDateTime dt;
@@ -790,12 +790,12 @@ comp_description (ECalComponent *comp)
case E_CAL_COMPONENT_FREEBUSY:
e_cal_component_get_dtstart (comp, &dt);
if (dt.value)
- start = get_label (dt.value);
+ start = get_label (dt.value, use_24_hour_format);
e_cal_component_free_datetime (&dt);
e_cal_component_get_dtend (comp, &dt);
if (dt.value)
- end = get_label (dt.value);
+ end = get_label (dt.value, use_24_hour_format);
e_cal_component_free_datetime (&dt);
if (start != NULL && end != NULL)
@@ -1068,7 +1068,12 @@ strip_x_microsoft_props (ECalComponent *comp)
}
static ECalComponent *
-comp_compliant (ECalComponentItipMethod method, ECalComponent *comp, ECal *client, icalcomponent *zones, gboolean strip_alarms)
+comp_compliant (ECalComponentItipMethod method,
+ ECalComponent *comp,
+ ECal *client,
+ icalcomponent *zones,
+ icaltimezone *default_zone,
+ gboolean strip_alarms)
{
ECalComponent *clone, *temp_clone;
struct icaltimetype itt;
@@ -1094,7 +1099,7 @@ comp_compliant (ECalComponentItipMethod method, ECalComponent *comp, ECal *clien
e_cal_component_get_dtstart (clone, &dt);
if (dt.value->is_date) {
- from_zone = calendar_config_get_icaltimezone ();
+ from_zone = default_zone;
} else if (dt.tzid == NULL) {
from_zone = icaltimezone_get_utc_timezone ();
} else {
@@ -1301,21 +1306,39 @@ setup_from (ECalComponentItipMethod method, ECalComponent *comp, ECal *client, E
}
gboolean
-itip_send_comp (ECalComponentItipMethod method, ECalComponent *send_comp,
- ECal *client, icalcomponent *zones, GSList *attachments_list, GList *users,
- gboolean strip_alarms, gboolean only_new_attendees)
+itip_send_comp (ECalComponentItipMethod method,
+ ECalComponent *send_comp,
+ ECal *client,
+ icalcomponent *zones,
+ GSList *attachments_list,
+ GList *users,
+ gboolean strip_alarms,
+ gboolean only_new_attendees)
{
EShell *shell;
+ EShellSettings *shell_settings;
EMsgComposer *composer;
EComposerHeaderTable *table;
EDestination **destinations;
ECalComponent *comp = NULL;
icalcomponent *top_level = NULL;
+ icaltimezone *default_zone;
gchar *ical_string = NULL;
gchar *content_type = NULL;
gchar *subject = NULL;
+ gboolean use_24_hour_format;
gboolean retval = FALSE;
+ /* FIXME Pass this in. */
+ shell = e_shell_get_default ();
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ default_zone = e_shell_settings_get_pointer (
+ shell_settings, "cal-timezone");
+
+ use_24_hour_format = e_shell_settings_get_boolean (
+ shell_settings, "cal-use-24-hour-format");
+
/* check whether backend could handle auto-saving requests/updates */
if (method != E_CAL_COMPONENT_METHOD_PUBLISH && e_cal_get_save_schedules (client))
return TRUE;
@@ -1336,7 +1359,8 @@ itip_send_comp (ECalComponentItipMethod method, ECalComponent *send_comp,
}
/* Tidy up the comp */
- comp = comp_compliant (method, send_comp, client, zones, strip_alarms);
+ comp = comp_compliant (
+ method, send_comp, client, zones, default_zone, strip_alarms);
if (comp == NULL)
goto cleanup;
@@ -1354,9 +1378,6 @@ itip_send_comp (ECalComponentItipMethod method, ECalComponent *send_comp,
/* Subject information */
subject = comp_subject (method, comp);
- /* FIXME Pass this in. */
- shell = e_shell_get_default ();
-
composer = e_msg_composer_new (shell);
table = e_msg_composer_get_header_table (composer);
@@ -1381,7 +1402,7 @@ itip_send_comp (ECalComponentItipMethod method, ECalComponent *send_comp,
gchar *body;
filename = comp_filename (comp);
- description = comp_description (comp);
+ description = comp_description (comp, use_24_hour_format);
body = camel_text_to_html (
description, CAMEL_MIME_FILTER_TOHTML_PRE, 0);
@@ -1439,18 +1460,28 @@ reply_to_calendar_comp (ECalComponentItipMethod method,
GSList *attachments_list)
{
EShell *shell;
+ EShellSettings *shell_settings;
EMsgComposer *composer;
EComposerHeaderTable *table;
EDestination **destinations;
ECalComponent *comp = NULL;
icalcomponent *top_level = NULL;
+ icaltimezone *default_zone;
GList *users = NULL;
gchar *subject = NULL;
gchar *ical_string = NULL;
gboolean retval = FALSE;
+ /* FIXME Pass this in. */
+ shell = e_shell_get_default ();
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ default_zone = e_shell_settings_get_pointer (
+ shell_settings, "cal-timezone");
+
/* Tidy up the comp */
- comp = comp_compliant (method, send_comp, client, zones, TRUE);
+ comp = comp_compliant (
+ method, send_comp, client, zones, default_zone, TRUE);
if (comp == NULL)
goto cleanup;
@@ -1460,9 +1491,6 @@ reply_to_calendar_comp (ECalComponentItipMethod method,
/* Subject information */
subject = comp_subject (method, comp);
- /* FIXME Pass this in. */
- shell = e_shell_get_default ();
-
composer = e_msg_composer_new (shell);
table = e_msg_composer_get_header_table (composer);
@@ -1526,7 +1554,7 @@ reply_to_calendar_comp (ECalComponentItipMethod method,
}
if (!start_zone || dtstart.value->is_date)
- start_zone = calendar_config_get_icaltimezone ();
+ start_zone = default_zone;
start = icaltime_as_timet_with_zone (*dtstart.value, start_zone);
time = g_strdup (ctime (&start));
diff --git a/calendar/gui/print.c b/calendar/gui/print.c
index abd844b..7378ca7 100644
--- a/calendar/gui/print.c
+++ b/calendar/gui/print.c
@@ -43,7 +43,6 @@
#include <e-util/e-print.h>
#include <libecal/e-cal-time-util.h>
#include <libecal/e-cal-component.h>
-#include "calendar-config.h"
#include "e-cal-model.h"
#include "e-day-view.h"
#include "e-day-view-layout.h"
@@ -61,6 +60,8 @@ typedef struct PrintCalItem PrintCalItem;
struct PrintCompItem {
ECal *client;
ECalComponent *comp;
+ icaltimezone *zone;
+ gboolean use_24_hour_format;
};
struct PrintCalItem {
@@ -198,6 +199,7 @@ struct pdinfo
gint mins_per_row;
guint8 cols_per_row[DAY_VIEW_ROWS];
gboolean use_24_hour_format;
+ icaltimezone *zone;
};
struct psinfo
@@ -217,31 +219,31 @@ struct psinfo
gboolean use_24_hour_format;
gdouble row_height;
gdouble header_row_height;
+ icaltimezone *zone;
};
/* Convenience function to help the transition to timezone functions.
It converts a time_t to a struct tm. */
-static struct tm*
-convert_timet_to_struct_tm (time_t time, icaltimezone *zone)
+static void
+convert_timet_to_struct_tm (time_t time,
+ icaltimezone *zone,
+ struct tm *tm)
{
- static struct tm my_tm;
struct icaltimetype tt;
/* Convert it to an icaltimetype. */
tt = icaltime_from_timet_with_zone (time, FALSE, zone);
/* Fill in the struct tm. */
- my_tm.tm_year = tt.year - 1900;
- my_tm.tm_mon = tt.month - 1;
- my_tm.tm_mday = tt.day;
- my_tm.tm_hour = tt.hour;
- my_tm.tm_min = tt.minute;
- my_tm.tm_sec = tt.second;
- my_tm.tm_isdst = tt.is_daylight;
-
- my_tm.tm_wday = time_day_of_week (tt.day, tt.month - 1, tt.year);
-
- return &my_tm;
+ tm->tm_year = tt.year - 1900;
+ tm->tm_mon = tt.month - 1;
+ tm->tm_mday = tt.day;
+ tm->tm_hour = tt.hour;
+ tm->tm_min = tt.minute;
+ tm->tm_sec = tt.second;
+ tm->tm_isdst = tt.is_daylight;
+
+ tm->tm_wday = time_day_of_week (tt.day, tt.month - 1, tt.year);
}
/* Fills the 42-element days array with the day numbers for the specified
@@ -249,7 +251,12 @@ convert_timet_to_struct_tm (time_t time, icaltimezone *zone)
* The starting and ending indexes of the days are returned in the start
* and end arguments. */
static void
-build_month (gint month, gint year, gint *days, gint *start, gint *end)
+build_month (ECalModel *model,
+ gint month,
+ gint year,
+ gint *days,
+ gint *start,
+ gint *end)
{
gint i;
gint d_month, d_week, week_start_day;
@@ -277,7 +284,7 @@ build_month (gint month, gint year, gint *days, gint *start, gint *end)
/* Get the configuration setting specifying which weekday we put on
the left column, 0=Sun to 6=Sat. */
- week_start_day = calendar_config_get_week_start_day ();
+ week_start_day = e_cal_model_get_week_start_day (model);
/* Figure out which square we want to put the 1 in. */
d_week = (d_week + 7 - week_start_day) % 7;
@@ -545,13 +552,12 @@ static const gchar *days[] = {
format the date 'nicely' and consistently for various headers
*/
static gchar *
-format_date (time_t time, gint flags, gchar *buffer, gint bufflen)
+format_date (struct tm *tm,
+ gint flags,
+ gchar *buffer,
+ gint bufflen)
{
- icaltimezone *zone = calendar_config_get_icaltimezone ();
gchar fmt[64];
- struct tm tm;
-
- tm = *convert_timet_to_struct_tm (time, zone);
fmt[0] = 0;
if (flags & DATE_DAYNAME) {
@@ -560,7 +566,7 @@ format_date (time_t time, gint flags, gchar *buffer, gint bufflen)
if (flags & DATE_DAY) {
if (flags & DATE_DAYNAME)
strcat(fmt, " ");
- strcat (fmt, gettext (days[tm.tm_mday-1]));
+ strcat (fmt, gettext (days[tm->tm_mday-1]));
}
if (flags & DATE_MONTH) {
if (flags & (DATE_DAY|DATE_DAYNAME))
@@ -574,7 +580,7 @@ format_date (time_t time, gint flags, gchar *buffer, gint bufflen)
strcat(fmt, " ");
strcat(fmt, "%Y");
}
- e_utf8_strftime (buffer, bufflen, fmt, &tm);
+ e_utf8_strftime (buffer, bufflen, fmt, tm);
buffer[bufflen - 1] = '\0';
return buffer;
@@ -633,8 +639,9 @@ print_month_small (GtkPrintContext *context, GnomeCalendar *gcal, time_t month,
gint titleflags, time_t greystart, time_t greyend,
gint bordertitle)
{
- icaltimezone *zone = calendar_config_get_icaltimezone ();
+ icaltimezone *zone;
PangoFontDescription *font, *font_bold, *font_normal;
+ ECalModel *model;
time_t now, next;
gint x, y;
gint days[42];
@@ -647,10 +654,14 @@ print_month_small (GtkPrintContext *context, GnomeCalendar *gcal, time_t month,
gboolean week_numbers;
cairo_t *cr;
+ model = gnome_calendar_get_model (gcal);
+ zone = e_cal_model_get_timezone (model);
+
week_numbers = get_show_week_numbers ();
/* Print the title, e.g. 'June 2001', in the top 16% of the area. */
- format_date (month, titleflags, buf, 100);
+ convert_timet_to_struct_tm (month, zone, &tm);
+ format_date (&tm, titleflags, buf, 100);
header_size = ABS (y2 - y1) * 0.16;
@@ -673,8 +684,8 @@ print_month_small (GtkPrintContext *context, GnomeCalendar *gcal, time_t month,
font_size = row_height;
/* get month days */
- tm = *convert_timet_to_struct_tm (month, zone);
- build_month (tm.tm_mon, tm.tm_year + 1900, days, NULL, NULL);
+ convert_timet_to_struct_tm (month, zone, &tm);
+ build_month (model, tm.tm_mon, tm.tm_year + 1900, days, NULL, NULL);
font_normal = get_font_for_size (font_size, PANGO_WEIGHT_NORMAL);
font_bold = get_font_for_size (font_size, PANGO_WEIGHT_BOLD);
@@ -689,7 +700,7 @@ print_month_small (GtkPrintContext *context, GnomeCalendar *gcal, time_t month,
cairo_set_source_rgb (cr, 0, 0, 0);
/* Print the abbreviated day names across the top in bold. */
- week_start_day = calendar_config_get_week_start_day ();
+ week_start_day = e_cal_model_get_week_start_day (model);
weekday = week_start_day;
for (x = 0; x < 7; x++) {
print_text (
@@ -727,7 +738,7 @@ print_month_small (GtkPrintContext *context, GnomeCalendar *gcal, time_t month,
if (day != 0) {
time_t week_begin = time_week_begin_with_zone (now, week_start_day, zone);
- tm = *convert_timet_to_struct_tm (week_begin, zone);
+ convert_timet_to_struct_tm (week_begin, zone, &tm);
/* month in e_calendar_item_get_week_number is also zero-based */
sprintf (buf, "%d", e_calendar_item_get_week_number (NULL, tm.tm_mday, tm.tm_mon, tm.tm_year + 1900));
@@ -843,6 +854,7 @@ print_day_background (GtkPrintContext *context, GnomeCalendar *gcal,
time_t whence, struct pdinfo *pdi,
double left, double right, double top, double bottom)
{
+ ECalModel *model;
PangoFontDescription *font_hour, *font_minute;
gdouble yinc, y;
gdouble width = DAY_VIEW_TIME_COLUMN_WIDTH;
@@ -854,7 +866,8 @@ print_day_background (GtkPrintContext *context, GnomeCalendar *gcal,
gdouble hour_minute_x, hour_minute_width;
cairo_t *cr;
- use_24_hour = calendar_config_get_24_hour_format ();
+ model = gnome_calendar_get_model (gcal);
+ use_24_hour = e_cal_model_get_use_24_hour_format (model);
/* Fill the time column in light-gray. */
print_border (context, left, left + width, top, bottom, -1.0, 0.9);
@@ -948,13 +961,13 @@ static gint
print_day_add_event (ECalModelComponent *comp_data,
time_t start,
time_t end,
+ icaltimezone *zone,
gint days_shown,
time_t *day_starts,
GArray *long_events,
GArray **events)
{
- icaltimezone *zone = calendar_config_get_icaltimezone ();
EDayViewEvent event;
gint day, offset;
struct icaltimetype start_tt, end_tt;
@@ -1025,7 +1038,7 @@ print_day_details_cb (ECalComponent *comp, time_t istart, time_t iend,
struct pdinfo *pdi = (struct pdinfo *) mdata->cb_data;
print_day_add_event (mdata->comp_data, istart, iend,
- pdi->days_shown, pdi->day_starts,
+ pdi->zone, pdi->days_shown, pdi->day_starts,
pdi->long_events, pdi->events);
return TRUE;
@@ -1338,7 +1351,8 @@ static void
print_day_details (GtkPrintContext *context, GnomeCalendar *gcal, time_t whence,
double left, double right, double top, double bottom)
{
- icaltimezone *zone = calendar_config_get_icaltimezone ();
+ ECalModel *model;
+ icaltimezone *zone;
EDayViewEvent *event;
PangoFontDescription *font;
time_t start, end;
@@ -1350,7 +1364,8 @@ print_day_details (GtkPrintContext *context, GnomeCalendar *gcal, time_t whence,
#define LONG_DAY_EVENTS_TOP_SPACING 4
#define LONG_DAY_EVENTS_BOTTOM_SPACING 2
- ECalModel *model = gnome_calendar_get_model (gcal);
+ model = gnome_calendar_get_model (gcal);
+ zone = e_cal_model_get_timezone (model);
start = time_day_begin_with_zone (whence, zone);
end = time_day_end_with_zone (start, zone);
@@ -1360,15 +1375,16 @@ print_day_details (GtkPrintContext *context, GnomeCalendar *gcal, time_t whence,
pdi.day_starts[1] = end;
pdi.long_events = g_array_new (FALSE, FALSE, sizeof (EDayViewEvent));
pdi.events[0] = g_array_new (FALSE, FALSE, sizeof (EDayViewEvent));
- pdi.start_hour = calendar_config_get_day_start_hour ();
- pdi.end_hour = calendar_config_get_day_end_hour ();
- if (calendar_config_get_day_end_minute () != 0)
+ pdi.start_hour = e_cal_model_get_work_day_start_hour (model);
+ pdi.end_hour = e_cal_model_get_work_day_end_hour (model);
+ if (e_cal_model_get_work_day_end_minute (model) != 0)
pdi.end_hour++;
pdi.rows = (pdi.end_hour - pdi.start_hour) * 2;
pdi.mins_per_row = 30;
pdi.start_minute_offset = pdi.start_hour * 60;
pdi.end_minute_offset = pdi.end_hour * 60;
- pdi.use_24_hour_format = calendar_config_get_24_hour_format ();
+ pdi.use_24_hour_format = e_cal_model_get_use_24_hour_format (model);
+ pdi.zone = e_cal_model_get_timezone (model);
/* Get the events from the server. */
e_cal_model_generate_instances (model, start, end, print_day_details_cb, &pdi);
@@ -1777,7 +1793,6 @@ print_week_view_background (GtkPrintContext *context,
double left, double top,
double cell_width, double cell_height)
{
- icaltimezone *zone = calendar_config_get_icaltimezone ();
struct tm tm;
gint day, day_x, day_y, day_h;
gdouble x1, x2, y1, y2, font_size, fillcolor;
@@ -1798,7 +1813,7 @@ print_week_view_background (GtkPrintContext *context,
y1 = top + day_y * cell_height;
y2 = y1 + day_h * cell_height;
- tm = *convert_timet_to_struct_tm (psi->day_starts[day], zone);
+ convert_timet_to_struct_tm (psi->day_starts[day], psi->zone, &tm);
/* In the month view we draw a grey background for the end
of the previous month and the start of the following. */
@@ -1848,7 +1863,6 @@ print_week_summary_cb (ECalComponent *comp,
gpointer data)
{
- icaltimezone *zone = calendar_config_get_icaltimezone ();
EWeekViewEvent event;
struct icaltimetype start_tt, end_tt;
ECalModelGenerateInstancesData *mdata = (ECalModelGenerateInstancesData *) data;
@@ -1866,8 +1880,8 @@ print_week_summary_cb (ECalComponent *comp,
g_return_val_if_fail (start < psi->day_starts[psi->days_shown], TRUE);
g_return_val_if_fail (end > psi->day_starts[0], TRUE);
- start_tt = icaltime_from_timet_with_zone (start, FALSE, zone);
- end_tt = icaltime_from_timet_with_zone (end, FALSE, zone);
+ start_tt = icaltime_from_timet_with_zone (start, FALSE, psi->zone);
+ end_tt = icaltime_from_timet_with_zone (end, FALSE, psi->zone);
event.comp_data = g_object_ref (mdata->comp_data);
@@ -1892,7 +1906,7 @@ print_week_summary (GtkPrintContext *context, GnomeCalendar *gcal,
gint month, double font_size,
double left, double right, double top, double bottom)
{
- icaltimezone *zone = calendar_config_get_icaltimezone ();
+ icaltimezone *zone;
EWeekViewEvent *event;
struct psinfo psi;
time_t day_start;
@@ -1900,23 +1914,27 @@ print_week_summary (GtkPrintContext *context, GnomeCalendar *gcal,
GArray *spans;
PangoFontDescription *font;
gdouble cell_width, cell_height;
- ECalModel *model = gnome_calendar_get_model (gcal);
+ ECalModel *model;
+
+ model = gnome_calendar_get_model (gcal);
+ zone = e_cal_model_get_timezone (model);
psi.days_shown = weeks_shown * 7;
psi.events = g_array_new (FALSE, FALSE, sizeof (EWeekViewEvent));
psi.multi_week_view = multi_week_view;
psi.weeks_shown = weeks_shown;
psi.month = month;
+ psi.zone = zone;
/* Get a few config settings. */
if (multi_week_view)
- psi.compress_weekend = calendar_config_get_compress_weekend ();
+ psi.compress_weekend = e_cal_model_get_compress_weekend (model);
else
psi.compress_weekend = TRUE;
- psi.use_24_hour_format = calendar_config_get_24_hour_format ();
+ psi.use_24_hour_format = e_cal_model_get_use_24_hour_format (model);
/* We convert this from (0 = Sun, 6 = Sat) to (0 = Mon, 6 = Sun). */
- psi.display_start_weekday = calendar_config_get_week_start_day ();
+ psi.display_start_weekday = e_cal_model_get_week_start_day (model);
psi.display_start_weekday = (psi.display_start_weekday + 6) % 7;
/* If weekends are compressed then we can't start on a Sunday. */
@@ -1986,68 +2004,30 @@ print_week_summary (GtkPrintContext *context, GnomeCalendar *gcal,
g_array_free (spans, TRUE);
}
-/* XXX Evolution doesn't have a "year" view. */
-#if 0
-static void
-print_year_summary (GtkPrintContext *context, GnomeCalendar *gcal, time_t whence,
- double left, double right, double top, double bottom,
- gint morerows)
-{
- icaltimezone *zone = calendar_config_get_icaltimezone ();
- gdouble row_height, col_width, l, r, t, b;
- time_t now;
- gint col, row, rows, cols;
-
- l = left;
- t = top;
-
- /* If morerows is set we do 4 rows and 3 columns instead of 3 rows and
- 4 columns. This is useful if we switch paper orientation. */
- if (morerows) {
- rows = 4;
- cols = 3;
- } else {
- rows = 3;
- cols = 4;
- }
-
- row_height = (top - bottom) / rows;
- col_width = (right - left) / cols;
- r = l + col_width;
- b = top - row_height;
- now = time_year_begin_with_zone (whence, zone);
-
- for (row = 0; row < rows; row++) {
- t = top - row_height * row;
- b = t - row_height;
- for (col = 0; col < cols; col++) {
- l = left + col_width * col;
- r = l + col_width;
- print_month_small (context, gcal, now,
- l + 8, t - 8, r - 8 - (get_show_week_numbers () ? 1 : 0), b + 8,
- DATE_MONTH, 0, 0, TRUE);
- now = time_add_month_with_zone (now, 1, zone);
- }
- }
-}
-#endif
-
static void
-print_month_summary (GtkPrintContext *context, GnomeCalendar *gcal, time_t whence,
- double left, double right, double top, double bottom)
+print_month_summary (GtkPrintContext *context,
+ GnomeCalendar *gcal,
+ time_t whence,
+ gdouble left,
+ gdouble right,
+ gdouble top,
+ gdouble bottom)
{
- icaltimezone *zone = calendar_config_get_icaltimezone ();
+ icaltimezone *zone;
time_t date;
struct tm tm;
struct icaltimetype tt;
gchar buffer[100];
+ ECalModel *model;
PangoFontDescription *font;
gboolean compress_weekend;
gint columns, col, weekday, month, weeks;
gdouble font_size, cell_width, x1, x2, y1, y2;
- weekday = calendar_config_get_week_start_day ();
- compress_weekend = calendar_config_get_compress_weekend ();
+ model = gnome_calendar_get_model (gcal);
+ zone = e_cal_model_get_timezone (model);
+ weekday = e_cal_model_get_week_start_day (model);
+ compress_weekend = e_cal_model_get_compress_weekend (model);
date = 0;
weeks = 6;
@@ -2088,7 +2068,7 @@ print_month_summary (GtkPrintContext *context, GnomeCalendar *gcal, time_t whenc
to be able to step through the week without worrying about
overflows making strftime choke, so we move near to the start of
the month. */
- tm = *convert_timet_to_struct_tm (date, zone);
+ convert_timet_to_struct_tm (date, zone, &tm);
tm.tm_mday = (tm.tm_mday % 7) + 7;
font = get_font_for_size (MONTH_NORMAL_FONT_SIZE, PANGO_WEIGHT_BOLD);
@@ -2228,12 +2208,17 @@ print_todo_details (GtkPrintContext *context, GnomeCalendar *gcal,
static void
print_day_view (GtkPrintContext *context, GnomeCalendar *gcal, time_t date)
{
+ ECalModel *model;
GtkPageSetup *setup;
- icaltimezone *zone = calendar_config_get_icaltimezone ();
+ icaltimezone *zone;
gint i, days = 1;
gdouble todo, l, week_numbers_inc, small_month_width;
gchar buf[100];
gdouble width, height;
+ struct tm tm;
+
+ model = gnome_calendar_get_model (gcal);
+ zone = e_cal_model_get_timezone (model);
setup = gtk_print_context_get_page_setup (context);
@@ -2273,7 +2258,8 @@ print_day_view (GtkPrintContext *context, GnomeCalendar *gcal, time_t date)
DATE_MONTH | DATE_YEAR, 0, 0, FALSE);
/* Print the date, e.g. '8th May, 2001'. */
- format_date (date, DATE_DAY | DATE_MONTH | DATE_YEAR,
+ convert_timet_to_struct_tm (date, zone, &tm);
+ format_date (&tm, DATE_DAY | DATE_MONTH | DATE_YEAR,
buf, 100);
print_text_size_bold (context, buf, PANGO_ALIGN_LEFT,
@@ -2281,7 +2267,7 @@ print_day_view (GtkPrintContext *context, GnomeCalendar *gcal, time_t date)
4 + 24);
/* Print the day, e.g. 'Tuesday'. */
- format_date (date, DATE_DAYNAME, buf, 100);
+ format_date (&tm, DATE_DAYNAME, buf, 100);
print_text_size_bold (context, buf, PANGO_ALIGN_LEFT,
4, todo,
@@ -2297,6 +2283,7 @@ print_work_week_background (GtkPrintContext *context, GnomeCalendar *gcal,
time_t whence, struct pdinfo *pdi, double left,
double right, double top, double bottom)
{
+ ECalModel *model;
PangoFontDescription *font_hour, *font_minute;
gdouble yinc, y;
gdouble width = DAY_VIEW_TIME_COLUMN_WIDTH;
@@ -2310,7 +2297,8 @@ print_work_week_background (GtkPrintContext *context, GnomeCalendar *gcal,
gdouble hour_minute_xl, hour_minute_xr;
cairo_t *cr;
- use_24_hour = calendar_config_get_24_hour_format ();
+ model = gnome_calendar_get_model (gcal);
+ use_24_hour = e_cal_model_get_use_24_hour_format (model);
/* Fill the left time column in light-gray. */
print_border (context, left, left + width, top, bottom, -1.0, 0.9);
@@ -2440,7 +2428,8 @@ print_work_week_day_details (GtkPrintContext *context, GnomeCalendar *gcal,
time_t whence, double left, double right,
double top, double bottom, struct pdinfo *_pdi)
{
- icaltimezone *zone = calendar_config_get_icaltimezone ();
+ ECalModel *model;
+ icaltimezone *zone;
EDayViewEvent *event;
PangoFontDescription *font;
time_t start, end;
@@ -2452,7 +2441,8 @@ print_work_week_day_details (GtkPrintContext *context, GnomeCalendar *gcal,
#define LONG_DAY_EVENTS_TOP_SPACING 4
#define LONG_DAY_EVENTS_BOTTOM_SPACING 2
- ECalModel *model = gnome_calendar_get_model (gcal);
+ model = gnome_calendar_get_model (gcal);
+ zone = e_cal_model_get_timezone (model);
start = time_day_begin_with_zone (whence, zone);
end = time_day_end_with_zone (start, zone);
@@ -2462,15 +2452,15 @@ print_work_week_day_details (GtkPrintContext *context, GnomeCalendar *gcal,
pdi.day_starts[1] = end;
pdi.long_events = g_array_new (FALSE, FALSE, sizeof (EDayViewEvent));
pdi.events[0] = g_array_new (FALSE, FALSE, sizeof (EDayViewEvent));
- pdi.start_hour = calendar_config_get_day_start_hour ();
- pdi.end_hour = calendar_config_get_day_end_hour ();
- if (calendar_config_get_day_end_minute () != 0)
+ pdi.start_hour = e_cal_model_get_work_day_start_hour (model);
+ pdi.end_hour = e_cal_model_get_work_day_end_hour (model);
+ if (e_cal_model_get_work_day_end_minute (model) != 0)
pdi.end_hour++;
pdi.rows = (pdi.end_hour - pdi.start_hour) * 2;
pdi.mins_per_row = 30;
pdi.start_minute_offset = pdi.start_hour * 60;
pdi.end_minute_offset = pdi.end_hour * 60;
- pdi.use_24_hour_format = calendar_config_get_24_hour_format ();
+ pdi.use_24_hour_format = e_cal_model_get_use_24_hour_format (model);
/* Get the events from the server. */
e_cal_model_generate_instances (model, start, end, print_day_details_cb, &pdi);
@@ -2610,18 +2600,19 @@ print_work_week_day_details (GtkPrintContext *context, GnomeCalendar *gcal,
/* Figure out what the overal hour limits are */
static gboolean
-print_work_week_view_cb (ECalComponent *comp, time_t istart, time_t iend,
- gpointer data)
+print_work_week_view_cb (ECalComponent *comp,
+ time_t istart,
+ time_t iend,
+ gpointer data)
{
ECalModelGenerateInstancesData *mdata = (ECalModelGenerateInstancesData *) data;
struct pdinfo *pdi = (struct pdinfo *) mdata->cb_data;
- icaltimezone *zone = calendar_config_get_icaltimezone ();
struct icaltimetype tt;
- tt = icaltime_from_timet_with_zone (istart, FALSE, zone);
+ tt = icaltime_from_timet_with_zone (istart, FALSE, pdi->zone);
pdi->start_hour = MIN (pdi->start_hour, tt.hour);
- tt = icaltime_from_timet_with_zone (iend, FALSE, zone);
+ tt = icaltime_from_timet_with_zone (iend, FALSE, pdi->zone);
/* If we're past the hour, use the next one */
pdi->end_hour = MAX(pdi->end_hour, tt.minute ? tt.hour + 1 : tt.hour);
@@ -2632,17 +2623,21 @@ static void
print_work_week_view (GtkPrintContext *context, GnomeCalendar *gcal, time_t date)
{
GtkPageSetup *setup;
- icaltimezone *zone = calendar_config_get_icaltimezone ();
+ icaltimezone *zone;
time_t when, start, end;
gdouble width, height, l, small_month_width = calc_small_month_width (context, HEADER_HEIGHT);
gint i, days = 5;
char buf[100];
const int LONG_EVENT_OFFSET = 6;
struct pdinfo pdi;
+ struct tm tm;
gdouble day_width, day_x;
- ECalModel *model = gnome_calendar_get_model (gcal);
+ ECalModel *model;
gdouble weeknum_inc = get_show_week_numbers () ? small_month_width / 7.0 : 0;
+ model = gnome_calendar_get_model (gcal);
+ zone = e_cal_model_get_timezone (model);
+
setup = gtk_print_context_get_page_setup (context);
width = gtk_page_setup_get_page_width (setup, GTK_UNIT_POINTS);
@@ -2653,8 +2648,8 @@ print_work_week_view (GtkPrintContext *context, GnomeCalendar *gcal, time_t date
end = time_add_day_with_zone (start, days, zone);
pdi.days_shown = days;
- pdi.start_hour = calendar_config_get_day_start_hour ();
- pdi.end_hour = calendar_config_get_day_end_hour ();
+ pdi.start_hour = e_cal_model_get_work_day_start_hour (model);
+ pdi.end_hour = e_cal_model_get_work_day_end_hour (model);
e_cal_model_generate_instances (model, start, end,
print_work_week_view_cb, &pdi);
@@ -2679,15 +2674,17 @@ print_work_week_view (GtkPrintContext *context, GnomeCalendar *gcal, time_t date
DATE_MONTH | DATE_YEAR, 0, 0, FALSE);
/* Print the start day of the week, e.g. '7th May 2001'. */
- format_date (start, DATE_DAY | DATE_MONTH | DATE_YEAR, buf, 100);
+ convert_timet_to_struct_tm (start, zone, &tm);
+ format_date (&tm, DATE_DAY | DATE_MONTH | DATE_YEAR, buf, 100);
print_text_size_bold (context, buf, PANGO_ALIGN_LEFT,
3, width,
4, 4 + 24);
/* Print the end day of the week, e.g. '13th May 2001'. */
/* We need to substract one or the wrong day will be printed */
- format_date (time_add_day_with_zone (end, -1, zone),
- DATE_DAY | DATE_MONTH | DATE_YEAR, buf, 100);
+ convert_timet_to_struct_tm (
+ time_add_day_with_zone (end, -1, zone), zone, &tm);
+ format_date (&tm, DATE_DAY | DATE_MONTH | DATE_YEAR, buf, 100);
print_text_size_bold (context, buf, PANGO_ALIGN_LEFT,
3, width,
24 + 3, 24 + 3 + 24);
@@ -2699,7 +2696,8 @@ print_work_week_view (GtkPrintContext *context, GnomeCalendar *gcal, time_t date
day_x = DAY_VIEW_TIME_COLUMN_WIDTH + day_width * i;
/* Print the day, e.g. 'Tuesday'. */
- format_date (when, DATE_DAYNAME, buf, 100);
+ convert_timet_to_struct_tm (when, zone, &tm);
+ format_date (&tm, DATE_DAYNAME, buf, 100);
print_text_size_bold (context, buf, PANGO_ALIGN_LEFT,
day_x + 4, day_x + day_width,
@@ -2716,7 +2714,8 @@ static void
print_week_view (GtkPrintContext *context, GnomeCalendar *gcal, time_t date)
{
GtkPageSetup *setup;
- icaltimezone *zone = calendar_config_get_icaltimezone ();
+ ECalModel *model;
+ icaltimezone *zone;
gdouble l, week_numbers_inc, small_month_width;
gchar buf[100];
time_t when;
@@ -2731,8 +2730,11 @@ print_week_view (GtkPrintContext *context, GnomeCalendar *gcal, time_t date)
small_month_width = calc_small_month_width (context, HEADER_HEIGHT);
week_numbers_inc = get_show_week_numbers () ? small_month_width / 7.0 : 0;
- tm = *convert_timet_to_struct_tm (date, zone);
- week_start_day = calendar_config_get_week_start_day ();
+ model = gnome_calendar_get_model (gcal);
+ zone = e_cal_model_get_timezone (model);
+
+ convert_timet_to_struct_tm (date, zone, &tm);
+ week_start_day = e_cal_model_get_week_start_day (model);
when = time_week_begin_with_zone (date, week_start_day, zone);
/* If the week starts on a Sunday, we have to show the Saturday first,
@@ -2774,14 +2776,16 @@ print_week_view (GtkPrintContext *context, GnomeCalendar *gcal, time_t date)
time_add_week_with_zone (when, 1, zone), FALSE);
/* Print the start day of the week, e.g. '7th May 2001'. */
- format_date (when, DATE_DAY | DATE_MONTH | DATE_YEAR, buf, 100);
+ convert_timet_to_struct_tm (when, zone, &tm);
+ format_date (&tm, DATE_DAY | DATE_MONTH | DATE_YEAR, buf, 100);
print_text_size_bold (context, buf, PANGO_ALIGN_LEFT,
3, width,
4, 4 + 24);
/* Print the end day of the week, e.g. '13th May 2001'. */
when = time_add_day_with_zone (when, 6, zone);
- format_date (when, DATE_DAY | DATE_MONTH | DATE_YEAR, buf, 100);
+ convert_timet_to_struct_tm (when, zone, &tm);
+ format_date (&tm, DATE_DAY | DATE_MONTH | DATE_YEAR, buf, 100);
print_text_size_bold (context, buf, PANGO_ALIGN_LEFT,
3, width,
24 + 3, 24 + 3 + 24);
@@ -2790,11 +2794,16 @@ print_week_view (GtkPrintContext *context, GnomeCalendar *gcal, time_t date)
static void
print_month_view (GtkPrintContext *context, GnomeCalendar *gcal, time_t date)
{
+ ECalModel *model;
GtkPageSetup *setup;
- icaltimezone *zone = calendar_config_get_icaltimezone ();
+ icaltimezone *zone;
gchar buf[100];
gdouble width, height;
gdouble l, week_numbers_inc, small_month_width;
+ struct tm tm;
+
+ model = gnome_calendar_get_model (gcal);
+ zone = e_cal_model_get_timezone (model);
setup = gtk_print_context_get_page_setup (context);
@@ -2823,51 +2832,20 @@ print_month_view (GtkPrintContext *context, GnomeCalendar *gcal, time_t date)
DATE_MONTH | DATE_YEAR, 0, 0, FALSE);
/* Print the month, e.g. 'May 2001'. */
- format_date (date, DATE_MONTH | DATE_YEAR, buf, 100);
+ convert_timet_to_struct_tm (date, zone, &tm);
+ format_date (&tm, DATE_MONTH | DATE_YEAR, buf, 100);
print_text_size_bold (context, buf, PANGO_ALIGN_CENTER,
3, width - 3,
3, 3 + 24);
}
-/* XXX Evolution doesn't have a "year" view. */
-#if 0
-static void
-print_year_view (GtkPrintContext *context, GnomeCalendar *gcal, time_t date)
-{
- GtkPageSetup *setup;
- gchar buf[100];
- cairo_t *cr;
- gdouble width, height;
-
- setup = gtk_print_context_get_page_setup (context);
-
- width = gtk_page_setup_get_page_width (setup, GTK_UNIT_POINTS);
- height = gtk_page_setup_get_page_height (setup, GTK_UNIT_POINTS);
-
- cr = gtk_print_context_get_cairo_context (context);
-
- cairo_show_page (cr);
- print_year_summary (context, gcal, date, 0.0,
- width, 50,
- height, TRUE);
-
- /* centered title */
- format_date (date, DATE_YEAR, buf, 100);
- print_text_size_bold (context, buf, PANGO_ALIGN_CENTER,
- 3, width,
- 3, 27);
- cr=gtk_print_context_get_cairo_context (context);
- cairo_show_page (cr);
-}
-#endif
-
static gboolean
same_date (struct tm tm1, time_t t2, icaltimezone *zone)
{
struct tm tm2;
- tm2 = *convert_timet_to_struct_tm (t2, zone);
+ convert_timet_to_struct_tm (t2, zone, &tm2);
return
tm1.tm_mday == tm2.tm_mday &&
@@ -2877,32 +2855,31 @@ same_date (struct tm tm1, time_t t2, icaltimezone *zone)
static void
write_label_piece (time_t t,
- time_t *start_cmp,
+ time_t *start_cmp,
+ icaltimezone *zone,
+ gboolean use_24_hour_format,
gchar *buffer,
gint size,
gchar *stext,
const gchar *etext)
{
- icaltimezone *zone = calendar_config_get_icaltimezone ();
struct tm tmp_tm;
gint len;
- tmp_tm = *convert_timet_to_struct_tm (t, zone);
+ convert_timet_to_struct_tm (t, zone, &tmp_tm);
if (stext != NULL)
strcat (buffer, stext);
len = strlen (buffer);
if (start_cmp && same_date (tmp_tm, *start_cmp, zone))
- e_time_format_time (&tmp_tm,
- calendar_config_get_24_hour_format (),
- FALSE,
- &buffer[len], size - len);
+ e_time_format_time (
+ &tmp_tm, use_24_hour_format,
+ FALSE, &buffer[len], size - len);
else
- e_time_format_date_and_time (&tmp_tm,
- calendar_config_get_24_hour_format (),
- FALSE, FALSE,
- &buffer[len], size - len);
+ e_time_format_date_and_time (
+ &tmp_tm, use_24_hour_format, FALSE,
+ FALSE, &buffer[len], size - len);
if (etext != NULL)
strcat (buffer, etext);
}
@@ -2926,8 +2903,15 @@ get_zone_from_tzid (ECal *client, const gchar *tzid)
}
static void
-print_date_label (GtkPrintContext *context, ECalComponent *comp, ECal *client,
- double left, double right, double top, double bottom)
+print_date_label (GtkPrintContext *context,
+ ECalComponent *comp,
+ ECal *client,
+ icaltimezone *zone,
+ gboolean use_24_hour_format,
+ gdouble left,
+ gdouble right,
+ gdouble top,
+ gdouble bottom)
{
icaltimezone *start_zone, *end_zone, *due_zone, *completed_zone;
ECalComponentDateTime datetime;
@@ -2938,7 +2922,7 @@ print_date_label (GtkPrintContext *context, ECalComponent *comp, ECal *client,
if (datetime.value) {
start_zone = get_zone_from_tzid (client, datetime.tzid);
if (!start_zone || datetime.value->is_date)
- start_zone = calendar_config_get_icaltimezone ();
+ start_zone = zone;
start = icaltime_as_timet_with_zone (*datetime.value,
start_zone);
}
@@ -2948,7 +2932,7 @@ print_date_label (GtkPrintContext *context, ECalComponent *comp, ECal *client,
if (datetime.value) {
end_zone = get_zone_from_tzid (client, datetime.tzid);
if (!end_zone || datetime.value->is_date)
- end_zone = calendar_config_get_icaltimezone ();
+ end_zone = zone;
end = icaltime_as_timet_with_zone (*datetime.value,
end_zone);
}
@@ -2958,7 +2942,7 @@ print_date_label (GtkPrintContext *context, ECalComponent *comp, ECal *client,
if (datetime.value) {
due_zone = get_zone_from_tzid (client, datetime.tzid);
if (!due_zone || datetime.value->is_date)
- due_zone = calendar_config_get_icaltimezone ();
+ due_zone = zone;
due = icaltime_as_timet_with_zone (*datetime.value,
due_zone);
}
@@ -2975,12 +2959,16 @@ print_date_label (GtkPrintContext *context, ECalComponent *comp, ECal *client,
buffer[0] = '\0';
if (start > 0)
- write_label_piece (start, NULL, buffer, 1024, NULL, NULL);
+ write_label_piece (
+ start, NULL, zone, use_24_hour_format,
+ buffer, 1024, NULL, NULL);
if (end > 0 && start > 0) {
/* Translators: This is part of "START to END" text,
* where START and END are date/times. */
- write_label_piece (end, &start, buffer, 1024, _(" to "), NULL);
+ write_label_piece (
+ end, &start, zone, use_24_hour_format,
+ buffer, 1024, _(" to "), NULL);
}
if (complete > 0) {
@@ -2988,11 +2976,15 @@ print_date_label (GtkPrintContext *context, ECalComponent *comp, ECal *client,
/* Translators: This is part of "START to END
* (Completed COMPLETED)", where COMPLETED is a
* completed date/time. */
- write_label_piece (complete, NULL, buffer, 1024, _(" (Completed "), ")");
+ write_label_piece (
+ complete, NULL, zone, use_24_hour_format,
+ buffer, 1024, _(" (Completed "), ")");
} else {
/* Translators: This is part of "Completed COMPLETED",
* where COMPLETED is a completed date/time. */
- write_label_piece (complete, &start, buffer, 1024, _("Completed "), NULL);
+ write_label_piece (
+ complete, &start, zone, use_24_hour_format,
+ buffer, 1024, _("Completed "), NULL);
}
}
@@ -3000,12 +2992,16 @@ print_date_label (GtkPrintContext *context, ECalComponent *comp, ECal *client,
if (start > 0) {
/* Translators: This is part of "START (Due DUE)",
* where START and DUE are dates/times. */
- write_label_piece (due, NULL, buffer, 1024, _(" (Due "), ")");
+ write_label_piece (
+ due, NULL, zone, use_24_hour_format,
+ buffer, 1024, _(" (Due "), ")");
} else {
/* Translators: This is part of "Due DUE",
* where DUE is a date/time due the event
* should be finished. */
- write_label_piece (due, &start, buffer, 1024, _("Due "), NULL);
+ write_label_piece (
+ due, &start, zone, use_24_hour_format,
+ buffer, 1024, _("Due "), NULL);
}
}
@@ -3188,7 +3184,10 @@ print_comp_draw_real (GtkPrintOperation *operation,
/* Date information */
if (page_nr == 0)
- print_date_label (context, comp, client, 0.0, width, top + 3, top + 15);
+ print_date_label (
+ context, comp, client,
+ pci->zone, pci->use_24_hour_format,
+ 0.0, width, top + 3, top + 15);
top += 20;
/* Attendees */
@@ -3374,7 +3373,11 @@ print_comp_begin_print (GtkPrintOperation *operation,
}
void
-print_comp (ECalComponent *comp, ECal *client, GtkPrintOperationAction action)
+print_comp (ECalComponent *comp,
+ ECal *client,
+ icaltimezone *zone,
+ gboolean use_24_hour_format,
+ GtkPrintOperationAction action)
{
GtkPrintOperation *operation;
PrintCompItem pci;
@@ -3383,6 +3386,8 @@ print_comp (ECalComponent *comp, ECal *client, GtkPrintOperationAction action)
pci.comp = comp;
pci.client = client;
+ pci.zone = zone;
+ pci.use_24_hour_format = use_24_hour_format;
operation = e_print_operation_new ();
gtk_print_operation_set_n_pages (operation, 1);
diff --git a/calendar/gui/print.h b/calendar/gui/print.h
index 5217c47..85397b0 100644
--- a/calendar/gui/print.h
+++ b/calendar/gui/print.h
@@ -36,15 +36,17 @@ typedef enum {
PRINT_VIEW_LIST
} PrintView;
-void print_calendar (GnomeCalendar *gcal,
- GtkPrintOperationAction action,
- time_t start);
-void print_comp (ECalComponent *comp,
- ECal *client,
- GtkPrintOperationAction action);
-void print_table (ETable *table,
- const gchar *dialog_title,
- const gchar *print_header,
- GtkPrintOperationAction action);
+void print_calendar (GnomeCalendar *gcal,
+ GtkPrintOperationAction action,
+ time_t start);
+void print_comp (ECalComponent *comp,
+ ECal *client,
+ icaltimezone *zone,
+ gboolean use_24_hour_format,
+ GtkPrintOperationAction action);
+void print_table (ETable *table,
+ const gchar *dialog_title,
+ const gchar *print_header,
+ GtkPrintOperationAction action);
#endif
diff --git a/e-util/e-util-enums.h b/e-util/e-util-enums.h
index 729788e..5f5ef75 100644
--- a/e-util/e-util-enums.h
+++ b/e-util/e-util-enums.h
@@ -31,9 +31,9 @@ typedef enum {
} EActivityState;
typedef enum {
- E_DURATION_DAYS,
+ E_DURATION_MINUTES,
E_DURATION_HOURS,
- E_DURATION_MINUTES
+ E_DURATION_DAYS
} EDurationType;
G_END_DECLS
diff --git a/modules/calendar/Makefile.am b/modules/calendar/Makefile.am
index 0beb128..c725ded 100644
--- a/modules/calendar/Makefile.am
+++ b/modules/calendar/Makefile.am
@@ -17,6 +17,8 @@ libevolution_module_calendar_la_SOURCES = \
e-cal-attachment-handler.h \
e-cal-config-calendar-item.c \
e-cal-config-calendar-item.h \
+ e-cal-config-comp-editor.c \
+ e-cal-config-comp-editor.h \
e-cal-config-date-edit.c \
e-cal-config-date-edit.h \
e-cal-config-hook.c \
@@ -49,6 +51,8 @@ libevolution_module_calendar_la_SOURCES = \
e-cal-shell-view-private.c \
e-cal-shell-view-private.h \
e-cal-shell-view-taskpad.c \
+ e-calendar-preferences.c \
+ e-calendar-preferences.h \
e-memo-shell-backend.c \
e-memo-shell-backend.h \
e-memo-shell-content.c \
@@ -97,4 +101,39 @@ libevolution_module_calendar_la_LIBADD = \
libevolution_module_calendar_la_LDFLAGS = \
-module -avoid-version $(NO_UNDEFINED)
+schemadir = $(GCONF_SCHEMA_FILE_DIR)
+schema_in_files = apps_evolution_calendar.schemas.in
+schema_DATA = $(schema_in_files:.schemas.in=.schemas)
+ INTLTOOL_SCHEMAS_RULE@
+
+ui_DATA = e-calendar-preferences.ui
+
+EXTRA_DIST = \
+ $(schema_in_files) \
+ $(ui_DATA)
+
+DISTCLEANFILES = $(schema_DATA)
+
+if GCONF_SCHEMAS_INSTALL
+if OS_WIN32
+install-data-local:
+ if test -z "$(DESTDIR)" ; then \
+ for p in $(schema_DATA) ; do \
+ (echo set GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE); \
+ echo $(GCONFTOOL) --makefile-install-rule $$p) >_temp.bat; \
+ cmd /c _temp.bat; \
+ rm _temp.bat; \
+ done \
+ fi
+else
+install-data-local:
+ if test -z "$(DESTDIR)" ; then \
+ for p in $(schema_DATA) ; do \
+ GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) \
+ $(GCONFTOOL) --makefile-install-rule $$p; \
+ done \
+ fi
+endif
+endif
+
-include $(top_srcdir)/git.mk
diff --git a/calendar/gui/apps_evolution_calendar.schemas.in b/modules/calendar/apps_evolution_calendar.schemas.in
similarity index 96%
rename from calendar/gui/apps_evolution_calendar.schemas.in
rename to modules/calendar/apps_evolution_calendar.schemas.in
index 229020a..5f946d1 100644
--- a/calendar/gui/apps_evolution_calendar.schemas.in
+++ b/modules/calendar/apps_evolution_calendar.schemas.in
@@ -482,31 +482,6 @@
</locale>
</schema>
- <schema>
- <key>/schemas/apps/evolution/calendar/display/events_transparency</key>
- <applyto>/apps/evolution/calendar/display/events_transparency</applyto>
- <owner>evolution-calendar</owner>
- <type>float</type>
- <default>1.0</default>
- <locale name="C">
- <short>Event Transparency</short>
- <long>Transparency of the events in calendar views, a value between 0 (transparent) and 1 (opaque).</long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/evolution/calendar/display/events_gradient</key>
- <applyto>/apps/evolution/calendar/display/events_gradient</applyto>
- <owner>evolution-calendar</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C">
- <short>Event Gradient</short>
- <long>Gradient of the events in calendar views.</long>
- </locale>
- </schema>
-
-
<schema>
<key>/schemas/apps/evolution/calendar/display/recur_events_italic</key>
<applyto>/apps/evolution/calendar/display/recur_events_italic</applyto>
@@ -668,7 +643,7 @@
<applyto>/apps/evolution/calendar/other/default_reminder_units</applyto>
<owner>evolution-calendar</owner>
<type>string</type>
- <default></default>
+ <default>minutes</default>
<locale name="C">
<short>Default reminder units</short>
<long>Units for a default reminder, "minutes", "hours" or "days".</long>
@@ -676,14 +651,45 @@
</schema>
<schema>
- <key>/schemas/apps/evolution/calendar/other/def_recur_count</key>
- <applyto>/apps/evolution/calendar/other/def_recur_count</applyto>
+ <key>/schemas/apps/evolution/calendar/other/use_ba_reminder</key>
+ <applyto>/apps/evolution/calendar/other/use_ba_reminder</applyto>
+ <owner>evolution-calendar</owner>
+ <type>bool</type>
+ <default>false</default>
+ <locale name="C">
+ <short>Birthday and anniversary reminder</short>
+ <long>
+ Whether to set a reminder for birthdays and anniversaries.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/evolution/calendar/other/ba_reminder_interval</key>
+ <applyto>/apps/evolution/calendar/other/ba_reminder_interval</applyto>
<owner>evolution-calendar</owner>
<type>int</type>
- <default>2</default>
+ <default>15</default>
<locale name="C">
- <short>Default recurrence count</short>
- <long>Count of default recurrence for a new event. -1 means forever.</long>
+ <short>Birthday and anniversary reminder value</short>
+ <long>
+ Number of units for determining a birthday or anniversary reminder.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/evolution/calendar/other/ba_reminder_units</key>
+ <applyto>/apps/evolution/calendar/other/ba_reminder_units</applyto>
+ <owner>evolution-calendar</owner>
+ <type>string</type>
+ <default>minutes</default>
+ <locale name="C">
+ <short>Birthday and anniversary reminder units</short>
+ <long>
+ Units for a birthday or anniversary reminder, "minutes", "hours"
+ or "days".
+ </long>
</locale>
</schema>
diff --git a/modules/calendar/e-cal-config-comp-editor.c b/modules/calendar/e-cal-config-comp-editor.c
new file mode 100644
index 0000000..327bcd4
--- /dev/null
+++ b/modules/calendar/e-cal-config-comp-editor.c
@@ -0,0 +1,100 @@
+/*
+ * e-cal-config-comp-editor.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#include "e-cal-config-comp-editor.h"
+
+#include <shell/e-shell.h>
+#include <e-util/e-extension.h>
+#include <calendar/gui/dialogs/comp-editor.h>
+
+static void
+cal_config_comp_editor_constructed (GObject *object)
+{
+ EExtension *extension;
+ EExtensible *extensible;
+ EShellSettings *shell_settings;
+ EShell *shell;
+
+ extension = E_EXTENSION (object);
+ extensible = e_extension_get_extensible (extension);
+
+ shell = e_shell_get_default ();
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ g_object_bind_property (
+ shell_settings, "cal-timezone",
+ extensible, "timezone",
+ G_BINDING_SYNC_CREATE);
+
+ g_object_bind_property (
+ shell_settings, "cal-use-24-hour-format",
+ extensible, "use-24-hour-format",
+ G_BINDING_SYNC_CREATE);
+
+ g_object_bind_property (
+ shell_settings, "cal-work-day-end-hour",
+ extensible, "work-day-end-hour",
+ G_BINDING_SYNC_CREATE);
+
+ g_object_bind_property (
+ shell_settings, "cal-work-day-end-minute",
+ extensible, "work-day-end-minute",
+ G_BINDING_SYNC_CREATE);
+
+ g_object_bind_property (
+ shell_settings, "cal-work-day-start-hour",
+ extensible, "work-day-start-hour",
+ G_BINDING_SYNC_CREATE);
+
+ g_object_bind_property (
+ shell_settings, "cal-work-day-start-minute",
+ extensible, "work-day-start-minute",
+ G_BINDING_SYNC_CREATE);
+}
+
+static void
+cal_config_comp_editor_class_init (EExtensionClass *class)
+{
+ GObjectClass *object_class;
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->constructed = cal_config_comp_editor_constructed;
+
+ class->extensible_type = TYPE_COMP_EDITOR;
+}
+
+void
+e_cal_config_comp_editor_register_type (GTypeModule *type_module)
+{
+ static const GTypeInfo type_info = {
+ sizeof (EExtensionClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) cal_config_comp_editor_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EExtension),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) NULL,
+ NULL /* value_table */
+ };
+
+ g_type_module_register_type (
+ type_module, E_TYPE_EXTENSION,
+ "ECalConfigCompEditor", &type_info, 0);
+}
diff --git a/modules/calendar/e-cal-config-comp-editor.h b/modules/calendar/e-cal-config-comp-editor.h
new file mode 100644
index 0000000..124547a
--- /dev/null
+++ b/modules/calendar/e-cal-config-comp-editor.h
@@ -0,0 +1,30 @@
+/*
+ * e-cal-config-comp-editor.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#ifndef E_CAL_CONFIG_COMP_EDITOR_H
+#define E_CAL_CONFIG_COMP_EDITOR_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+void e_cal_config_comp_editor_register_type (GTypeModule *type_module);
+
+G_END_DECLS
+
+#endif /* E_CAL_CONFIG_COMP_EDITOR_H */
diff --git a/modules/calendar/e-cal-config-meeting-store.c b/modules/calendar/e-cal-config-meeting-store.c
index 72f103b..f9babc5 100644
--- a/modules/calendar/e-cal-config-meeting-store.c
+++ b/modules/calendar/e-cal-config-meeting-store.c
@@ -37,6 +37,16 @@ cal_config_meeting_store_constructed (GObject *object)
shell_settings = e_shell_get_shell_settings (shell);
g_object_bind_property (
+ shell_settings, "cal-default-reminder-interval",
+ extensible, "default-reminder-interval",
+ G_BINDING_SYNC_CREATE);
+
+ g_object_bind_property (
+ shell_settings, "cal-default-reminder-units",
+ extensible, "default-reminder-units",
+ G_BINDING_SYNC_CREATE);
+
+ g_object_bind_property (
shell_settings, "cal-free-busy-template",
extensible, "free-busy-template",
G_BINDING_SYNC_CREATE);
@@ -45,6 +55,11 @@ cal_config_meeting_store_constructed (GObject *object)
shell_settings, "cal-timezone",
extensible, "timezone",
G_BINDING_SYNC_CREATE);
+
+ g_object_bind_property (
+ shell_settings, "cal-week-start-day",
+ extensible, "week-start-day",
+ G_BINDING_SYNC_CREATE);
}
static void
diff --git a/modules/calendar/e-cal-config-model.c b/modules/calendar/e-cal-config-model.c
index 62ff9b5..9dd5ee9 100644
--- a/modules/calendar/e-cal-config-model.c
+++ b/modules/calendar/e-cal-config-model.c
@@ -40,6 +40,26 @@ cal_config_model_constructed (GObject *object)
/*** ECalModel ***/
g_object_bind_property (
+ shell_settings, "cal-compress-weekend",
+ extensible, "compress-weekend",
+ G_BINDING_SYNC_CREATE);
+
+ g_object_bind_property (
+ shell_settings, "cal-confirm-delete",
+ extensible, "confirm-delete",
+ G_BINDING_SYNC_CREATE);
+
+ g_object_bind_property (
+ shell_settings, "cal-default-reminder-interval",
+ extensible, "default-reminder-interval",
+ G_BINDING_SYNC_CREATE);
+
+ g_object_bind_property (
+ shell_settings, "cal-default-reminder-units",
+ extensible, "default-reminder-units",
+ G_BINDING_SYNC_CREATE);
+
+ g_object_bind_property (
shell_settings, "cal-timezone",
extensible, "timezone",
G_BINDING_SYNC_CREATE);
@@ -50,10 +70,35 @@ cal_config_model_constructed (GObject *object)
G_BINDING_SYNC_CREATE);
g_object_bind_property (
+ shell_settings, "cal-use-default-reminder",
+ extensible, "use-default-reminder",
+ G_BINDING_SYNC_CREATE);
+
+ g_object_bind_property (
shell_settings, "cal-week-start-day",
extensible, "week-start-day",
G_BINDING_SYNC_CREATE);
+ g_object_bind_property (
+ shell_settings, "cal-work-day-end-hour",
+ extensible, "work-day-end-hour",
+ G_BINDING_SYNC_CREATE);
+
+ g_object_bind_property (
+ shell_settings, "cal-work-day-end-minute",
+ extensible, "work-day-end-minute",
+ G_BINDING_SYNC_CREATE);
+
+ g_object_bind_property (
+ shell_settings, "cal-work-day-start-hour",
+ extensible, "work-day-start-hour",
+ G_BINDING_SYNC_CREATE);
+
+ g_object_bind_property (
+ shell_settings, "cal-work-day-start-minute",
+ extensible, "work-day-start-minute",
+ G_BINDING_SYNC_CREATE);
+
/*** ECalModelTasks ***/
if (E_IS_CAL_MODEL_TASKS (extensible)) {
diff --git a/modules/calendar/e-cal-config-view.c b/modules/calendar/e-cal-config-view.c
index c163022..e2f769c 100644
--- a/modules/calendar/e-cal-config-view.c
+++ b/modules/calendar/e-cal-config-view.c
@@ -37,6 +37,12 @@ cal_config_view_constructed (GObject *object)
shell = e_shell_get_default ();
shell_settings = e_shell_get_shell_settings (shell);
+ g_object_bind_property (
+ shell_settings, "cal-time-divisions",
+ extensible, "time-divisions",
+ G_BINDING_BIDIRECTIONAL |
+ G_BINDING_SYNC_CREATE);
+
/*** EDayView ***/
if (E_IS_DAY_VIEW (extensible)) {
@@ -62,31 +68,6 @@ cal_config_view_constructed (GObject *object)
G_BINDING_SYNC_CREATE);
g_object_bind_property (
- shell_settings, "cal-time-divisions",
- extensible, "mins-per-row",
- G_BINDING_SYNC_CREATE);
-
- g_object_bind_property (
- shell_settings, "cal-work-day-end-hour",
- extensible, "work-day-end-hour",
- G_BINDING_SYNC_CREATE);
-
- g_object_bind_property (
- shell_settings, "cal-work-day-end-minute",
- extensible, "work-day-end-minute",
- G_BINDING_SYNC_CREATE);
-
- g_object_bind_property (
- shell_settings, "cal-work-day-start-hour",
- extensible, "work-day-start-hour",
- G_BINDING_SYNC_CREATE);
-
- g_object_bind_property (
- shell_settings, "cal-work-day-start-minute",
- extensible, "work-day-start-minute",
- G_BINDING_SYNC_CREATE);
-
- g_object_bind_property (
shell_settings, "cal-working-days-bitset",
extensible, "working-days",
G_BINDING_SYNC_CREATE);
diff --git a/modules/calendar/e-cal-shell-backend.c b/modules/calendar/e-cal-shell-backend.c
index 749dd7e..fa4c2db 100644
--- a/modules/calendar/e-cal-shell-backend.c
+++ b/modules/calendar/e-cal-shell-backend.c
@@ -36,9 +36,7 @@
#include "widgets/misc/e-preferences-window.h"
#include "calendar/common/authentication.h"
-#include "calendar/gui/calendar-config.h"
#include "calendar/gui/comp-util.h"
-#include "calendar/gui/dialogs/cal-prefs-dialog.h"
#include "calendar/gui/dialogs/calendar-setup.h"
#include "calendar/gui/dialogs/event-editor.h"
#include "calendar/gui/e-calendar-view.h"
@@ -51,6 +49,8 @@
#include "e-cal-shell-sidebar.h"
#include "e-cal-shell-view.h"
+#include "e-calendar-preferences.h"
+
#define E_CAL_SHELL_BACKEND_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
((obj), E_TYPE_CAL_SHELL_BACKEND, ECalShellBackendPrivate))
@@ -73,9 +73,10 @@ cal_shell_backend_ensure_sources (EShellBackend *shell_backend)
/* XXX This is basically the same algorithm across all backends.
* Maybe we could somehow integrate this into EShellBackend? */
- ECalShellBackendPrivate *priv;
+ ECalShellBackend *cal_shell_backend;
ESourceGroup *on_this_computer;
ESourceGroup *contacts;
+ ESourceList *source_list;
ESource *birthdays;
ESource *personal;
EShell *shell;
@@ -88,24 +89,28 @@ cal_shell_backend_ensure_sources (EShellBackend *shell_backend)
birthdays = NULL;
personal = NULL;
- priv = E_CAL_SHELL_BACKEND_GET_PRIVATE (shell_backend);
+ cal_shell_backend = E_CAL_SHELL_BACKEND (shell_backend);
shell = e_shell_backend_get_shell (shell_backend);
shell_settings = e_shell_get_shell_settings (shell);
- if (!e_cal_get_sources (&priv->source_list, E_CAL_SOURCE_TYPE_EVENT, NULL)) {
+ if (!e_cal_get_sources (
+ &cal_shell_backend->priv->source_list,
+ E_CAL_SOURCE_TYPE_EVENT, NULL)) {
g_warning ("Could not get calendar sources from GConf!");
return;
}
+ source_list = cal_shell_backend->priv->source_list;
+
on_this_computer = e_source_list_ensure_group (
- priv->source_list, _("On This Computer"), "local:", TRUE);
+ source_list, _("On This Computer"), "local:", TRUE);
contacts = e_source_list_ensure_group (
- priv->source_list, _("Contacts"), "contacts://", TRUE);
+ source_list, _("Contacts"), "contacts://", TRUE);
e_source_list_ensure_group (
- priv->source_list, _("On The Web"), "webcal://", FALSE);
+ source_list, _("On The Web"), "webcal://", FALSE);
e_source_list_ensure_group (
- priv->source_list, _("Weather"), "weather://", FALSE);
+ source_list, _("Weather"), "weather://", FALSE);
g_return_if_fail (on_this_computer != NULL);
g_return_if_fail (contacts != NULL);
@@ -140,7 +145,8 @@ cal_shell_backend_ensure_sources (EShellBackend *shell_backend)
primary = e_shell_settings_get_string (
shell_settings, "cal-primary-calendar");
- selected = calendar_config_get_calendars_selected ();
+ selected = e_cal_shell_backend_get_selected_calendars (
+ cal_shell_backend);
if (primary == NULL && selected == NULL) {
const gchar *uid;
@@ -150,7 +156,8 @@ cal_shell_backend_ensure_sources (EShellBackend *shell_backend)
e_shell_settings_set_string (
shell_settings, "cal-primary-calendar", uid);
- calendar_config_set_calendars_selected (selected);
+ e_cal_shell_backend_set_selected_calendars (
+ cal_shell_backend, selected);
}
g_slist_foreach (selected, (GFunc) g_free, NULL);
@@ -217,7 +224,7 @@ cal_shell_backend_ensure_sources (EShellBackend *shell_backend)
g_object_unref (contacts);
if (save_list)
- e_source_list_sync (priv->source_list, NULL);
+ e_source_list_sync (source_list, NULL);
}
static void
@@ -229,14 +236,26 @@ cal_shell_backend_new_event (ESource *source,
{
ECal *cal;
ECalComponent *comp;
+ EShellSettings *shell_settings;
CompEditor *editor;
/* XXX Handle errors better. */
cal = e_load_cal_source_finish (source, result, NULL);
g_return_if_fail (E_IS_CAL (cal));
+ shell_settings = e_shell_get_shell_settings (shell);
+
editor = event_editor_new (cal, shell, flags);
- comp = cal_comp_event_new_with_current_time (cal, all_day);
+ comp = cal_comp_event_new_with_current_time (
+ cal, all_day,
+ e_shell_settings_get_pointer (
+ shell_settings, "cal-timezone"),
+ e_shell_settings_get_boolean (
+ shell_settings, "cal-use-default-reminder"),
+ e_shell_settings_get_int (
+ shell_settings, "cal-default-reminder-interval"),
+ e_shell_settings_get_int ( /* enum, actually */
+ shell_settings, "cal-default-reminder-units"));
e_cal_component_commit_sequence (comp);
comp_editor_edit_comp (editor, comp);
@@ -452,10 +471,9 @@ cal_shell_backend_init_importers (void)
}
static time_t
-utc_to_user_zone (time_t utc_time)
+utc_to_user_zone (time_t utc_time,
+ icaltimezone *zone)
{
- icaltimezone *zone = calendar_config_get_icaltimezone ();
-
if (!zone || (int) utc_time == -1)
return utc_time;
@@ -468,6 +486,7 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
const gchar *uri)
{
EShell *shell;
+ EShellSettings *shell_settings;
CompEditor *editor;
CompEditorFlags flags = 0;
ECal *client;
@@ -484,11 +503,15 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
gchar *comp_rid = NULL;
GDate start_date;
GDate end_date;
+ icaltimezone *zone;
gboolean handled = FALSE;
GError *error = NULL;
source_type = E_CAL_SOURCE_TYPE_EVENT;
shell = e_shell_backend_get_shell (shell_backend);
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ zone = e_shell_settings_get_pointer (shell_settings, "cal-timezone");
if (strncmp (uri, "calendar:", 9) != 0)
return FALSE;
@@ -522,10 +545,12 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
content = g_strndup (cp, content_len);
if (g_ascii_strcasecmp (header, "startdate") == 0)
g_date_set_time_t (
- &start_date, utc_to_user_zone (time_from_isodate (content)));
+ &start_date, utc_to_user_zone (
+ time_from_isodate (content), zone));
else if (g_ascii_strcasecmp (header, "enddate") == 0)
g_date_set_time_t (
- &end_date, utc_to_user_zone (time_from_isodate (content)));
+ &end_date, utc_to_user_zone (
+ time_from_isodate (content), zone));
else if (g_ascii_strcasecmp (header, "source-uid") == 0)
source_uid = g_strdup (content);
else if (g_ascii_strcasecmp (header, "comp-uid") == 0)
@@ -727,7 +752,7 @@ cal_shell_backend_constructed (GObject *object)
"calendar-and-tasks",
"preferences-calendar-and-tasks",
_("Calendar and Tasks"),
- calendar_prefs_dialog_new,
+ e_calendar_preferences_new,
600);
}
@@ -835,6 +860,41 @@ e_cal_shell_backend_get_source_list (ECalShellBackend *cal_shell_backend)
return cal_shell_backend->priv->source_list;
}
+GSList *
+e_cal_shell_backend_get_selected_calendars (ECalShellBackend *cal_shell_backend)
+{
+ GConfClient *client;
+ GSList *selected_calendars;
+ const gchar *key;
+
+ g_return_val_if_fail (
+ E_IS_CAL_SHELL_BACKEND (cal_shell_backend), NULL);
+
+ client = gconf_client_get_default ();
+ key = "/apps/evolution/calendar/display/selected_calendars";
+ selected_calendars = gconf_client_get_list (
+ client, key, GCONF_VALUE_STRING, NULL);
+ g_object_unref (client);
+
+ return selected_calendars;
+}
+
+void
+e_cal_shell_backend_set_selected_calendars (ECalShellBackend *cal_shell_backend,
+ GSList *selected_calendars)
+{
+ GConfClient *client;
+ const gchar *key;
+
+ g_return_if_fail (E_IS_CAL_SHELL_BACKEND (cal_shell_backend));
+
+ client = gconf_client_get_default ();
+ key = "/apps/evolution/calendar/display/selected_calendars";
+ gconf_client_set_list (
+ client, key, GCONF_VALUE_STRING, selected_calendars, NULL);
+ g_object_unref (client);
+}
+
void
e_cal_shell_backend_open_date_range (ECalShellBackend *cal_shell_backend,
const GDate *start_date,
diff --git a/modules/calendar/e-cal-shell-backend.h b/modules/calendar/e-cal-shell-backend.h
index 4b19275..32fca7f 100644
--- a/modules/calendar/e-cal-shell-backend.h
+++ b/modules/calendar/e-cal-shell-backend.h
@@ -64,6 +64,11 @@ void e_cal_shell_backend_register_type
(GTypeModule *type_module);
ESourceList * e_cal_shell_backend_get_source_list
(ECalShellBackend *cal_shell_backend);
+GSList * e_cal_shell_backend_get_selected_calendars
+ (ECalShellBackend *cal_shell_backend);
+void e_cal_shell_backend_set_selected_calendars
+ (ECalShellBackend *cal_shell_backend,
+ GSList *selected_calendars);
void e_cal_shell_backend_open_date_range
(ECalShellBackend *cal_shell_backend,
const GDate *start_date,
diff --git a/modules/calendar/e-cal-shell-migrate.c b/modules/calendar/e-cal-shell-migrate.c
index c1a7221..d25228d 100644
--- a/modules/calendar/e-cal-shell-migrate.c
+++ b/modules/calendar/e-cal-shell-migrate.c
@@ -37,11 +37,12 @@
#include <libedataserver/e-xml-hash-utils.h>
#include "e-util/e-util-private.h"
-#include "calendar/gui/calendar-config.h"
#include "calendar/gui/calendar-config-keys.h"
#include "calendar/gui/e-cal-event.h"
#include "shell/e-shell.h"
+#include "e-cal-shell-backend.h"
+
#define WEBCAL_BASE_URI "webcal://"
#define CONTACTS_BASE_URI "contacts://"
#define BAD_CONTACTS_BASE_URI "contact://"
@@ -150,6 +151,7 @@ create_calendar_sources (EShellBackend *shell_backend,
}
if (!*personal_source) {
+ GSList *selected;
gchar *primary_calendar;
/* Create the default Person calendar */
@@ -159,18 +161,26 @@ create_calendar_sources (EShellBackend *shell_backend,
primary_calendar = e_shell_settings_get_string (
shell_settings, "cal-primary-calendar");
- if (!primary_calendar && !calendar_config_get_calendars_selected ()) {
- GSList selected;
+ selected = e_cal_shell_backend_get_selected_calendars (
+ E_CAL_SHELL_BACKEND (shell_backend));
+
+ if (primary_calendar == NULL && selected == NULL) {
+ GSList link;
e_shell_settings_set_string (
shell_settings, "cal-primary-calendar",
e_source_peek_uid (source));
- selected.data = (gpointer)e_source_peek_uid (source);
- selected.next = NULL;
- calendar_config_set_calendars_selected (&selected);
+ link.data = (gpointer)e_source_peek_uid (source);
+ link.next = NULL;
+
+ e_cal_shell_backend_set_selected_calendars (
+ E_CAL_SHELL_BACKEND (shell_backend), &link);
}
+ g_slist_foreach (selected, (GFunc) g_free, NULL);
+ g_slist_free (selected);
+
g_free (primary_calendar);
e_source_set_color_spec (source, "#BECEDD");
*personal_source = source;
@@ -196,10 +206,10 @@ create_calendar_sources (EShellBackend *shell_backend,
gboolean
e_cal_shell_backend_migrate (EShellBackend *shell_backend,
- gint major,
- gint minor,
- gint micro,
- GError **error)
+ gint major,
+ gint minor,
+ gint micro,
+ GError **error)
{
ESourceGroup *on_this_computer = NULL, *on_the_web = NULL, *contacts = NULL;
ESource *personal_source = NULL;
diff --git a/modules/calendar/e-cal-shell-settings.c b/modules/calendar/e-cal-shell-settings.c
index 524157c..30fc1c4 100644
--- a/modules/calendar/e-cal-shell-settings.c
+++ b/modules/calendar/e-cal-shell-settings.c
@@ -24,6 +24,9 @@
#include <gconf/gconf-client.h>
#include <libecal/e-cal-util.h>
+#include <e-util/e-util.h>
+#include <e-util/e-util-enumtypes.h>
+
static gboolean
transform_string_to_icaltimezone (GBinding *binding,
const GValue *source_value,
@@ -495,6 +498,14 @@ e_cal_shell_backend_init_settings (EShell *shell)
shell_settings = e_shell_get_shell_settings (shell);
e_shell_settings_install_property_for_key (
+ "cal-ba-reminder-interval",
+ "/apps/evolution/calendar/other/ba_reminder_interval");
+
+ e_shell_settings_install_property_for_key (
+ "cal-ba-reminder-units-string",
+ "/apps/evolution/calendar/other/ba_reminder_units");
+
+ e_shell_settings_install_property_for_key (
"cal-compress-weekend",
"/apps/evolution/calendar/display/compress_weekend");
@@ -507,8 +518,14 @@ e_cal_shell_backend_init_settings (EShell *shell)
"/apps/evolution/calendar/prompts/confirm_purge");
e_shell_settings_install_property_for_key (
- "cal-show-week-numbers",
- "/apps/evolution/calendar/display/show_week_numbers");
+ "cal-default-reminder-interval",
+ "/apps/evolution/calendar/other/default_reminder_interval");
+
+ /* Do not bind to this.
+ * Use "cal-default-reminder-units" instead. */
+ e_shell_settings_install_property_for_key (
+ "cal-default-reminder-units-string",
+ "/apps/evolution/calendar/other/default_reminder_units");
e_shell_settings_install_property_for_key (
"cal-free-busy-template",
@@ -518,8 +535,10 @@ e_cal_shell_backend_init_settings (EShell *shell)
"cal-hide-completed-tasks",
"/apps/evolution/calendar/tasks/hide_completed");
+ /* Do not bind to this.
+ * Use "cal-hide-completed-tasks-units" instead. */
e_shell_settings_install_property_for_key (
- "cal-hide-completed-tasks-units",
+ "cal-hide-completed-tasks-units-string",
"/apps/evolution/calendar/tasks/hide_completed_units");
e_shell_settings_install_property_for_key (
@@ -539,6 +558,10 @@ e_cal_shell_backend_init_settings (EShell *shell)
"/apps/evolution/calendar/display/marcus_bains_line");
e_shell_settings_install_property_for_key (
+ "cal-month-scroll-by-week",
+ "/apps/evolution/calendar/display/month_scroll_by_week");
+
+ e_shell_settings_install_property_for_key (
"cal-primary-calendar",
"/apps/evolution/calendar/display/primary_calendar");
@@ -559,6 +582,10 @@ e_cal_shell_backend_init_settings (EShell *shell)
"/apps/evolution/calendar/display/show_event_end");
e_shell_settings_install_property_for_key (
+ "cal-show-week-numbers",
+ "/apps/evolution/calendar/display/show_week_numbers");
+
+ e_shell_settings_install_property_for_key (
"cal-tasks-color-due-today",
"/apps/evolution/calendar/tasks/colors/due_today");
@@ -580,6 +607,14 @@ e_cal_shell_backend_init_settings (EShell *shell)
"/apps/evolution/calendar/display/use_24hour_format");
e_shell_settings_install_property_for_key (
+ "cal-use-ba-reminder",
+ "/apps/evolution/calendar/other/use_ba_reminder");
+
+ e_shell_settings_install_property_for_key (
+ "cal-use-default-reminder",
+ "/apps/evolution/calendar/other/use_default_reminder");
+
+ e_shell_settings_install_property_for_key (
"cal-use-system-timezone",
"/apps/evolution/calendar/display/use_system_timezone");
@@ -616,6 +651,60 @@ e_cal_shell_backend_init_settings (EShell *shell)
* GConf schemas. */
e_shell_settings_install_property (
+ g_param_spec_enum (
+ "cal-ba-reminder-units",
+ NULL,
+ NULL,
+ E_TYPE_DURATION_TYPE,
+ E_DURATION_MINUTES,
+ G_PARAM_READWRITE));
+
+ g_object_bind_property_full (
+ shell_settings, "cal-ba-reminder-units-string",
+ shell_settings, "cal-ba-reminder-units",
+ G_BINDING_BIDIRECTIONAL |
+ G_BINDING_SYNC_CREATE,
+ e_binding_transform_enum_nick_to_value,
+ e_binding_transform_enum_value_to_nick,
+ NULL, (GDestroyNotify) NULL);
+
+ e_shell_settings_install_property (
+ g_param_spec_enum (
+ "cal-default-reminder-units",
+ NULL,
+ NULL,
+ E_TYPE_DURATION_TYPE,
+ E_DURATION_MINUTES,
+ G_PARAM_READWRITE));
+
+ g_object_bind_property_full (
+ shell_settings, "cal-default-reminder-units-string",
+ shell_settings, "cal-default-reminder-units",
+ G_BINDING_BIDIRECTIONAL |
+ G_BINDING_SYNC_CREATE,
+ e_binding_transform_enum_nick_to_value,
+ e_binding_transform_enum_value_to_nick,
+ NULL, (GDestroyNotify) NULL);
+
+ e_shell_settings_install_property (
+ g_param_spec_enum (
+ "cal-hide-completed-tasks-units",
+ NULL,
+ NULL,
+ E_TYPE_DURATION_TYPE,
+ E_DURATION_MINUTES,
+ G_PARAM_READWRITE));
+
+ g_object_bind_property_full (
+ shell_settings, "cal-hide-completed-tasks-units-string",
+ shell_settings, "cal-hide-completed-tasks-units",
+ G_BINDING_BIDIRECTIONAL |
+ G_BINDING_SYNC_CREATE,
+ e_binding_transform_enum_nick_to_value,
+ e_binding_transform_enum_value_to_nick,
+ NULL, (GDestroyNotify) NULL);
+
+ e_shell_settings_install_property (
g_param_spec_pointer (
"cal-timezone",
NULL,
diff --git a/modules/calendar/e-cal-shell-sidebar.c b/modules/calendar/e-cal-shell-sidebar.c
index 66a1102..1e29198 100644
--- a/modules/calendar/e-cal-shell-sidebar.c
+++ b/modules/calendar/e-cal-shell-sidebar.c
@@ -29,7 +29,6 @@
#include "widgets/misc/e-paned.h"
#include "calendar/common/authentication.h"
-#include "calendar/gui/calendar-config.h"
#include "calendar/gui/e-calendar-selector.h"
#include "calendar/gui/misc.h"
#include "calendar/gui/dialogs/calendar-setup.h"
@@ -382,12 +381,19 @@ static void
cal_shell_sidebar_selection_changed_cb (ECalShellSidebar *cal_shell_sidebar,
ESourceSelector *selector)
{
+ EShellView *shell_view;
+ EShellBackend *shell_backend;
+ EShellSidebar *shell_sidebar;
GSList *list, *iter;
/* This signal is emitted less frequently than "row-changed",
* especially when the model is being rebuilt. So we'll take
* it easy on poor GConf. */
+ shell_sidebar = E_SHELL_SIDEBAR (cal_shell_sidebar);
+ shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
+
list = e_source_selector_get_selection (selector);
for (iter = list; iter != NULL; iter = iter->next) {
@@ -397,7 +403,8 @@ cal_shell_sidebar_selection_changed_cb (ECalShellSidebar *cal_shell_sidebar,
g_object_unref (source);
}
- calendar_config_set_calendars_selected (list);
+ e_cal_shell_backend_set_selected_calendars (
+ E_CAL_SHELL_BACKEND (shell_backend), list);
g_slist_free (list);
}
@@ -467,19 +474,19 @@ cal_shell_sidebar_restore_state_cb (EShellWindow *shell_window,
g_object_ref (source_list),
(GDestroyNotify) g_object_unref);
- list = calendar_config_get_calendars_selected ();
+ list = e_cal_shell_backend_get_selected_calendars (
+ E_CAL_SHELL_BACKEND (shell_backend));
+
for (iter = list; iter != NULL; iter = iter->next) {
- gchar *uid;
+ const gchar *uid = iter->data;
- uid = iter->data;
source = e_source_list_peek_source_by_uid (source_list, uid);
- g_free (uid);
- if (source == NULL)
- continue;
-
- e_source_selector_select_source (selector, source);
+ if (source != NULL)
+ e_source_selector_select_source (selector, source);
}
+
+ g_slist_foreach (list, (GFunc) g_free, NULL);
g_slist_free (list);
/* Listen for subsequent changes to the selector. */
diff --git a/modules/calendar/e-cal-shell-view-actions.c b/modules/calendar/e-cal-shell-view-actions.c
index bce4fc4..7b9d88f 100644
--- a/modules/calendar/e-cal-shell-view-actions.c
+++ b/modules/calendar/e-cal-shell-view-actions.c
@@ -960,6 +960,7 @@ action_event_print_cb (GtkAction *action,
ECalendarView *calendar_view;
ECalendarViewEvent *event;
ECalComponent *component;
+ ECalModel *model;
ECal *client;
icalcomponent *icalcomp;
GList *selected;
@@ -968,6 +969,7 @@ action_event_print_cb (GtkAction *action,
calendar = e_cal_shell_content_get_calendar (cal_shell_content);
view_type = gnome_calendar_get_view (calendar);
calendar_view = gnome_calendar_get_calendar_view (calendar, view_type);
+ model = e_calendar_view_get_model (calendar_view);
selected = e_calendar_view_get_selected_events (calendar_view);
g_return_if_fail (g_list_length (selected) == 1);
@@ -985,7 +987,10 @@ action_event_print_cb (GtkAction *action,
e_cal_component_set_icalcomponent (
component, icalcomponent_new_clone (icalcomp));
print_comp (
- component, client, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG);
+ component, client,
+ e_cal_model_get_timezone (model),
+ e_cal_model_get_use_24_hour_format (model),
+ GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG);
g_object_unref (component);
diff --git a/modules/calendar/e-cal-shell-view-memopad.c b/modules/calendar/e-cal-shell-view-memopad.c
index 11e1bcd..c4b67a8 100644
--- a/modules/calendar/e-cal-shell-view-memopad.c
+++ b/modules/calendar/e-cal-shell-view-memopad.c
@@ -153,12 +153,13 @@ action_calendar_memopad_print_cb (GtkAction *action,
EMemoTable *memo_table;
ECalModelComponent *comp_data;
ECalComponent *comp;
+ ECalModel *model;
icalcomponent *clone;
- GtkPrintOperationAction print_action;
GSList *list;
cal_shell_content = cal_shell_view->priv->cal_shell_content;
memo_table = e_cal_shell_content_get_memo_table (cal_shell_content);
+ model = e_memo_table_get_model (memo_table);
list = e_memo_table_get_selected (memo_table);
g_return_if_fail (list != NULL);
@@ -168,9 +169,14 @@ action_calendar_memopad_print_cb (GtkAction *action,
/* XXX We only print the first selected memo. */
comp = e_cal_component_new ();
clone = icalcomponent_new_clone (comp_data->icalcomp);
- print_action = GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG;
e_cal_component_set_icalcomponent (comp, clone);
- print_comp (comp, comp_data->client, print_action);
+
+ print_comp (
+ comp, comp_data->client,
+ e_cal_model_get_timezone (model),
+ e_cal_model_get_use_24_hour_format (model),
+ GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG);
+
g_object_unref (comp);
}
diff --git a/modules/calendar/e-cal-shell-view-taskpad.c b/modules/calendar/e-cal-shell-view-taskpad.c
index 6dae144..ead28ae 100644
--- a/modules/calendar/e-cal-shell-view-taskpad.c
+++ b/modules/calendar/e-cal-shell-view-taskpad.c
@@ -220,12 +220,13 @@ action_calendar_taskpad_print_cb (GtkAction *action,
ECalModelComponent *comp_data;
ETaskTable *task_table;
ECalComponent *comp;
+ ECalModel *model;
icalcomponent *clone;
- GtkPrintOperationAction print_action;
GSList *list;
cal_shell_content = cal_shell_view->priv->cal_shell_content;
task_table = e_cal_shell_content_get_task_table (cal_shell_content);
+ model = e_task_table_get_model (task_table);
list = e_task_table_get_selected (task_table);
g_return_if_fail (list != NULL);
@@ -235,9 +236,14 @@ action_calendar_taskpad_print_cb (GtkAction *action,
/* XXX We only print the first selected task. */
comp = e_cal_component_new ();
clone = icalcomponent_new_clone (comp_data->icalcomp);
- print_action = GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG;
e_cal_component_set_icalcomponent (comp, clone);
- print_comp (comp, comp_data->client, print_action);
+
+ print_comp (
+ comp, comp_data->client,
+ e_cal_model_get_timezone (model),
+ e_cal_model_get_use_24_hour_format (model),
+ GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG);
+
g_object_unref (comp);
}
diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/modules/calendar/e-calendar-preferences.c
similarity index 61%
rename from calendar/gui/dialogs/cal-prefs-dialog.c
rename to modules/calendar/e-calendar-preferences.c
index f404d08..9db9f45 100644
--- a/calendar/gui/dialogs/cal-prefs-dialog.c
+++ b/modules/calendar/e-calendar-preferences.c
@@ -22,80 +22,148 @@
*
*/
-#ifdef HAVE_CONFIG_H
+#include "e-calendar-preferences.h"
+
#include <config.h>
-#endif
+#include <string.h>
+#include <glib/gi18n.h>
-#include "../e-cal-config.h"
-#include "../e-timezone-entry.h"
-#include "../calendar-config.h"
-#include "cal-prefs-dialog.h"
-#include <widgets/misc/e-dateedit.h>
+#include "calendar/gui/e-cal-config.h"
+#include "calendar/gui/e-timezone-entry.h"
+#include "calendar/gui/calendar-config.h"
+#include "widgets/misc/e-dateedit.h"
#include "e-util/e-util.h"
#include "e-util/e-datetime-format.h"
#include "e-util/e-dialog-widgets.h"
#include "e-util/e-util-private.h"
#include "shell/e-shell-utils.h"
-#include <glib/gi18n.h>
-#include <string.h>
-
-static const gint time_division_map[] = {
- 60, 30, 15, 10, 5, -1
-};
-
-/* The following two are kept separate in case we need to re-order each menu individually */
-static const gint hide_completed_units_map[] = {
- E_DURATION_MINUTES, E_DURATION_HOURS, E_DURATION_DAYS, -1
-};
/* same is used for Birthdays & Anniversaries calendar */
static const gint default_reminder_units_map[] = {
E_DURATION_MINUTES, E_DURATION_HOURS, E_DURATION_DAYS, -1
};
-static GtkVBoxClass *parent_class = NULL;
+G_DEFINE_DYNAMIC_TYPE (
+ ECalendarPreferences,
+ e_calendar_preferences,
+ GTK_TYPE_VBOX)
+
+static gboolean
+transform_time_divisions_to_index (GBinding *binding,
+ const GValue *source_value,
+ GValue *target_value,
+ gpointer not_used)
+{
+ gboolean success = TRUE;
+
+ g_return_val_if_fail (G_IS_BINDING (binding), FALSE);
+
+ switch (g_value_get_int (source_value)) {
+ case 60:
+ g_value_set_int (target_value, 0);
+ break;
+ case 30:
+ g_value_set_int (target_value, 1);
+ break;
+ case 15:
+ g_value_set_int (target_value, 2);
+ break;
+ case 10:
+ g_value_set_int (target_value, 3);
+ break;
+ case 5:
+ g_value_set_int (target_value, 4);
+ break;
+ default:
+ success = FALSE;
+ }
+
+ return success;
+}
+
+static gboolean
+transform_index_to_time_divisions (GBinding *binding,
+ const GValue *source_value,
+ GValue *target_value,
+ gpointer not_used)
+{
+ gboolean success = TRUE;
+
+ switch (g_value_get_int (source_value)) {
+ case 0:
+ g_value_set_int (target_value, 60);
+ break;
+ case 1:
+ g_value_set_int (target_value, 30);
+ break;
+ case 2:
+ g_value_set_int (target_value, 15);
+ break;
+ case 3:
+ g_value_set_int (target_value, 10);
+ break;
+ case 4:
+ g_value_set_int (target_value, 5);
+ break;
+ default:
+ success = FALSE;
+ }
+
+ return success;
+}
static void
-calendar_prefs_dialog_finalize (GObject *obj)
+calendar_preferences_dispose (GObject *object)
{
- CalendarPrefsDialog *prefs = (CalendarPrefsDialog *) obj;
+ ECalendarPreferences *prefs = (ECalendarPreferences *) object;
- g_object_unref (prefs->builder);
+ if (prefs->builder != NULL) {
+ g_object_unref (prefs->builder);
+ prefs->builder = NULL;
+ }
- if (prefs->gconf) {
- g_object_unref (prefs->gconf);
- prefs->gconf = NULL;
+ if (prefs->shell_settings != NULL) {
+ g_object_unref (prefs->shell_settings);
+ prefs->shell_settings = NULL;
}
- ((GObjectClass *)(parent_class))->finalize (obj);
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (e_calendar_preferences_parent_class)->dispose (object);
}
static void
-calendar_prefs_dialog_class_init (CalendarPrefsDialogClass *klass)
+e_calendar_preferences_class_init (ECalendarPreferencesClass *class)
{
GObjectClass *object_class;
- object_class = (GObjectClass *) klass;
- parent_class = g_type_class_ref (GTK_TYPE_VBOX);
+ object_class = G_OBJECT_CLASS (class);
+ object_class->dispose = calendar_preferences_dispose;
+}
- object_class->finalize = calendar_prefs_dialog_finalize;
+static void
+e_calendar_preferences_class_finalize (ECalendarPreferencesClass *class)
+{
}
static void
-calendar_prefs_dialog_init (CalendarPrefsDialog *dialog)
+e_calendar_preferences_init (ECalendarPreferences *preferences)
{
}
static GtkWidget *
-eccp_widget_glade (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *old, gpointer data)
+calendar_preferences_get_config_widget (EConfig *ec,
+ EConfigItem *item,
+ GtkWidget *parent,
+ GtkWidget *old,
+ gpointer data)
{
- CalendarPrefsDialog *prefs = data;
+ ECalendarPreferences *preferences = data;
- return e_builder_get_widget (prefs->builder, item->label);
+ return e_builder_get_widget (preferences->builder, item->label);
}
static void
-update_day_second_zone_caption (CalendarPrefsDialog *prefs)
+update_day_second_zone_caption (ECalendarPreferences *prefs)
{
gchar *location;
const gchar *caption;
@@ -119,7 +187,7 @@ update_day_second_zone_caption (CalendarPrefsDialog *prefs)
}
static void
-on_set_day_second_zone (GtkWidget *item, CalendarPrefsDialog *prefs)
+on_set_day_second_zone (GtkWidget *item, ECalendarPreferences *prefs)
{
if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (item)))
return;
@@ -129,7 +197,7 @@ on_set_day_second_zone (GtkWidget *item, CalendarPrefsDialog *prefs)
}
static void
-on_select_day_second_zone (GtkWidget *item, CalendarPrefsDialog *prefs)
+on_select_day_second_zone (GtkWidget *item, ECalendarPreferences *prefs)
{
g_return_if_fail (prefs != NULL);
@@ -138,7 +206,7 @@ on_select_day_second_zone (GtkWidget *item, CalendarPrefsDialog *prefs)
}
static void
-day_second_zone_clicked (GtkWidget *widget, CalendarPrefsDialog *prefs)
+day_second_zone_clicked (GtkWidget *widget, ECalendarPreferences *prefs)
{
GtkWidget *menu, *item;
GSList *group = NULL, *recent_zones, *s;
@@ -191,7 +259,7 @@ day_second_zone_clicked (GtkWidget *widget, CalendarPrefsDialog *prefs)
}
static void
-start_of_day_changed (GtkWidget *widget, CalendarPrefsDialog *prefs)
+start_of_day_changed (GtkWidget *widget, ECalendarPreferences *prefs)
{
gint start_hour, start_minute, end_hour, end_minute;
EDateEdit *start, *end;
@@ -211,12 +279,16 @@ start_of_day_changed (GtkWidget *widget, CalendarPrefsDialog *prefs)
return;
}
- calendar_config_set_day_start_hour (start_hour);
- calendar_config_set_day_start_minute (start_minute);
+ e_shell_settings_set_int (
+ prefs->shell_settings,
+ "cal-work-day-start-hour", start_hour);
+ e_shell_settings_set_int (
+ prefs->shell_settings,
+ "cal-work-day-start-minute", start_minute);
}
static void
-end_of_day_changed (GtkWidget *widget, CalendarPrefsDialog *prefs)
+end_of_day_changed (GtkWidget *widget, ECalendarPreferences *prefs)
{
gint start_hour, start_minute, end_hour, end_minute;
EDateEdit *start, *end;
@@ -236,108 +308,16 @@ end_of_day_changed (GtkWidget *widget, CalendarPrefsDialog *prefs)
return;
}
- calendar_config_set_day_end_hour (end_hour);
- calendar_config_set_day_end_minute (end_minute);
-}
-
-static void
-time_divisions_changed (GtkWidget *widget, CalendarPrefsDialog *prefs)
-{
- gint time_divisions;
-
- time_divisions = e_dialog_combo_box_get (prefs->time_divisions, time_division_map);
- calendar_config_set_time_divisions (time_divisions);
+ e_shell_settings_set_int (
+ prefs->shell_settings,
+ "cal-work-day-end-hour", end_hour);
+ e_shell_settings_set_int (
+ prefs->shell_settings,
+ "cal-work-day-end-minute", end_minute);
}
static void
-month_scroll_by_week_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs)
-{
- calendar_config_set_month_scroll_by_week (gtk_toggle_button_get_active (toggle));
-}
-
-static void
-hide_completed_tasks_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs)
-{
- gboolean hide;
-
- hide = gtk_toggle_button_get_active (toggle);
-
- gtk_widget_set_sensitive (prefs->tasks_hide_completed_interval, hide);
- gtk_widget_set_sensitive (prefs->tasks_hide_completed_units, hide);
-
- calendar_config_set_hide_completed_tasks (hide);
-}
-
-static void
-hide_completed_tasks_changed (GtkWidget *widget, CalendarPrefsDialog *prefs)
-{
- calendar_config_set_hide_completed_tasks_value (
- gtk_spin_button_get_value_as_int (
- GTK_SPIN_BUTTON (prefs->tasks_hide_completed_interval)));
-}
-
-static void
-hide_completed_tasks_units_changed (GtkWidget *widget, CalendarPrefsDialog *prefs)
-{
- calendar_config_set_hide_completed_tasks_units (
- e_dialog_combo_box_get (prefs->tasks_hide_completed_units, hide_completed_units_map));
-}
-
-static void
-default_reminder_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs)
-{
- calendar_config_set_use_default_reminder (gtk_toggle_button_get_active (toggle));
-}
-
-static void
-default_reminder_interval_changed (GtkWidget *widget, CalendarPrefsDialog *prefs)
-{
- const gchar *str;
- gdouble value;
-
- str = gtk_entry_get_text (GTK_ENTRY (widget));
- value = g_ascii_strtod (str, NULL);
-
- calendar_config_set_default_reminder_interval (value);
-}
-
-static void
-default_reminder_units_changed (GtkWidget *widget, CalendarPrefsDialog *prefs)
-{
- calendar_config_set_default_reminder_units (
- e_dialog_combo_box_get (prefs->default_reminder_units, default_reminder_units_map));
-}
-
-static void
-ba_reminder_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs)
-{
- gboolean enabled = gtk_toggle_button_get_active (toggle);
-
- calendar_config_set_ba_reminder (&enabled, NULL, NULL);
-}
-
-static void
-ba_reminder_interval_changed (GtkWidget *widget, CalendarPrefsDialog *prefs)
-{
- const gchar *str;
- gint value;
-
- str = gtk_entry_get_text (GTK_ENTRY (widget));
- value = (gint) g_ascii_strtod (str, NULL);
-
- calendar_config_set_ba_reminder (NULL, &value, NULL);
-}
-
-static void
-ba_reminder_units_changed (GtkWidget *widget, CalendarPrefsDialog *prefs)
-{
- EDurationType units = e_dialog_combo_box_get (prefs->ba_reminder_units, default_reminder_units_map);
-
- calendar_config_set_ba_reminder (NULL, NULL, &units);
-}
-
-static void
-notify_with_tray_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs)
+notify_with_tray_toggled (GtkToggleButton *toggle, ECalendarPreferences *prefs)
{
GConfClient *gconf;
@@ -349,7 +329,7 @@ notify_with_tray_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs)
}
static void
-alarms_selection_changed (ESourceSelector *selector, CalendarPrefsDialog *prefs)
+alarms_selection_changed (ESourceSelector *selector, ECalendarPreferences *prefs)
{
ESourceList *source_list = prefs->alarms_list;
GSList *selection;
@@ -394,7 +374,7 @@ alarms_selection_changed (ESourceSelector *selector, CalendarPrefsDialog *prefs)
static void
update_system_tz_widgets (EShellSettings *shell_settings,
GParamSpec *pspec,
- CalendarPrefsDialog *prefs)
+ ECalendarPreferences *prefs)
{
GtkWidget *widget;
icaltimezone *zone;
@@ -416,63 +396,17 @@ update_system_tz_widgets (EShellSettings *shell_settings,
}
static void
-setup_changes (CalendarPrefsDialog *prefs)
+setup_changes (ECalendarPreferences *prefs)
{
g_signal_connect (G_OBJECT (prefs->day_second_zone), "clicked", G_CALLBACK (day_second_zone_clicked), prefs);
g_signal_connect (G_OBJECT (prefs->start_of_day), "changed", G_CALLBACK (start_of_day_changed), prefs);
g_signal_connect (G_OBJECT (prefs->end_of_day), "changed", G_CALLBACK (end_of_day_changed), prefs);
- g_signal_connect (G_OBJECT (prefs->time_divisions), "changed", G_CALLBACK (time_divisions_changed), prefs);
-
- g_signal_connect (G_OBJECT (prefs->month_scroll_by_week), "toggled", G_CALLBACK (month_scroll_by_week_toggled), prefs);
-
- g_signal_connect (G_OBJECT (prefs->tasks_hide_completed), "toggled",
- G_CALLBACK (hide_completed_tasks_toggled), prefs);
- g_signal_connect (G_OBJECT (prefs->tasks_hide_completed_interval), "value-changed",
- G_CALLBACK (hide_completed_tasks_changed), prefs);
- g_signal_connect (G_OBJECT (prefs->tasks_hide_completed_units), "changed", G_CALLBACK (hide_completed_tasks_units_changed), prefs);
-
- g_signal_connect (G_OBJECT (prefs->default_reminder), "toggled", G_CALLBACK (default_reminder_toggled), prefs);
- g_signal_connect (G_OBJECT (prefs->default_reminder_interval), "changed",
- G_CALLBACK (default_reminder_interval_changed), prefs);
- g_signal_connect (G_OBJECT (prefs->default_reminder_units), "changed", G_CALLBACK (default_reminder_units_changed), prefs);
-
- g_signal_connect (G_OBJECT (prefs->ba_reminder), "toggled", G_CALLBACK (ba_reminder_toggled), prefs);
- g_signal_connect (G_OBJECT (prefs->ba_reminder_interval), "changed",
- G_CALLBACK (ba_reminder_interval_changed), prefs);
- g_signal_connect (G_OBJECT (prefs->ba_reminder_units), "changed", G_CALLBACK (ba_reminder_units_changed), prefs);
-
g_signal_connect (G_OBJECT (prefs->notify_with_tray), "toggled", G_CALLBACK (notify_with_tray_toggled), prefs);
g_signal_connect (G_OBJECT (prefs->alarm_list_widget), "selection_changed", G_CALLBACK (alarms_selection_changed), prefs);
}
-/* Shows the current task list settings in the dialog */
-static void
-show_task_list_config (CalendarPrefsDialog *prefs)
-{
- EDurationType units;
- gboolean hide_completed_tasks;
-
- /* Hide Completed Tasks. */
- hide_completed_tasks = calendar_config_get_hide_completed_tasks ();
- gtk_toggle_button_set_active (
- GTK_TOGGLE_BUTTON (prefs->tasks_hide_completed),
- hide_completed_tasks);
-
- /* Hide Completed Tasks Units. */
- units = calendar_config_get_hide_completed_tasks_units ();
- e_dialog_combo_box_set (prefs->tasks_hide_completed_units, units, hide_completed_units_map);
-
- /* Hide Completed Tasks Value. */
- gtk_spin_button_set_value (
- GTK_SPIN_BUTTON (prefs->tasks_hide_completed_interval),
- calendar_config_get_hide_completed_tasks_value ());
-
- gtk_widget_set_sensitive (prefs->tasks_hide_completed_interval, hide_completed_tasks);
- gtk_widget_set_sensitive (prefs->tasks_hide_completed_units, hide_completed_tasks);
-}
-
static void
initialize_selection (ESourceSelector *selector, ESourceList *source_list)
{
@@ -494,7 +428,7 @@ initialize_selection (ESourceSelector *selector, ESourceList *source_list)
}
static void
-show_alarms_config (CalendarPrefsDialog *prefs)
+show_alarms_config (ECalendarPreferences *prefs)
{
GConfClient *gconf;
@@ -513,72 +447,48 @@ show_alarms_config (CalendarPrefsDialog *prefs)
/* Shows the current config settings in the dialog. */
static void
-show_config (CalendarPrefsDialog *prefs)
+show_config (ECalendarPreferences *prefs)
{
- gint time_divisions;
- gboolean set = FALSE;
- EDurationType units;
- gint interval;
+ EShellSettings *shell_settings;
- /* Day's second zone */
- update_day_second_zone_caption (prefs);
+ shell_settings = prefs->shell_settings;
/* Day's second zone */
update_day_second_zone_caption (prefs);
/* Start of Day. */
- e_date_edit_set_time_of_day (E_DATE_EDIT (prefs->start_of_day), calendar_config_get_day_start_hour (), calendar_config_get_day_start_minute ());
+ e_date_edit_set_time_of_day (
+ E_DATE_EDIT (prefs->start_of_day),
+ e_shell_settings_get_int (
+ shell_settings, "cal-work-day-start-hour"),
+ e_shell_settings_get_int (
+ shell_settings, "cal-work-day-start-minute"));
/* End of Day. */
- e_date_edit_set_time_of_day (E_DATE_EDIT (prefs->end_of_day), calendar_config_get_day_end_hour (), calendar_config_get_day_end_minute ());
-
- /* Time Divisions. */
- time_divisions = calendar_config_get_time_divisions ();
- e_dialog_combo_box_set (prefs->time_divisions, time_divisions, time_division_map);
-
- /* Month View - Scroll by a week */
- gtk_toggle_button_set_active (
- GTK_TOGGLE_BUTTON (prefs->month_scroll_by_week),
- calendar_config_get_month_scroll_by_week ());
-
- /* Task list */
- show_task_list_config (prefs);
-
- /* Alarms list*/
+ e_date_edit_set_time_of_day (
+ E_DATE_EDIT (prefs->end_of_day),
+ e_shell_settings_get_int (
+ shell_settings, "cal-work-day-end-hour"),
+ e_shell_settings_get_int (
+ shell_settings, "cal-work-day-end-minute"));
+
+ /* Alarms list */
show_alarms_config (prefs);
-
- /* Other page */
- gtk_toggle_button_set_active (
- GTK_TOGGLE_BUTTON (prefs->default_reminder),
- calendar_config_get_use_default_reminder ());
- gtk_spin_button_set_value (
- GTK_SPIN_BUTTON (prefs->default_reminder_interval),
- calendar_config_get_default_reminder_interval ());
- e_dialog_combo_box_set (prefs->default_reminder_units, calendar_config_get_default_reminder_units (), default_reminder_units_map);
-
- /* Birthdays & Anniversaries reminder */
- set = calendar_config_get_ba_reminder (&interval, &units);
-
- gtk_toggle_button_set_active (
- GTK_TOGGLE_BUTTON (prefs->ba_reminder), set);
- gtk_spin_button_set_value (
- GTK_SPIN_BUTTON (prefs->ba_reminder_interval), interval);
- e_dialog_combo_box_set (prefs->ba_reminder_units, units, default_reminder_units_map);
}
/* plugin meta-data */
static ECalConfigItem eccp_items[] = {
- { E_CONFIG_BOOK, (gchar *) "", (gchar *) "toplevel-notebook", eccp_widget_glade },
- { E_CONFIG_PAGE, (gchar *) "00.general", (gchar *) "general", eccp_widget_glade },
- { E_CONFIG_SECTION_TABLE, (gchar *) "00.general/00.time", (gchar *) "time", eccp_widget_glade },
- { E_CONFIG_SECTION_TABLE, (gchar *) "00.general/10.workWeek", (gchar *) "workWeek", eccp_widget_glade },
- { E_CONFIG_SECTION, (gchar *) "00.general/20.alerts", (gchar *) "alerts", eccp_widget_glade },
- { E_CONFIG_PAGE, (gchar *) "10.display", (gchar *) "display", eccp_widget_glade },
- { E_CONFIG_SECTION, (gchar *) "10.display/00.general", (gchar *) "displayGeneral", eccp_widget_glade },
- { E_CONFIG_SECTION, (gchar *) "10.display/10.taskList", (gchar *) "taskList", eccp_widget_glade },
- { E_CONFIG_PAGE, (gchar *) "15.alarms", (gchar *) "alarms", eccp_widget_glade },
- { E_CONFIG_PAGE, (gchar *) "20.freeBusy", (gchar *) "freebusy", eccp_widget_glade },
- { E_CONFIG_SECTION, (gchar *) "20.freeBusy/00.defaultServer", (gchar *) "default-freebusy-vbox", eccp_widget_glade },
+ { E_CONFIG_BOOK, (gchar *) "", (gchar *) "toplevel-notebook", calendar_preferences_get_config_widget },
+ { E_CONFIG_PAGE, (gchar *) "00.general", (gchar *) "general", calendar_preferences_get_config_widget },
+ { E_CONFIG_SECTION_TABLE, (gchar *) "00.general/00.time", (gchar *) "time", calendar_preferences_get_config_widget },
+ { E_CONFIG_SECTION_TABLE, (gchar *) "00.general/10.workWeek", (gchar *) "workWeek", calendar_preferences_get_config_widget },
+ { E_CONFIG_SECTION, (gchar *) "00.general/20.alerts", (gchar *) "alerts", calendar_preferences_get_config_widget },
+ { E_CONFIG_PAGE, (gchar *) "10.display", (gchar *) "display", calendar_preferences_get_config_widget },
+ { E_CONFIG_SECTION, (gchar *) "10.display/00.general", (gchar *) "displayGeneral", calendar_preferences_get_config_widget },
+ { E_CONFIG_SECTION, (gchar *) "10.display/10.taskList", (gchar *) "taskList", calendar_preferences_get_config_widget },
+ { E_CONFIG_PAGE, (gchar *) "15.alarms", (gchar *) "alarms", calendar_preferences_get_config_widget },
+ { E_CONFIG_PAGE, (gchar *) "20.freeBusy", (gchar *) "freebusy", calendar_preferences_get_config_widget },
+ { E_CONFIG_SECTION, (gchar *) "20.freeBusy/00.defaultServer", (gchar *) "default-freebusy-vbox", calendar_preferences_get_config_widget },
};
static void
@@ -588,8 +498,8 @@ eccp_free (EConfig *ec, GSList *items, gpointer data)
}
static void
-calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs,
- EShell *shell)
+calendar_preferences_construct (ECalendarPreferences *prefs,
+ EShell *shell)
{
ECalConfig *ec;
ECalConfigTargetPrefs *target;
@@ -601,7 +511,7 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs,
GtkWidget *table;
GSList *l;
- shell_settings = e_shell_get_shell_settings (shell);
+ shell_settings = prefs->shell_settings;
locale_supports_12_hour_format =
calendar_config_locale_supports_12_hour_format ();
@@ -617,9 +527,7 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs,
E_TYPE_TIMEZONE_ENTRY;
prefs->builder = gtk_builder_new ();
- e_load_ui_builder_definition (prefs->builder, "cal-prefs-dialog.ui");
-
- prefs->gconf = gconf_client_get_default ();
+ e_load_ui_builder_definition (prefs->builder, "e-calendar-preferences.ui");
/** @HookPoint-ECalConfig: Calendar Preferences Page
* @Id: org.gnome.evolution.calendar.prefs
@@ -758,15 +666,74 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs,
G_BINDING_BIDIRECTIONAL |
G_BINDING_SYNC_CREATE);
- prefs->default_reminder = e_builder_get_widget (prefs->builder, "default_reminder");
- prefs->default_reminder_interval = e_builder_get_widget (prefs->builder, "default_reminder_interval");
- prefs->default_reminder_units = e_builder_get_widget (prefs->builder, "default_reminder_units");
- prefs->ba_reminder = e_builder_get_widget (prefs->builder, "ba_reminder");
- prefs->ba_reminder_interval = e_builder_get_widget (prefs->builder, "ba_reminder_interval");
- prefs->ba_reminder_units = e_builder_get_widget (prefs->builder, "ba_reminder_units");
+ widget = e_builder_get_widget (prefs->builder, "default_reminder");
+ g_object_bind_property (
+ shell_settings, "cal-use-default-reminder",
+ widget, "active",
+ G_BINDING_BIDIRECTIONAL |
+ G_BINDING_SYNC_CREATE);
+
+ widget = e_builder_get_widget (prefs->builder, "default_reminder_interval");
+ g_object_bind_property (
+ shell_settings, "cal-default-reminder-interval",
+ widget, "value",
+ G_BINDING_BIDIRECTIONAL |
+ G_BINDING_SYNC_CREATE);
+ g_object_bind_property (
+ shell_settings, "cal-use-default-reminder",
+ widget, "sensitive",
+ G_BINDING_SYNC_CREATE);
+
+ widget = e_builder_get_widget (prefs->builder, "default_reminder_units");
+ g_object_bind_property (
+ shell_settings, "cal-default-reminder-units",
+ widget, "active",
+ G_BINDING_BIDIRECTIONAL |
+ G_BINDING_SYNC_CREATE);
+ g_object_bind_property (
+ shell_settings, "cal-use-default-reminder",
+ widget, "sensitive",
+ G_BINDING_SYNC_CREATE);
+
+ widget = e_builder_get_widget (prefs->builder, "ba_reminder");
+ g_object_bind_property (
+ shell_settings, "cal-use-ba-reminder",
+ widget, "active",
+ G_BINDING_BIDIRECTIONAL |
+ G_BINDING_SYNC_CREATE);
+
+ widget = e_builder_get_widget (prefs->builder, "ba_reminder_interval");
+ g_object_bind_property (
+ shell_settings, "cal-ba-reminder-interval",
+ widget, "value",
+ G_BINDING_BIDIRECTIONAL |
+ G_BINDING_SYNC_CREATE);
+ g_object_bind_property (
+ shell_settings, "cal-use-ba-reminder",
+ widget, "sensitive",
+ G_BINDING_SYNC_CREATE);
+
+ widget = e_builder_get_widget (prefs->builder, "ba_reminder_units");
+ g_object_bind_property (
+ shell_settings, "cal-ba-reminder-units",
+ widget, "active",
+ G_BINDING_BIDIRECTIONAL |
+ G_BINDING_SYNC_CREATE);
+ g_object_bind_property (
+ shell_settings, "cal-use-ba-reminder",
+ widget, "sensitive",
+ G_BINDING_SYNC_CREATE);
/* Display tab */
- prefs->time_divisions = e_builder_get_widget (prefs->builder, "time_divisions");
+ widget = e_builder_get_widget (prefs->builder, "time_divisions");
+ g_object_bind_property_full (
+ shell_settings, "cal-time-divisions",
+ widget, "active",
+ G_BINDING_BIDIRECTIONAL |
+ G_BINDING_SYNC_CREATE,
+ transform_time_divisions_to_index,
+ transform_index_to_time_divisions,
+ NULL, (GDestroyNotify) NULL);
widget = e_builder_get_widget (prefs->builder, "show_end_times");
g_object_bind_property (
@@ -796,7 +763,12 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs,
G_BINDING_BIDIRECTIONAL |
G_BINDING_SYNC_CREATE);
- prefs->month_scroll_by_week = e_builder_get_widget (prefs->builder, "month_scroll_by_week");
+ widget = e_builder_get_widget (prefs->builder, "month_scroll_by_week");
+ g_object_bind_property (
+ shell_settings, "cal-month-scroll-by-week",
+ widget, "active",
+ G_BINDING_BIDIRECTIONAL |
+ G_BINDING_SYNC_CREATE);
widget = e_builder_get_widget (prefs->builder, "tasks_due_today_color");
g_object_bind_property_full (
@@ -818,9 +790,34 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs,
e_binding_transform_color_to_string,
(GDestroyNotify) NULL, NULL);
- prefs->tasks_hide_completed = e_builder_get_widget (prefs->builder, "tasks_hide_completed");
- prefs->tasks_hide_completed_interval = e_builder_get_widget (prefs->builder, "tasks_hide_completed_interval");
- prefs->tasks_hide_completed_units = e_builder_get_widget (prefs->builder, "tasks_hide_completed_units");
+ widget = e_builder_get_widget (prefs->builder, "tasks_hide_completed");
+ g_object_bind_property (
+ shell_settings, "cal-hide-completed-tasks",
+ widget, "active",
+ G_BINDING_BIDIRECTIONAL |
+ G_BINDING_SYNC_CREATE);
+
+ widget = e_builder_get_widget (prefs->builder, "tasks_hide_completed_interval");
+ g_object_bind_property (
+ shell_settings, "cal-hide-completed-tasks-value",
+ widget, "value",
+ G_BINDING_BIDIRECTIONAL |
+ G_BINDING_SYNC_CREATE);
+ g_object_bind_property (
+ shell_settings, "cal-hide-completed-tasks",
+ widget, "sensitive",
+ G_BINDING_SYNC_CREATE);
+
+ widget = e_builder_get_widget (prefs->builder, "tasks_hide_completed_units");
+ g_object_bind_property (
+ shell_settings, "cal-hide-completed-tasks-units",
+ widget, "active",
+ G_BINDING_BIDIRECTIONAL |
+ G_BINDING_SYNC_CREATE);
+ g_object_bind_property (
+ shell_settings, "cal-hide-completed-tasks",
+ widget, "sensitive",
+ G_BINDING_SYNC_CREATE);
/* Alarms tab */
prefs->notify_with_tray = e_builder_get_widget (prefs->builder, "notify_with_tray");
@@ -851,12 +848,14 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs,
"month_scroll_by_week",
NULL);
- /* HACK: GTK+ 2.18 and 2.20 has a GtkTable which includes row/column spacing even for empty rows/columns.
- * When Evo runs in Express mode, we hide all the rows in the Time section of the calendar's General
- * preferences page. However, due to that behavior in GTK+, we get a lot of extra spacing in that
- * section. Since we know that in Express mode we only leave a single row visible, we'll make the
- * table's row spacing equal to 0 in that case.
- */
+ /* HACK: GTK+ 2.18 and 2.20 has a GtkTable which includes
+ * row/column spacing even for empty rows/columns.
+ * When Evo runs in Express mode, we hide all the rows in
+ * the Time section of the calendar's General preferences
+ * page. However, due to that behavior in GTK+, we get a
+ * lot of extra spacing in that section. Since we know that
+ * in Express mode we only leave a single row visible, we'll
+ * make the table's row spacing equal to 0 in that case. */
if (e_shell_get_express_mode (shell)) {
widget = e_builder_get_widget (prefs->builder, "time");
gtk_table_set_row_spacings (GTK_TABLE (widget), 0);
@@ -864,7 +863,7 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs,
/* Hook up and add the toplevel widget */
- target = e_cal_config_target_new_prefs (ec, prefs->gconf);
+ target = e_cal_config_target_new_prefs (ec);
e_config_set_target ((EConfig *)ec, (EConfigTarget *) target);
toplevel = e_config_create_widget ((EConfig *)ec);
gtk_container_add (GTK_CONTAINER (prefs), toplevel);
@@ -874,42 +873,33 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs,
setup_changes (prefs);
}
-GType
-calendar_prefs_dialog_get_type (void)
+void
+e_calendar_preferences_type_register (GTypeModule *type_module)
{
- static GType type = 0;
-
- if (!type) {
- static GTypeInfo type_info = {
- sizeof (CalendarPrefsDialogClass),
- NULL, NULL,
- (GClassInitFunc) calendar_prefs_dialog_class_init,
- NULL, NULL,
- sizeof (CalendarPrefsDialog),
- 0,
- (GInstanceInitFunc) calendar_prefs_dialog_init,
- };
-
- type = g_type_register_static (GTK_TYPE_VBOX, "CalendarPrefsDialog", &type_info, 0);
- }
-
- return type;
+ /* XXX G_DEFINE_DYNAMIC_TYPE declares a static type registration
+ * function, so we have to wrap it with a public function in
+ * order to register types from a separate compilation unit. */
+ e_calendar_preferences_register_type (type_module);
}
GtkWidget *
-calendar_prefs_dialog_new (EPreferencesWindow *window)
+e_calendar_preferences_new (EPreferencesWindow *window)
{
EShell *shell;
- CalendarPrefsDialog *dialog;
+ EShellSettings *shell_settings;
+ ECalendarPreferences *preferences;
shell = e_preferences_window_get_shell (window);
+ shell_settings = e_shell_get_shell_settings (shell);
g_return_val_if_fail (E_IS_SHELL (shell), NULL);
- dialog = g_object_new (CALENDAR_TYPE_PREFS_DIALOG, NULL);
+ preferences = g_object_new (E_TYPE_CALENDAR_PREFERENCES, NULL);
+
+ preferences->shell_settings = g_object_ref (shell_settings);
/* FIXME Kill this function. */
- calendar_prefs_dialog_construct (dialog, shell);
+ calendar_preferences_construct (preferences, shell);
- return GTK_WIDGET (dialog);
+ return GTK_WIDGET (preferences);
}
diff --git a/modules/calendar/e-calendar-preferences.h b/modules/calendar/e-calendar-preferences.h
new file mode 100644
index 0000000..ae96fc1
--- /dev/null
+++ b/modules/calendar/e-calendar-preferences.h
@@ -0,0 +1,89 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Authors:
+ * David Trowbridge <trowbrds cs colorado edu>
+ * Damon Chaplin <damon ximian com>
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef CAL_PREFERENCES_H
+#define CAL_PREFERENCES_H
+
+#include <gtk/gtk.h>
+#include <shell/e-shell.h>
+#include <libedataserverui/e-source-selector.h>
+#include <widgets/misc/e-preferences-window.h>
+
+/* Standard GObject macros */
+#define E_TYPE_CALENDAR_PREFERENCES \
+ (e_calendar_preferences_get_type ())
+#define E_CALENDAR_PREFERENCES(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_CALENDAR_PREFERENCES, ECalendarPreferences))
+#define E_CALENDAR_PREFERENCES_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_CALENDAR_PREFERENCES, ECalendarPreferencesClass))
+#define E_CALENDAR_IS_PREFERENCES(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_CALENDAR_PREFERENCES))
+#define E_CALENDAR_IS_PREFERENCES_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_CALENDAR_PREFERENCES))
+#define E_CALENDAR_PREFERENCES_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_CALENDAR_PREFERENCES, ECalendarPreferencesClass))
+
+G_BEGIN_DECLS
+
+typedef struct _ECalendarPreferences ECalendarPreferences;
+typedef struct _ECalendarPreferencesClass ECalendarPreferencesClass;
+
+struct _ECalendarPreferences {
+ GtkVBox parent;
+
+ GtkBuilder *builder;
+
+ EShellSettings *shell_settings;
+
+ /* General tab */
+ GtkWidget *day_second_zone;
+ GtkWidget *start_of_day;
+ GtkWidget *end_of_day;
+ GtkWidget *ba_reminder;
+ GtkWidget *ba_reminder_interval;
+ GtkWidget *ba_reminder_units;
+
+ /* Alarms tab */
+ GtkWidget *notify_with_tray;
+ GtkWidget *scrolled_window;
+ ESourceList *alarms_list;
+ GtkWidget *alarm_list_widget;
+};
+
+struct _ECalendarPreferencesClass {
+ GtkVBoxClass parent;
+};
+
+GType e_calendar_preferences_get_type (void);
+void e_calendar_preferences_type_register
+ (GTypeModule *type_module);
+GtkWidget * e_calendar_preferences_new (EPreferencesWindow *window);
+
+G_END_DECLS
+
+#endif /* CAL_PREFERENCES_H */
diff --git a/calendar/gui/dialogs/cal-prefs-dialog.ui b/modules/calendar/e-calendar-preferences.ui
similarity index 100%
rename from calendar/gui/dialogs/cal-prefs-dialog.ui
rename to modules/calendar/e-calendar-preferences.ui
diff --git a/modules/calendar/e-memo-shell-backend.c b/modules/calendar/e-memo-shell-backend.c
index d54c32f..e6658ed 100644
--- a/modules/calendar/e-memo-shell-backend.c
+++ b/modules/calendar/e-memo-shell-backend.c
@@ -34,7 +34,6 @@
#include "shell/e-shell-window.h"
#include "calendar/common/authentication.h"
-#include "calendar/gui/calendar-config.h"
#include "calendar/gui/comp-util.h"
#include "calendar/gui/dialogs/calendar-setup.h"
#include "calendar/gui/dialogs/memo-editor.h"
@@ -67,8 +66,9 @@ memo_shell_backend_ensure_sources (EShellBackend *shell_backend)
/* XXX This is basically the same algorithm across all modules.
* Maybe we could somehow integrate this into EShellBackend? */
- EMemoShellBackendPrivate *priv;
+ EMemoShellBackend *memo_shell_backend;
ESourceGroup *on_this_computer;
+ ESourceList *source_list;
ESource *personal;
EShell *shell;
EShellSettings *shell_settings;
@@ -78,20 +78,24 @@ memo_shell_backend_ensure_sources (EShellBackend *shell_backend)
personal = NULL;
- priv = E_MEMO_SHELL_BACKEND_GET_PRIVATE (shell_backend);
+ memo_shell_backend = E_MEMO_SHELL_BACKEND (shell_backend);
shell = e_shell_backend_get_shell (shell_backend);
shell_settings = e_shell_get_shell_settings (shell);
- if (!e_cal_get_sources (&priv->source_list, E_CAL_SOURCE_TYPE_JOURNAL, NULL)) {
+ if (!e_cal_get_sources (
+ &memo_shell_backend->priv->source_list,
+ E_CAL_SOURCE_TYPE_JOURNAL, NULL)) {
g_warning ("Could not get memo sources from GConf!");
return;
}
+ source_list = memo_shell_backend->priv->source_list;
+
on_this_computer = e_source_list_ensure_group (
- priv->source_list, _("On This Computer"), "local:", TRUE);
+ source_list, _("On This Computer"), "local:", TRUE);
e_source_list_ensure_group (
- priv->source_list, _("On The Web"), "webcal://", FALSE);
+ source_list, _("On The Web"), "webcal://", FALSE);
g_return_if_fail (on_this_computer);
@@ -125,7 +129,8 @@ memo_shell_backend_ensure_sources (EShellBackend *shell_backend)
primary = e_shell_settings_get_string (
shell_settings, "cal-primary-memo-list");
- selected = calendar_config_get_memos_selected ();
+ selected = e_memo_shell_backend_get_selected_memo_lists (
+ memo_shell_backend);
if (primary == NULL && selected == NULL) {
const gchar *uid;
@@ -135,7 +140,8 @@ memo_shell_backend_ensure_sources (EShellBackend *shell_backend)
e_shell_settings_set_string (
shell_settings, "cal-primary-memo-list", uid);
- calendar_config_set_memos_selected (selected);
+ e_memo_shell_backend_set_selected_memo_lists (
+ memo_shell_backend, selected);
}
g_slist_foreach (selected, (GFunc) g_free, NULL);
@@ -149,7 +155,7 @@ memo_shell_backend_ensure_sources (EShellBackend *shell_backend)
g_object_unref (on_this_computer);
if (save_list)
- e_source_list_sync (priv->source_list, NULL);
+ e_source_list_sync (source_list, NULL);
}
static void
@@ -593,3 +599,38 @@ e_memo_shell_backend_get_source_list (EMemoShellBackend *memo_shell_backend)
return memo_shell_backend->priv->source_list;
}
+
+GSList *
+e_memo_shell_backend_get_selected_memo_lists (EMemoShellBackend *memo_shell_backend)
+{
+ GConfClient *client;
+ GSList *selected_memo_lists;
+ const gchar *key;
+
+ g_return_val_if_fail (
+ E_IS_MEMO_SHELL_BACKEND (memo_shell_backend), NULL);
+
+ client = gconf_client_get_default ();
+ key = "/apps/evolution/calendar/memos/selected_memos";
+ selected_memo_lists = gconf_client_get_list (
+ client, key, GCONF_VALUE_STRING, NULL);
+ g_object_unref (client);
+
+ return selected_memo_lists;
+}
+
+void
+e_memo_shell_backend_set_selected_memo_lists (EMemoShellBackend *memo_shell_backend,
+ GSList *selected_memo_lists)
+{
+ GConfClient *client;
+ const gchar *key;
+
+ g_return_if_fail (E_IS_MEMO_SHELL_BACKEND (memo_shell_backend));
+
+ client = gconf_client_get_default ();
+ key = "/apps/evolution/calendar/memos/selected_memos";
+ gconf_client_set_list (
+ client, key, GCONF_VALUE_STRING, selected_memo_lists, NULL);
+ g_object_unref (client);
+}
diff --git a/modules/calendar/e-memo-shell-backend.h b/modules/calendar/e-memo-shell-backend.h
index 37fe41a..8a005c4 100644
--- a/modules/calendar/e-memo-shell-backend.h
+++ b/modules/calendar/e-memo-shell-backend.h
@@ -64,6 +64,11 @@ void e_memo_shell_backend_register_type
(GTypeModule *type_module);
ESourceList * e_memo_shell_backend_get_source_list
(EMemoShellBackend *memo_shell_backend);
+GSList * e_memo_shell_backend_get_selected_memo_lists
+ (EMemoShellBackend *memo_shell_backend);
+void e_memo_shell_backend_set_selected_memo_lists
+ (EMemoShellBackend *memo_shell_backend,
+ GSList *selected_memo_lists);
G_END_DECLS
diff --git a/modules/calendar/e-memo-shell-content.c b/modules/calendar/e-memo-shell-content.c
index 4764607..a9d299e 100644
--- a/modules/calendar/e-memo-shell-content.c
+++ b/modules/calendar/e-memo-shell-content.c
@@ -209,7 +209,9 @@ memo_shell_content_cursor_change_cb (EMemoShellContent *memo_shell_content,
e_cal_component_set_icalcomponent (
comp, icalcomponent_new_clone (comp_data->icalcomp));
e_cal_component_preview_display (
- memo_preview, comp_data->client, comp);
+ memo_preview, comp_data->client, comp,
+ e_cal_model_get_timezone (memo_model),
+ e_cal_model_get_use_24_hour_format (memo_model));
e_cal_component_get_uid (comp, &uid);
g_free (memo_shell_content->priv->current_uid);
@@ -415,13 +417,11 @@ memo_shell_content_constructed (GObject *object)
EMemoShellContentPrivate *priv;
EShell *shell;
EShellView *shell_view;
- EShellSettings *shell_settings;
EShellBackend *shell_backend;
EShellContent *shell_content;
EShellTaskbar *shell_taskbar;
EShellWindow *shell_window;
GalViewInstance *view_instance;
- icaltimezone *timezone;
GtkTargetList *target_list;
GtkTargetEntry *targets;
GtkWidget *container;
@@ -438,15 +438,10 @@ memo_shell_content_constructed (GObject *object)
shell_backend = e_shell_view_get_shell_backend (shell_view);
shell_taskbar = e_shell_view_get_shell_taskbar (shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
-
shell = e_shell_backend_get_shell (shell_backend);
- shell_settings = e_shell_get_shell_settings (shell);
priv->memo_model = e_cal_model_memos_new ();
- timezone = e_shell_settings_get_pointer (
- shell_settings, "cal-timezone");
-
/* Build content widgets. */
container = GTK_WIDGET (object);
@@ -482,8 +477,6 @@ memo_shell_content_constructed (GObject *object)
container = priv->paned;
widget = e_cal_component_preview_new ();
- e_cal_component_preview_set_default_timezone (
- E_CAL_COMPONENT_PREVIEW (widget), timezone);
e_shell_configure_web_view (shell, E_WEB_VIEW (widget));
gtk_widget_show (widget);
diff --git a/modules/calendar/e-memo-shell-migrate.c b/modules/calendar/e-memo-shell-migrate.c
index d858247..e4b5697 100644
--- a/modules/calendar/e-memo-shell-migrate.c
+++ b/modules/calendar/e-memo-shell-migrate.c
@@ -30,20 +30,21 @@
#include <libedataserver/e-source-group.h>
#include <libedataserver/e-source-list.h>
-#include "calendar/gui/calendar-config.h"
#include "calendar/gui/calendar-config-keys.h"
#include "shell/e-shell.h"
+#include "e-memo-shell-backend.h"
+
#define WEBCAL_BASE_URI "webcal://"
#define PERSONAL_RELATIVE_URI "system"
#define GROUPWISE_BASE_URI "groupwise://"
static void
create_memo_sources (EShellBackend *shell_backend,
- ESourceList *source_list,
- ESourceGroup **on_this_computer,
- ESourceGroup **on_the_web,
- ESource **personal_source)
+ ESourceList *source_list,
+ ESourceGroup **on_this_computer,
+ ESourceGroup **on_the_web,
+ ESource **personal_source)
{
EShell *shell;
EShellSettings *shell_settings;
@@ -106,6 +107,7 @@ create_memo_sources (EShellBackend *shell_backend,
}
if (!*personal_source) {
+ GSList *selected;
gchar *primary_memo_list;
/* Create the default Person memo list */
@@ -115,18 +117,26 @@ create_memo_sources (EShellBackend *shell_backend,
primary_memo_list = e_shell_settings_get_string (
shell_settings, "cal-primary-memo-list");
- if (!primary_memo_list && !calendar_config_get_memos_selected ()) {
- GSList selected;
+ selected = e_memo_shell_backend_get_selected_memo_lists (
+ E_MEMO_SHELL_BACKEND (shell_backend));
+
+ if (primary_memo_list == NULL && selected == NULL) {
+ GSList link;
e_shell_settings_set_string (
shell_settings, "cal-primary-memo-list",
e_source_peek_uid (source));
- selected.data = (gpointer)e_source_peek_uid (source);
- selected.next = NULL;
- calendar_config_set_memos_selected (&selected);
+ link.data = (gpointer)e_source_peek_uid (source);
+ link.next = NULL;
+
+ e_memo_shell_backend_set_selected_memo_lists (
+ E_MEMO_SHELL_BACKEND (shell_backend), &link);
}
+ g_slist_foreach (selected, (GFunc) g_free, NULL);
+ g_slist_free (selected);
+
e_source_set_color_spec (source, "#BECEDD");
*personal_source = source;
}
@@ -212,10 +222,10 @@ add_gw_esource (ESourceList *source_list, const gchar *group_name, const gchar
gboolean
e_memo_shell_backend_migrate (EShellBackend *shell_backend,
- gint major,
- gint minor,
- gint revision,
- GError **error)
+ gint major,
+ gint minor,
+ gint revision,
+ GError **error)
{
ESourceGroup *on_this_computer = NULL;
ESourceGroup *on_the_web = NULL;
diff --git a/modules/calendar/e-memo-shell-sidebar.c b/modules/calendar/e-memo-shell-sidebar.c
index 04292af..5bc5dfd 100644
--- a/modules/calendar/e-memo-shell-sidebar.c
+++ b/modules/calendar/e-memo-shell-sidebar.c
@@ -28,7 +28,6 @@
#include "e-util/e-alert-dialog.h"
#include "e-util/e-util.h"
#include "calendar/common/authentication.h"
-#include "calendar/gui/calendar-config.h"
#include "calendar/gui/e-memo-list-selector.h"
#include "calendar/gui/misc.h"
@@ -376,12 +375,19 @@ static void
memo_shell_sidebar_selection_changed_cb (EMemoShellSidebar *memo_shell_sidebar,
ESourceSelector *selector)
{
+ EShellView *shell_view;
+ EShellBackend *shell_backend;
+ EShellSidebar *shell_sidebar;
GSList *list, *iter;
/* This signal is emitted less frequently than "row-changed",
* especially when the model is being rebuilt. So we'll take
* it easy on poor GConf. */
+ shell_sidebar = E_SHELL_SIDEBAR (memo_shell_sidebar);
+ shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
+
list = e_source_selector_get_selection (selector);
for (iter = list; iter != NULL; iter = iter->next) {
@@ -391,7 +397,8 @@ memo_shell_sidebar_selection_changed_cb (EMemoShellSidebar *memo_shell_sidebar,
g_object_unref (source);
}
- calendar_config_set_memos_selected (list);
+ e_memo_shell_backend_set_selected_memo_lists (
+ E_MEMO_SHELL_BACKEND (shell_backend), list);
g_slist_free (list);
}
@@ -458,19 +465,19 @@ memo_shell_sidebar_restore_state_cb (EShellWindow *shell_window,
g_object_ref (source_list),
(GDestroyNotify) g_object_unref);
- list = calendar_config_get_memos_selected ();
+ list = e_memo_shell_backend_get_selected_memo_lists (
+ E_MEMO_SHELL_BACKEND (shell_backend));
+
for (iter = list; iter != NULL; iter = iter->next) {
- gchar *uid;
+ const gchar *uid = iter->data;
- uid = iter->data;
source = e_source_list_peek_source_by_uid (source_list, uid);
- g_free (uid);
- if (source == NULL)
- continue;
-
- e_source_selector_select_source (selector, source);
+ if (source != NULL)
+ e_source_selector_select_source (selector, source);
}
+
+ g_slist_foreach (list, (GFunc) g_free, NULL);
g_slist_free (list);
/* Listen for subsequent changes to the selector. */
diff --git a/modules/calendar/e-memo-shell-view-actions.c b/modules/calendar/e-memo-shell-view-actions.c
index bebeba1..a55eab1 100644
--- a/modules/calendar/e-memo-shell-view-actions.c
+++ b/modules/calendar/e-memo-shell-view-actions.c
@@ -447,12 +447,13 @@ action_memo_print_cb (GtkAction *action,
EMemoTable *memo_table;
ECalModelComponent *comp_data;
ECalComponent *comp;
+ ECalModel *model;
icalcomponent *clone;
- GtkPrintOperationAction print_action;
GSList *list;
memo_shell_content = memo_shell_view->priv->memo_shell_content;
memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
+ model = e_memo_table_get_model (memo_table);
list = e_memo_table_get_selected (memo_table);
g_return_if_fail (list != NULL);
@@ -462,9 +463,14 @@ action_memo_print_cb (GtkAction *action,
/* XXX We only print the first selected memo. */
comp = e_cal_component_new ();
clone = icalcomponent_new_clone (comp_data->icalcomp);
- print_action = GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG;
e_cal_component_set_icalcomponent (comp, clone);
- print_comp (comp, comp_data->client, print_action);
+
+ print_comp (
+ comp, comp_data->client,
+ e_cal_model_get_timezone (model),
+ e_cal_model_get_use_24_hour_format (model),
+ GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG);
+
g_object_unref (comp);
}
diff --git a/modules/calendar/e-memo-shell-view-private.c b/modules/calendar/e-memo-shell-view-private.c
index 4fe6a25..0880750 100644
--- a/modules/calendar/e-memo-shell-view-private.c
+++ b/modules/calendar/e-memo-shell-view-private.c
@@ -461,7 +461,5 @@ e_memo_shell_view_update_timezone (EMemoShellView *memo_shell_view)
e_cal_set_default_timezone (client, timezone, NULL);
}
- e_cal_component_preview_set_default_timezone (memo_preview, timezone);
-
g_list_free (clients);
}
diff --git a/modules/calendar/e-task-shell-backend.c b/modules/calendar/e-task-shell-backend.c
index be085af..6982d48 100644
--- a/modules/calendar/e-task-shell-backend.c
+++ b/modules/calendar/e-task-shell-backend.c
@@ -34,7 +34,6 @@
#include "shell/e-shell-window.h"
#include "calendar/common/authentication.h"
-#include "calendar/gui/calendar-config.h"
#include "calendar/gui/comp-util.h"
#include "calendar/gui/dialogs/calendar-setup.h"
#include "calendar/gui/dialogs/task-editor.h"
@@ -66,8 +65,9 @@ task_shell_backend_ensure_sources (EShellBackend *shell_backend)
/* XXX This is basically the same algorithm across all modules.
* Maybe we could somehow integrate this into EShellBackend? */
- ETaskShellBackendPrivate *priv;
+ ETaskShellBackend *task_shell_backend;
ESourceGroup *on_this_computer;
+ ESourceList *source_list;
ESource *personal;
EShell *shell;
EShellSettings *shell_settings;
@@ -78,20 +78,24 @@ task_shell_backend_ensure_sources (EShellBackend *shell_backend)
on_this_computer = NULL;
personal = NULL;
- priv = E_TASK_SHELL_BACKEND_GET_PRIVATE (shell_backend);
+ task_shell_backend = E_TASK_SHELL_BACKEND (shell_backend);
shell = e_shell_backend_get_shell (shell_backend);
shell_settings = e_shell_get_shell_settings (shell);
- if (!e_cal_get_sources (&priv->source_list, E_CAL_SOURCE_TYPE_TODO, NULL)) {
+ if (!e_cal_get_sources (
+ &task_shell_backend->priv->source_list,
+ E_CAL_SOURCE_TYPE_TODO, NULL)) {
g_warning ("Could not get task sources from GConf!");
return;
}
+ source_list = task_shell_backend->priv->source_list;
+
on_this_computer = e_source_list_ensure_group (
- priv->source_list, _("On This Computer"), "local:", TRUE);
+ source_list, _("On This Computer"), "local:", TRUE);
e_source_list_ensure_group (
- priv->source_list, _("On The Web"), "webcal://", FALSE);
+ source_list, _("On The Web"), "webcal://", FALSE);
g_return_if_fail (on_this_computer);
@@ -125,7 +129,8 @@ task_shell_backend_ensure_sources (EShellBackend *shell_backend)
primary = e_shell_settings_get_string (
shell_settings, "cal-primary-task-list");
- selected = calendar_config_get_tasks_selected ();
+ selected = e_task_shell_backend_get_selected_task_lists (
+ task_shell_backend);
if (primary == NULL && selected == NULL) {
const gchar *uid;
@@ -135,7 +140,8 @@ task_shell_backend_ensure_sources (EShellBackend *shell_backend)
e_shell_settings_set_string (
shell_settings, "cal-primary-task-list", uid);
- calendar_config_set_tasks_selected (selected);
+ e_task_shell_backend_set_selected_task_lists (
+ task_shell_backend, selected);
}
g_slist_foreach (selected, (GFunc) g_free, NULL);
@@ -149,7 +155,7 @@ task_shell_backend_ensure_sources (EShellBackend *shell_backend)
g_object_unref (on_this_computer);
if (save_list)
- e_source_list_sync (priv->source_list, NULL);
+ e_source_list_sync (source_list, NULL);
}
static void
@@ -598,3 +604,38 @@ e_task_shell_backend_get_source_list (ETaskShellBackend *task_shell_backend)
return task_shell_backend->priv->source_list;
}
+
+GSList *
+e_task_shell_backend_get_selected_task_lists (ETaskShellBackend *task_shell_backend)
+{
+ GConfClient *client;
+ GSList *selected_task_lists;
+ const gchar *key;
+
+ g_return_val_if_fail (
+ E_IS_TASK_SHELL_BACKEND (task_shell_backend), NULL);
+
+ client = gconf_client_get_default ();
+ key = "/apps/evolution/calendar/tasks/selected_tasks";
+ selected_task_lists = gconf_client_get_list (
+ client, key, GCONF_VALUE_STRING, NULL);
+ g_object_unref (client);
+
+ return selected_task_lists;
+}
+
+void
+e_task_shell_backend_set_selected_task_lists (ETaskShellBackend *task_shell_backend,
+ GSList *selected_task_lists)
+{
+ GConfClient *client;
+ const gchar *key;
+
+ g_return_if_fail (E_IS_TASK_SHELL_BACKEND (task_shell_backend));
+
+ client = gconf_client_get_default ();
+ key = "/apps/evolution/calendar/tasks/selected_tasks";
+ gconf_client_set_list (
+ client, key, GCONF_VALUE_STRING, selected_task_lists, NULL);
+ g_object_unref (client);
+}
diff --git a/modules/calendar/e-task-shell-backend.h b/modules/calendar/e-task-shell-backend.h
index 63b157a..ba56e91 100644
--- a/modules/calendar/e-task-shell-backend.h
+++ b/modules/calendar/e-task-shell-backend.h
@@ -64,6 +64,11 @@ void e_task_shell_backend_register_type
(GTypeModule *type_module);
ESourceList * e_task_shell_backend_get_source_list
(ETaskShellBackend *task_shell_backend);
+GSList * e_task_shell_backend_get_selected_task_lists
+ (ETaskShellBackend *task_shell_backend);
+void e_task_shell_backend_set_selected_task_lists
+ (ETaskShellBackend *task_shell_backend,
+ GSList *selected_task_lists);
G_END_DECLS
diff --git a/modules/calendar/e-task-shell-content.c b/modules/calendar/e-task-shell-content.c
index f0af66f..9cc9246 100644
--- a/modules/calendar/e-task-shell-content.c
+++ b/modules/calendar/e-task-shell-content.c
@@ -209,7 +209,9 @@ task_shell_content_cursor_change_cb (ETaskShellContent *task_shell_content,
e_cal_component_set_icalcomponent (
comp, icalcomponent_new_clone (comp_data->icalcomp));
e_cal_component_preview_display (
- task_preview, comp_data->client, comp);
+ task_preview, comp_data->client, comp,
+ e_cal_model_get_timezone (task_model),
+ e_cal_model_get_use_24_hour_format (task_model));
e_cal_component_get_uid (comp, &uid);
g_free (task_shell_content->priv->current_uid);
@@ -412,13 +414,11 @@ task_shell_content_constructed (GObject *object)
{
ETaskShellContentPrivate *priv;
EShell *shell;
- EShellSettings *shell_settings;
EShellContent *shell_content;
EShellTaskbar *shell_taskbar;
EShellWindow *shell_window;
EShellView *shell_view;
GalViewInstance *view_instance;
- icaltimezone *timezone;
GtkTargetList *target_list;
GtkTargetEntry *targets;
GtkWidget *container;
@@ -435,13 +435,9 @@ task_shell_content_constructed (GObject *object)
shell_taskbar = e_shell_view_get_shell_taskbar (shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
shell = e_shell_window_get_shell (shell_window);
- shell_settings = e_shell_get_shell_settings (shell);
priv->task_model = e_cal_model_tasks_new ();
- timezone = e_shell_settings_get_pointer (
- shell_settings, "cal-timezone");
-
/* Build content widgets. */
container = GTK_WIDGET (object);
@@ -477,8 +473,6 @@ task_shell_content_constructed (GObject *object)
container = priv->paned;
widget = e_cal_component_preview_new ();
- e_cal_component_preview_set_default_timezone (
- E_CAL_COMPONENT_PREVIEW (widget), timezone);
e_shell_configure_web_view (shell, E_WEB_VIEW (widget));
gtk_widget_show (widget);
diff --git a/modules/calendar/e-task-shell-migrate.c b/modules/calendar/e-task-shell-migrate.c
index 91da8f4..fbfedb0 100644
--- a/modules/calendar/e-task-shell-migrate.c
+++ b/modules/calendar/e-task-shell-migrate.c
@@ -38,19 +38,20 @@
#include <libedataserver/e-xml-utils.h>
#include "e-util/e-util-private.h"
-#include "calendar/gui/calendar-config.h"
#include "calendar/gui/calendar-config-keys.h"
#include "shell/e-shell.h"
+#include "e-task-shell-backend.h"
+
#define WEBCAL_BASE_URI "webcal://"
#define PERSONAL_RELATIVE_URI "system"
static void
create_task_sources (EShellBackend *shell_backend,
- ESourceList *source_list,
- ESourceGroup **on_this_computer,
- ESourceGroup **on_the_web,
- ESource **personal_source)
+ ESourceList *source_list,
+ ESourceGroup **on_this_computer,
+ ESourceGroup **on_the_web,
+ ESource **personal_source)
{
EShell *shell;
EShellSettings *shell_settings;
@@ -115,6 +116,7 @@ create_task_sources (EShellBackend *shell_backend,
}
if (!*personal_source) {
+ GSList *selected;
gchar *primary_task_list;
/* Create the default Person task list */
@@ -124,18 +126,26 @@ create_task_sources (EShellBackend *shell_backend,
primary_task_list = e_shell_settings_get_string (
shell_settings, "cal-primary-task-list");
- if (!primary_task_list && !calendar_config_get_tasks_selected ()) {
- GSList selected;
+ selected = e_task_shell_backend_get_selected_task_lists (
+ E_TASK_SHELL_BACKEND (shell_backend));
+
+ if (primary_task_list == NULL && selected == NULL) {
+ GSList link;
e_shell_settings_set_string (
shell_settings, "cal-primary-task-list",
e_source_peek_uid (source));
- selected.data = (gpointer)e_source_peek_uid (source);
- selected.next = NULL;
- calendar_config_set_tasks_selected (&selected);
+ link.data = (gpointer)e_source_peek_uid (source);
+ link.next = NULL;
+
+ e_task_shell_backend_set_selected_task_lists (
+ E_TASK_SHELL_BACKEND (shell_backend), &link);
}
+ g_slist_foreach (selected, (GFunc) g_free, NULL);
+ g_slist_free (selected);
+
e_source_set_color_spec (source, "#BECEDD");
*personal_source = source;
}
@@ -154,10 +164,10 @@ create_task_sources (EShellBackend *shell_backend,
gboolean
e_task_shell_backend_migrate (EShellBackend *shell_backend,
- gint major,
- gint minor,
- gint micro,
- GError **error)
+ gint major,
+ gint minor,
+ gint micro,
+ GError **error)
{
ESourceGroup *on_this_computer = NULL;
ESourceGroup *on_the_web = NULL;
diff --git a/modules/calendar/e-task-shell-sidebar.c b/modules/calendar/e-task-shell-sidebar.c
index 580cee2..52887fa 100644
--- a/modules/calendar/e-task-shell-sidebar.c
+++ b/modules/calendar/e-task-shell-sidebar.c
@@ -28,7 +28,6 @@
#include "e-util/e-alert-dialog.h"
#include "e-util/e-util.h"
#include "calendar/common/authentication.h"
-#include "calendar/gui/calendar-config.h"
#include "calendar/gui/e-task-list-selector.h"
#include "calendar/gui/misc.h"
@@ -376,12 +375,19 @@ static void
task_shell_sidebar_selection_changed_cb (ETaskShellSidebar *task_shell_sidebar,
ESourceSelector *selector)
{
+ EShellView *shell_view;
+ EShellBackend *shell_backend;
+ EShellSidebar *shell_sidebar;
GSList *list, *iter;
/* This signal is emitted less frequently than "row-changed",
* especially when the model is being rebuilt. So we'll take
* it easy on poor GConf. */
+ shell_sidebar = E_SHELL_SIDEBAR (task_shell_sidebar);
+ shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
+
list = e_source_selector_get_selection (selector);
for (iter = list; iter != NULL; iter = iter->next) {
@@ -391,7 +397,8 @@ task_shell_sidebar_selection_changed_cb (ETaskShellSidebar *task_shell_sidebar,
g_object_unref (source);
}
- calendar_config_set_tasks_selected (list);
+ e_task_shell_backend_set_selected_task_lists (
+ E_TASK_SHELL_BACKEND (shell_backend), list);
g_slist_free (list);
}
@@ -458,19 +465,19 @@ task_shell_sidebar_restore_state_cb (EShellWindow *shell_window,
g_object_ref (source_list),
(GDestroyNotify) g_object_unref);
- list = calendar_config_get_tasks_selected ();
+ list = e_task_shell_backend_get_selected_task_lists (
+ E_TASK_SHELL_BACKEND (shell_backend));
+
for (iter = list; iter != NULL; iter = iter->next) {
- gchar *uid;
+ const gchar *uid = iter->data;
- uid = iter->data;
source = e_source_list_peek_source_by_uid (source_list, uid);
- g_free (uid);
- if (source == NULL)
- continue;
-
- e_source_selector_select_source (selector, source);
+ if (source != NULL)
+ e_source_selector_select_source (selector, source);
}
+
+ g_slist_foreach (list, (GFunc) g_free, NULL);
g_slist_free (list);
/* Listen for subsequent changes to the selector. */
diff --git a/modules/calendar/e-task-shell-view-actions.c b/modules/calendar/e-task-shell-view-actions.c
index 8ab9082..d353124 100644
--- a/modules/calendar/e-task-shell-view-actions.c
+++ b/modules/calendar/e-task-shell-view-actions.c
@@ -513,13 +513,14 @@ action_task_print_cb (GtkAction *action,
ETaskShellContent *task_shell_content;
ECalModelComponent *comp_data;
ECalComponent *comp;
+ ECalModel *model;
ETaskTable *task_table;
icalcomponent *clone;
- GtkPrintOperationAction print_action;
GSList *list;
task_shell_content = task_shell_view->priv->task_shell_content;
task_table = e_task_shell_content_get_task_table (task_shell_content);
+ model = e_task_table_get_model (task_table);
list = e_task_table_get_selected (task_table);
g_return_if_fail (list != NULL);
@@ -529,9 +530,14 @@ action_task_print_cb (GtkAction *action,
/* XXX We only print the first selected task. */
comp = e_cal_component_new ();
clone = icalcomponent_new_clone (comp_data->icalcomp);
- print_action = GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG;
e_cal_component_set_icalcomponent (comp, clone);
- print_comp (comp, comp_data->client, print_action);
+
+ print_comp (
+ comp, comp_data->client,
+ e_cal_model_get_timezone (model),
+ e_cal_model_get_use_24_hour_format (model),
+ GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG);
+
g_object_unref (comp);
}
diff --git a/modules/calendar/e-task-shell-view-private.c b/modules/calendar/e-task-shell-view-private.c
index 9f833e9..83b0e94 100644
--- a/modules/calendar/e-task-shell-view-private.c
+++ b/modules/calendar/e-task-shell-view-private.c
@@ -612,7 +612,5 @@ e_task_shell_view_update_timezone (ETaskShellView *task_shell_view)
e_cal_set_default_timezone (client, timezone, NULL);
}
- e_cal_component_preview_set_default_timezone (task_preview, timezone);
-
g_list_free (clients);
}
diff --git a/modules/calendar/evolution-module-calendar.c b/modules/calendar/evolution-module-calendar.c
index b54f643..af972cf 100644
--- a/modules/calendar/evolution-module-calendar.c
+++ b/modules/calendar/evolution-module-calendar.c
@@ -40,12 +40,15 @@
#include "e-task-shell-view.h"
#include "e-cal-config-calendar-item.h"
+#include "e-cal-config-comp-editor.h"
#include "e-cal-config-date-edit.h"
#include "e-cal-config-meeting-store.h"
#include "e-cal-config-meeting-time-selector.h"
#include "e-cal-config-model.h"
#include "e-cal-config-view.h"
+#include "e-calendar-preferences.h"
+
/* Module Entry Points */
void e_module_load (GTypeModule *type_module);
void e_module_unload (GTypeModule *type_module);
@@ -76,11 +79,14 @@ e_module_load (GTypeModule *type_module)
e_task_shell_view_register_type (type_module);
e_cal_config_calendar_item_register_type (type_module);
+ e_cal_config_comp_editor_register_type (type_module);
e_cal_config_date_edit_register_type (type_module);
e_cal_config_meeting_store_register_type (type_module);
e_cal_config_meeting_time_selector_register_type (type_module);
e_cal_config_model_register_type (type_module);
e_cal_config_view_register_type (type_module);
+
+ e_calendar_preferences_type_register (type_module);
}
G_MODULE_EXPORT void
diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c
index 3630ec3..149d165 100644
--- a/plugins/itip-formatter/itip-formatter.c
+++ b/plugins/itip-formatter/itip-formatter.c
@@ -43,7 +43,6 @@
#include <libedataserver/e-account-list.h>
#include <e-util/e-alert-dialog.h>
#include <e-util/e-mktemp.h>
-#include <calendar/gui/calendar-config.h>
#include <calendar/gui/itip-utils.h>
#include <calendar/common/authentication.h>
#include <shell/e-shell.h>
@@ -542,10 +541,15 @@ static ECal *
start_calendar_server (struct _itip_puri *pitip, ESource *source, ECalSourceType type, FormatItipOpenFunc func, gpointer data)
{
ECal *ecal;
+ EShell *shell;
+ EShellSettings *shell_settings;
icaltimezone *zone = NULL;
g_return_val_if_fail (source != NULL, NULL);
+ shell = e_shell_get_default ();
+ shell_settings = e_shell_get_shell_settings (shell);
+
ecal = g_hash_table_lookup (pitip->ecals[type], e_source_peek_uid (source));
if (ecal) {
pitip->current_ecal = ecal;
@@ -567,7 +571,7 @@ start_calendar_server (struct _itip_puri *pitip, ESource *source, ECalSourceType
g_hash_table_insert (pitip->ecals[type], g_strdup (e_source_peek_uid (source)), ecal);
- zone = calendar_config_get_icaltimezone ();
+ zone = e_shell_settings_get_pointer (shell_settings, "cal-timezone");
e_cal_set_default_timezone (ecal, zone, NULL);
e_cal_open_async (ecal, TRUE);
@@ -1680,6 +1684,8 @@ set_itip_error (struct _itip_puri *pitip, GtkContainer *container, const gchar *
static gboolean
extract_itip_data (struct _itip_puri *pitip, GtkContainer *container, gboolean *have_alarms)
{
+ EShell *shell;
+ EShellSettings *shell_settings;
icalproperty *prop;
icalcomponent_kind kind = ICAL_NO_COMPONENT;
icalcomponent *tz_comp;
@@ -1687,6 +1693,10 @@ extract_itip_data (struct _itip_puri *pitip, GtkContainer *container, gboolean *
icalcomponent *alarm_comp;
icalcompiter alarm_iter;
ECalComponent *comp;
+ gboolean use_default_reminder;
+
+ shell = e_shell_get_default ();
+ shell_settings = e_shell_get_shell_settings (shell);
if (!pitip->vcalendar) {
set_itip_error (pitip, container,
@@ -1886,14 +1896,20 @@ extract_itip_data (struct _itip_puri *pitip, GtkContainer *container, gboolean *
};
/* Add default reminder if the config says so */
- if (calendar_config_get_use_default_reminder ()) {
+
+ use_default_reminder = e_shell_settings_get_boolean (
+ shell_settings, "cal-use-default-reminder");
+
+ if (use_default_reminder) {
ECalComponentAlarm *acomp;
gint interval;
EDurationType units;
ECalComponentAlarmTrigger trigger;
- interval = calendar_config_get_default_reminder_interval ();
- units = calendar_config_get_default_reminder_units ();
+ interval = e_shell_settings_get_int (
+ shell_settings, "cal-default-reminder-interval");
+ units = e_shell_settings_get_int (
+ shell_settings, "cal-default-reminder-units");
acomp = e_cal_component_alarm_new ();
@@ -2286,6 +2302,8 @@ in_proper_folder (CamelFolder *folder)
static gboolean
format_itip_object (EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject *pobject)
{
+ EShell *shell;
+ EShellSettings *shell_settings;
struct _itip_puri *info;
ECalComponentText text;
ECalComponentOrganizer organizer;
@@ -2299,6 +2317,9 @@ format_itip_object (EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject
gboolean response_enabled;
gboolean have_alarms = FALSE;
+ shell = e_shell_get_default ();
+ shell_settings = e_shell_get_shell_settings (shell);
+
info = (struct _itip_puri *) em_format_find_puri ((EMFormat *)efh, pobject->classid);
/* Accounts */
@@ -2498,7 +2519,7 @@ format_itip_object (EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject
g_string_free (gstring, TRUE);
}
- to_zone = calendar_config_get_icaltimezone ();
+ to_zone = e_shell_settings_get_pointer (shell_settings, "cal-timezone");
e_cal_component_get_dtstart (info->comp, &datetime);
info->start_time = 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]