diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-12-23 21:58:10 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2012-06-03 11:00:40 +0800 |
commit | 26e7480340ff1bcdeed3692b5046e4d735f185b1 (patch) | |
tree | 81bf81a6e9d7ac39299b847209dd1142b9023bf6 /modules/calendar/e-memo-shell-view-actions.c | |
parent | 7894db49b9a161f7b63d90a98e57ad6a1e1dca54 (diff) | |
download | gsoc2013-evolution-26e7480340ff1bcdeed3692b5046e4d735f185b1.tar gsoc2013-evolution-26e7480340ff1bcdeed3692b5046e4d735f185b1.tar.gz gsoc2013-evolution-26e7480340ff1bcdeed3692b5046e4d735f185b1.tar.bz2 gsoc2013-evolution-26e7480340ff1bcdeed3692b5046e4d735f185b1.tar.lz gsoc2013-evolution-26e7480340ff1bcdeed3692b5046e4d735f185b1.tar.xz gsoc2013-evolution-26e7480340ff1bcdeed3692b5046e4d735f185b1.tar.zst gsoc2013-evolution-26e7480340ff1bcdeed3692b5046e4d735f185b1.zip |
Adapt modules/calendar to the new ESource API.
Diffstat (limited to 'modules/calendar/e-memo-shell-view-actions.c')
-rw-r--r-- | modules/calendar/e-memo-shell-view-actions.c | 122 |
1 files changed, 64 insertions, 58 deletions
diff --git a/modules/calendar/e-memo-shell-view-actions.c b/modules/calendar/e-memo-shell-view-actions.c index 44625ad670..689d65c796 100644 --- a/modules/calendar/e-memo-shell-view-actions.c +++ b/modules/calendar/e-memo-shell-view-actions.c @@ -77,12 +77,22 @@ action_memo_forward_cb (GtkAction *action, EMemoShellView *memo_shell_view) { EMemoShellContent *memo_shell_content; + EShell *shell; + EShellView *shell_view; + EShellWindow *shell_window; + ESourceRegistry *registry; EMemoTable *memo_table; ECalModelComponent *comp_data; ECalComponent *comp; icalcomponent *clone; GSList *list; + shell_view = E_SHELL_VIEW (memo_shell_view); + shell_window = e_shell_view_get_shell_window (shell_view); + shell = e_shell_window_get_shell (shell_window); + + registry = e_shell_get_registry (shell); + memo_shell_content = memo_shell_view->priv->memo_shell_content; memo_table = e_memo_shell_content_get_memo_table (memo_shell_content); @@ -97,7 +107,7 @@ action_memo_forward_cb (GtkAction *action, e_cal_component_set_icalcomponent (comp, clone); itip_send_comp ( - E_CAL_COMPONENT_METHOD_PUBLISH, comp, + registry, E_CAL_COMPONENT_METHOD_PUBLISH, comp, comp_data->client, NULL, NULL, NULL, TRUE, FALSE); g_object_unref (comp); @@ -108,13 +118,18 @@ action_memo_list_copy_cb (GtkAction *action, EMemoShellView *memo_shell_view) { EMemoShellSidebar *memo_shell_sidebar; - EShellWindow *shell_window; + EShell *shell; EShellView *shell_view; + EShellWindow *shell_window; + ESourceRegistry *registry; ESourceSelector *selector; ESource *source; shell_view = E_SHELL_VIEW (memo_shell_view); shell_window = e_shell_view_get_shell_window (shell_view); + shell = e_shell_window_get_shell (shell_window); + + registry = e_shell_get_registry (shell); memo_shell_sidebar = memo_shell_view->priv->memo_shell_sidebar; selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar); @@ -122,7 +137,7 @@ action_memo_list_copy_cb (GtkAction *action, g_return_if_fail (source != NULL); copy_source_dialog ( - GTK_WINDOW (shell_window), + GTK_WINDOW (shell_window), registry, source, E_CAL_CLIENT_SOURCE_TYPE_MEMOS); g_object_unref (source); @@ -132,32 +147,16 @@ static void action_memo_list_delete_cb (GtkAction *action, EMemoShellView *memo_shell_view) { - EMemoShellBackend *memo_shell_backend; - EMemoShellContent *memo_shell_content; EMemoShellSidebar *memo_shell_sidebar; EShellWindow *shell_window; EShellView *shell_view; - EMemoTable *memo_table; - ECalClient *client; - ECalModel *model; ESourceSelector *selector; - ESourceGroup *source_group; - ESourceList *source_list; ESource *source; gint response; - gchar *uri; - GError *error = NULL; shell_view = E_SHELL_VIEW (memo_shell_view); shell_window = e_shell_view_get_shell_window (shell_view); - memo_shell_backend = memo_shell_view->priv->memo_shell_backend; - source_list = e_memo_shell_backend_get_source_list (memo_shell_backend); - - 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); - memo_shell_sidebar = memo_shell_view->priv->memo_shell_sidebar; selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar); source = e_source_selector_ref_primary_selection (selector); @@ -174,43 +173,13 @@ action_memo_list_delete_cb (GtkAction *action, return; } - uri = e_source_get_uri (source); - client = e_cal_model_get_client_for_uri (model, uri); - if (client == NULL) - client = e_cal_client_new_from_uri ( - uri, E_CAL_CLIENT_SOURCE_TYPE_MEMOS, NULL); - g_free (uri); - - g_return_if_fail (client != NULL); - - e_client_remove_sync (E_CLIENT (client), NULL, &error); - - if (error != NULL) { - g_warning ( - "%s: Failed to remove client: %s", - G_STRFUNC, error->message); - g_object_unref (source); - g_error_free (error); - return; - } - if (e_source_selector_source_is_selected (selector, source)) { e_memo_shell_sidebar_remove_source ( memo_shell_sidebar, source); e_source_selector_unselect_source (selector, source); } - source_group = e_source_peek_group (source); - e_source_group_remove_source (source_group, source); - - e_source_list_sync (source_list, &error); - - if (error != NULL) { - g_warning ( - "%s: Failed to sync source list: %s", - G_STRFUNC, error->message); - g_error_free (error); - } + e_shell_view_remove_source (shell_view, source); g_object_unref (source); } @@ -219,12 +188,34 @@ static void action_memo_list_new_cb (GtkAction *action, EMemoShellView *memo_shell_view) { + EShell *shell; EShellView *shell_view; EShellWindow *shell_window; + ESourceRegistry *registry; + ECalClientSourceType source_type; + GtkWidget *config; + GtkWidget *dialog; + const gchar *icon_name; shell_view = E_SHELL_VIEW (memo_shell_view); shell_window = e_shell_view_get_shell_window (shell_view); - calendar_setup_new_memo_list (GTK_WINDOW (shell_window)); + shell = e_shell_window_get_shell (shell_window); + + registry = e_shell_get_registry (shell); + source_type = E_CAL_CLIENT_SOURCE_TYPE_MEMOS; + config = e_cal_source_config_new (registry, NULL, source_type); + + dialog = e_source_config_dialog_new (E_SOURCE_CONFIG (config)); + + gtk_window_set_transient_for ( + GTK_WINDOW (dialog), GTK_WINDOW (shell_window)); + + icon_name = gtk_action_get_icon_name (action); + gtk_window_set_icon_name (GTK_WINDOW (dialog), icon_name); + + gtk_window_set_title (GTK_WINDOW (dialog), _("New Memo List")); + + gtk_widget_show (dialog); } static void @@ -261,11 +252,16 @@ static void action_memo_list_properties_cb (GtkAction *action, EMemoShellView *memo_shell_view) { - EMemoShellSidebar *memo_shell_sidebar; EShellView *shell_view; EShellWindow *shell_window; + EMemoShellSidebar *memo_shell_sidebar; + ECalClientSourceType source_type; ESource *source; ESourceSelector *selector; + ESourceRegistry *registry; + GtkWidget *config; + GtkWidget *dialog; + const gchar *icon_name; shell_view = E_SHELL_VIEW (memo_shell_view); shell_window = e_shell_view_get_shell_window (shell_view); @@ -275,9 +271,23 @@ action_memo_list_properties_cb (GtkAction *action, source = e_source_selector_ref_primary_selection (selector); g_return_if_fail (source != NULL); - calendar_setup_edit_memo_list (GTK_WINDOW (shell_window), source); + source_type = E_CAL_CLIENT_SOURCE_TYPE_MEMOS; + registry = e_source_selector_get_registry (selector); + config = e_cal_source_config_new (registry, source, source_type); g_object_unref (source); + + dialog = e_source_config_dialog_new (E_SOURCE_CONFIG (config)); + + gtk_window_set_transient_for ( + GTK_WINDOW (dialog), GTK_WINDOW (shell_window)); + + icon_name = gtk_action_get_icon_name (action); + gtk_window_set_icon_name (GTK_WINDOW (dialog), icon_name); + + gtk_window_set_title (GTK_WINDOW (dialog), _("Memo List Properties")); + + gtk_widget_show (dialog); } static void @@ -290,7 +300,6 @@ action_memo_list_refresh_cb (GtkAction *action, ECalClient *client; ECalModel *model; ESource *source; - gchar *uri; GError *error = NULL; memo_shell_content = memo_shell_view->priv->memo_shell_content; @@ -302,10 +311,7 @@ action_memo_list_refresh_cb (GtkAction *action, source = e_source_selector_ref_primary_selection (selector); g_return_if_fail (source != NULL); - uri = e_source_get_uri (source); - client = e_cal_model_get_client_for_uri (model, uri); - g_free (uri); - + client = e_cal_model_get_client_for_source (model, source); if (client == NULL) { g_object_unref (source); return; |