diff options
Diffstat (limited to 'modules/calendar')
33 files changed, 3962 insertions, 169 deletions
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 @@ +<gconfschemafile> + <schemalist> + + <!-- Display --> + + <schema> + <key>/schemas/apps/evolution/calendar/display/primary_calendar</key> + <applyto>/apps/evolution/calendar/display/primary_calendar</applyto> + <owner>evolution-calendar</owner> + <type>string</type> + <locale name="C"> + <short>Primary calendar</short> + <long> + The UID of the selected (or "primary") calendar in the + sidebar of the "Calendar" view. + </long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/timezone</key> + <applyto>/apps/evolution/calendar/display/timezone</applyto> + <owner>evolution-calendar</owner> + <type>string</type> + <default>UTC</default> + <locale name="C"> + <short>Timezone</short> + <long>The default timezone to use for dates and times in the calendar, as an untranslated Olsen timezone database location like "America/New York".</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/use_system_timezone</key> + <applyto>/apps/evolution/calendar/display/use_system_timezone</applyto> + <owner>evolution-calendar</owner> + <type>bool</type> + <default>true</default> + <locale name="C"> + <short>Use system timezone</short> + <long>Use the system timezone instead of the timezone selected + in Evolution.</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/day_second_zone</key> + <applyto>/apps/evolution/calendar/display/day_second_zone</applyto> + <owner>evolution-calendar</owner> + <type>string</type> + <default></default> + <locale name="C"> + <short>The second timezone for a Day View</short> + <long>Shows the second time zone in a Day View, if set. Value is similar to one used in a 'timezone' key.</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/day_second_zones</key> + <applyto>/apps/evolution/calendar/display/day_second_zones</applyto> + <owner>evolution-calendar</owner> + <type>list</type> + <list_type>string</list_type> + <default>[]</default> + <locale name="C"> + <short>Recently used second time zones in a Day View</short> + <long>List of recently used second time zones in a Day View.</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/day_second_zones_max</key> + <applyto>/apps/evolution/calendar/display/day_second_zones_max</applyto> + <owner>evolution-calendar</owner> + <type>int</type> + <default>5</default> + <locale name="C"> + <short>Maximum number of recently used timezones to remember.</short> + <long>Maximum number of recently used timezones to remember in a 'day_second_zones' list.</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/use_24hour_format</key> + <applyto>/apps/evolution/calendar/display/use_24hour_format</applyto> + <owner>evolution-calendar</owner> + <type>bool</type> + <default>false</default> + <locale name="C"> + <short>Twenty four hour time format</short> + <long>Whether to show times in twenty four hour format instead of using am/pm.</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/show_role</key> + <applyto>/apps/evolution/calendar/display/show_role</applyto> + <owner>evolution-calendar</owner> + <type>bool</type> + <default>true</default> + <locale name="C"> + <short>Show Role field in the event/task/meeting editor</short> + <long>Whether to show role field in the event/task/meeting editor</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/show_status</key> + <applyto>/apps/evolution/calendar/display/show_status</applyto> + <owner>evolution-calendar</owner> + <type>bool</type> + <default>false</default> + <locale name="C"> + <short>Show status field in the event/task/meeting editor</short> + <long>Whether to show status field in the event/task/meeting editor</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/show_type</key> + <applyto>/apps/evolution/calendar/display/show_type</applyto> + <owner>evolution-calendar</owner> + <type>bool</type> + <default>false</default> + <locale name="C"> + <short>Show type field in the event/task/meeting editor</short> + <long>Whether to show type field in the event/task/meeting editor</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/show_rsvp</key> + <applyto>/apps/evolution/calendar/display/show_rsvp</applyto> + <owner>evolution-calendar</owner> + <type>bool</type> + <default>false</default> + <locale name="C"> + <short>Show RSVP field in the event/task/meeting editor</short> + <long>Whether to show RSVP field in the event/task/meeting editor</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/show_timezone</key> + <applyto>/apps/evolution/calendar/display/show_timezone</applyto> + <owner>evolution-calendar</owner> + <type>bool</type> + <default>false</default> + <locale name="C"> + <short>Show timezone field in the event/meeting editor</short> + <long>Whether to show timezone field in the event/meeting editor</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/show_categories</key> + <applyto>/apps/evolution/calendar/display/show_categories</applyto> + <owner>evolution-calendar</owner> + <type>bool</type> + <default>false</default> + <locale name="C"> + <short>Show categories field in the event/meeting/task editor</short> + <long>Whether to show categories field in the event/meeting editor</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/week_start_day</key> + <applyto>/apps/evolution/calendar/display/week_start_day</applyto> + <owner>evolution-calendar</owner> + <type>int</type> + <default>1</default> + <locale name="C"> + <short>Week start</short> + <long>Weekday the week starts on, from Sunday (0) to Saturday (6).</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/day_start_hour</key> + <applyto>/apps/evolution/calendar/display/day_start_hour</applyto> + <owner>evolution-calendar</owner> + <type>int</type> + <default>9</default> + <locale name="C"> + <short>Workday start hour</short> + <long>Hour the workday starts on, in twenty four hour format, 0 to 23.</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/day_start_minute</key> + <applyto>/apps/evolution/calendar/display/day_start_minute</applyto> + <owner>evolution-calendar</owner> + <type>int</type> + <default>0</default> + <locale name="C"> + <short>Workday start minute</short> + <long>Minute the workday starts on, 0 to 59.</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/day_end_hour</key> + <applyto>/apps/evolution/calendar/display/day_end_hour</applyto> + <owner>evolution-calendar</owner> + <type>int</type> + <default>17</default> + <locale name="C"> + <short>Workday end hour</short> + <long>Hour the workday ends on, in twenty four hour format, 0 to 23.</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/day_end_minute</key> + <applyto>/apps/evolution/calendar/display/day_end_minute</applyto> + <owner>evolution-calendar</owner> + <type>int</type> + <default>0</default> + <locale name="C"> + <short>Workday end minute</short> + <long>Minute the workday ends on, 0 to 59.</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/time_divisions</key> + <applyto>/apps/evolution/calendar/display/time_divisions</applyto> + <owner>evolution-calendar</owner> + <type>int</type> + <default>30</default> + <locale name="C"> + <short>Time divisions</short> + <long>Intervals shown in Day and Work Week views, in minutes.</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/hpane_position</key> + <applyto>/apps/evolution/calendar/display/hpane_position</applyto> + <owner>evolution-calendar</owner> + <type>int</type> + <default>400</default> + <locale name="C"> + <short>Horizontal pane position</short> + <long>Position of the horizontal pane, between the date navigator calendar and the task list when not in the month view, in pixels.</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/vpane_position</key> + <applyto>/apps/evolution/calendar/display/vpane_position</applyto> + <owner>evolution-calendar</owner> + <type>int</type> + <default>150</default> + <locale name="C"> + <short>Vertical pane position</short> + <long>Position of the vertical pane, between the view and the date navigator calendar and task list when not in the month view, in pixels.</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/month_hpane_position</key> + <applyto>/apps/evolution/calendar/display/month_hpane_position</applyto> + <owner>evolution-calendar</owner> + <type>int</type> + <default>32000</default> + <locale name="C"> + <short>Month view horizontal pane position </short> + <long>Position of the horizontal pane, between the view and the date navigator calendar and task list in the month view, in pixels.</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/month_vpane_position</key> + <applyto>/apps/evolution/calendar/display/month_vpane_position</applyto> + <owner>evolution-calendar</owner> + <type>int</type> + <default>150</default> + <locale name="C"> + <short>Month view vertical pane position </short> + <long>Position of the vertical pane, between the view and the date navigator calendar and task list in the month view, in pixels.</long> + </locale> + </schema> + <schema> + <key>/schemas/apps/evolution/calendar/display/date_navigator_pane_position</key> + <applyto>/apps/evolution/calendar/display/date_navigator_pane_position</applyto> + <owner>evolution-calendar</owner> + <type>int</type> + <default>150</default> + <locale name="C"> + <short>Month view vertical pane position </short> + <long>Position of the vertical pane, between the calendar lists and the date navigator calendar.</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/memo_layout</key> + <applyto>/apps/evolution/calendar/display/memo_layout</applyto> + <type>int</type> + <default>0</default> + <locale name="C"> + <short>Memo layout style</short> + <long> + 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. + </long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/show_memo_preview</key> + <applyto>/apps/evolution/calendar/display/show_memo_preview</applyto> + <owner>evolution-calendar</owner> + <type>bool</type> + <default>true</default> + <locale name="C"> + <short>Show the memo preview pane</short> + <long> + If "true", show the memo preview pane in the main window. + </long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/memo_hpane_position</key> + <applyto>/apps/evolution/calendar/display/memo_hpane_position</applyto> + <owner>evolution-calendar</owner> + <type>int</type> + <default>200</default> + <locale name="C"> + <short>Memo preview pane position (horizontal)</short> + <long> + Position of the task preview pane when oriented horizontally. + </long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/memo_vpane_position</key> + <applyto>/apps/evolution/calendar/display/memo_vpane_position</applyto> + <owner>evolution-calendar</owner> + <type>int</type> + <default>400</default> + <locale name="C"> + <short>Memo preview pane position (vertical)</short> + <long> + Position of the memo preview pane when oriented vertically. + </long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/task_layout</key> + <applyto>/apps/evolution/calendar/display/task_layout</applyto> + <type>int</type> + <default>0</default> + <locale name="C"> + <short>Task layout style</short> + <long> + 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. + </long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/show_task_preview</key> + <applyto>/apps/evolution/calendar/display/show_task_preview</applyto> + <owner>evolution-calendar</owner> + <type>bool</type> + <default>true</default> + <locale name="C"> + <short>Show the task preview pane</short> + <long> + If "true", show the task preview pane in the main window. + </long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/task_hpane_position</key> + <applyto>/apps/evolution/calendar/display/task_hpane_position</applyto> + <owner>evolution-calendar</owner> + <type>int</type> + <default>200</default> + <locale name="C"> + <short>Task preview pane position (horizontal)</short> + <long> + Position of the task preview pane when oriented horizontally. + </long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/task_vpane_position</key> + <applyto>/apps/evolution/calendar/display/task_vpane_position</applyto> + <owner>evolution-calendar</owner> + <type>int</type> + <default>400</default> + <locale name="C"> + <short>Task preview pane position (vertical)</short> + <long> + Position of the task preview pane when oriented vertically. + </long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/compress_weekend</key> + <applyto>/apps/evolution/calendar/display/compress_weekend</applyto> + <owner>evolution-calendar</owner> + <type>bool</type> + <default>true</default> + <locale name="C"> + <short>Compress weekends in month view</short> + <long>Whether to compress weekends in the month view, which puts Saturday and Sunday in the space of one weekday.</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/show_event_end</key> + <applyto>/apps/evolution/calendar/display/show_event_end</applyto> + <owner>evolution-calendar</owner> + <type>bool</type> + <default>true</default> + <locale name="C"> + <short>Show appointment end times in week and month views</short> + <long>Whether to display the end time of events in the week and month views.</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/working_days</key> + <applyto>/apps/evolution/calendar/display/working_days</applyto> + <owner>evolution-calendar</owner> + <type>int</type> + <default>62</default> + <locale name="C"> + <short>Work days</short> + <long>Days on which the start and end of work hours should be indicated.</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/marcus_bains_line</key> + <applyto>/apps/evolution/calendar/display/marcus_bains_line</applyto> + <owner>evolution-calendar</owner> + <type>bool</type> + <default>true</default> + <locale name="C"> + <short>Marcus Bains Line</short> + <long>Whether to draw the Marcus Bains Line (line at current time) in the calendar.</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/marcus_bains_color_dayview</key> + <applyto>/apps/evolution/calendar/display/marcus_bains_color_dayview</applyto> + <owner>evolution-calendar</owner> + <type>string</type> + <default>#ff0000</default> + <locale name="C"> + <short>Marcus Bains Line Color - Day View</short> + <long>Color to draw the Marcus Bains line in the Day View.</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/marcus_bains_color_timebar</key> + <applyto>/apps/evolution/calendar/display/marcus_bains_color_timebar</applyto> + <owner>evolution-calendar</owner> + <type>string</type> + <default>#ff0000</default> + <locale name="C"> + <short>Marcus Bains Line Color - Time bar</short> + <long>Color to draw the Marcus Bains Line in the Time bar (empty for default).</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/recur_events_italic</key> + <applyto>/apps/evolution/calendar/display/recur_events_italic</applyto> + <owner>evolution-calendar</owner> + <type>bool</type> + <default>false</default> + <locale name="C"> + <short>Recurrent Events in Italic</short> + <long>Show days with recurrent events in italic font in bottom left calendar.</long> + </locale> + </schema> + + <!-- Memos --> + + <schema> + <key>/schemas/apps/evolution/calendar/memos/primary_memos</key> + <applyto>/apps/evolution/calendar/memos/primary_memos</applyto> + <owner>evolution-calendar</owner> + <type>string</type> + <locale name="C"> + <short>Primary memo list</short> + <long> + The UID of the selected (or "primary") memo list in the + sidebar of the "Memos" view. + </long> + </locale> + </schema> + + <!-- Tasks --> + + <schema> + <key>/schemas/apps/evolution/calendar/tasks/primary_tasks</key> + <applyto>/apps/evolution/calendar/tasks/primary_tasks</applyto> + <owner>evolution-calendar</owner> + <type>string</type> + <locale name="C"> + <short>Primary task list</short> + <long> + The UID of the selected (or "primary") task list in the + sidebar of the "Tasks" view. + </long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/tasks/hide_completed</key> + <applyto>/apps/evolution/calendar/tasks/hide_completed</applyto> + <owner>evolution-calendar</owner> + <type>bool</type> + <default>false</default> + <locale name="C"> + <short>Hide completed tasks</short> + <long>Whether to hide completed tasks in the tasks view.</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/tasks/hide_completed_units</key> + <applyto>/apps/evolution/calendar/tasks/hide_completed_units</applyto> + <owner>evolution-calendar</owner> + <type>string</type> + <default>days</default> + <locale name="C"> + <short>Hide task units</short> + <long>Units for determining when to hide tasks, "minutes", "hours" or "days".</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/tasks/hide_completed_value</key> + <applyto>/apps/evolution/calendar/tasks/hide_completed_value</applyto> + <owner>evolution-calendar</owner> + <type>int</type> + <default>1</default> + <locale name="C"> + <short>Hide task value</short> + <long>Number of units for determining when to hide tasks.</long> + </locale> + </schema> + + <!-- Tasks: Colors --> + + <schema> + <key>/schemas/apps/evolution/calendar/tasks/colors/due_today</key> + <applyto>/apps/evolution/calendar/tasks/colors/due_today</applyto> + <owner>evolution-calendar</owner> + <type>string</type> + <default>#1e90ff</default> + <locale name="C"> + <short>Tasks due today color</short> + <long>Background color of tasks that are due today, in "#rrggbb" format.</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/tasks/colors/overdue</key> + <applyto>/apps/evolution/calendar/tasks/colors/overdue</applyto> + <owner>evolution-calendar</owner> + <type>string</type> + <default>#ff0000</default> + <locale name="C"> + <short>Overdue tasks color</short> + <long>Background color of tasks that are overdue, in "#rrggbb" format.</long> + </locale> + </schema> + + <!-- Miscellaneous --> + + <schema> + <key>/schemas/apps/evolution/calendar/prompts/confirm_delete</key> + <applyto>/apps/evolution/calendar/prompts/confirm_delete</applyto> + <owner>evolution-calendar</owner> + <type>bool</type> + <default>true</default> + <locale name="C"> + <short>Ask for confirmation when deleting items</short> + <long>Whether to ask for confirmation when deleting an appointment or task.</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/prompts/confirm_purge</key> + <applyto>/apps/evolution/calendar/prompts/confirm_purge</applyto> + <owner>evolution-calendar</owner> + <type>bool</type> + <default>true</default> + <locale name="C"> + <short>Confirm expunge</short> + <long>Whether to ask for confirmation when expunging appointments and tasks.</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/other/use_default_reminder</key> + <applyto>/apps/evolution/calendar/other/use_default_reminder</applyto> + <owner>evolution-calendar</owner> + <type>bool</type> + <default>false</default> + <locale name="C"> + <short>Default appointment reminder</short> + <long>Whether to set a default reminder for appointments.</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/other/default_reminder_interval</key> + <applyto>/apps/evolution/calendar/other/default_reminder_interval</applyto> + <owner>evolution-calendar</owner> + <type>int</type> + <default>15</default> + <locale name="C"> + <short>Default reminder value</short> + <long>Number of units for determining a default reminder.</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/other/default_reminder_units</key> + <applyto>/apps/evolution/calendar/other/default_reminder_units</applyto> + <owner>evolution-calendar</owner> + <type>string</type> + <default>minutes</default> + <locale name="C"> + <short>Default reminder units</short> + <long>Units for a default reminder, "minutes", "hours" or "days".</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/other/use_ba_reminder</key> + <applyto>/apps/evolution/calendar/other/use_ba_reminder</applyto> + <owner>evolution-calendar</owner> + <type>bool</type> + <default>false</default> + <locale name="C"> + <short>Birthday and anniversary reminder</short> + <long> + Whether to set a reminder for birthdays and anniversaries. + </long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/other/ba_reminder_interval</key> + <applyto>/apps/evolution/calendar/other/ba_reminder_interval</applyto> + <owner>evolution-calendar</owner> + <type>int</type> + <default>15</default> + <locale name="C"> + <short>Birthday and anniversary reminder value</short> + <long> + Number of units for determining a birthday or anniversary reminder. + </long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/other/ba_reminder_units</key> + <applyto>/apps/evolution/calendar/other/ba_reminder_units</applyto> + <owner>evolution-calendar</owner> + <type>string</type> + <default>minutes</default> + <locale name="C"> + <short>Birthday and anniversary reminder units</short> + <long> + Units for a birthday or anniversary reminder, "minutes", "hours" + or "days". + </long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/show_week_numbers</key> + <applyto>/apps/evolution/calendar/display/show_week_numbers</applyto> + <owner>evolution-calendar</owner> + <type>bool</type> + <default>false</default> + <locale name="C"> + <short>Show week numbers in Day View, Work Week View, and Date Navigator</short> + <long>Whether to show week numbers in various places in the Calendar.</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/month_scroll_by_week</key> + <applyto>/apps/evolution/calendar/display/month_scroll_by_week</applyto> + <owner>evolution-calendar</owner> + <type>bool</type> + <default>true</default> + <locale name="C"> + <short>Scroll Month View by a week</short> + <long>Whether to scroll a Month View by a week, not by a month.</long> + </locale> + </schema> + + <!-- Alarm notification --> + + <schema> + <key>/schemas/apps/evolution/calendar/notify/last_notification_time</key> + <applyto>/apps/evolution/calendar/notify/last_notification_time</applyto> + <owner>evolution-calendar</owner> + <type>int</type> + <default>-1</default> + <locale name="C"> + <short>Last alarm time</short> + <long>Time the last alarm ran, in time_t.</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/notify/calendars</key> + <applyto>/apps/evolution/calendar/notify/calendars</applyto> + <owner>evolution-calendar</owner> + <type>list</type> + <list_type>string</list_type> + <default>[]</default> + <locale name="C"> + <short>Calendars to run alarms for</short> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/notify/programs</key> + <applyto>/apps/evolution/calendar/notify/programs</applyto> + <owner>evolution-calendar</owner> + <type>list</type> + <list_type>string</list_type> + <default>[]</default> + <locale name="C"> + <short>Alarm programs</short> + <long>Programs that are allowed to be run by alarms.</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/notify/notify_with_tray</key> + <applyto>/apps/evolution/calendar/notify/notify_with_tray</applyto> + <owner>evolution-calendar</owner> + <type>bool</type> + <default>false</default> + <locale name="C"> + <short>Show display alarms in notification tray</short> + <long>Whether or not to use the notification tray for display alarms.</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/publish/uris</key> + <applyto>/apps/evolution/calendar/publish/uris</applyto> + <owner>evolution-calendar</owner> + <type>list</type> + <list_type>string</list_type> + <default>[]</default> + <locale name="C"> + <short>Free/busy server URLs</short> + <long>List of server URLs for free/busy publishing.</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/publish/template</key> + <applyto>/apps/evolution/calendar/publish/template</applyto> + <owner>evolution-calendar</owner> + <type>string</type> + <locale name="C"> + <short>Free/busy template URL</short> + <long>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.</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/audio_dir</key> + <applyto>/apps/evolution/calendar/audio_dir</applyto> + <owner>evolution-calendar</owner> + <type>string</type> + <locale name="C"> + <short>Save directory for alarm audio</short> + <long> + Directory for saving alarm audio files + </long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/error_timeout</key> + <applyto>/apps/evolution/calendar/display/error_timeout</applyto> + <owner>evolution-calendar</owner> + <type>int</type> + <default>60</default> + <locale name="C"> + <short>Amount of time in seconds the error should be shown on the status bar.</short> + <long> Amount of time in seconds the error should be shown on the status bar. + </long> + </locale> + </schema> + <schema> + <key>/schemas/apps/evolution/calendar/display/error_level</key> + <applyto>/apps/evolution/calendar/display/error_level</applyto> + <owner>evolution-calendar</owner> + <type>int</type> + <default>0</default> + <locale name="C"> + <short>Level beyond which the message should be logged.</short> + <long> This can have three possible values. 0 for errors. 1 for warnings. + 2 for debug messages. + </long> + </locale> + </schema> + </schemalist> +</gconfschemafile> 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 <http://www.gnu.org/licenses/> + * + */ + +#include "e-cal-config-comp-editor.h" + +#include <shell/e-shell.h> +#include <e-util/e-extension.h> +#include <calendar/gui/dialogs/comp-editor.h> + +static void +cal_config_comp_editor_constructed (GObject *object) +{ + EExtension *extension; + EExtensible *extensible; + EShellSettings *shell_settings; + EShell *shell; + + extension = E_EXTENSION (object); + extensible = e_extension_get_extensible (extension); + + shell = e_shell_get_default (); + shell_settings = e_shell_get_shell_settings (shell); + + g_object_bind_property ( + shell_settings, "cal-timezone", + extensible, "timezone", + G_BINDING_SYNC_CREATE); + + g_object_bind_property ( + shell_settings, "cal-use-24-hour-format", + extensible, "use-24-hour-format", + G_BINDING_SYNC_CREATE); + + g_object_bind_property ( + shell_settings, "cal-work-day-end-hour", + extensible, "work-day-end-hour", + G_BINDING_SYNC_CREATE); + + g_object_bind_property ( + shell_settings, "cal-work-day-end-minute", + extensible, "work-day-end-minute", + G_BINDING_SYNC_CREATE); + + g_object_bind_property ( + shell_settings, "cal-work-day-start-hour", + extensible, "work-day-start-hour", + G_BINDING_SYNC_CREATE); + + g_object_bind_property ( + shell_settings, "cal-work-day-start-minute", + extensible, "work-day-start-minute", + G_BINDING_SYNC_CREATE); +} + +static void +cal_config_comp_editor_class_init (EExtensionClass *class) +{ + GObjectClass *object_class; + + object_class = G_OBJECT_CLASS (class); + object_class->constructed = cal_config_comp_editor_constructed; + + class->extensible_type = TYPE_COMP_EDITOR; +} + +void +e_cal_config_comp_editor_register_type (GTypeModule *type_module) +{ + static const GTypeInfo type_info = { + sizeof (EExtensionClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) cal_config_comp_editor_class_init, + (GClassFinalizeFunc) NULL, + NULL, /* class_data */ + sizeof (EExtension), + 0, /* n_preallocs */ + (GInstanceInitFunc) NULL, + NULL /* value_table */ + }; + + g_type_module_register_type ( + type_module, E_TYPE_EXTENSION, + "ECalConfigCompEditor", &type_info, 0); +} diff --git a/modules/calendar/e-cal-config-comp-editor.h b/modules/calendar/e-cal-config-comp-editor.h new file mode 100644 index 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 <http://www.gnu.org/licenses/> + * + */ + +#ifndef E_CAL_CONFIG_COMP_EDITOR_H +#define E_CAL_CONFIG_COMP_EDITOR_H + +#include <glib-object.h> + +G_BEGIN_DECLS + +void e_cal_config_comp_editor_register_type (GTypeModule *type_module); + +G_END_DECLS + +#endif /* E_CAL_CONFIG_COMP_EDITOR_H */ diff --git a/modules/calendar/e-cal-config-meeting-store.c b/modules/calendar/e-cal-config-meeting-store.c index 72f103bbec..f9babc53bf 100644 --- a/modules/calendar/e-cal-config-meeting-store.c +++ b/modules/calendar/e-cal-config-meeting-store.c @@ -37,6 +37,16 @@ cal_config_meeting_store_constructed (GObject *object) shell_settings = e_shell_get_shell_settings (shell); g_object_bind_property ( + shell_settings, "cal-default-reminder-interval", + extensible, "default-reminder-interval", + G_BINDING_SYNC_CREATE); + + g_object_bind_property ( + shell_settings, "cal-default-reminder-units", + extensible, "default-reminder-units", + G_BINDING_SYNC_CREATE); + + g_object_bind_property ( shell_settings, "cal-free-busy-template", extensible, "free-busy-template", G_BINDING_SYNC_CREATE); @@ -45,6 +55,11 @@ cal_config_meeting_store_constructed (GObject *object) shell_settings, "cal-timezone", extensible, "timezone", G_BINDING_SYNC_CREATE); + + g_object_bind_property ( + shell_settings, "cal-week-start-day", + extensible, "week-start-day", + G_BINDING_SYNC_CREATE); } static void diff --git a/modules/calendar/e-cal-config-model.c b/modules/calendar/e-cal-config-model.c index 62ff9b57b6..9dd5ee9b8d 100644 --- a/modules/calendar/e-cal-config-model.c +++ b/modules/calendar/e-cal-config-model.c @@ -40,6 +40,26 @@ cal_config_model_constructed (GObject *object) /*** ECalModel ***/ g_object_bind_property ( + shell_settings, "cal-compress-weekend", + extensible, "compress-weekend", + G_BINDING_SYNC_CREATE); + + g_object_bind_property ( + shell_settings, "cal-confirm-delete", + extensible, "confirm-delete", + G_BINDING_SYNC_CREATE); + + g_object_bind_property ( + shell_settings, "cal-default-reminder-interval", + extensible, "default-reminder-interval", + G_BINDING_SYNC_CREATE); + + g_object_bind_property ( + shell_settings, "cal-default-reminder-units", + extensible, "default-reminder-units", + G_BINDING_SYNC_CREATE); + + g_object_bind_property ( shell_settings, "cal-timezone", extensible, "timezone", G_BINDING_SYNC_CREATE); @@ -50,10 +70,35 @@ cal_config_model_constructed (GObject *object) G_BINDING_SYNC_CREATE); g_object_bind_property ( + shell_settings, "cal-use-default-reminder", + extensible, "use-default-reminder", + G_BINDING_SYNC_CREATE); + + g_object_bind_property ( shell_settings, "cal-week-start-day", extensible, "week-start-day", G_BINDING_SYNC_CREATE); + g_object_bind_property ( + shell_settings, "cal-work-day-end-hour", + extensible, "work-day-end-hour", + G_BINDING_SYNC_CREATE); + + g_object_bind_property ( + shell_settings, "cal-work-day-end-minute", + extensible, "work-day-end-minute", + G_BINDING_SYNC_CREATE); + + g_object_bind_property ( + shell_settings, "cal-work-day-start-hour", + extensible, "work-day-start-hour", + G_BINDING_SYNC_CREATE); + + g_object_bind_property ( + shell_settings, "cal-work-day-start-minute", + extensible, "work-day-start-minute", + G_BINDING_SYNC_CREATE); + /*** ECalModelTasks ***/ if (E_IS_CAL_MODEL_TASKS (extensible)) { diff --git a/modules/calendar/e-cal-config-view.c b/modules/calendar/e-cal-config-view.c index 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)) { @@ -62,31 +68,6 @@ cal_config_view_constructed (GObject *object) G_BINDING_SYNC_CREATE); g_object_bind_property ( - shell_settings, "cal-time-divisions", - extensible, "mins-per-row", - G_BINDING_SYNC_CREATE); - - g_object_bind_property ( - shell_settings, "cal-work-day-end-hour", - extensible, "work-day-end-hour", - G_BINDING_SYNC_CREATE); - - g_object_bind_property ( - shell_settings, "cal-work-day-end-minute", - extensible, "work-day-end-minute", - G_BINDING_SYNC_CREATE); - - g_object_bind_property ( - shell_settings, "cal-work-day-start-hour", - extensible, "work-day-start-hour", - G_BINDING_SYNC_CREATE); - - g_object_bind_property ( - shell_settings, "cal-work-day-start-minute", - extensible, "work-day-start-minute", - G_BINDING_SYNC_CREATE); - - g_object_bind_property ( shell_settings, "cal-working-days-bitset", extensible, "working-days", G_BINDING_SYNC_CREATE); diff --git a/modules/calendar/e-cal-shell-backend.c b/modules/calendar/e-cal-shell-backend.c index 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 <libedataserver/e-xml-hash-utils.h> #include "e-util/e-util-private.h" -#include "calendar/gui/calendar-config.h" #include "calendar/gui/calendar-config-keys.h" #include "calendar/gui/e-cal-event.h" #include "shell/e-shell.h" +#include "e-cal-shell-backend.h" + #define WEBCAL_BASE_URI "webcal://" #define CONTACTS_BASE_URI "contacts://" #define BAD_CONTACTS_BASE_URI "contact://" @@ -150,6 +151,7 @@ create_calendar_sources (EShellBackend *shell_backend, } if (!*personal_source) { + GSList *selected; gchar *primary_calendar; /* Create the default Person calendar */ @@ -159,18 +161,26 @@ create_calendar_sources (EShellBackend *shell_backend, primary_calendar = e_shell_settings_get_string ( shell_settings, "cal-primary-calendar"); - if (!primary_calendar && !calendar_config_get_calendars_selected ()) { - GSList selected; + selected = e_cal_shell_backend_get_selected_calendars ( + E_CAL_SHELL_BACKEND (shell_backend)); + + if (primary_calendar == NULL && selected == NULL) { + GSList link; e_shell_settings_set_string ( shell_settings, "cal-primary-calendar", e_source_peek_uid (source)); - selected.data = (gpointer)e_source_peek_uid (source); - selected.next = NULL; - calendar_config_set_calendars_selected (&selected); + link.data = (gpointer)e_source_peek_uid (source); + link.next = NULL; + + e_cal_shell_backend_set_selected_calendars ( + E_CAL_SHELL_BACKEND (shell_backend), &link); } + g_slist_foreach (selected, (GFunc) g_free, NULL); + g_slist_free (selected); + g_free (primary_calendar); e_source_set_color_spec (source, "#BECEDD"); *personal_source = source; @@ -196,10 +206,10 @@ create_calendar_sources (EShellBackend *shell_backend, gboolean e_cal_shell_backend_migrate (EShellBackend *shell_backend, - gint major, - gint minor, - gint micro, - GError **error) + gint major, + gint minor, + gint micro, + GError **error) { ESourceGroup *on_this_computer = NULL, *on_the_web = NULL, *contacts = NULL; ESource *personal_source = NULL; diff --git a/modules/calendar/e-cal-shell-settings.c b/modules/calendar/e-cal-shell-settings.c index 524157c5a9..30fc1c4fa7 100644 --- a/modules/calendar/e-cal-shell-settings.c +++ b/modules/calendar/e-cal-shell-settings.c @@ -24,6 +24,9 @@ #include <gconf/gconf-client.h> #include <libecal/e-cal-util.h> +#include <e-util/e-util.h> +#include <e-util/e-util-enumtypes.h> + static gboolean transform_string_to_icaltimezone (GBinding *binding, const GValue *source_value, @@ -495,6 +498,14 @@ e_cal_shell_backend_init_settings (EShell *shell) shell_settings = e_shell_get_shell_settings (shell); e_shell_settings_install_property_for_key ( + "cal-ba-reminder-interval", + "/apps/evolution/calendar/other/ba_reminder_interval"); + + e_shell_settings_install_property_for_key ( + "cal-ba-reminder-units-string", + "/apps/evolution/calendar/other/ba_reminder_units"); + + e_shell_settings_install_property_for_key ( "cal-compress-weekend", "/apps/evolution/calendar/display/compress_weekend"); @@ -507,8 +518,14 @@ e_cal_shell_backend_init_settings (EShell *shell) "/apps/evolution/calendar/prompts/confirm_purge"); e_shell_settings_install_property_for_key ( - "cal-show-week-numbers", - "/apps/evolution/calendar/display/show_week_numbers"); + "cal-default-reminder-interval", + "/apps/evolution/calendar/other/default_reminder_interval"); + + /* Do not bind to this. + * Use "cal-default-reminder-units" instead. */ + e_shell_settings_install_property_for_key ( + "cal-default-reminder-units-string", + "/apps/evolution/calendar/other/default_reminder_units"); e_shell_settings_install_property_for_key ( "cal-free-busy-template", @@ -518,8 +535,10 @@ e_cal_shell_backend_init_settings (EShell *shell) "cal-hide-completed-tasks", "/apps/evolution/calendar/tasks/hide_completed"); + /* Do not bind to this. + * Use "cal-hide-completed-tasks-units" instead. */ e_shell_settings_install_property_for_key ( - "cal-hide-completed-tasks-units", + "cal-hide-completed-tasks-units-string", "/apps/evolution/calendar/tasks/hide_completed_units"); e_shell_settings_install_property_for_key ( @@ -539,6 +558,10 @@ e_cal_shell_backend_init_settings (EShell *shell) "/apps/evolution/calendar/display/marcus_bains_line"); e_shell_settings_install_property_for_key ( + "cal-month-scroll-by-week", + "/apps/evolution/calendar/display/month_scroll_by_week"); + + e_shell_settings_install_property_for_key ( "cal-primary-calendar", "/apps/evolution/calendar/display/primary_calendar"); @@ -559,6 +582,10 @@ e_cal_shell_backend_init_settings (EShell *shell) "/apps/evolution/calendar/display/show_event_end"); e_shell_settings_install_property_for_key ( + "cal-show-week-numbers", + "/apps/evolution/calendar/display/show_week_numbers"); + + e_shell_settings_install_property_for_key ( "cal-tasks-color-due-today", "/apps/evolution/calendar/tasks/colors/due_today"); @@ -580,6 +607,14 @@ e_cal_shell_backend_init_settings (EShell *shell) "/apps/evolution/calendar/display/use_24hour_format"); e_shell_settings_install_property_for_key ( + "cal-use-ba-reminder", + "/apps/evolution/calendar/other/use_ba_reminder"); + + e_shell_settings_install_property_for_key ( + "cal-use-default-reminder", + "/apps/evolution/calendar/other/use_default_reminder"); + + e_shell_settings_install_property_for_key ( "cal-use-system-timezone", "/apps/evolution/calendar/display/use_system_timezone"); @@ -616,6 +651,60 @@ e_cal_shell_backend_init_settings (EShell *shell) * GConf schemas. */ e_shell_settings_install_property ( + g_param_spec_enum ( + "cal-ba-reminder-units", + NULL, + NULL, + E_TYPE_DURATION_TYPE, + E_DURATION_MINUTES, + G_PARAM_READWRITE)); + + g_object_bind_property_full ( + shell_settings, "cal-ba-reminder-units-string", + shell_settings, "cal-ba-reminder-units", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE, + e_binding_transform_enum_nick_to_value, + e_binding_transform_enum_value_to_nick, + NULL, (GDestroyNotify) NULL); + + e_shell_settings_install_property ( + g_param_spec_enum ( + "cal-default-reminder-units", + NULL, + NULL, + E_TYPE_DURATION_TYPE, + E_DURATION_MINUTES, + G_PARAM_READWRITE)); + + g_object_bind_property_full ( + shell_settings, "cal-default-reminder-units-string", + shell_settings, "cal-default-reminder-units", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE, + e_binding_transform_enum_nick_to_value, + e_binding_transform_enum_value_to_nick, + NULL, (GDestroyNotify) NULL); + + e_shell_settings_install_property ( + g_param_spec_enum ( + "cal-hide-completed-tasks-units", + NULL, + NULL, + E_TYPE_DURATION_TYPE, + E_DURATION_MINUTES, + G_PARAM_READWRITE)); + + g_object_bind_property_full ( + shell_settings, "cal-hide-completed-tasks-units-string", + shell_settings, "cal-hide-completed-tasks-units", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE, + e_binding_transform_enum_nick_to_value, + e_binding_transform_enum_value_to_nick, + NULL, (GDestroyNotify) NULL); + + e_shell_settings_install_property ( g_param_spec_pointer ( "cal-timezone", NULL, diff --git a/modules/calendar/e-cal-shell-sidebar.c b/modules/calendar/e-cal-shell-sidebar.c index 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 <http://www.gnu.org/licenses/> + * + * + * Authors: + * Damon Chaplin <damon@ximian.com> + * Ettore Perazzoli <ettore@ximian.com> + * David Trowbridge <trowbrds cs colorado edu> + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * + */ + +#include "e-calendar-preferences.h" + +#include <config.h> +#include <string.h> +#include <glib/gi18n.h> + +#include "calendar/gui/e-cal-config.h" +#include "calendar/gui/e-timezone-entry.h" +#include "calendar/gui/calendar-config.h" +#include "widgets/misc/e-dateedit.h" +#include "e-util/e-util.h" +#include "e-util/e-datetime-format.h" +#include "e-util/e-dialog-widgets.h" +#include "e-util/e-util-private.h" +#include "shell/e-shell-utils.h" + +/* 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 <http://www.gnu.org/licenses/> + * + * + * Authors: + * David Trowbridge <trowbrds cs colorado edu> + * Damon Chaplin <damon@ximian.com> + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * + */ + +#ifndef CAL_PREFERENCES_H +#define CAL_PREFERENCES_H + +#include <gtk/gtk.h> +#include <shell/e-shell.h> +#include <libedataserverui/e-source-selector.h> +#include <widgets/misc/e-preferences-window.h> + +/* Standard GObject macros */ +#define E_TYPE_CALENDAR_PREFERENCES \ + (e_calendar_preferences_get_type ()) +#define E_CALENDAR_PREFERENCES(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_CALENDAR_PREFERENCES, ECalendarPreferences)) +#define E_CALENDAR_PREFERENCES_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_CALENDAR_PREFERENCES, ECalendarPreferencesClass)) +#define E_CALENDAR_IS_PREFERENCES(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_CALENDAR_PREFERENCES)) +#define E_CALENDAR_IS_PREFERENCES_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_CALENDAR_PREFERENCES)) +#define E_CALENDAR_PREFERENCES_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_CALENDAR_PREFERENCES, ECalendarPreferencesClass)) + +G_BEGIN_DECLS + +typedef struct _ECalendarPreferences ECalendarPreferences; +typedef struct _ECalendarPreferencesClass ECalendarPreferencesClass; + +struct _ECalendarPreferences { + GtkVBox parent; + + GtkBuilder *builder; + + EShellSettings *shell_settings; + + /* General tab */ + GtkWidget *day_second_zone; + GtkWidget *start_of_day; + GtkWidget *end_of_day; + GtkWidget *ba_reminder; + GtkWidget *ba_reminder_interval; + GtkWidget *ba_reminder_units; + + /* Alarms tab */ + GtkWidget *notify_with_tray; + GtkWidget *scrolled_window; + ESourceList *alarms_list; + GtkWidget *alarm_list_widget; +}; + +struct _ECalendarPreferencesClass { + GtkVBoxClass parent; +}; + +GType e_calendar_preferences_get_type (void); +void e_calendar_preferences_type_register + (GTypeModule *type_module); +GtkWidget * e_calendar_preferences_new (EPreferencesWindow *window); + +G_END_DECLS + +#endif /* CAL_PREFERENCES_H */ diff --git a/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 @@ +<?xml version="1.0"?> +<interface> + <requires lib="gtk+" version="2.16"/> + <!-- interface-requires evolution 0.0 --> + <!-- interface-naming-policy toplevel-contextual --> + <object class="GtkAdjustment" id="adjustment1"> + <property name="upper">9999</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> + <object class="GtkAdjustment" id="adjustment2"> + <property name="upper">9999</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> + <object class="GtkAdjustment" id="adjustment3"> + <property name="value">1</property> + <property name="upper">9999</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> + <object class="GtkListStore" id="model1"> + <columns> + <!-- column-name gchararray --> + <column type="gchararray"/> + </columns> + <data> + <row> + <col id="0" translatable="yes">Monday</col> + </row> + <row> + <col id="0" translatable="yes">Tuesday</col> + </row> + <row> + <col id="0" translatable="yes">Wednesday</col> + </row> + <row> + <col id="0" translatable="yes">Thursday</col> + </row> + <row> + <col id="0" translatable="yes">Friday</col> + </row> + <row> + <col id="0" translatable="yes">Saturday</col> + </row> + <row> + <col id="0" translatable="yes">Sunday</col> + </row> + </data> + </object> + <object class="GtkListStore" id="model2"> + <columns> + <!-- column-name gchararray --> + <column type="gchararray"/> + </columns> + <data> + <row> + <col id="0" translatable="yes">Minutes</col> + </row> + <row> + <col id="0" translatable="yes">Hours</col> + </row> + <row> + <col id="0" translatable="yes">Days</col> + </row> + </data> + </object> + <object class="GtkListStore" id="model3"> + <columns> + <!-- column-name gchararray --> + <column type="gchararray"/> + </columns> + <data> + <row> + <col id="0" translatable="yes">Minutes</col> + </row> + <row> + <col id="0" translatable="yes">Hours</col> + </row> + <row> + <col id="0" translatable="yes">Days</col> + </row> + </data> + </object> + <object class="GtkListStore" id="model4"> + <columns> + <!-- column-name gchararray --> + <column type="gchararray"/> + </columns> + <data> + <row> + <col id="0" translatable="yes">60 minutes</col> + </row> + <row> + <col id="0" translatable="yes">30 minutes</col> + </row> + <row> + <col id="0" translatable="yes">15 minutes</col> + </row> + <row> + <col id="0" translatable="yes">10 minutes</col> + </row> + <row> + <col id="0" translatable="yes">05 minutes</col> + </row> + </data> + </object> + <object class="GtkListStore" id="model5"> + <columns> + <!-- column-name gchararray --> + <column type="gchararray"/> + </columns> + <data> + <row> + <col id="0" translatable="yes">Minutes</col> + </row> + <row> + <col id="0" translatable="yes">Hours</col> + </row> + <row> + <col id="0" translatable="yes">Days</col> + </row> + </data> + </object> + <object class="GtkNotebook" id="toplevel-notebook"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <child> + <object class="GtkVBox" id="general"> + <property name="visible">True</property> + <property name="border_width">12</property> + <property name="spacing">12</property> + <child> + <object class="GtkLabel" id="label4"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Time</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkHBox" id="hbox1"> + <property name="visible">True</property> + <property name="spacing">12</property> + <child> + <object class="GtkLabel" id="label7"> + <property name="visible">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkTable" id="time"> + <property name="visible">True</property> + <property name="n_rows">4</property> + <property name="n_columns">2</property> + <property name="column_spacing">6</property> + <property name="row_spacing">6</property> + <child> + <object class="GtkLabel" id="label_second_zone"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Se_cond zone:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">day_second_zone</property> + </object> + <packing> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + <property name="x_options">GTK_FILL</property> + <property name="y_options"></property> + </packing> + </child> + <child> + <object class="GtkHBox" id="hbox_second_zone"> + <property name="visible">True</property> + <child> + <object class="GtkButton" id="day_second_zone"> + <property name="label" translatable="yes" context="cal-second-zone">None</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label64"> + <property name="visible">True</property> + <property name="xpad">6</property> + <property name="label" translatable="yes">(Shown in a Day View)</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + <property name="x_options">GTK_FILL</property> + <property name="y_options">GTK_FILL</property> + </packing> + </child> + <child> + <object class="ETimezoneEntry" id="timezone"> + <property name="visible">True</property> + <accessibility> + <relation type="labelled-by" target="timezone_label"/> + </accessibility> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="y_options">GTK_FILL</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="timezone_label"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Time _zone:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">timezone</property> + </object> + <packing> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">GTK_FILL</property> + <property name="y_options"></property> + </packing> + </child> + <child> + <object class="GtkHBox" id="hbox_use_system_timezone"> + <property name="visible">True</property> + <child> + <object class="GtkCheckButton" id="use-system-tz-check"> + <property name="label" translatable="yes">Use s_ystem time zone</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="system-tz-label"> + <property name="visible">True</property> + <property name="xpad">5</property> + <property name="label">(system/tz)</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">GTK_FILL</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label_time_format"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Time format:</property> + </object> + <packing> + <property name="x_options">GTK_FILL</property> + <property name="y_options"></property> + </packing> + </child> + <child> + <object class="GtkHBox" id="hbox_time_format"> + <property name="visible">True</property> + <property name="spacing">6</property> + <child> + <object class="GtkRadioButton" id="use_12_hour"> + <property name="label" translatable="yes">_12 hour (AM/PM)</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkRadioButton" id="use_24_hour"> + <property name="label" translatable="yes">_24 hour</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + <property name="group">use_12_hour</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="x_options">GTK_FILL</property> + <property name="y_options">GTK_FILL</property> + </packing> + </child> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label5"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Work Week</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkHBox" id="hbox2"> + <property name="visible">True</property> + <property name="spacing">12</property> + <child> + <object class="GtkLabel" id="label8"> + <property name="visible">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkTable" id="workWeek"> + <property name="visible">True</property> + <property name="n_rows">3</property> + <property name="n_columns">2</property> + <property name="column_spacing">6</property> + <property name="row_spacing">6</property> + <child> + <object class="GtkLabel" id="label12"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes" comments="A weekday like "Monday" follows">Wee_k starts on:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">week_start_day</property> + </object> + <packing> + <property name="x_options">GTK_FILL</property> + <property name="y_options"></property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label13"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Work days:</property> + </object> + <packing> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">GTK_FILL</property> + <property name="y_options"></property> + </packing> + </child> + <child> + <object class="GtkLabel" id="day_start_label"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">_Day begins:</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="x_options">GTK_FILL</property> + <property name="y_options"></property> + </packing> + </child> + <child> + <object class="GtkHBox" id="hbox5"> + <property name="visible">True</property> + <property name="spacing">6</property> + <child> + <object class="GtkCheckButton" id="mon_button"> + <property name="label" translatable="yes" comments="Monday">_Mon</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + <child internal-child="accessible"> + <object class="AtkObject" id="mon_button-atkobject"> + <property name="AtkObject::accessible-name" translatable="yes">Monday</property> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="tue_button"> + <property name="label" translatable="yes" comments="Tuesday">_Tue</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + <child internal-child="accessible"> + <object class="AtkObject" id="tue_button-atkobject"> + <property name="AtkObject::accessible-name" translatable="yes">Tuesday</property> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="wed_button"> + <property name="label" translatable="yes" comments="Wednesday">_Wed</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + <child internal-child="accessible"> + <object class="AtkObject" id="wed_button-atkobject"> + <property name="AtkObject::accessible-name" translatable="yes">Wednesday</property> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="thu_button"> + <property name="label" translatable="yes" comments="Thursday">T_hu</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + <child internal-child="accessible"> + <object class="AtkObject" id="thu_button-atkobject"> + <property name="AtkObject::accessible-name" translatable="yes">Thursday</property> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">3</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="fri_button"> + <property name="label" translatable="yes" comments="Friday">_Fri</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + <child internal-child="accessible"> + <object class="AtkObject" id="fri_button-atkobject"> + <property name="AtkObject::accessible-name" translatable="yes">Friday</property> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">4</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="sat_button"> + <property name="label" translatable="yes" comments="Saturday">_Sat</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + <child internal-child="accessible"> + <object class="AtkObject" id="sat_button-atkobject"> + <property name="AtkObject::accessible-name" translatable="yes">Saturday</property> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">5</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="sun_button"> + <property name="label" translatable="yes" comments="Sunday">S_un</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + <child internal-child="accessible"> + <object class="AtkObject" id="sun_button-atkobject"> + <property name="AtkObject::accessible-name" translatable="yes">Sunday</property> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">6</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">GTK_FILL</property> + <property name="y_options">GTK_FILL</property> + </packing> + </child> + <child> + <object class="GtkComboBox" id="week_start_day"> + <property name="visible">True</property> + <property name="model">model1</property> + <child> + <object class="GtkCellRendererText" id="renderer1"/> + <attributes> + <attribute name="text">0</attribute> + </attributes> + </child> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="x_options">GTK_FILL</property> + <property name="y_options">GTK_FILL</property> + </packing> + </child> + <child> + <object class="GtkHBox" id="hbox13"> + <property name="visible">True</property> + <property name="spacing">12</property> + <child> + <object class="EDateEdit" id="start_of_day"> + <property name="visible">True</property> + <property name="show_date">False</property> + <property name="show_week_numbers">False</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="day_end_label"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Day _ends:</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="pack_type">end</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="EDateEdit" id="end_of_day"> + <property name="visible">True</property> + <property name="show_date">False</property> + <property name="show_week_numbers">False</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="pack_type">end</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="y_options">GTK_FILL</property> + </packing> + </child> + </object> + <packing> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="position">3</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label6"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Alerts</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">4</property> + </packing> + </child> + <child> + <object class="GtkHBox" id="hbox3"> + <property name="visible">True</property> + <property name="spacing">12</property> + <child> + <object class="GtkLabel" id="label9"> + <property name="visible">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkVBox" id="alerts"> + <property name="visible">True</property> + <property name="spacing">6</property> + <child> + <object class="GtkCheckButton" id="confirm_delete"> + <property name="label" translatable="yes">_Ask for confirmation when deleting items</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkHBox" id="hbox6"> + <property name="visible">True</property> + <property name="spacing">4</property> + <child> + <object class="GtkCheckButton" id="default_reminder"> + <property name="label" translatable="yes" comments="This is the first half of a user preference. "Show a reminder [time-period] before every appointment"">Sh_ow a reminder</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="default_reminder_interval"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="adjustment">adjustment1</property> + <property name="climb_rate">1</property> + </object> + <packing> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkComboBox" id="default_reminder_units"> + <property name="visible">True</property> + <property name="model">model2</property> + <child> + <object class="GtkCellRendererText" id="renderer2"/> + <attributes> + <attribute name="text">0</attribute> + </attributes> + </child> + </object> + <packing> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label16"> + <property name="visible">True</property> + <property name="label" translatable="yes" comments="This is the last half of a user preference. "Show a reminder [time-period] before every appointment"">before every appointment</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">3</property> + </packing> + </child> + </object> + <packing> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkHBox" id="hbox7"> + <property name="visible">True</property> + <property name="spacing">4</property> + <child> + <object class="GtkCheckButton" id="ba_reminder"> + <property name="label" translatable="yes" comments="This is the first half of a user preference. "Show a reminder [time-period] before every anniversary/birthday"">Show a _reminder</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="ba_reminder_interval"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="adjustment">adjustment2</property> + <property name="climb_rate">1</property> + </object> + <packing> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkComboBox" id="ba_reminder_units"> + <property name="visible">True</property> + <property name="model">model3</property> + <child> + <object class="GtkCellRendererText" id="renderer3"/> + <attributes> + <attribute name="text">0</attribute> + </attributes> + </child> + </object> + <packing> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="ba_reminder_label"> + <property name="visible">True</property> + <property name="label" translatable="yes" comments="This is the last half of a user preference. "Show a reminder [time-period] before every anniversary/birthday"">before every anniversary/birthday</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">3</property> + </packing> + </child> + </object> + <packing> + <property name="position">2</property> + </packing> + </child> + </object> + <packing> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="position">5</property> + </packing> + </child> + </object> + </child> + <child type="tab"> + <object class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="label" translatable="yes">General</property> + </object> + <packing> + <property name="tab_fill">False</property> + </packing> + </child> + <child> + <object class="GtkVBox" id="display"> + <property name="visible">True</property> + <property name="border_width">12</property> + <property name="spacing">12</property> + <child> + <object class="GtkLabel" id="label17"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">General</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkHBox" id="hbox8"> + <property name="visible">True</property> + <property name="spacing">12</property> + <child> + <object class="GtkLabel" id="label19"> + <property name="visible">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkVBox" id="displayGeneral"> + <property name="visible">True</property> + <property name="spacing">6</property> + <child> + <object class="GtkHBox" id="hbox_time_divisions"> + <property name="visible">True</property> + <property name="spacing">6</property> + <child> + <object class="GtkLabel" id="label23"> + <property name="visible">True</property> + <property name="label" translatable="yes">_Time divisions:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">time_divisions</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkComboBox" id="time_divisions"> + <property name="visible">True</property> + <property name="model">model4</property> + <child> + <object class="GtkCellRendererText" id="renderer4"/> + <attributes> + <attribute name="text">0</attribute> + </attributes> + </child> + </object> + <packing> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="show_end_times"> + <property name="label" translatable="yes">_Show appointment end times in week and month view</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="compress_weekend"> + <property name="label" translatable="yes">_Compress weekends in month view</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="show_week_numbers"> + <property name="label" translatable="yes">Show week _numbers</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">3</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="recur_events_italic"> + <property name="label" translatable="yes">Show r_ecurring events in italic in bottom left calendar</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">4</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="month_scroll_by_week"> + <property name="label" translatable="yes">Sc_roll Month View by a week</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">5</property> + </packing> + </child> + </object> + <packing> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label18"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Task List</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkHBox" id="hbox9"> + <property name="visible">True</property> + <property name="spacing">12</property> + <child> + <object class="GtkLabel" id="label20"> + <property name="visible">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkVBox" id="taskList"> + <property name="visible">True</property> + <property name="spacing">6</property> + <child> + <object class="GtkHBox" id="hbox14"> + <property name="visible">True</property> + <property name="spacing">12</property> + <child> + <object class="GtkLabel" id="label21"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">T_asks due today:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">tasks_due_today_color</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkColorButton" id="tasks_due_today_color"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="title" translatable="yes">Pick a color</property> + <property name="color">#000000000000</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label22"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">_Overdue tasks:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">tasks_overdue_color</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="pack_type">end</property> + <property name="position">3</property> + </packing> + </child> + <child> + <object class="GtkColorButton" id="tasks_overdue_color"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="title" translatable="yes">Pick a color</property> + <property name="color">#000000000000</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="pack_type">end</property> + <property name="position">2</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkHBox" id="hbox11"> + <property name="visible">True</property> + <property name="spacing">6</property> + <child> + <object class="GtkCheckButton" id="tasks_hide_completed"> + <property name="label" translatable="yes">_Hide completed tasks after</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="tasks_hide_completed_interval"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="adjustment">adjustment3</property> + <property name="climb_rate">1</property> + </object> + <packing> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkComboBox" id="tasks_hide_completed_units"> + <property name="visible">True</property> + <property name="model">model5</property> + <child> + <object class="GtkCellRendererText" id="renderer5"/> + <attributes> + <attribute name="text">0</attribute> + </attributes> + </child> + </object> + <packing> + <property name="position">2</property> + </packing> + </child> + </object> + <packing> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="position">3</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label65"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Date/Time Format</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">4</property> + </packing> + </child> + <child> + <object class="GtkHBox" id="hbox27"> + <property name="visible">True</property> + <property name="spacing">12</property> + <child> + <object class="GtkLabel" id="label66"> + <property name="visible">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkTable" id="datetime_format_table"> + <property name="visible">True</property> + <property name="n_columns">3</property> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="position">5</property> + </packing> + </child> + </object> + <packing> + <property name="position">1</property> + </packing> + </child> + <child type="tab"> + <object class="GtkLabel" id="label2"> + <property name="visible">True</property> + <property name="label" translatable="yes">Display</property> + </object> + <packing> + <property name="position">1</property> + <property name="tab_fill">False</property> + </packing> + </child> + <child> + <object class="GtkVBox" id="alarms"> + <property name="visible">True</property> + <property name="border_width">12</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> + <child> + <object class="GtkLabel" id="label67"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Alarms</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkAlignment" id="alignment1"> + <property name="visible">True</property> + <property name="left_padding">10</property> + <child> + <object class="GtkCheckButton" id="notify_with_tray"> + <property name="label" translatable="yes">Display alarms in _notification area only</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label62"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Select the calendars for alarm notification</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkScrolledWindow" id="calendar-source-scrolled-window"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hscrollbar_policy">automatic</property> + <property name="vscrollbar_policy">automatic</property> + <property name="shadow_type">in</property> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="position">3</property> + </packing> + </child> + </object> + <packing> + <property name="position">2</property> + </packing> + </child> + <child type="tab"> + <object class="GtkLabel" id="alarm-label"> + <property name="visible">True</property> + <property name="label" translatable="yes">Alarms</property> + </object> + <packing> + <property name="position">2</property> + <property name="tab_fill">False</property> + </packing> + </child> + <child> + <object class="GtkVBox" id="freebusy"> + <property name="visible">True</property> + <property name="border_width">12</property> + <property name="orientation">vertical</property> + <property name="spacing">12</property> + <child> + <object class="GtkLabel" id="default-freebusy-header"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Default Free/Busy Server</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkAlignment" id="default-freebusy-alignment"> + <property name="visible">True</property> + <property name="left_padding">12</property> + <child> + <object class="GtkVBox" id="default-freebusy-vbox"> + <property name="visible">True</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> + <child> + <object class="GtkHBox" id="hbox18"> + <property name="visible">True</property> + <property name="spacing">6</property> + <child> + <object class="GtkLabel" id="label33"> + <property name="visible">True</property> + <property name="label" translatable="yes">Template:</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="template_url"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="invisible_char">●</property> + </object> + <packing> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label32"> + <property name="visible">True</property> + <property name="label" translatable="yes">%u and %d will be replaced by user and domain from the email address.</property> + <property name="wrap">True</property> + <attributes> + <attribute name="style" value="italic"/> + </attributes> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">1</property> + </packing> + </child> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="position">3</property> + </packing> + </child> + <child type="tab"> + <object class="GtkLabel" id="label3"> + <property name="visible">True</property> + <property name="label" translatable="yes">Free/Busy</property> + </object> + <packing> + <property name="position">3</property> + <property name="tab_fill">False</property> + </packing> + </child> + </object> + <object class="GtkSizeGroup" id="day_begins_ends_sizegroup"> + <widgets> + <widget name="day_end_label"/> + <widget name="day_start_label"/> + </widgets> + </object> +</interface> 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 <libedataserver/e-source-group.h> #include <libedataserver/e-source-list.h> -#include "calendar/gui/calendar-config.h" #include "calendar/gui/calendar-config-keys.h" #include "shell/e-shell.h" +#include "e-memo-shell-backend.h" + #define WEBCAL_BASE_URI "webcal://" #define PERSONAL_RELATIVE_URI "system" #define GROUPWISE_BASE_URI "groupwise://" static void create_memo_sources (EShellBackend *shell_backend, - ESourceList *source_list, - ESourceGroup **on_this_computer, - ESourceGroup **on_the_web, - ESource **personal_source) + ESourceList *source_list, + ESourceGroup **on_this_computer, + ESourceGroup **on_the_web, + ESource **personal_source) { EShell *shell; EShellSettings *shell_settings; @@ -106,6 +107,7 @@ create_memo_sources (EShellBackend *shell_backend, } if (!*personal_source) { + GSList *selected; gchar *primary_memo_list; /* Create the default Person memo list */ @@ -115,18 +117,26 @@ create_memo_sources (EShellBackend *shell_backend, primary_memo_list = e_shell_settings_get_string ( shell_settings, "cal-primary-memo-list"); - if (!primary_memo_list && !calendar_config_get_memos_selected ()) { - GSList selected; + selected = e_memo_shell_backend_get_selected_memo_lists ( + E_MEMO_SHELL_BACKEND (shell_backend)); + + if (primary_memo_list == NULL && selected == NULL) { + GSList link; e_shell_settings_set_string ( shell_settings, "cal-primary-memo-list", e_source_peek_uid (source)); - selected.data = (gpointer)e_source_peek_uid (source); - selected.next = NULL; - calendar_config_set_memos_selected (&selected); + link.data = (gpointer)e_source_peek_uid (source); + link.next = NULL; + + e_memo_shell_backend_set_selected_memo_lists ( + E_MEMO_SHELL_BACKEND (shell_backend), &link); } + g_slist_foreach (selected, (GFunc) g_free, NULL); + g_slist_free (selected); + e_source_set_color_spec (source, "#BECEDD"); *personal_source = source; } @@ -212,10 +222,10 @@ add_gw_esource (ESourceList *source_list, const gchar *group_name, const gchar gboolean e_memo_shell_backend_migrate (EShellBackend *shell_backend, - gint major, - gint minor, - gint revision, - GError **error) + gint major, + gint minor, + gint revision, + GError **error) { ESourceGroup *on_this_computer = NULL; ESourceGroup *on_the_web = NULL; diff --git a/modules/calendar/e-memo-shell-sidebar.c b/modules/calendar/e-memo-shell-sidebar.c index 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 <libedataserver/e-xml-utils.h> #include "e-util/e-util-private.h" -#include "calendar/gui/calendar-config.h" #include "calendar/gui/calendar-config-keys.h" #include "shell/e-shell.h" +#include "e-task-shell-backend.h" + #define WEBCAL_BASE_URI "webcal://" #define PERSONAL_RELATIVE_URI "system" static void create_task_sources (EShellBackend *shell_backend, - ESourceList *source_list, - ESourceGroup **on_this_computer, - ESourceGroup **on_the_web, - ESource **personal_source) + ESourceList *source_list, + ESourceGroup **on_this_computer, + ESourceGroup **on_the_web, + ESource **personal_source) { EShell *shell; EShellSettings *shell_settings; @@ -115,6 +116,7 @@ create_task_sources (EShellBackend *shell_backend, } if (!*personal_source) { + GSList *selected; gchar *primary_task_list; /* Create the default Person task list */ @@ -124,18 +126,26 @@ create_task_sources (EShellBackend *shell_backend, primary_task_list = e_shell_settings_get_string ( shell_settings, "cal-primary-task-list"); - if (!primary_task_list && !calendar_config_get_tasks_selected ()) { - GSList selected; + selected = e_task_shell_backend_get_selected_task_lists ( + E_TASK_SHELL_BACKEND (shell_backend)); + + if (primary_task_list == NULL && selected == NULL) { + GSList link; e_shell_settings_set_string ( shell_settings, "cal-primary-task-list", e_source_peek_uid (source)); - selected.data = (gpointer)e_source_peek_uid (source); - selected.next = NULL; - calendar_config_set_tasks_selected (&selected); + link.data = (gpointer)e_source_peek_uid (source); + link.next = NULL; + + e_task_shell_backend_set_selected_task_lists ( + E_TASK_SHELL_BACKEND (shell_backend), &link); } + g_slist_foreach (selected, (GFunc) g_free, NULL); + g_slist_free (selected); + e_source_set_color_spec (source, "#BECEDD"); *personal_source = source; } @@ -154,10 +164,10 @@ create_task_sources (EShellBackend *shell_backend, gboolean e_task_shell_backend_migrate (EShellBackend *shell_backend, - gint major, - gint minor, - gint micro, - GError **error) + gint major, + gint minor, + gint micro, + GError **error) { ESourceGroup *on_this_computer = NULL; ESourceGroup *on_the_web = NULL; diff --git a/modules/calendar/e-task-shell-sidebar.c b/modules/calendar/e-task-shell-sidebar.c index 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 |