diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2013-01-24 05:05:08 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2013-01-30 22:35:27 +0800 |
commit | f19241d136043d5cfffbfbaf5b2d6d1affc70682 (patch) | |
tree | 6abc10286b092dfc9b046bde599f24767ad0c177 /calendar/gui/dialogs/memo-page.c | |
parent | e583928e0401a4baea4432c5b7e12a1b1eff8c2e (diff) | |
download | gsoc2013-evolution-f19241d136043d5cfffbfbaf5b2d6d1affc70682.tar.gz gsoc2013-evolution-f19241d136043d5cfffbfbaf5b2d6d1affc70682.tar.zst gsoc2013-evolution-f19241d136043d5cfffbfbaf5b2d6d1affc70682.zip |
Use e_cal_client_connect().
Instead of e_client_utils_open_new() or e_cal_client_new().
Diffstat (limited to 'calendar/gui/dialogs/memo-page.c')
-rw-r--r-- | calendar/gui/dialogs/memo-page.c | 58 |
1 files changed, 34 insertions, 24 deletions
diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c index d6f9d93ffc..a93068cb14 100644 --- a/calendar/gui/dialogs/memo-page.c +++ b/calendar/gui/dialogs/memo-page.c @@ -85,7 +85,7 @@ struct _MemoPagePrivate { ENameSelector *name_selector; - GCancellable *open_cancellable; + GCancellable *connect_cancellable; }; static void set_subscriber_info_string (MemoPage *mpage, const gchar *backend_address); @@ -187,10 +187,10 @@ memo_page_dispose (GObject *object) priv = MEMO_PAGE_GET_PRIVATE (object); - if (priv->open_cancellable) { - g_cancellable_cancel (priv->open_cancellable); - g_object_unref (priv->open_cancellable); - priv->open_cancellable = NULL; + if (priv->connect_cancellable != NULL) { + g_cancellable_cancel (priv->connect_cancellable); + g_object_unref (priv->connect_cancellable); + priv->connect_cancellable = NULL; } g_strfreev (priv->address_strings); @@ -941,23 +941,27 @@ categories_clicked_cb (GtkWidget *button, } static void -mpage_client_opened_cb (GObject *source_object, - GAsyncResult *result, - gpointer user_data) +mpage_client_connect_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { - ESource *source = E_SOURCE (source_object); - EClient *client = NULL; + EClient *client; MemoPage *mpage = user_data; MemoPagePrivate *priv; CompEditor *editor; GError *error = NULL; - if (!e_client_utils_open_new_finish (source, result, &client, &error)) { - if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || - g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { - g_clear_error (&error); - return; - } + client = e_cal_client_connect_finish (result, &error); + + /* Sanity check. */ + g_return_if_fail ( + ((client != NULL) && (error == NULL)) || + ((client == NULL) && (error != NULL))); + + if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || + g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + g_clear_error (&error); + return; } editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (mpage)); @@ -966,9 +970,13 @@ mpage_client_opened_cb (GObject *source_object, if (error != NULL) { GtkWidget *dialog; ECalClient *old_client; + ESource *source; old_client = comp_editor_get_client (editor); + source = e_source_combo_box_ref_active ( + E_SOURCE_COMBO_BOX (priv->source_combo_box)); + e_source_combo_box_set_active ( E_SOURCE_COMBO_BOX (priv->source_combo_box), e_client_get_source (E_CLIENT (old_client))); @@ -982,6 +990,8 @@ mpage_client_opened_cb (GObject *source_object, gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); + g_object_unref (source); + g_clear_error (&error); } else { icaltimezone *zone; @@ -1025,16 +1035,16 @@ source_changed_cb (ESourceComboBox *source_combo_box, source = e_source_combo_box_ref_active (source_combo_box); g_return_if_fail (source != NULL); - if (priv->open_cancellable) { - g_cancellable_cancel (priv->open_cancellable); - g_object_unref (priv->open_cancellable); + if (priv->connect_cancellable != NULL) { + g_cancellable_cancel (priv->connect_cancellable); + g_object_unref (priv->connect_cancellable); } - priv->open_cancellable = g_cancellable_new (); + priv->connect_cancellable = g_cancellable_new (); - e_client_utils_open_new ( - source, E_CLIENT_SOURCE_TYPE_MEMOS, - FALSE, priv->open_cancellable, - mpage_client_opened_cb, mpage); + e_cal_client_connect ( + source, E_CAL_CLIENT_SOURCE_TYPE_MEMOS, + priv->connect_cancellable, + mpage_client_connect_cb, mpage); g_object_unref (source); } |