diff options
author | Milan Crha <mcrha@redhat.com> | 2011-08-26 20:22:58 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-09-14 20:08:57 +0800 |
commit | bc03bf534a55275bd7e5de99e0c0b612d33c25d7 (patch) | |
tree | 1083d6d6d91b59d87208b175a40b890d6e36e113 | |
parent | 1fcec870ae72635a85a9b377c5e62f4b764d5354 (diff) | |
download | gsoc2013-evolution-bc03bf534a55275bd7e5de99e0c0b612d33c25d7.tar gsoc2013-evolution-bc03bf534a55275bd7e5de99e0c0b612d33c25d7.tar.gz gsoc2013-evolution-bc03bf534a55275bd7e5de99e0c0b612d33c25d7.tar.bz2 gsoc2013-evolution-bc03bf534a55275bd7e5de99e0c0b612d33c25d7.tar.lz gsoc2013-evolution-bc03bf534a55275bd7e5de99e0c0b612d33c25d7.tar.xz gsoc2013-evolution-bc03bf534a55275bd7e5de99e0c0b612d33c25d7.tar.zst gsoc2013-evolution-bc03bf534a55275bd7e5de99e0c0b612d33c25d7.zip |
Changing source in CompEditor blocks UI
-rw-r--r-- | calendar/gui/dialogs/event-page.c | 94 | ||||
-rw-r--r-- | calendar/gui/dialogs/memo-page.c | 81 | ||||
-rw-r--r-- | calendar/gui/dialogs/recurrence-page.c | 128 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-page.c | 86 | ||||
-rw-r--r-- | plugins/mail-to-task/mail-to-task.c | 14 |
5 files changed, 289 insertions, 114 deletions
diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index 12b59a2c32..0ecb18393c 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -192,6 +192,8 @@ struct _EventPagePrivate { /* either with-user-time or without it */ const gint *alarm_map; + + GCancellable *open_cancellable; }; static void event_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates); @@ -867,6 +869,12 @@ event_page_dispose (GObject *object) priv = EVENT_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->location_completion != NULL) { g_object_unref (priv->location_completion); priv->location_completion = NULL; @@ -1794,6 +1802,7 @@ event_page_init (EventPage *epage) epage->priv->alarm_interval = -1; epage->priv->alarm_map = alarm_map_with_user_time; epage->priv->location_completion = gtk_entry_completion_new (); + epage->priv->open_cancellable = NULL; } void @@ -2849,39 +2858,31 @@ event_page_send_options_clicked_cb (EventPage *epage) } static void -source_changed_cb (ESourceComboBox *source_combo_box, EventPage *epage) +epage_client_opened_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { - EventPagePrivate *priv = epage->priv; + ESource *source = E_SOURCE (source_object); + EClient *client = NULL; + EventPage *epage = user_data; + EventPagePrivate *priv; CompEditor *editor; - ESource *source; - ECalClient *client; GError *error = NULL; - if (comp_editor_page_get_updating (COMP_EDITOR_PAGE (epage))) - return; + 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)) { + return; + } + } editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage)); - source = e_source_combo_box_get_active (source_combo_box); - client = e_cal_client_new (source, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, &error); - - if (client) { - icaltimezone *zone; - - zone = e_meeting_store_get_timezone (epage->priv->meeting_store); - e_cal_client_set_default_timezone (client, zone); - - g_signal_connect (client, "authenticate", G_CALLBACK (e_client_utils_authenticate_handler), NULL); - } + priv = epage->priv; - if (!client || !e_client_open_sync (E_CLIENT (client), FALSE, NULL, &error)) { + if (error) { GtkWidget *dialog; ECalClient *old_client; old_client = comp_editor_get_client (editor); - if (client) - g_object_unref (client); - e_source_combo_box_set_active ( E_SOURCE_COMBO_BOX (priv->source_selector), e_client_get_source (E_CLIENT (old_client))); @@ -2897,31 +2898,58 @@ source_changed_cb (ESourceComboBox *source_combo_box, EventPage *epage) if (error) g_error_free (error); } else { - comp_editor_set_client (editor, client); - if (e_client_check_capability (E_CLIENT (client), CAL_STATIC_CAPABILITY_REQ_SEND_OPTIONS) && priv->is_meeting) + gchar *backend_addr = NULL; + icaltimezone *zone; + ECalClient *cal_client = E_CAL_CLIENT (client); + + g_return_if_fail (cal_client != NULL); + + zone = e_meeting_store_get_timezone (priv->meeting_store); + e_cal_client_set_default_timezone (cal_client, zone); + + comp_editor_set_client (editor, cal_client); + if (e_client_check_capability (client, CAL_STATIC_CAPABILITY_REQ_SEND_OPTIONS) && priv->is_meeting) event_page_show_options (epage); else event_page_hide_options (epage); - if (client) { - gchar *backend_addr = NULL; - - e_client_get_backend_property_sync (E_CLIENT (client), CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS, &backend_addr, NULL, NULL); + e_client_get_backend_property_sync (client, CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS, &backend_addr, NULL, NULL); - if (priv->is_meeting) - event_page_select_organizer (epage, backend_addr); + if (priv->is_meeting) + event_page_select_organizer (epage, backend_addr); - set_subscriber_info_string (epage, backend_addr); - g_free (backend_addr); - } + set_subscriber_info_string (epage, backend_addr); + g_free (backend_addr); sensitize_widgets (epage); - alarm_list_dialog_set_client (priv->alarm_list_dlg_widget, client); + alarm_list_dialog_set_client (priv->alarm_list_dlg_widget, cal_client); } } static void +source_changed_cb (ESourceComboBox *source_combo_box, EventPage *epage) +{ + EventPagePrivate *priv = epage->priv; + ESource *source; + + if (comp_editor_page_get_updating (COMP_EDITOR_PAGE (epage))) + return; + + source = e_source_combo_box_get_active (source_combo_box); + + if (priv->open_cancellable) { + g_cancellable_cancel (priv->open_cancellable); + g_object_unref (priv->open_cancellable); + } + priv->open_cancellable = g_cancellable_new (); + + e_client_utils_open_new (source, E_CLIENT_SOURCE_TYPE_EVENTS, FALSE, priv->open_cancellable, + e_client_utils_authenticate_handler, NULL, + epage_client_opened_cb, epage); +} + +static void set_subscriber_info_string (EventPage *epage, const gchar *backend_address) { CompEditor *editor; diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c index 3a53421dd5..9c14fccd0a 100644 --- a/calendar/gui/dialogs/memo-page.c +++ b/calendar/gui/dialogs/memo-page.c @@ -96,6 +96,8 @@ struct _MemoPagePrivate { gchar *fallback_address; ENameSelector *name_selector; + + GCancellable *open_cancellable; }; static void set_subscriber_info_string (MemoPage *mpage, const gchar *backend_address); @@ -188,8 +190,17 @@ memo_page_dispose (GObject *object) priv = MEMO_PAGE (object)->priv; + if (priv->open_cancellable) { + g_cancellable_cancel (priv->open_cancellable); + g_object_unref (priv->open_cancellable); + priv->open_cancellable = NULL; + } + g_strfreev (priv->address_strings); + priv->address_strings = NULL; + g_free (priv->fallback_address); + priv->fallback_address = NULL; /* Chain up to parent's dispose() method. */ G_OBJECT_CLASS (memo_page_parent_class)->dispose (object); @@ -373,6 +384,7 @@ memo_page_init (MemoPage *mpage) { mpage->priv = G_TYPE_INSTANCE_GET_PRIVATE ( mpage, TYPE_MEMO_PAGE, MemoPagePrivate); + mpage->priv->open_cancellable = NULL; } /* returns whether changed info text */ @@ -884,37 +896,31 @@ categories_clicked_cb (GtkWidget *button, } static void -source_changed_cb (ESourceComboBox *source_combo_box, - MemoPage *mpage) +mpage_client_opened_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { - MemoPagePrivate *priv = mpage->priv; + ESource *source = E_SOURCE (source_object); + EClient *client = NULL; + MemoPage *mpage = user_data; + MemoPagePrivate *priv; CompEditor *editor; - CompEditorFlags flags; - ESource *source; - ECalClient *client; GError *error = NULL; - if (comp_editor_page_get_updating (COMP_EDITOR_PAGE (mpage))) - return; + 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)) { + return; + } + } editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (mpage)); - flags = comp_editor_get_flags (editor); - - source = e_source_combo_box_get_active (source_combo_box); - client = e_cal_client_new (source, E_CAL_CLIENT_SOURCE_TYPE_MEMOS, &error); - - if (client) - g_signal_connect (client, "authenticate", G_CALLBACK (e_client_utils_authenticate_handler), NULL); + priv = mpage->priv; - if (!client || !e_client_open_sync (E_CLIENT (client), FALSE, NULL, &error)) { + if (error) { GtkWidget *dialog; ECalClient *old_client; old_client = comp_editor_get_client (editor); - if (client) - g_object_unref (client); - e_source_combo_box_set_active ( E_SOURCE_COMBO_BOX (priv->source_selector), e_client_get_source (E_CLIENT (old_client))); @@ -930,12 +936,22 @@ source_changed_cb (ESourceComboBox *source_combo_box, if (error) g_error_free (error); } else { - comp_editor_set_client (editor, client); + icaltimezone *zone; + CompEditorFlags flags; + ECalClient *cal_client = E_CAL_CLIENT (client); + + g_return_if_fail (cal_client != NULL); + + flags = comp_editor_get_flags (editor); + zone = comp_editor_get_timezone (editor); + e_cal_client_set_default_timezone (cal_client, zone); + + comp_editor_set_client (editor, cal_client); if (client) { gchar *backend_addr = NULL; - e_client_get_backend_property_sync (E_CLIENT (client), CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS, &backend_addr, NULL, NULL); + e_client_get_backend_property_sync (client, CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS, &backend_addr, NULL, NULL); if (flags & COMP_EDITOR_IS_SHARED) memo_page_select_organizer (mpage, backend_addr); @@ -949,6 +965,29 @@ source_changed_cb (ESourceComboBox *source_combo_box, } static void +source_changed_cb (ESourceComboBox *source_combo_box, + MemoPage *mpage) +{ + MemoPagePrivate *priv = mpage->priv; + ESource *source; + + if (comp_editor_page_get_updating (COMP_EDITOR_PAGE (mpage))) + return; + + source = e_source_combo_box_get_active (source_combo_box); + + if (priv->open_cancellable) { + g_cancellable_cancel (priv->open_cancellable); + g_object_unref (priv->open_cancellable); + } + priv->open_cancellable = g_cancellable_new (); + + e_client_utils_open_new (source, E_CLIENT_SOURCE_TYPE_MEMOS, FALSE, priv->open_cancellable, + e_client_utils_authenticate_handler, NULL, + mpage_client_opened_cb, mpage); +} + +static void set_subscriber_info_string (MemoPage *mpage, const gchar *backend_address) { diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index c22138f6b9..fa18e0d9f1 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -588,22 +588,15 @@ sensitize_recur_widgets (RecurrencePage *rpage) } static void -sensitize_buttons (RecurrencePage *rpage) +update_with_readonly (RecurrencePage *rpage, gboolean read_only) { RecurrencePagePrivate *priv = rpage->priv; CompEditor *editor; CompEditorFlags flags; - gboolean read_only, sensitize = TRUE; gint selected_rows; - icalcomponent *icalcomp; - ECalClient *client; - const gchar *uid; - - if (priv->comp == NULL) - return; + gboolean sensitize = TRUE; editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (rpage)); - client = comp_editor_get_client (editor); flags = comp_editor_get_flags (editor); if (flags & COMP_EDITOR_MEETING) @@ -612,39 +605,110 @@ sensitize_buttons (RecurrencePage *rpage) selected_rows = gtk_tree_selection_count_selected_rows ( gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->exception_list))); - read_only = e_client_is_readonly (E_CLIENT (client)); + if (!read_only) + sensitize_recur_widgets (rpage); + else + gtk_widget_set_sensitive (priv->params, FALSE); - if (!read_only) { - e_cal_component_get_uid (priv->comp, &uid); + gtk_widget_set_sensitive (priv->recurs, !read_only && sensitize); + gtk_widget_set_sensitive (priv->exception_add, !read_only && e_cal_component_has_recurrences (priv->comp) && sensitize); + gtk_widget_set_sensitive (priv->exception_modify, !read_only && selected_rows > 0 && sensitize); + gtk_widget_set_sensitive (priv->exception_delete, !read_only && selected_rows > 0 && sensitize); +} - if (e_client_check_capability (E_CLIENT (client), CAL_STATIC_CAPABILITY_NO_CONV_TO_RECUR) && e_cal_client_get_object_sync (client, uid, NULL, &icalcomp, NULL, NULL)) { - read_only = TRUE; - icalcomponent_free (icalcomp); +static void +rpage_get_objects_for_uid_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +{ + ECalClient *client = E_CAL_CLIENT (source_object); + RecurrencePage *rpage = user_data; + GSList *ecalcomps = NULL; + GError *error = NULL; + + if (result && !e_cal_client_get_objects_for_uid_finish (client, result, &ecalcomps, &error)) { + ecalcomps = NULL; + if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || + g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + return; } + } - if (!read_only) { - GSList *list = NULL; + update_with_readonly (rpage, g_slist_length (ecalcomps) > 1); - /* see if we have detached instances */ - if (e_cal_client_get_objects_for_uid_sync (client, uid, &list, NULL, NULL)) { - if (list && g_slist_length (list) > 1) - read_only = TRUE; + g_slist_foreach (ecalcomps, (GFunc) g_object_unref, NULL); + g_slist_free (ecalcomps); +} - g_slist_foreach (list, (GFunc) g_object_unref, NULL); - g_slist_free (list); - } +static void +rpage_get_object_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +{ + ECalClient *client = E_CAL_CLIENT (source_object); + RecurrencePage *rpage = user_data; + icalcomponent *icalcomp = NULL; + const gchar *uid = NULL; + GError *error = NULL; + + if (result && !e_cal_client_get_object_finish (client, result, &icalcomp, &error)) { + icalcomp = NULL; + if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || + g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + return; } } - if (!read_only) - sensitize_recur_widgets (rpage); - else - gtk_widget_set_sensitive (priv->params, FALSE); + if (icalcomp) { + icalcomponent_free (icalcomp); + update_with_readonly (rpage, TRUE); + return; + } - gtk_widget_set_sensitive (priv->recurs, !read_only && sensitize); - gtk_widget_set_sensitive (priv->exception_add, !read_only && e_cal_component_has_recurrences (priv->comp) && sensitize); - gtk_widget_set_sensitive (priv->exception_modify, !read_only && selected_rows > 0 && sensitize); - gtk_widget_set_sensitive (priv->exception_delete, !read_only && selected_rows > 0 && sensitize); + if (rpage->priv->comp) + e_cal_component_get_uid (rpage->priv->comp, &uid); + + if (!uid || !*uid) { + update_with_readonly (rpage, FALSE); + return; + } + + /* see if we have detached instances */ + e_cal_client_get_objects_for_uid (client, uid, rpage->priv->cancellable, rpage_get_objects_for_uid_cb, rpage); +} + +static void +sensitize_buttons (RecurrencePage *rpage) +{ + RecurrencePagePrivate *priv = rpage->priv; + CompEditor *editor; + ECalClient *client; + const gchar *uid; + + if (priv->comp == NULL) + return; + + editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (rpage)); + client = comp_editor_get_client (editor); + + if (e_client_is_readonly (E_CLIENT (client))) { + update_with_readonly (rpage, TRUE); + return; + } + + if (priv->cancellable) { + g_cancellable_cancel (priv->cancellable); + g_object_unref (priv->cancellable); + } + priv->cancellable = g_cancellable_new (); + + e_cal_component_get_uid (priv->comp, &uid); + if (!uid || !*uid) { + update_with_readonly (rpage, FALSE); + return; + } + + if (e_client_check_capability (E_CLIENT (client), CAL_STATIC_CAPABILITY_NO_CONV_TO_RECUR)) { + e_cal_client_get_object (client, uid, NULL, priv->cancellable, rpage_get_object_cb, rpage); + } else { + rpage_get_object_cb (G_OBJECT (client), NULL, rpage); + } } #if 0 diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index c48888008f..958eac682b 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -124,6 +124,8 @@ struct _TaskPagePrivate { gboolean is_assignment; ESendOptionsDialog *sod; + + GCancellable *open_cancellable; }; static const gint classification_map[] = { @@ -394,6 +396,12 @@ task_page_dispose (GObject *object) priv = TASK_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->main != NULL) { g_object_unref (priv->main); priv->main = NULL; @@ -1006,6 +1014,7 @@ task_page_init (TaskPage *tpage) { tpage->priv = TASK_PAGE_GET_PRIVATE (tpage); tpage->priv->deleted_attendees = g_ptr_array_new (); + tpage->priv->open_cancellable = NULL; } void @@ -1695,42 +1704,33 @@ due_date_changed_cb (TaskPage *tpage) } static void -source_changed_cb (ESourceComboBox *source_combo_box, TaskPage *tpage) +tpage_client_opened_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { - TaskPagePrivate *priv = tpage->priv; + ESource *source = E_SOURCE (source_object); + EClient *client = NULL; + TaskPage *tpage = user_data; + TaskPagePrivate *priv; CompEditor *editor; - ESource *source; - ECalClient *client; GError *error = NULL; - editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (tpage)); - source = e_source_combo_box_get_active (source_combo_box); - - if (comp_editor_page_get_updating (COMP_EDITOR_PAGE (tpage))) - return; - - client = e_cal_client_new (source, E_CAL_CLIENT_SOURCE_TYPE_TASKS, &error); - if (client) { - icaltimezone *zone; - - zone = comp_editor_get_timezone (editor); - e_cal_client_set_default_timezone (client, zone); + 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)) { + return; + } } - if (client) - g_signal_connect (client, "authenticate", G_CALLBACK (e_client_utils_authenticate_handler), NULL); - - if (!client || !e_client_open_sync (E_CLIENT (client), FALSE, NULL, &error)) { + editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (tpage)); + priv = tpage->priv; + if (error) { GtkWidget *dialog; + ECalClient *old_client; - if (client) - g_object_unref (client); - - client = comp_editor_get_client (editor); + old_client = comp_editor_get_client (editor); e_source_combo_box_set_active ( E_SOURCE_COMBO_BOX (priv->source_selector), - e_client_get_source (E_CLIENT (client))); + e_client_get_source (E_CLIENT (old_client))); dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, @@ -1743,9 +1743,17 @@ source_changed_cb (ESourceComboBox *source_combo_box, TaskPage *tpage) if (error) g_error_free (error); } else { - comp_editor_set_client (editor, client); + icaltimezone *zone; + ECalClient *cal_client = E_CAL_CLIENT (client); + + g_return_if_fail (cal_client != NULL); + + zone = comp_editor_get_timezone (editor); + e_cal_client_set_default_timezone (cal_client, zone); + + comp_editor_set_client (editor, cal_client); comp_editor_page_changed (COMP_EDITOR_PAGE (tpage)); - if (e_client_check_capability (E_CLIENT (client), CAL_STATIC_CAPABILITY_REQ_SEND_OPTIONS) && priv->is_assignment) + if (e_client_check_capability (client, CAL_STATIC_CAPABILITY_REQ_SEND_OPTIONS) && priv->is_assignment) task_page_show_options (tpage); else task_page_hide_options (tpage); @@ -1753,7 +1761,7 @@ source_changed_cb (ESourceComboBox *source_combo_box, TaskPage *tpage) if (client) { gchar *backend_addr = NULL; - e_client_get_backend_property_sync (E_CLIENT (client), CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS, &backend_addr, NULL, NULL); + e_client_get_backend_property_sync (client, CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS, &backend_addr, NULL, NULL); if (priv->is_assignment) task_page_select_organizer (tpage, backend_addr); @@ -1767,6 +1775,28 @@ source_changed_cb (ESourceComboBox *source_combo_box, TaskPage *tpage) } static void +source_changed_cb (ESourceComboBox *source_combo_box, TaskPage *tpage) +{ + TaskPagePrivate *priv = tpage->priv; + ESource *source; + + if (comp_editor_page_get_updating (COMP_EDITOR_PAGE (tpage))) + return; + + source = e_source_combo_box_get_active (source_combo_box); + + if (priv->open_cancellable) { + g_cancellable_cancel (priv->open_cancellable); + g_object_unref (priv->open_cancellable); + } + priv->open_cancellable = g_cancellable_new (); + + e_client_utils_open_new (source, E_CLIENT_SOURCE_TYPE_TASKS, FALSE, priv->open_cancellable, + e_client_utils_authenticate_handler, NULL, + tpage_client_opened_cb, tpage); +} + +static void set_subscriber_info_string (TaskPage *tpage, const gchar *backend_address) { CompEditor *editor; diff --git a/plugins/mail-to-task/mail-to-task.c b/plugins/mail-to-task/mail-to-task.c index ddcd1328d1..a39456a00f 100644 --- a/plugins/mail-to-task/mail-to-task.c +++ b/plugins/mail-to-task/mail-to-task.c @@ -827,6 +827,20 @@ do_mail_to_event (AsyncData *data) struct icaltimetype tt, tt2; struct _manage_comp *oldmc = NULL; + #define cache_backend_prop(prop) { \ + gchar *val = NULL; \ + e_client_get_backend_property_sync (E_CLIENT (client), prop, &val, NULL, NULL); \ + g_free (val); \ + } + + /* precache backend properties, thus editor have them ready when needed */ + cache_backend_prop (CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS); + cache_backend_prop (CAL_BACKEND_PROPERTY_ALARM_EMAIL_ADDRESS); + cache_backend_prop (CAL_BACKEND_PROPERTY_DEFAULT_OBJECT); + e_client_get_capabilities (E_CLIENT (client)); + + #undef cache_backend_prop + /* set start day of the event as today, without time - easier than looking for a calendar's time zone */ tt = icaltime_today (); dt.value = &tt; |