diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2009-08-12 21:29:44 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2009-08-12 21:29:44 +0800 |
commit | 9199f2c5b1925b6d1092738bf1a1c026e53d37f0 (patch) | |
tree | ef8107588f14a9baeba47097b9fff61b8c054057 /modules/calendar | |
parent | e68456f60f37d5d6e18fac95a5a9ddea2e9627fa (diff) | |
download | gsoc2013-evolution-9199f2c5b1925b6d1092738bf1a1c026e53d37f0.tar.gz gsoc2013-evolution-9199f2c5b1925b6d1092738bf1a1c026e53d37f0.tar.zst gsoc2013-evolution-9199f2c5b1925b6d1092738bf1a1c026e53d37f0.zip |
Get the itip-formatter plugin working.
Diffstat (limited to 'modules/calendar')
-rw-r--r-- | modules/calendar/e-cal-shell-settings.c | 8 | ||||
-rw-r--r-- | modules/calendar/e-cal-shell-sidebar.c | 4 | ||||
-rw-r--r-- | modules/calendar/e-memo-shell-backend.c | 78 | ||||
-rw-r--r-- | modules/calendar/e-memo-shell-migrate.c | 19 | ||||
-rw-r--r-- | modules/calendar/e-memo-shell-sidebar.c | 26 | ||||
-rw-r--r-- | modules/calendar/e-task-shell-backend.c | 78 | ||||
-rw-r--r-- | modules/calendar/e-task-shell-migrate.c | 17 | ||||
-rw-r--r-- | modules/calendar/e-task-shell-sidebar.c | 26 |
8 files changed, 202 insertions, 54 deletions
diff --git a/modules/calendar/e-cal-shell-settings.c b/modules/calendar/e-cal-shell-settings.c index 4d75bae4e9..be50c8e7b3 100644 --- a/modules/calendar/e-cal-shell-settings.c +++ b/modules/calendar/e-cal-shell-settings.c @@ -525,6 +525,14 @@ e_cal_shell_backend_init_settings (EShell *shell) "/apps/evolution/calendar/display/primary_calendar"); e_shell_settings_install_property_for_key ( + "cal-primary-memo-list", + "/apps/evolution/calendar/memos/primary_memos"); + + e_shell_settings_install_property_for_key ( + "cal-primary-task-list", + "/apps/evolution/calendar/tasks/primary_tasks"); + + e_shell_settings_install_property_for_key ( "cal-show-event-end-times", "/apps/evolution/calendar/display/show_event_end"); diff --git a/modules/calendar/e-cal-shell-sidebar.c b/modules/calendar/e-cal-shell-sidebar.c index 28f96e553d..f8f6acae9b 100644 --- a/modules/calendar/e-cal-shell-sidebar.c +++ b/modules/calendar/e-cal-shell-sidebar.c @@ -368,7 +368,6 @@ cal_shell_sidebar_constructed (GObject *object) ECalShellSidebarPrivate *priv; EShell *shell; EShellView *shell_view; - EShellWindow *shell_window; EShellBackend *shell_backend; EShellSidebar *shell_sidebar; EShellSettings *shell_settings; @@ -393,9 +392,8 @@ cal_shell_sidebar_constructed (GObject *object) shell_sidebar = E_SHELL_SIDEBAR (object); shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); shell_backend = e_shell_view_get_shell_backend (shell_view); - shell_window = e_shell_view_get_shell_window (shell_view); - shell = e_shell_window_get_shell (shell_window); + shell = e_shell_backend_get_shell (shell_backend); shell_settings = e_shell_get_shell_settings (shell); source_list = e_cal_shell_backend_get_source_list ( diff --git a/modules/calendar/e-memo-shell-backend.c b/modules/calendar/e-memo-shell-backend.c index dc072e3062..9642528b78 100644 --- a/modules/calendar/e-memo-shell-backend.c +++ b/modules/calendar/e-memo-shell-backend.c @@ -71,6 +71,8 @@ memo_module_ensure_sources (EShellBackend *shell_backend) ESourceGroup *on_this_computer; ESourceGroup *on_the_web; ESource *personal; + EShell *shell; + EShellSettings *shell_settings; GSList *groups, *iter; const gchar *data_dir; const gchar *name; @@ -83,6 +85,9 @@ memo_module_ensure_sources (EShellBackend *shell_backend) priv = E_MEMO_SHELL_BACKEND_GET_PRIVATE (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)) { g_warning ("Could not get memo sources from GConf!"); return; @@ -172,7 +177,9 @@ memo_module_ensure_sources (EShellBackend *shell_backend) e_source_group_add_source (on_this_computer, source, -1); g_object_unref (source); - primary = calendar_config_get_primary_memos (); + primary = e_shell_settings_get_string ( + shell_settings, "cal-primary-memo-list"); + selected = calendar_config_get_memos_selected (); if (primary == NULL && selected == NULL) { @@ -181,7 +188,8 @@ memo_module_ensure_sources (EShellBackend *shell_backend) uid = e_source_peek_uid (source); selected = g_slist_prepend (NULL, g_strdup (uid)); - calendar_config_set_primary_memos (uid); + e_shell_settings_set_string ( + shell_settings, "cal-primary-memo-list", uid); calendar_config_set_memos_selected (selected); } @@ -210,30 +218,46 @@ memo_module_ensure_sources (EShellBackend *shell_backend) } static void -memo_module_cal_opened_cb (ECal *cal, - ECalendarStatus status, - GtkAction *action) +memo_shell_backend_memo_new_cb (ECal *cal, + ECalendarStatus status, + EShell *shell) { - EShell *shell; ECalComponent *comp; CompEditor *editor; CompEditorFlags flags = 0; - const gchar *action_name; - - /* FIXME Pass this in. */ - shell = e_shell_get_default (); /* XXX Handle errors better. */ if (status != E_CALENDAR_STATUS_OK) return; - action_name = gtk_action_get_name (action); + flags |= COMP_EDITOR_NEW_ITEM; + + editor = memo_editor_new (cal, shell, flags); + comp = cal_comp_memo_new_with_defaults (cal); + comp_editor_edit_comp (editor, comp); + + gtk_window_present (GTK_WINDOW (editor)); + + g_object_unref (comp); + g_object_unref (cal); +} + +static void +memo_shell_backend_memo_shared_new_cb (ECal *cal, + ECalendarStatus status, + EShell *shell) +{ + ECalComponent *comp; + CompEditor *editor; + CompEditorFlags flags = 0; + + /* XXX Handle errors better. */ + if (status != E_CALENDAR_STATUS_OK) + return; flags |= COMP_EDITOR_NEW_ITEM; - if (strcmp (action_name, "memo-shared-new") == 0) { - flags |= COMP_EDITOR_IS_SHARED; - flags |= COMP_EDITOR_USER_ORG; - } + flags |= COMP_EDITOR_IS_SHARED; + flags |= COMP_EDITOR_USER_ORG; editor = memo_editor_new (cal, shell, flags); comp = cal_comp_memo_new_with_defaults (cal); @@ -252,18 +276,25 @@ action_memo_new_cb (GtkAction *action, ECal *cal = NULL; ECalSourceType source_type; ESourceList *source_list; + EShellSettings *shell_settings; + EShell *shell; + const gchar *action_name; gchar *uid; /* This callback is used for both memos and shared memos. */ source_type = E_CAL_SOURCE_TYPE_JOURNAL; + 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 memo sources from GConf!"); return; } - uid = calendar_config_get_primary_memos (); + uid = e_shell_settings_get_string ( + shell_settings, "cal-primary-memo-list"); if (uid != NULL) { ESource *source; @@ -279,9 +310,18 @@ action_memo_new_cb (GtkAction *action, g_return_if_fail (cal != NULL); - g_signal_connect ( - cal, "cal-opened", - G_CALLBACK (memo_module_cal_opened_cb), action); + /* Connect the appropriate signal handler. */ + action_name = gtk_action_get_name (action); + if (strcmp (action_name, "memo-shared-new") == 0) + g_signal_connect ( + cal, "cal-opened", + G_CALLBACK (memo_shell_backend_memo_shared_new_cb), + shell); + else + g_signal_connect ( + cal, "cal-opened", + G_CALLBACK (memo_shell_backend_memo_new_cb), + shell); e_cal_open_async (cal, FALSE); } diff --git a/modules/calendar/e-memo-shell-migrate.c b/modules/calendar/e-memo-shell-migrate.c index 20b9fea43e..d2dce309d7 100644 --- a/modules/calendar/e-memo-shell-migrate.c +++ b/modules/calendar/e-memo-shell-migrate.c @@ -32,6 +32,7 @@ #include "calendar/gui/calendar-config.h" #include "calendar/gui/calendar-config-keys.h" +#include "shell/e-shell.h" #define WEBCAL_BASE_URI "webcal://" #define PERSONAL_RELATIVE_URI "system" @@ -44,6 +45,8 @@ create_memo_sources (EShellBackend *shell_backend, ESourceGroup **on_the_web, ESource **personal_source) { + EShell *shell; + EShellSettings *shell_settings; GSList *groups; ESourceGroup *group; gchar *base_uri, *base_uri_proto; @@ -53,6 +56,9 @@ create_memo_sources (EShellBackend *shell_backend, *on_the_web = NULL; *personal_source = NULL; + shell = e_shell_backend_get_shell (shell_backend); + shell_settings = e_shell_get_shell_settings (shell); + base_dir = e_shell_backend_get_config_dir (shell_backend); base_uri = g_build_filename (base_dir, "local", NULL); @@ -100,14 +106,21 @@ create_memo_sources (EShellBackend *shell_backend, } if (!*personal_source) { - /* Create the default Person task list */ + gchar *primary_memo_list; + + /* Create the default Person memo list */ ESource *source = e_source_new (_("Personal"), PERSONAL_RELATIVE_URI); e_source_group_add_source (*on_this_computer, source, -1); - if (!calendar_config_get_primary_memos () && !calendar_config_get_memos_selected ()) { + 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; - calendar_config_set_primary_memos (e_source_peek_uid (source)); + 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; diff --git a/modules/calendar/e-memo-shell-sidebar.c b/modules/calendar/e-memo-shell-sidebar.c index 0962a8a20d..33a2226c00 100644 --- a/modules/calendar/e-memo-shell-sidebar.c +++ b/modules/calendar/e-memo-shell-sidebar.c @@ -271,8 +271,12 @@ static void memo_shell_sidebar_primary_selection_changed_cb (EMemoShellSidebar *memo_shell_sidebar, ESourceSelector *selector) { + EShell *shell; + EShellView *shell_view; + EShellWindow *shell_window; + EShellSidebar *shell_sidebar; + EShellSettings *shell_settings; ESource *source; - const gchar *uid; /* XXX ESourceSelector needs a "primary-selection-uid" property * so we can just bind the property with GConfBridge. */ @@ -281,8 +285,16 @@ memo_shell_sidebar_primary_selection_changed_cb (EMemoShellSidebar *memo_shell_s if (source == NULL) return; - uid = e_source_peek_uid (source); - calendar_config_set_primary_memos (uid); + shell_sidebar = E_SHELL_SIDEBAR (memo_shell_sidebar); + shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); + 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); + + e_shell_settings_set_string ( + shell_settings, "cal-primary-memo-list", + e_source_peek_uid (source)); } static void @@ -337,9 +349,11 @@ static void memo_shell_sidebar_constructed (GObject *object) { EMemoShellSidebarPrivate *priv; + EShell *shell; EShellView *shell_view; EShellBackend *shell_backend; EShellSidebar *shell_sidebar; + EShellSettings *shell_settings; ESourceSelector *selector; ESourceList *source_list; ESource *source; @@ -359,6 +373,9 @@ memo_shell_sidebar_constructed (GObject *object) shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); shell_backend = e_shell_view_get_shell_backend (shell_view); + shell = e_shell_backend_get_shell (shell_backend); + shell_settings = e_shell_get_shell_settings (shell); + source_list = e_memo_shell_backend_get_source_list ( E_MEMO_SHELL_BACKEND (shell_backend)); @@ -394,7 +411,8 @@ memo_shell_sidebar_constructed (GObject *object) object); source = NULL; - uid = calendar_config_get_primary_memos (); + uid = e_shell_settings_get_string ( + shell_settings, "cal-primary-memo-list"); if (uid != NULL) source = e_source_list_peek_source_by_uid (source_list, uid); if (source == NULL) diff --git a/modules/calendar/e-task-shell-backend.c b/modules/calendar/e-task-shell-backend.c index b9280c7373..23d5e35d7b 100644 --- a/modules/calendar/e-task-shell-backend.c +++ b/modules/calendar/e-task-shell-backend.c @@ -73,6 +73,8 @@ task_module_ensure_sources (EShellBackend *shell_backend) ESourceGroup *on_this_computer; ESourceGroup *on_the_web; ESource *personal; + EShell *shell; + EShellSettings *shell_settings; GSList *groups, *iter; const gchar *data_dir; const gchar *name; @@ -85,6 +87,9 @@ task_module_ensure_sources (EShellBackend *shell_backend) priv = E_TASK_SHELL_BACKEND_GET_PRIVATE (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)) { g_warning ("Could not get task sources from GConf!"); return; @@ -174,7 +179,9 @@ task_module_ensure_sources (EShellBackend *shell_backend) e_source_group_add_source (on_this_computer, source, -1); g_object_unref (source); - primary = calendar_config_get_primary_tasks (); + primary = e_shell_settings_get_string ( + shell_settings, "cal-primary-task-list"); + selected = calendar_config_get_tasks_selected (); if (primary == NULL && selected == NULL) { @@ -183,7 +190,8 @@ task_module_ensure_sources (EShellBackend *shell_backend) uid = e_source_peek_uid (source); selected = g_slist_prepend (NULL, g_strdup (uid)); - calendar_config_set_primary_tasks (uid); + e_shell_settings_set_string ( + shell_settings, "cal-primary-task-list", uid); calendar_config_set_tasks_selected (selected); } @@ -212,30 +220,46 @@ task_module_ensure_sources (EShellBackend *shell_backend) } static void -task_module_cal_opened_cb (ECal *cal, - ECalendarStatus status, - GtkAction *action) +task_shell_backend_task_new_cb (ECal *cal, + ECalendarStatus status, + EShell *shell) { - EShell *shell; ECalComponent *comp; CompEditor *editor; CompEditorFlags flags = 0; - const gchar *action_name; - - /* FIXME Pass this in. */ - shell = e_shell_get_default (); /* XXX Handle errors better. */ if (status != E_CALENDAR_STATUS_OK) return; - action_name = gtk_action_get_name (action); + flags |= COMP_EDITOR_NEW_ITEM; + + editor = task_editor_new (cal, shell, flags); + comp = cal_comp_task_new_with_defaults (cal); + comp_editor_edit_comp (editor, comp); + + gtk_window_present (GTK_WINDOW (editor)); + + g_object_unref (comp); + g_object_unref (cal); +} + +static void +task_shell_backend_task_assigned_new_cb (ECal *cal, + ECalendarStatus status, + EShell *shell) +{ + ECalComponent *comp; + CompEditor *editor; + CompEditorFlags flags = 0; + + /* XXX Handle errors better. */ + if (status != E_CALENDAR_STATUS_OK) + return; flags |= COMP_EDITOR_NEW_ITEM; - if (strcmp (action_name, "task-assigned-new") == 0) { - flags |= COMP_EDITOR_IS_ASSIGNED; - flags |= COMP_EDITOR_USER_ORG; - } + flags |= COMP_EDITOR_IS_ASSIGNED; + flags |= COMP_EDITOR_USER_ORG; editor = task_editor_new (cal, shell, flags); comp = cal_comp_task_new_with_defaults (cal); @@ -254,18 +278,25 @@ action_task_new_cb (GtkAction *action, ECal *cal = NULL; ECalSourceType source_type; ESourceList *source_list; + EShellSettings *shell_settings; + EShell *shell; + const gchar *action_name; gchar *uid; /* This callback is used for both tasks and assigned tasks. */ source_type = E_CAL_SOURCE_TYPE_TODO; + 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 task sources from GConf!"); return; } - uid = calendar_config_get_primary_tasks (); + uid = e_shell_settings_get_string ( + shell_settings, "cal-primary-task-list"); if (uid != NULL) { ESource *source; @@ -281,9 +312,18 @@ action_task_new_cb (GtkAction *action, g_return_if_fail (cal != NULL); - g_signal_connect ( - cal, "cal-opened", - G_CALLBACK (task_module_cal_opened_cb), action); + /* Connect the appropriate signal handler. */ + action_name = gtk_action_get_name (action); + if (strcmp (action_name, "task-assigned-new") == 0) + g_signal_connect ( + cal, "cal-opened", + G_CALLBACK (task_shell_backend_task_assigned_new_cb), + shell); + else + g_signal_connect ( + cal, "cal-opened", + G_CALLBACK (task_shell_backend_task_new_cb), + shell); e_cal_open_async (cal, FALSE); } diff --git a/modules/calendar/e-task-shell-migrate.c b/modules/calendar/e-task-shell-migrate.c index 2e7928fd14..4bbaee65a6 100644 --- a/modules/calendar/e-task-shell-migrate.c +++ b/modules/calendar/e-task-shell-migrate.c @@ -42,6 +42,7 @@ #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" #define WEBCAL_BASE_URI "webcal://" #define PERSONAL_RELATIVE_URI "system" @@ -443,6 +444,8 @@ create_task_sources (EShellBackend *shell_backend, ESourceGroup **on_the_web, ESource **personal_source) { + EShell *shell; + EShellSettings *shell_settings; GSList *groups; ESourceGroup *group; gchar *base_uri, *base_uri_proto; @@ -452,6 +455,9 @@ create_task_sources (EShellBackend *shell_backend, *on_the_web = NULL; *personal_source = NULL; + shell = e_shell_backend_get_shell (shell_backend); + shell_settings = e_shell_get_shell_settings (shell); + base_dir = e_shell_backend_get_config_dir (shell_backend); base_uri = g_build_filename (base_dir, "local", NULL); @@ -499,14 +505,21 @@ create_task_sources (EShellBackend *shell_backend, } if (!*personal_source) { + gchar *primary_task_list; + /* Create the default Person task list */ ESource *source = e_source_new (_("Personal"), PERSONAL_RELATIVE_URI); e_source_group_add_source (*on_this_computer, source, -1); - if (!calendar_config_get_primary_tasks () && !calendar_config_get_tasks_selected ()) { + 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; - calendar_config_set_primary_tasks (e_source_peek_uid (source)); + 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; diff --git a/modules/calendar/e-task-shell-sidebar.c b/modules/calendar/e-task-shell-sidebar.c index 827a0a037e..6bd7700fcf 100644 --- a/modules/calendar/e-task-shell-sidebar.c +++ b/modules/calendar/e-task-shell-sidebar.c @@ -269,8 +269,12 @@ static void task_shell_sidebar_primary_selection_changed_cb (ETaskShellSidebar *task_shell_sidebar, ESourceSelector *selector) { + EShell *shell; + EShellView *shell_view; + EShellWindow *shell_window; + EShellSidebar *shell_sidebar; + EShellSettings *shell_settings; ESource *source; - const gchar *uid; /* XXX ESourceSelector needs a "primary-selection-uid" property * so we can just bind the property with GConfBridge. */ @@ -279,8 +283,16 @@ task_shell_sidebar_primary_selection_changed_cb (ETaskShellSidebar *task_shell_s if (source == NULL) return; - uid = e_source_peek_uid (source); - calendar_config_set_primary_tasks (uid); + shell_sidebar = E_SHELL_SIDEBAR (task_shell_sidebar); + shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); + 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); + + e_shell_settings_set_string ( + shell_settings, "cal-primary-task-list", + e_source_peek_uid (source)); } static void @@ -335,9 +347,11 @@ static void task_shell_sidebar_constructed (GObject *object) { ETaskShellSidebarPrivate *priv; + EShell *shell; EShellView *shell_view; EShellBackend *shell_backend; EShellSidebar *shell_sidebar; + EShellSettings *shell_settings; ESourceSelector *selector; ESourceList *source_list; ESource *source; @@ -357,6 +371,9 @@ task_shell_sidebar_constructed (GObject *object) shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); shell_backend = e_shell_view_get_shell_backend (shell_view); + shell = e_shell_backend_get_shell (shell_backend); + shell_settings = e_shell_get_shell_settings (shell); + source_list = e_task_shell_backend_get_source_list ( E_TASK_SHELL_BACKEND (shell_backend)); @@ -392,7 +409,8 @@ task_shell_sidebar_constructed (GObject *object) object); source = NULL; - uid = calendar_config_get_primary_tasks (); + uid = e_shell_settings_get_string ( + shell_settings, "cal-primary-task-list"); if (uid != NULL) source = e_source_list_peek_source_by_uid (source_list, uid); if (source == NULL) |