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/e-memo-shell-backend.c | |
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/e-memo-shell-backend.c')
-rw-r--r-- | modules/calendar/e-memo-shell-backend.c | 78 |
1 files changed, 59 insertions, 19 deletions
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); } |