aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/modules/e-cal-shell-module.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-04-26 07:37:21 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-04-26 07:37:21 +0800
commitd261d0b2e46d4793c2d54540782552846535eb60 (patch)
tree5e37dd30639f8ae27c298ccdbbe4cb18d79b0830 /calendar/modules/e-cal-shell-module.c
parentdc7efb1311d23c32a76a9a8092f734223ce3207e (diff)
downloadgsoc2013-evolution-d261d0b2e46d4793c2d54540782552846535eb60.tar
gsoc2013-evolution-d261d0b2e46d4793c2d54540782552846535eb60.tar.gz
gsoc2013-evolution-d261d0b2e46d4793c2d54540782552846535eb60.tar.bz2
gsoc2013-evolution-d261d0b2e46d4793c2d54540782552846535eb60.tar.lz
gsoc2013-evolution-d261d0b2e46d4793c2d54540782552846535eb60.tar.xz
gsoc2013-evolution-d261d0b2e46d4793c2d54540782552846535eb60.tar.zst
gsoc2013-evolution-d261d0b2e46d4793c2d54540782552846535eb60.zip
Begin migrating calendar settings to EShellSettings.
Begin dismantling calendar-config.c and migrating calendar settings to EShellSettings. EShellSettings utilizes GObject properties instead of separate get/set/notify functions for each setting.
Diffstat (limited to 'calendar/modules/e-cal-shell-module.c')
-rw-r--r--calendar/modules/e-cal-shell-module.c33
1 files changed, 28 insertions, 5 deletions
diff --git a/calendar/modules/e-cal-shell-module.c b/calendar/modules/e-cal-shell-module.c
index 15b5af2d20..a73f0b5960 100644
--- a/calendar/modules/e-cal-shell-module.c
+++ b/calendar/modules/e-cal-shell-module.c
@@ -46,6 +46,7 @@
#include "e-cal-shell-view.h"
#include "e-cal-shell-module-migrate.h"
+#include "e-cal-shell-module-settings.h"
#define MODULE_NAME "calendar"
#define MODULE_ALIASES ""
@@ -73,6 +74,8 @@ cal_shell_module_ensure_sources (EShellModule *shell_module)
ESourceGroup *weather;
ESource *birthdays;
ESource *personal;
+ EShell *shell;
+ EShellSettings *shell_settings;
GSList *groups, *iter;
const gchar *data_dir;
const gchar *name;
@@ -87,6 +90,9 @@ cal_shell_module_ensure_sources (EShellModule *shell_module)
birthdays = NULL;
personal = NULL;
+ shell = e_shell_module_get_shell (shell_module);
+ shell_settings = e_shell_get_shell_settings (shell);
+
if (!e_cal_get_sources (&source_list, E_CAL_SOURCE_TYPE_EVENT, NULL)) {
g_warning ("Could not get calendar sources from GConf!");
return;
@@ -195,7 +201,9 @@ cal_shell_module_ensure_sources (EShellModule *shell_module)
e_source_group_add_source (on_this_computer, source, -1);
g_object_unref (source);
- primary = calendar_config_get_primary_calendar ();
+ primary = e_shell_settings_get_string (
+ shell_settings, "cal-primary-calendar");
+
selected = calendar_config_get_calendars_selected ();
if (primary == NULL && selected == NULL) {
@@ -204,7 +212,8 @@ cal_shell_module_ensure_sources (EShellModule *shell_module)
uid = e_source_peek_uid (source);
selected = g_slist_prepend (NULL, g_strdup (uid));
- calendar_config_set_primary_calendar (uid);
+ e_shell_settings_set_string (
+ shell_settings, "cal-primary-calendar", uid);
calendar_config_set_calendars_selected (selected);
}
@@ -321,12 +330,16 @@ cal_shell_module_cal_opened_cb (ECal *cal,
ECalendarStatus status,
GtkAction *action)
{
+ EShell *shell;
ECalComponent *comp;
CompEditor *editor;
CompEditorFlags flags = 0;
const gchar *action_name;
gboolean all_day;
+ /* FIXME Pass this in. */
+ shell = e_shell_get_default ();
+
/* XXX Handle errors better. */
if (status != E_CALENDAR_STATUS_OK)
return;
@@ -340,7 +353,7 @@ cal_shell_module_cal_opened_cb (ECal *cal,
all_day = (strcmp (action_name, "event-all-day-new") == 0);
- editor = event_editor_new (cal, flags);
+ editor = event_editor_new (cal, shell, flags);
comp = cal_comp_event_new_with_current_time (cal, all_day);
comp_editor_edit_comp (editor, comp);
@@ -357,18 +370,24 @@ action_event_new_cb (GtkAction *action,
ECal *cal = NULL;
ECalSourceType source_type;
ESourceList *source_list;
+ EShellSettings *shell_settings;
+ EShell *shell;
gchar *uid;
/* This callback is used for both appointments and meetings. */
source_type = E_CAL_SOURCE_TYPE_EVENT;
+ shell = e_shell_window_get_shell (shell_window);
+ shell_settings = e_shell_get_shell_settings (shell);
+
if (!e_cal_get_sources (&source_list, source_type, NULL)) {
g_warning ("Could not get calendar sources from GConf!");
return;
}
- uid = calendar_config_get_primary_calendar ();
+ uid = e_shell_settings_get_string (
+ shell_settings, "cal-primary-calendar");
if (uid != NULL) {
ESource *source;
@@ -469,7 +488,7 @@ cal_shell_module_init_preferences (EShell *shell)
"calendar-and-tasks",
"preferences-calendar-and-tasks",
_("Calendar and Tasks"),
- calendar_prefs_dialog_new (),
+ calendar_prefs_dialog_new (shell),
600);
}
@@ -541,6 +560,10 @@ e_shell_module_init (GTypeModule *type_module)
cal_shell_module_init_hooks ();
cal_shell_module_init_importers ();
+
+ /* Initialize settings before initializing preferences,
+ * since the preferences bind to the shell settings. */
+ e_cal_shell_module_init_settings (shell);
cal_shell_module_init_preferences (shell);
e_attachment_handler_calendar_get_type ();