From a5309fa72c8b84c68ee6c53432f896318940eda9 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 3 Aug 2009 18:13:25 +0200 Subject: Bug #320071 - Unclear why you can't edit appointment in calendar --- calendar/gui/dialogs/event-page.c | 30 +++++++++++++++++++++++++----- calendar/gui/dialogs/memo-page.c | 30 +++++++++++++++++++++++++----- calendar/gui/dialogs/task-page.c | 31 ++++++++++++++++++++++++++----- 3 files changed, 76 insertions(+), 15 deletions(-) (limited to 'calendar') diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index 8a9b67ef06..7a595000a8 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -104,6 +104,7 @@ struct _EventPagePrivate { GtkWidget *info_hbox; GtkWidget *info_icon; GtkWidget *info_string; + gchar *subscriber_info_text; GtkWidget *summary; GtkWidget *summary_label; @@ -262,6 +263,7 @@ event_page_finalize (GObject *object) g_ptr_array_free (priv->deleted_attendees, TRUE); g_free (priv->old_summary); + g_free (priv->subscriber_info_text); priv->alarm_list_dlg_widget = NULL; @@ -741,6 +743,18 @@ sensitize_widgets (EventPage *epage) sensitize = !read_only && sens; + if (read_only) { + gchar *tmp = g_strconcat ("", _("Event cannot be edited, because the selected calendar is read only"), "", NULL); + event_page_set_info_string (epage, GTK_STOCK_DIALOG_INFO, tmp); + g_free (tmp); + } else if (!sens) { + gchar *tmp = g_strconcat ("", _("Event cannot be fully edited, because you are not the organizer"), "", NULL); + event_page_set_info_string (epage, GTK_STOCK_DIALOG_INFO, tmp); + g_free (tmp); + } else { + event_page_set_info_string (epage, priv->subscriber_info_text ? GTK_STOCK_DIALOG_INFO : NULL, priv->subscriber_info_text); + } + alarm = e_dialog_combo_box_get (priv->alarm_time_combo, priv->alarm_map) != ALARM_NONE; custom = is_custom_alarm_store (priv->alarm_list_store, priv->old_summary, priv->alarm_units, priv->alarm_interval, NULL) || e_dialog_combo_box_get (priv->alarm_time_combo, priv->alarm_map) == ALARM_CUSTOM ? TRUE:FALSE; @@ -2165,7 +2179,7 @@ event_page_set_info_string (EventPage *epage, const gchar *icon, const gchar *ms priv = epage->priv; gtk_image_set_from_stock (GTK_IMAGE (priv->info_icon), icon, GTK_ICON_SIZE_BUTTON); - gtk_label_set_text (GTK_LABEL(priv->info_string), msg); + gtk_label_set_markup (GTK_LABEL(priv->info_string), msg); if (msg && icon) gtk_widget_show (priv->info_hbox); @@ -2655,13 +2669,19 @@ set_subscriber_info_string (EventPage *epage, const gchar *backend_address) client = comp_editor_get_client (editor); source = e_cal_get_source (client); - if (e_source_get_property (source, "subscriber")) + if (e_source_get_property (source, "subscriber")) { + g_free (epage->priv->subscriber_info_text); /* Translators: This string is used when we are creating an Event (meeting or appointment) on behalf of some other user */ - event_page_set_info_string (epage, GTK_STOCK_DIALOG_INFO, - g_strdup_printf(_("You are acting on behalf of %s"), backend_address)); - else + epage->priv->subscriber_info_text = g_markup_printf_escaped (_("You are acting on behalf of %s"), backend_address); + + event_page_set_info_string (epage, GTK_STOCK_DIALOG_INFO, epage->priv->subscriber_info_text); + } else { + g_free (epage->priv->subscriber_info_text); + epage->priv->subscriber_info_text = NULL; + event_page_set_info_string (epage, NULL, NULL); + } } static void diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c index c82bed2efc..83cd00a911 100644 --- a/calendar/gui/dialogs/memo-page.c +++ b/calendar/gui/dialogs/memo-page.c @@ -72,6 +72,7 @@ struct _MemoPagePrivate { GtkWidget *info_hbox; GtkWidget *info_icon; GtkWidget *info_string; + gchar *subscriber_info_text; /* Organizer */ GtkWidget *org_label; @@ -163,6 +164,8 @@ memo_page_finalize (GObject *object) priv->xml = NULL; } + g_free (priv->subscriber_info_text); + /* Chain up to parent's finalize() method. */ G_OBJECT_CLASS (memo_page_parent_class)->finalize (object); } @@ -340,6 +343,18 @@ sensitize_widgets (MemoPage *mpage) sensitize = (!read_only && sens); + if (read_only) { + gchar *tmp = g_strconcat ("", _("Memo cannot be edited, because the selected memo list is read only"), "", NULL); + memo_page_set_info_string (mpage, GTK_STOCK_DIALOG_INFO, tmp); + g_free (tmp); + } else if (!sens) { + gchar *tmp = g_strconcat ("", _("Memo cannot be fully edited, because you are not the organizer"), "", NULL); + memo_page_set_info_string (mpage, GTK_STOCK_DIALOG_INFO, tmp); + g_free (tmp); + } else { + memo_page_set_info_string (mpage, priv->subscriber_info_text ? GTK_STOCK_DIALOG_INFO : NULL, priv->subscriber_info_text); + } + /* The list of organizers is set to be non-editable. Otherwise any * change in the displayed list causes an 'Account not found' error. */ @@ -732,7 +747,7 @@ memo_page_set_info_string (MemoPage *mpage, const gchar *icon, const gchar *msg) priv = mpage->priv; gtk_image_set_from_stock (GTK_IMAGE (priv->info_icon), icon, GTK_ICON_SIZE_BUTTON); - gtk_label_set_text (GTK_LABEL(priv->info_string), msg); + gtk_label_set_markup (GTK_LABEL(priv->info_string), msg); if (msg && icon) gtk_widget_show (priv->info_hbox); @@ -888,13 +903,18 @@ set_subscriber_info_string (MemoPage *mpage, client = comp_editor_get_client (editor); source = e_cal_get_source (client); - if (e_source_get_property (source, "subscriber")) + if (e_source_get_property (source, "subscriber")) { + g_free (mpage->priv->subscriber_info_text); /* Translators: This string is used when we are creating a Memo on behalf of some other user */ - memo_page_set_info_string (mpage, GTK_STOCK_DIALOG_INFO, - g_strdup_printf(_("You are acting on behalf of %s"), backend_address)); - else + mpage->priv->subscriber_info_text = g_markup_printf_escaped (_("You are acting on behalf of %s"), backend_address); + memo_page_set_info_string (mpage, GTK_STOCK_DIALOG_INFO, mpage->priv->subscriber_info_text); + } else { + g_free (mpage->priv->subscriber_info_text); + mpage->priv->subscriber_info_text = NULL; + memo_page_set_info_string (mpage, NULL, NULL); + } } static void diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index 6de55a14e2..8b5c02843e 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -85,6 +85,7 @@ struct _TaskPagePrivate { GtkWidget *info_hbox; GtkWidget *info_icon; GtkWidget *info_string; + gchar *subscriber_info_text; GtkWidget *summary; GtkWidget *summary_label; @@ -193,6 +194,8 @@ task_page_finalize (GObject *object) priv->deleted_attendees, (GFunc) g_object_unref, NULL); g_ptr_array_free (priv->deleted_attendees, TRUE); + g_free (priv->subscriber_info_text); + /* Chain up to parent's finalize() method. */ G_OBJECT_CLASS (task_page_parent_class)->finalize (object); } @@ -329,6 +332,18 @@ sensitize_widgets (TaskPage *tpage) sensitize = (!read_only && sens); + if (read_only) { + gchar *tmp = g_strconcat ("", _("Task cannot be edited, because the selected task list is read only"), "", NULL); + task_page_set_info_string (tpage, GTK_STOCK_DIALOG_INFO, tmp); + g_free (tmp); + } else if (!sens) { + gchar *tmp = g_strconcat ("", _("Task cannot be fully edited, because you are not the organizer"), "", NULL); + task_page_set_info_string (tpage, GTK_STOCK_DIALOG_INFO, tmp); + g_free (tmp); + } else { + task_page_set_info_string (tpage, priv->subscriber_info_text ? GTK_STOCK_DIALOG_INFO : NULL, priv->subscriber_info_text); + } + /* The list of organizers is set to be non-editable. Otherwise any * change in the displayed list causes an 'Account not found' error. */ @@ -1370,7 +1385,7 @@ task_page_set_info_string (TaskPage *tpage, const gchar *icon, const gchar *msg) priv = tpage->priv; gtk_image_set_from_stock (GTK_IMAGE (priv->info_icon), icon, GTK_ICON_SIZE_BUTTON); - gtk_label_set_text (GTK_LABEL(priv->info_string), msg); + gtk_label_set_markup (GTK_LABEL(priv->info_string), msg); if (msg && icon) gtk_widget_show (priv->info_hbox); @@ -1803,13 +1818,19 @@ set_subscriber_info_string (TaskPage *tpage, const gchar *backend_address) client = comp_editor_get_client (editor); source = e_cal_get_source (client); - if (e_source_get_property (source, "subscriber")) + if (e_source_get_property (source, "subscriber")) { + g_free (tpage->priv->subscriber_info_text); /* Translators: This string is used when we are creating a Task on behalf of some other user */ - task_page_set_info_string (tpage, GTK_STOCK_DIALOG_INFO, - g_strdup_printf(_("You are acting on behalf of %s"), backend_address)); - else + tpage->priv->subscriber_info_text = g_markup_printf_escaped (_("You are acting on behalf of %s"), backend_address); + + task_page_set_info_string (tpage, GTK_STOCK_DIALOG_INFO, tpage->priv->subscriber_info_text); + } else { + g_free (tpage->priv->subscriber_info_text); + tpage->priv->subscriber_info_text = NULL; + task_page_set_info_string (tpage, NULL, NULL); + } } void -- cgit v1.2.3