Changing source in CompEditor blocks UI
This commit is contained in:
@ -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;
|
||||
|
||||
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);
|
||||
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 || !e_client_open_sync (E_CLIENT (client), FALSE, NULL, &error)) {
|
||||
editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage));
|
||||
priv = epage->priv;
|
||||
|
||||
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,30 +2898,57 @@ 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 (client, CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS, &backend_addr, NULL, NULL);
|
||||
|
||||
e_client_get_backend_property_sync (E_CLIENT (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)
|
||||
{
|
||||
|
||||
@ -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);
|
||||
priv = mpage->priv;
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
@ -948,6 +964,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)
|
||||
|
||||
@ -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,30 +605,6 @@ 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) {
|
||||
e_cal_component_get_uid (priv->comp, &uid);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
if (!read_only) {
|
||||
GSList *list = NULL;
|
||||
|
||||
/* 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 (list, (GFunc) g_object_unref, NULL);
|
||||
g_slist_free (list);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!read_only)
|
||||
sensitize_recur_widgets (rpage);
|
||||
else
|
||||
@ -647,6 +616,101 @@ sensitize_buttons (RecurrencePage *rpage)
|
||||
gtk_widget_set_sensitive (priv->exception_delete, !read_only && selected_rows > 0 && sensitize);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
update_with_readonly (rpage, g_slist_length (ecalcomps) > 1);
|
||||
|
||||
g_slist_foreach (ecalcomps, (GFunc) g_object_unref, NULL);
|
||||
g_slist_free (ecalcomps);
|
||||
}
|
||||
|
||||
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 (icalcomp) {
|
||||
icalcomponent_free (icalcomp);
|
||||
update_with_readonly (rpage, TRUE);
|
||||
return;
|
||||
}
|
||||
|
||||
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
|
||||
/* Encondes a position/weekday pair into the proper format for
|
||||
* icalrecurrencetype.by_day. Not needed at present.
|
||||
|
||||
@ -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);
|
||||
@ -1766,6 +1774,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)
|
||||
{
|
||||
|
||||
@ -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;
|
||||
|
||||
Reference in New Issue
Block a user