From 1f17dab6b0d9c5413dea38dcc95e7a7bb5b4bd9b Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 2 Nov 2010 11:49:38 -0400 Subject: Move calendar preferences to the calendar module. Continue replacing the use of calendar-config functions with GObject property bindings to EShellSettings properties. --- modules/calendar/Makefile.am | 39 + .../calendar/apps_evolution_calendar.schemas.in | 834 ++++++++++++ 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 +- modules/calendar/e-calendar-preferences.c | 905 ++++++++++++ modules/calendar/e-calendar-preferences.h | 89 ++ modules/calendar/e-calendar-preferences.ui | 1440 ++++++++++++++++++++ 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 + 33 files changed, 3962 insertions(+), 169 deletions(-) create mode 100644 modules/calendar/apps_evolution_calendar.schemas.in create mode 100644 modules/calendar/e-cal-config-comp-editor.c create mode 100644 modules/calendar/e-cal-config-comp-editor.h create mode 100644 modules/calendar/e-calendar-preferences.c create mode 100644 modules/calendar/e-calendar-preferences.h create mode 100644 modules/calendar/e-calendar-preferences.ui (limited to 'modules/calendar') diff --git a/modules/calendar/Makefile.am b/modules/calendar/Makefile.am index 0beb1285fa..c725dedb1c 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/modules/calendar/apps_evolution_calendar.schemas.in b/modules/calendar/apps_evolution_calendar.schemas.in new file mode 100644 index 0000000000..5f946d12ef --- /dev/null +++ b/modules/calendar/apps_evolution_calendar.schemas.in @@ -0,0 +1,834 @@ + + + + + + + /schemas/apps/evolution/calendar/display/primary_calendar + /apps/evolution/calendar/display/primary_calendar + evolution-calendar + string + + Primary calendar + + The UID of the selected (or "primary") calendar in the + sidebar of the "Calendar" view. + + + + + + /schemas/apps/evolution/calendar/display/timezone + /apps/evolution/calendar/display/timezone + evolution-calendar + string + UTC + + Timezone + The default timezone to use for dates and times in the calendar, as an untranslated Olsen timezone database location like "America/New York". + + + + + /schemas/apps/evolution/calendar/display/use_system_timezone + /apps/evolution/calendar/display/use_system_timezone + evolution-calendar + bool + true + + Use system timezone + Use the system timezone instead of the timezone selected + in Evolution. + + + + + /schemas/apps/evolution/calendar/display/day_second_zone + /apps/evolution/calendar/display/day_second_zone + evolution-calendar + string + + + The second timezone for a Day View + Shows the second time zone in a Day View, if set. Value is similar to one used in a 'timezone' key. + + + + + /schemas/apps/evolution/calendar/display/day_second_zones + /apps/evolution/calendar/display/day_second_zones + evolution-calendar + list + string + [] + + Recently used second time zones in a Day View + List of recently used second time zones in a Day View. + + + + + /schemas/apps/evolution/calendar/display/day_second_zones_max + /apps/evolution/calendar/display/day_second_zones_max + evolution-calendar + int + 5 + + Maximum number of recently used timezones to remember. + Maximum number of recently used timezones to remember in a 'day_second_zones' list. + + + + + /schemas/apps/evolution/calendar/display/use_24hour_format + /apps/evolution/calendar/display/use_24hour_format + evolution-calendar + bool + false + + Twenty four hour time format + Whether to show times in twenty four hour format instead of using am/pm. + + + + + /schemas/apps/evolution/calendar/display/show_role + /apps/evolution/calendar/display/show_role + evolution-calendar + bool + true + + Show Role field in the event/task/meeting editor + Whether to show role field in the event/task/meeting editor + + + + + /schemas/apps/evolution/calendar/display/show_status + /apps/evolution/calendar/display/show_status + evolution-calendar + bool + false + + Show status field in the event/task/meeting editor + Whether to show status field in the event/task/meeting editor + + + + + /schemas/apps/evolution/calendar/display/show_type + /apps/evolution/calendar/display/show_type + evolution-calendar + bool + false + + Show type field in the event/task/meeting editor + Whether to show type field in the event/task/meeting editor + + + + + /schemas/apps/evolution/calendar/display/show_rsvp + /apps/evolution/calendar/display/show_rsvp + evolution-calendar + bool + false + + Show RSVP field in the event/task/meeting editor + Whether to show RSVP field in the event/task/meeting editor + + + + + /schemas/apps/evolution/calendar/display/show_timezone + /apps/evolution/calendar/display/show_timezone + evolution-calendar + bool + false + + Show timezone field in the event/meeting editor + Whether to show timezone field in the event/meeting editor + + + + + /schemas/apps/evolution/calendar/display/show_categories + /apps/evolution/calendar/display/show_categories + evolution-calendar + bool + false + + Show categories field in the event/meeting/task editor + Whether to show categories field in the event/meeting editor + + + + + /schemas/apps/evolution/calendar/display/week_start_day + /apps/evolution/calendar/display/week_start_day + evolution-calendar + int + 1 + + Week start + Weekday the week starts on, from Sunday (0) to Saturday (6). + + + + + /schemas/apps/evolution/calendar/display/day_start_hour + /apps/evolution/calendar/display/day_start_hour + evolution-calendar + int + 9 + + Workday start hour + Hour the workday starts on, in twenty four hour format, 0 to 23. + + + + + /schemas/apps/evolution/calendar/display/day_start_minute + /apps/evolution/calendar/display/day_start_minute + evolution-calendar + int + 0 + + Workday start minute + Minute the workday starts on, 0 to 59. + + + + + /schemas/apps/evolution/calendar/display/day_end_hour + /apps/evolution/calendar/display/day_end_hour + evolution-calendar + int + 17 + + Workday end hour + Hour the workday ends on, in twenty four hour format, 0 to 23. + + + + + /schemas/apps/evolution/calendar/display/day_end_minute + /apps/evolution/calendar/display/day_end_minute + evolution-calendar + int + 0 + + Workday end minute + Minute the workday ends on, 0 to 59. + + + + + /schemas/apps/evolution/calendar/display/time_divisions + /apps/evolution/calendar/display/time_divisions + evolution-calendar + int + 30 + + Time divisions + Intervals shown in Day and Work Week views, in minutes. + + + + + /schemas/apps/evolution/calendar/display/hpane_position + /apps/evolution/calendar/display/hpane_position + evolution-calendar + int + 400 + + Horizontal pane position + Position of the horizontal pane, between the date navigator calendar and the task list when not in the month view, in pixels. + + + + + /schemas/apps/evolution/calendar/display/vpane_position + /apps/evolution/calendar/display/vpane_position + evolution-calendar + int + 150 + + Vertical pane position + Position of the vertical pane, between the view and the date navigator calendar and task list when not in the month view, in pixels. + + + + + /schemas/apps/evolution/calendar/display/month_hpane_position + /apps/evolution/calendar/display/month_hpane_position + evolution-calendar + int + 32000 + + Month view horizontal pane position + Position of the horizontal pane, between the view and the date navigator calendar and task list in the month view, in pixels. + + + + + /schemas/apps/evolution/calendar/display/month_vpane_position + /apps/evolution/calendar/display/month_vpane_position + evolution-calendar + int + 150 + + Month view vertical pane position + Position of the vertical pane, between the view and the date navigator calendar and task list in the month view, in pixels. + + + + /schemas/apps/evolution/calendar/display/date_navigator_pane_position + /apps/evolution/calendar/display/date_navigator_pane_position + evolution-calendar + int + 150 + + Month view vertical pane position + Position of the vertical pane, between the calendar lists and the date navigator calendar. + + + + + /schemas/apps/evolution/calendar/display/memo_layout + /apps/evolution/calendar/display/memo_layout + int + 0 + + Memo layout style + + The layout style determines where to place the preview pane + in relation to the memo list. "0" (Classic View) places the + preview pane below the memo list. "1" (Vertical View) places + the preview pane next to the memo list. + + + + + + /schemas/apps/evolution/calendar/display/show_memo_preview + /apps/evolution/calendar/display/show_memo_preview + evolution-calendar + bool + true + + Show the memo preview pane + + If "true", show the memo preview pane in the main window. + + + + + + /schemas/apps/evolution/calendar/display/memo_hpane_position + /apps/evolution/calendar/display/memo_hpane_position + evolution-calendar + int + 200 + + Memo preview pane position (horizontal) + + Position of the task preview pane when oriented horizontally. + + + + + + /schemas/apps/evolution/calendar/display/memo_vpane_position + /apps/evolution/calendar/display/memo_vpane_position + evolution-calendar + int + 400 + + Memo preview pane position (vertical) + + Position of the memo preview pane when oriented vertically. + + + + + + /schemas/apps/evolution/calendar/display/task_layout + /apps/evolution/calendar/display/task_layout + int + 0 + + Task layout style + + The layout style determines where to place the preview pane + in relation to the task list. "0" (Classic View) places the + preview pane below the task list. "1" (Vertical View) places + the preview pane next to the task list. + + + + + + /schemas/apps/evolution/calendar/display/show_task_preview + /apps/evolution/calendar/display/show_task_preview + evolution-calendar + bool + true + + Show the task preview pane + + If "true", show the task preview pane in the main window. + + + + + + /schemas/apps/evolution/calendar/display/task_hpane_position + /apps/evolution/calendar/display/task_hpane_position + evolution-calendar + int + 200 + + Task preview pane position (horizontal) + + Position of the task preview pane when oriented horizontally. + + + + + + /schemas/apps/evolution/calendar/display/task_vpane_position + /apps/evolution/calendar/display/task_vpane_position + evolution-calendar + int + 400 + + Task preview pane position (vertical) + + Position of the task preview pane when oriented vertically. + + + + + + /schemas/apps/evolution/calendar/display/compress_weekend + /apps/evolution/calendar/display/compress_weekend + evolution-calendar + bool + true + + Compress weekends in month view + Whether to compress weekends in the month view, which puts Saturday and Sunday in the space of one weekday. + + + + + /schemas/apps/evolution/calendar/display/show_event_end + /apps/evolution/calendar/display/show_event_end + evolution-calendar + bool + true + + Show appointment end times in week and month views + Whether to display the end time of events in the week and month views. + + + + + /schemas/apps/evolution/calendar/display/working_days + /apps/evolution/calendar/display/working_days + evolution-calendar + int + 62 + + Work days + Days on which the start and end of work hours should be indicated. + + + + + /schemas/apps/evolution/calendar/display/marcus_bains_line + /apps/evolution/calendar/display/marcus_bains_line + evolution-calendar + bool + true + + Marcus Bains Line + Whether to draw the Marcus Bains Line (line at current time) in the calendar. + + + + + /schemas/apps/evolution/calendar/display/marcus_bains_color_dayview + /apps/evolution/calendar/display/marcus_bains_color_dayview + evolution-calendar + string + #ff0000 + + Marcus Bains Line Color - Day View + Color to draw the Marcus Bains line in the Day View. + + + + + /schemas/apps/evolution/calendar/display/marcus_bains_color_timebar + /apps/evolution/calendar/display/marcus_bains_color_timebar + evolution-calendar + string + #ff0000 + + Marcus Bains Line Color - Time bar + Color to draw the Marcus Bains Line in the Time bar (empty for default). + + + + + /schemas/apps/evolution/calendar/display/recur_events_italic + /apps/evolution/calendar/display/recur_events_italic + evolution-calendar + bool + false + + Recurrent Events in Italic + Show days with recurrent events in italic font in bottom left calendar. + + + + + + + /schemas/apps/evolution/calendar/memos/primary_memos + /apps/evolution/calendar/memos/primary_memos + evolution-calendar + string + + Primary memo list + + The UID of the selected (or "primary") memo list in the + sidebar of the "Memos" view. + + + + + + + + /schemas/apps/evolution/calendar/tasks/primary_tasks + /apps/evolution/calendar/tasks/primary_tasks + evolution-calendar + string + + Primary task list + + The UID of the selected (or "primary") task list in the + sidebar of the "Tasks" view. + + + + + + /schemas/apps/evolution/calendar/tasks/hide_completed + /apps/evolution/calendar/tasks/hide_completed + evolution-calendar + bool + false + + Hide completed tasks + Whether to hide completed tasks in the tasks view. + + + + + /schemas/apps/evolution/calendar/tasks/hide_completed_units + /apps/evolution/calendar/tasks/hide_completed_units + evolution-calendar + string + days + + Hide task units + Units for determining when to hide tasks, "minutes", "hours" or "days". + + + + + /schemas/apps/evolution/calendar/tasks/hide_completed_value + /apps/evolution/calendar/tasks/hide_completed_value + evolution-calendar + int + 1 + + Hide task value + Number of units for determining when to hide tasks. + + + + + + + /schemas/apps/evolution/calendar/tasks/colors/due_today + /apps/evolution/calendar/tasks/colors/due_today + evolution-calendar + string + #1e90ff + + Tasks due today color + Background color of tasks that are due today, in "#rrggbb" format. + + + + + /schemas/apps/evolution/calendar/tasks/colors/overdue + /apps/evolution/calendar/tasks/colors/overdue + evolution-calendar + string + #ff0000 + + Overdue tasks color + Background color of tasks that are overdue, in "#rrggbb" format. + + + + + + + /schemas/apps/evolution/calendar/prompts/confirm_delete + /apps/evolution/calendar/prompts/confirm_delete + evolution-calendar + bool + true + + Ask for confirmation when deleting items + Whether to ask for confirmation when deleting an appointment or task. + + + + + /schemas/apps/evolution/calendar/prompts/confirm_purge + /apps/evolution/calendar/prompts/confirm_purge + evolution-calendar + bool + true + + Confirm expunge + Whether to ask for confirmation when expunging appointments and tasks. + + + + + /schemas/apps/evolution/calendar/other/use_default_reminder + /apps/evolution/calendar/other/use_default_reminder + evolution-calendar + bool + false + + Default appointment reminder + Whether to set a default reminder for appointments. + + + + + /schemas/apps/evolution/calendar/other/default_reminder_interval + /apps/evolution/calendar/other/default_reminder_interval + evolution-calendar + int + 15 + + Default reminder value + Number of units for determining a default reminder. + + + + + /schemas/apps/evolution/calendar/other/default_reminder_units + /apps/evolution/calendar/other/default_reminder_units + evolution-calendar + string + minutes + + Default reminder units + Units for a default reminder, "minutes", "hours" or "days". + + + + + /schemas/apps/evolution/calendar/other/use_ba_reminder + /apps/evolution/calendar/other/use_ba_reminder + evolution-calendar + bool + false + + Birthday and anniversary reminder + + Whether to set a reminder for birthdays and anniversaries. + + + + + + /schemas/apps/evolution/calendar/other/ba_reminder_interval + /apps/evolution/calendar/other/ba_reminder_interval + evolution-calendar + int + 15 + + Birthday and anniversary reminder value + + Number of units for determining a birthday or anniversary reminder. + + + + + + /schemas/apps/evolution/calendar/other/ba_reminder_units + /apps/evolution/calendar/other/ba_reminder_units + evolution-calendar + string + minutes + + Birthday and anniversary reminder units + + Units for a birthday or anniversary reminder, "minutes", "hours" + or "days". + + + + + + /schemas/apps/evolution/calendar/display/show_week_numbers + /apps/evolution/calendar/display/show_week_numbers + evolution-calendar + bool + false + + Show week numbers in Day View, Work Week View, and Date Navigator + Whether to show week numbers in various places in the Calendar. + + + + + /schemas/apps/evolution/calendar/display/month_scroll_by_week + /apps/evolution/calendar/display/month_scroll_by_week + evolution-calendar + bool + true + + Scroll Month View by a week + Whether to scroll a Month View by a week, not by a month. + + + + + + + /schemas/apps/evolution/calendar/notify/last_notification_time + /apps/evolution/calendar/notify/last_notification_time + evolution-calendar + int + -1 + + Last alarm time + Time the last alarm ran, in time_t. + + + + + /schemas/apps/evolution/calendar/notify/calendars + /apps/evolution/calendar/notify/calendars + evolution-calendar + list + string + [] + + Calendars to run alarms for + + + + + /schemas/apps/evolution/calendar/notify/programs + /apps/evolution/calendar/notify/programs + evolution-calendar + list + string + [] + + Alarm programs + Programs that are allowed to be run by alarms. + + + + + /schemas/apps/evolution/calendar/notify/notify_with_tray + /apps/evolution/calendar/notify/notify_with_tray + evolution-calendar + bool + false + + Show display alarms in notification tray + Whether or not to use the notification tray for display alarms. + + + + + /schemas/apps/evolution/calendar/publish/uris + /apps/evolution/calendar/publish/uris + evolution-calendar + list + string + [] + + Free/busy server URLs + List of server URLs for free/busy publishing. + + + + + /schemas/apps/evolution/calendar/publish/template + /apps/evolution/calendar/publish/template + evolution-calendar + string + + Free/busy template URL + The URL template to use as a free/busy data fallback, %u is replaced by the user part of the mail address and %d is replaced by the domain. + + + + + /schemas/apps/evolution/calendar/audio_dir + /apps/evolution/calendar/audio_dir + evolution-calendar + string + + Save directory for alarm audio + + Directory for saving alarm audio files + + + + + + /schemas/apps/evolution/calendar/display/error_timeout + /apps/evolution/calendar/display/error_timeout + evolution-calendar + int + 60 + + Amount of time in seconds the error should be shown on the status bar. + Amount of time in seconds the error should be shown on the status bar. + + + + + /schemas/apps/evolution/calendar/display/error_level + /apps/evolution/calendar/display/error_level + evolution-calendar + int + 0 + + Level beyond which the message should be logged. + This can have three possible values. 0 for errors. 1 for warnings. + 2 for debug messages. + + + + + 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 0000000000..327bcd4518 --- /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 + * + */ + +#include "e-cal-config-comp-editor.h" + +#include +#include +#include + +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 0000000000..124547a4dd --- /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 + * + */ + +#ifndef E_CAL_CONFIG_COMP_EDITOR_H +#define E_CAL_CONFIG_COMP_EDITOR_H + +#include + +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 72f103bbec..f9babc53bf 100644 --- a/modules/calendar/e-cal-config-meeting-store.c +++ b/modules/calendar/e-cal-config-meeting-store.c @@ -36,6 +36,16 @@ cal_config_meeting_store_constructed (GObject *object) shell = e_shell_get_default (); 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", @@ -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 62ff9b57b6..9dd5ee9b8d 100644 --- a/modules/calendar/e-cal-config-model.c +++ b/modules/calendar/e-cal-config-model.c @@ -39,6 +39,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", @@ -49,11 +69,36 @@ cal_config_model_constructed (GObject *object) extensible, "use-24-hour-format", 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 c1630223eb..e2f769c501 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)) { @@ -61,31 +67,6 @@ cal_config_view_constructed (GObject *object) extensible, "marcus-bains-time-bar-color", 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", diff --git a/modules/calendar/e-cal-shell-backend.c b/modules/calendar/e-cal-shell-backend.c index 749dd7ec19..fa4c2db0de 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 4b19275b79..32fca7f53b 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 c1a7221597..d25228d98f 100644 --- a/modules/calendar/e-cal-shell-migrate.c +++ b/modules/calendar/e-cal-shell-migrate.c @@ -37,11 +37,12 @@ #include #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 524157c5a9..30fc1c4fa7 100644 --- a/modules/calendar/e-cal-shell-settings.c +++ b/modules/calendar/e-cal-shell-settings.c @@ -24,6 +24,9 @@ #include #include +#include +#include + static gboolean transform_string_to_icaltimezone (GBinding *binding, const GValue *source_value, @@ -494,6 +497,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 ( @@ -538,6 +557,10 @@ e_cal_shell_backend_init_settings (EShell *shell) "cal-marcus-bains-show-line", "/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"); @@ -558,6 +581,10 @@ e_cal_shell_backend_init_settings (EShell *shell) "cal-show-event-end-times", "/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"); @@ -579,6 +606,14 @@ e_cal_shell_backend_init_settings (EShell *shell) "cal-use-24-hour-format", "/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"); @@ -615,6 +650,60 @@ e_cal_shell_backend_init_settings (EShell *shell) * is backward-compatibility cruft for poorly designed * 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", diff --git a/modules/calendar/e-cal-shell-sidebar.c b/modules/calendar/e-cal-shell-sidebar.c index 66a1102cb7..1e291989cf 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 bce4fc4266..7b9d88fc73 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 11e1bcd3dc..c4b67a88f4 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 6dae14465d..ead28ae351 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/modules/calendar/e-calendar-preferences.c b/modules/calendar/e-calendar-preferences.c new file mode 100644 index 0000000000..9db9f4538b --- /dev/null +++ b/modules/calendar/e-calendar-preferences.c @@ -0,0 +1,905 @@ +/* + * 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 + * + * + * Authors: + * Damon Chaplin + * Ettore Perazzoli + * David Trowbridge + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * + */ + +#include "e-calendar-preferences.h" + +#include +#include +#include + +#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" + +/* same is used for Birthdays & Anniversaries calendar */ +static const gint default_reminder_units_map[] = { + E_DURATION_MINUTES, E_DURATION_HOURS, E_DURATION_DAYS, -1 +}; + +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_preferences_dispose (GObject *object) +{ + ECalendarPreferences *prefs = (ECalendarPreferences *) object; + + if (prefs->builder != NULL) { + g_object_unref (prefs->builder); + prefs->builder = NULL; + } + + if (prefs->shell_settings != NULL) { + g_object_unref (prefs->shell_settings); + prefs->shell_settings = NULL; + } + + /* Chain up to parent's dispose() method. */ + G_OBJECT_CLASS (e_calendar_preferences_parent_class)->dispose (object); +} + +static void +e_calendar_preferences_class_init (ECalendarPreferencesClass *class) +{ + GObjectClass *object_class; + + object_class = G_OBJECT_CLASS (class); + object_class->dispose = calendar_preferences_dispose; +} + +static void +e_calendar_preferences_class_finalize (ECalendarPreferencesClass *class) +{ +} + +static void +e_calendar_preferences_init (ECalendarPreferences *preferences) +{ +} + +static GtkWidget * +calendar_preferences_get_config_widget (EConfig *ec, + EConfigItem *item, + GtkWidget *parent, + GtkWidget *old, + gpointer data) +{ + ECalendarPreferences *preferences = data; + + return e_builder_get_widget (preferences->builder, item->label); +} + +static void +update_day_second_zone_caption (ECalendarPreferences *prefs) +{ + gchar *location; + const gchar *caption; + icaltimezone *zone; + + g_return_if_fail (prefs != NULL); + + /* Translators: "None" indicates no second time zone set for a day view */ + caption = C_("cal-second-zone", "None"); + + location = calendar_config_get_day_second_zone (); + if (location && *location) { + zone = icaltimezone_get_builtin_timezone (location); + if (zone && icaltimezone_get_display_name (zone)) { + caption = icaltimezone_get_display_name (zone); + } + } + g_free (location); + + gtk_button_set_label (GTK_BUTTON (prefs->day_second_zone), caption); +} + +static void +on_set_day_second_zone (GtkWidget *item, ECalendarPreferences *prefs) +{ + if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (item))) + return; + + calendar_config_set_day_second_zone (g_object_get_data (G_OBJECT (item), "timezone")); + update_day_second_zone_caption (prefs); +} + +static void +on_select_day_second_zone (GtkWidget *item, ECalendarPreferences *prefs) +{ + g_return_if_fail (prefs != NULL); + + calendar_config_select_day_second_zone (); + update_day_second_zone_caption (prefs); +} + +static void +day_second_zone_clicked (GtkWidget *widget, ECalendarPreferences *prefs) +{ + GtkWidget *menu, *item; + GSList *group = NULL, *recent_zones, *s; + gchar *location; + icaltimezone *zone, *second_zone = NULL; + + menu = gtk_menu_new (); + + location = calendar_config_get_day_second_zone (); + if (location && *location) + second_zone = icaltimezone_get_builtin_timezone (location); + g_free (location); + + group = NULL; + item = gtk_radio_menu_item_new_with_label (group, C_("cal-second-zone", "None")); + group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (item)); + if (!second_zone) + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), TRUE); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + g_signal_connect (item, "toggled", G_CALLBACK (on_set_day_second_zone), prefs); + + recent_zones = calendar_config_get_day_second_zones (); + for (s = recent_zones; s != NULL; s = s->next) { + zone = icaltimezone_get_builtin_timezone (s->data); + if (!zone) + continue; + + item = gtk_radio_menu_item_new_with_label (group, icaltimezone_get_display_name (zone)); + group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (item)); + /* both comes from builtin, thus no problem to compare pointers */ + if (zone == second_zone) + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), TRUE); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + g_object_set_data_full (G_OBJECT (item), "timezone", g_strdup (s->data), g_free); + g_signal_connect (item, "toggled", G_CALLBACK (on_set_day_second_zone), prefs); + } + calendar_config_free_day_second_zones (recent_zones); + + item = gtk_separator_menu_item_new (); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + + item = gtk_menu_item_new_with_label (_("Select...")); + g_signal_connect (item, "activate", G_CALLBACK (on_select_day_second_zone), prefs); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + + gtk_widget_show_all (menu); + + gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, + 0, gtk_get_current_event_time ()); +} + +static void +start_of_day_changed (GtkWidget *widget, ECalendarPreferences *prefs) +{ + gint start_hour, start_minute, end_hour, end_minute; + EDateEdit *start, *end; + + start = E_DATE_EDIT (prefs->start_of_day); + end = E_DATE_EDIT (prefs->end_of_day); + + e_date_edit_get_time_of_day (start, &start_hour, &start_minute); + e_date_edit_get_time_of_day (end, &end_hour, &end_minute); + + if ((start_hour > end_hour) || (start_hour == end_hour && start_minute > end_minute)) { + if (start_hour < 23) + e_date_edit_set_time_of_day (end, start_hour + 1, start_minute); + else + e_date_edit_set_time_of_day (end, 23, 59); + + return; + } + + 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, ECalendarPreferences *prefs) +{ + gint start_hour, start_minute, end_hour, end_minute; + EDateEdit *start, *end; + + start = E_DATE_EDIT (prefs->start_of_day); + end = E_DATE_EDIT (prefs->end_of_day); + + e_date_edit_get_time_of_day (start, &start_hour, &start_minute); + e_date_edit_get_time_of_day (end, &end_hour, &end_minute); + + if ((end_hour < start_hour) || (end_hour == start_hour && end_minute < start_minute)) { + if (end_hour < 1) + e_date_edit_set_time_of_day (start, 0, 0); + else + e_date_edit_set_time_of_day (start, end_hour - 1, end_minute); + + return; + } + + 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 +notify_with_tray_toggled (GtkToggleButton *toggle, ECalendarPreferences *prefs) +{ + GConfClient *gconf; + + g_return_if_fail (toggle != NULL); + + gconf = gconf_client_get_default (); + gconf_client_set_bool (gconf, "/apps/evolution/calendar/notify/notify_with_tray", gtk_toggle_button_get_active (toggle), NULL); + g_object_unref (gconf); +} + +static void +alarms_selection_changed (ESourceSelector *selector, ECalendarPreferences *prefs) +{ + ESourceList *source_list = prefs->alarms_list; + GSList *selection; + GSList *l; + GSList *groups; + ESource *source; + const gchar *alarm; + + /* first we clear all the alarm flags from all sources */ + for (groups = e_source_list_peek_groups (source_list); groups; groups = groups->next) { + ESourceGroup *group = E_SOURCE_GROUP (groups->data); + GSList *sources; + for (sources = e_source_group_peek_sources (group); sources; sources = sources->next) { + source = E_SOURCE (sources->data); + + alarm = e_source_get_property (source, "alarm"); + if (alarm && !g_ascii_strcasecmp (alarm, "never")) + continue; + + e_source_set_property (source, "alarm", "false"); + } + } + + /* then we loop over the selector's selection, setting the + property on those sources */ + selection = e_source_selector_get_selection (selector); + for (l = selection; l; l = l->next) { + source = E_SOURCE (l->data); + + alarm = (gchar *)e_source_get_property (source, "alarm"); + if (alarm && !g_ascii_strcasecmp (alarm, "never")) + continue; + + e_source_set_property (E_SOURCE (l->data), "alarm", "true"); + } + e_source_selector_free_selection (selection); + + /* FIXME show an error if this fails? */ + e_source_list_sync (source_list, NULL); +} + +static void +update_system_tz_widgets (EShellSettings *shell_settings, + GParamSpec *pspec, + ECalendarPreferences *prefs) +{ + GtkWidget *widget; + icaltimezone *zone; + const gchar *display_name; + gchar *text; + + widget = e_builder_get_widget (prefs->builder, "system-tz-label"); + g_return_if_fail (GTK_IS_LABEL (widget)); + + zone = e_cal_util_get_system_timezone (); + if (zone != NULL) + display_name = gettext (icaltimezone_get_display_name (zone)); + else + display_name = "UTC"; + + text = g_strdup_printf ("(%s)", display_name); + gtk_label_set_text (GTK_LABEL (widget), text); + g_free (text); +} + +static void +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->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); +} + +static void +initialize_selection (ESourceSelector *selector, ESourceList *source_list) +{ + GSList *groups; + + for (groups = e_source_list_peek_groups (source_list); groups; groups = groups->next) { + ESourceGroup *group = E_SOURCE_GROUP (groups->data); + GSList *sources; + for (sources = e_source_group_peek_sources (group); sources; sources = sources->next) { + ESource *source = E_SOURCE (sources->data); + const gchar *completion = e_source_get_property (source, "alarm"); + if (!completion || !g_ascii_strcasecmp (completion, "true")) { + if (!completion) + e_source_set_property (E_SOURCE (source), "alarm", "true"); + e_source_selector_select_source (selector, source); + } + } + } +} + +static void +show_alarms_config (ECalendarPreferences *prefs) +{ + GConfClient *gconf; + + if (e_cal_get_sources (&prefs->alarms_list, E_CAL_SOURCE_TYPE_EVENT, NULL)) { + prefs->alarm_list_widget = e_source_selector_new (prefs->alarms_list); + atk_object_set_name (gtk_widget_get_accessible (prefs->alarm_list_widget), _("Selected Calendars for Alarms")); + gtk_container_add (GTK_CONTAINER (prefs->scrolled_window), prefs->alarm_list_widget); + gtk_widget_show (prefs->alarm_list_widget); + initialize_selection (E_SOURCE_SELECTOR (prefs->alarm_list_widget), prefs->alarms_list); + } + + gconf = gconf_client_get_default (); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (prefs->notify_with_tray), gconf_client_get_bool (gconf, "/apps/evolution/calendar/notify/notify_with_tray", NULL)); + g_object_unref (gconf); +} + +/* Shows the current config settings in the dialog. */ +static void +show_config (ECalendarPreferences *prefs) +{ + EShellSettings *shell_settings; + + 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), + 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), + 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); +} + +/* plugin meta-data */ +static ECalConfigItem eccp_items[] = { + { 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 +eccp_free (EConfig *ec, GSList *items, gpointer data) +{ + g_slist_free (items); +} + +static void +calendar_preferences_construct (ECalendarPreferences *prefs, + EShell *shell) +{ + ECalConfig *ec; + ECalConfigTargetPrefs *target; + EShellSettings *shell_settings; + gboolean locale_supports_12_hour_format; + gint i; + GtkWidget *toplevel; + GtkWidget *widget; + GtkWidget *table; + GSList *l; + + shell_settings = prefs->shell_settings; + + locale_supports_12_hour_format = + calendar_config_locale_supports_12_hour_format (); + + /* Force 24 hour format for locales which don't support 12 hour format */ + if (!locale_supports_12_hour_format + && !e_shell_settings_get_boolean (shell_settings, "cal-use-24-hour-format")) + e_shell_settings_set_boolean (shell_settings, "cal-use-24-hour-format", TRUE); + + /* Make sure our custom widget classes are registered with + * GType before we load the GtkBuilder definition file. */ + E_TYPE_DATE_EDIT; + E_TYPE_TIMEZONE_ENTRY; + + prefs->builder = gtk_builder_new (); + e_load_ui_builder_definition (prefs->builder, "e-calendar-preferences.ui"); + + /** @HookPoint-ECalConfig: Calendar Preferences Page + * @Id: org.gnome.evolution.calendar.prefs + * @Type: E_CONFIG_BOOK + * @Class: org.gnome.evolution.calendar.config:1.0 + * @Target: ECalConfigTargetPrefs + * + * The mail calendar preferences page + */ + ec = e_cal_config_new (E_CONFIG_BOOK, "org.gnome.evolution.calendar.prefs"); + l = NULL; + for (i = 0; i < G_N_ELEMENTS (eccp_items); i++) + l = g_slist_prepend (l, &eccp_items[i]); + e_config_add_items ((EConfig *) ec, l, NULL, NULL, eccp_free, prefs); + + widget = e_builder_get_widget (prefs->builder, "use-system-tz-check"); + g_object_bind_property ( + shell_settings, "cal-use-system-timezone", + widget, "active", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + g_signal_connect ( + shell_settings, "notify::cal-use-system-timezone", + G_CALLBACK (update_system_tz_widgets), prefs); + g_object_notify (G_OBJECT (shell_settings), "cal-use-system-timezone"); + + widget = e_builder_get_widget (prefs->builder, "timezone"); + g_object_bind_property ( + shell_settings, "cal-timezone", + widget, "timezone", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + g_object_bind_property ( + shell_settings, "cal-use-system-timezone", + widget, "sensitive", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE | + G_BINDING_INVERT_BOOLEAN); + + /* General tab */ + prefs->day_second_zone = e_builder_get_widget (prefs->builder, "day_second_zone"); + + widget = e_builder_get_widget (prefs->builder, "sun_button"); + g_object_bind_property ( + shell_settings, "cal-working-days-sunday", + widget, "active", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + + widget = e_builder_get_widget (prefs->builder, "mon_button"); + g_object_bind_property ( + shell_settings, "cal-working-days-monday", + widget, "active", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + + widget = e_builder_get_widget (prefs->builder, "tue_button"); + g_object_bind_property ( + shell_settings, "cal-working-days-tuesday", + widget, "active", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + + widget = e_builder_get_widget (prefs->builder, "wed_button"); + g_object_bind_property ( + shell_settings, "cal-working-days-wednesday", + widget, "active", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + + widget = e_builder_get_widget (prefs->builder, "thu_button"); + g_object_bind_property ( + shell_settings, "cal-working-days-thursday", + widget, "active", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + + widget = e_builder_get_widget (prefs->builder, "fri_button"); + g_object_bind_property ( + shell_settings, "cal-working-days-friday", + widget, "active", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + + widget = e_builder_get_widget (prefs->builder, "sat_button"); + g_object_bind_property ( + shell_settings, "cal-working-days-saturday", + widget, "active", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + + widget = e_builder_get_widget (prefs->builder, "week_start_day"); + g_object_bind_property ( + shell_settings, "cal-week-start-day", + widget, "active", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + + widget = e_builder_get_widget (prefs->builder, "start_of_day"); + prefs->start_of_day = widget; /* XXX delete this */ + if (locale_supports_12_hour_format) + g_object_bind_property ( + shell_settings, "cal-use-24-hour-format", + widget, "use-24-hour-format", + G_BINDING_SYNC_CREATE); + + widget = e_builder_get_widget (prefs->builder, "end_of_day"); + prefs->end_of_day = widget; /* XXX delete this */ + if (locale_supports_12_hour_format) + g_object_bind_property ( + shell_settings, "cal-use-24-hour-format", + widget, "use-24-hour-format", + G_BINDING_SYNC_CREATE); + + widget = e_builder_get_widget (prefs->builder, "use_12_hour"); + gtk_widget_set_sensitive (widget, locale_supports_12_hour_format); + g_object_bind_property ( + shell_settings, "cal-use-24-hour-format", + widget, "active", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE | + G_BINDING_INVERT_BOOLEAN); + + widget = e_builder_get_widget (prefs->builder, "use_24_hour"); + gtk_widget_set_sensitive (widget, locale_supports_12_hour_format); + g_object_bind_property ( + shell_settings, "cal-use-24-hour-format", + widget, "active", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + + widget = e_builder_get_widget (prefs->builder, "confirm_delete"); + g_object_bind_property ( + shell_settings, "cal-confirm-delete", + widget, "active", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + + 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 */ + 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 ( + shell_settings, "cal-show-event-end-times", + widget, "active", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + + widget = e_builder_get_widget (prefs->builder, "compress_weekend"); + g_object_bind_property ( + shell_settings, "cal-compress-weekend", + widget, "active", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + + widget = e_builder_get_widget (prefs->builder, "show_week_numbers"); + g_object_bind_property ( + shell_settings, "cal-show-week-numbers", + widget, "active", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + + widget = e_builder_get_widget (prefs->builder, "recur_events_italic"); + g_object_bind_property ( + shell_settings, "cal-recur-events-italic", + widget, "active", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + + 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 ( + shell_settings, "cal-tasks-color-due-today", + widget, "color", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE, + e_binding_transform_string_to_color, + e_binding_transform_color_to_string, + NULL, (GDestroyNotify) NULL); + + widget = e_builder_get_widget (prefs->builder, "tasks_overdue_color"); + g_object_bind_property_full ( + shell_settings, "cal-tasks-color-overdue", + widget, "color", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE, + e_binding_transform_string_to_color, + e_binding_transform_color_to_string, + (GDestroyNotify) NULL, NULL); + + 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"); + prefs->scrolled_window = e_builder_get_widget (prefs->builder, "calendar-source-scrolled-window"); + + /* Free/Busy tab */ + widget = e_builder_get_widget (prefs->builder, "template_url"); + g_object_bind_property ( + shell_settings, "cal-free-busy-template", + widget, "text", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + + /* date/time format */ + table = e_builder_get_widget (prefs->builder, "datetime_format_table"); + e_datetime_format_add_setup_widget (table, 0, "calendar", "table", DTFormatKindDateTime, _("Ti_me and date:")); + e_datetime_format_add_setup_widget (table, 1, "calendar", "table", DTFormatKindDate, _("_Date only:")); + + /* Hide senseless preferences when running in Express mode */ + e_shell_hide_widgets_for_express_mode (shell, prefs->builder, + "label_second_zone", + "hbox_second_zone", + "timezone", + "timezone_label", + "hbox_use_system_timezone", + "hbox_time_divisions", + "show_end_times", + "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. */ + if (e_shell_get_express_mode (shell)) { + widget = e_builder_get_widget (prefs->builder, "time"); + gtk_table_set_row_spacings (GTK_TABLE (widget), 0); + } + + /* Hook up and add the toplevel widget */ + + 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); + + show_config (prefs); + /* FIXME: weakref? */ + setup_changes (prefs); +} + +void +e_calendar_preferences_type_register (GTypeModule *type_module) +{ + /* 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 * +e_calendar_preferences_new (EPreferencesWindow *window) +{ + EShell *shell; + 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); + + preferences = g_object_new (E_TYPE_CALENDAR_PREFERENCES, NULL); + + preferences->shell_settings = g_object_ref (shell_settings); + + /* FIXME Kill this function. */ + calendar_preferences_construct (preferences, shell); + + 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 0000000000..ae96fc1b1f --- /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 + * + * + * Authors: + * David Trowbridge + * Damon Chaplin + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * + */ + +#ifndef CAL_PREFERENCES_H +#define CAL_PREFERENCES_H + +#include +#include +#include +#include + +/* 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/modules/calendar/e-calendar-preferences.ui b/modules/calendar/e-calendar-preferences.ui new file mode 100644 index 0000000000..7e581cf4ad --- /dev/null +++ b/modules/calendar/e-calendar-preferences.ui @@ -0,0 +1,1440 @@ + + + + + + + 9999 + 1 + 10 + + + 9999 + 1 + 10 + + + 1 + 9999 + 1 + 10 + + + + + + + + + Monday + + + Tuesday + + + Wednesday + + + Thursday + + + Friday + + + Saturday + + + Sunday + + + + + + + + + + + Minutes + + + Hours + + + Days + + + + + + + + + + + Minutes + + + Hours + + + Days + + + + + + + + + + + 60 minutes + + + 30 minutes + + + 15 minutes + + + 10 minutes + + + 05 minutes + + + + + + + + + + + Minutes + + + Hours + + + Days + + + + + True + True + + + True + 12 + 12 + + + True + 0 + Time + + + + + + False + False + 0 + + + + + True + 12 + + + True + + + False + False + 0 + + + + + True + 4 + 2 + 6 + 6 + + + True + 0 + Se_cond zone: + True + day_second_zone + + + 3 + 4 + GTK_FILL + + + + + + True + + + None + True + True + False + True + + + 0 + + + + + True + 6 + (Shown in a Day View) + + + False + False + 1 + + + + + 1 + 2 + 3 + 4 + GTK_FILL + GTK_FILL + + + + + True + + + + + + 1 + 2 + 2 + 3 + GTK_FILL + + + + + True + 0 + Time _zone: + True + timezone + + + 1 + 2 + GTK_FILL + + + + + + True + + + Use s_ystem time zone + True + True + False + True + True + + + False + 0 + + + + + True + 5 + (system/tz) + + + False + False + 1 + + + + + 1 + 2 + 1 + 2 + GTK_FILL + + + + + True + 0 + Time format: + + + GTK_FILL + + + + + + True + 6 + + + _12 hour (AM/PM) + True + True + False + True + True + True + + + False + False + 0 + + + + + _24 hour + True + True + False + True + True + use_12_hour + + + False + False + 1 + + + + + 1 + 2 + GTK_FILL + GTK_FILL + + + + + + + + 1 + + + + + False + 1 + + + + + True + 0 + Work Week + + + + + + False + False + 2 + + + + + True + 12 + + + True + + + False + False + 0 + + + + + True + 3 + 2 + 6 + 6 + + + True + 0 + Wee_k starts on: + True + week_start_day + + + GTK_FILL + + + + + + True + 0 + Work days: + + + 1 + 2 + GTK_FILL + + + + + + True + 0 + _Day begins: + True + + + 2 + 3 + GTK_FILL + + + + + + True + 6 + + + _Mon + True + True + False + True + True + + + Monday + + + + + False + False + 0 + + + + + _Tue + True + True + False + True + True + + + Tuesday + + + + + False + False + 1 + + + + + _Wed + True + True + False + True + True + + + Wednesday + + + + + False + False + 2 + + + + + T_hu + True + True + False + True + True + + + Thursday + + + + + False + False + 3 + + + + + _Fri + True + True + False + True + True + + + Friday + + + + + False + False + 4 + + + + + _Sat + True + True + False + True + True + + + Saturday + + + + + False + False + 5 + + + + + S_un + True + True + False + True + True + + + Sunday + + + + + False + False + 6 + + + + + 1 + 2 + 1 + 2 + GTK_FILL + GTK_FILL + + + + + True + model1 + + + + 0 + + + + + 1 + 2 + GTK_FILL + GTK_FILL + + + + + True + 12 + + + True + False + False + + + False + False + 0 + + + + + True + 0 + Day _ends: + True + + + False + end + 2 + + + + + True + False + False + + + False + False + end + 1 + + + + + 1 + 2 + 2 + 3 + GTK_FILL + + + + + 1 + + + + + False + 3 + + + + + True + 0 + Alerts + + + + + + False + False + 4 + + + + + True + 12 + + + True + + + False + False + 0 + + + + + True + 6 + + + _Ask for confirmation when deleting items + True + True + False + True + True + + + False + False + 0 + + + + + True + 4 + + + Sh_ow a reminder + True + True + False + True + True + + + False + False + 0 + + + + + True + True + adjustment1 + 1 + + + 1 + + + + + True + model2 + + + + 0 + + + + + 2 + + + + + True + before every appointment + + + False + False + 3 + + + + + 1 + + + + + True + 4 + + + Show a _reminder + True + True + False + True + True + + + False + False + 0 + + + + + True + True + adjustment2 + 1 + + + 1 + + + + + True + model3 + + + + 0 + + + + + 2 + + + + + True + before every anniversary/birthday + + + False + False + 3 + + + + + 2 + + + + + 1 + + + + + False + 5 + + + + + + + True + General + + + False + + + + + True + 12 + 12 + + + True + 0 + General + + + + + + False + False + 0 + + + + + True + 12 + + + True + + + False + False + 0 + + + + + True + 6 + + + True + 6 + + + True + _Time divisions: + True + time_divisions + + + False + False + 0 + + + + + True + model4 + + + + 0 + + + + + 1 + + + + + 0 + + + + + _Show appointment end times in week and month view + True + True + False + True + True + + + False + False + 1 + + + + + _Compress weekends in month view + True + True + False + True + True + + + False + False + 2 + + + + + Show week _numbers + True + True + False + True + True + + + False + False + 3 + + + + + Show r_ecurring events in italic in bottom left calendar + True + True + False + True + True + + + False + False + 4 + + + + + Sc_roll Month View by a week + True + True + False + True + True + + + False + False + 5 + + + + + 1 + + + + + False + 1 + + + + + True + 0 + Task List + + + + + + False + False + 2 + + + + + True + 12 + + + True + + + False + False + 0 + + + + + True + 6 + + + True + 12 + + + True + 0 + T_asks due today: + True + tasks_due_today_color + + + False + False + 0 + + + + + True + True + True + Pick a color + #000000000000 + + + False + False + 1 + + + + + True + 0 + _Overdue tasks: + True + tasks_overdue_color + + + False + False + end + 3 + + + + + True + True + True + Pick a color + #000000000000 + + + False + False + end + 2 + + + + + False + False + 0 + + + + + True + 6 + + + _Hide completed tasks after + True + True + False + True + True + + + False + False + 0 + + + + + True + True + adjustment3 + 1 + + + 1 + + + + + True + model5 + + + + 0 + + + + + 2 + + + + + 1 + + + + + 1 + + + + + False + 3 + + + + + True + 0 + Date/Time Format + + + + + + False + False + 4 + + + + + True + 12 + + + True + + + False + False + 0 + + + + + True + 3 + + + + + + + + + + + + 1 + + + + + 5 + + + + + 1 + + + + + True + Display + + + 1 + False + + + + + True + 12 + vertical + 6 + + + True + 0 + Alarms + + + + + + False + False + 0 + + + + + True + 10 + + + Display alarms in _notification area only + True + True + False + True + True + + + + + False + 1 + + + + + True + 0 + Select the calendars for alarm notification + + + False + False + 2 + + + + + True + True + automatic + automatic + in + + + + + + 3 + + + + + 2 + + + + + True + Alarms + + + 2 + False + + + + + True + 12 + vertical + 12 + + + True + 0 + Default Free/Busy Server + + + + + + False + False + 0 + + + + + True + 12 + + + True + vertical + 6 + + + True + 6 + + + True + Template: + + + False + False + 0 + + + + + True + True + + + + 1 + + + + + 0 + + + + + True + %u and %d will be replaced by user and domain from the email address. + True + + + + + + False + False + 1 + + + + + + + False + False + 1 + + + + + 3 + + + + + True + Free/Busy + + + 3 + False + + + + + + + + + + diff --git a/modules/calendar/e-memo-shell-backend.c b/modules/calendar/e-memo-shell-backend.c index d54c32f98e..e6658ed6cd 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 37fe41a784..8a005c4385 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 476460761c..a9d299e221 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 d85824767f..e4b5697c38 100644 --- a/modules/calendar/e-memo-shell-migrate.c +++ b/modules/calendar/e-memo-shell-migrate.c @@ -30,20 +30,21 @@ #include #include -#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 04292af2fd..5bc5dfd132 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 bebeba1110..a55eab1c10 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 4fe6a259e2..0880750828 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 be085afa8d..6982d48c4a 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 63b157ad85..ba56e91dd9 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 f0af66fa93..9cc924642c 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 91da8f45ef..fbfedb0617 100644 --- a/modules/calendar/e-task-shell-migrate.c +++ b/modules/calendar/e-task-shell-migrate.c @@ -38,19 +38,20 @@ #include #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 580cee286f..52887faf03 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 8ab9082ee0..d3531244d9 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 9f833e9542..83b0e9408f 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 b54f6439a3..af972cfc7b 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 -- cgit v1.2.3