[evolution] [ECompEditor] Disable editing of some parts when the user is not the organizer



commit fa2a22e015d3615fb1eb9ebd7ddc5f5f85d03402
Author: Milan Crha <mcrha redhat com>
Date:   Mon Nov 16 19:22:15 2015 +0100

    [ECompEditor] Disable editing of some parts when the user is not the organizer

 calendar/gui/e-comp-editor-event.c            |   43 ++++++++++++++++++--
 calendar/gui/e-comp-editor-memo.c             |   54 +++++++++++++++++++++++++
 calendar/gui/e-comp-editor-page-attachments.c |   18 +++++++-
 calendar/gui/e-comp-editor-page-general.c     |   12 +++++-
 calendar/gui/e-comp-editor-page-recurrence.c  |   10 ++++-
 calendar/gui/e-comp-editor-page.c             |    2 +-
 calendar/gui/e-comp-editor-property-part.c    |   49 ++++++++++++++++++++++
 calendar/gui/e-comp-editor-property-part.h    |    5 ++
 calendar/gui/e-comp-editor-task.c             |    8 +++-
 calendar/gui/e-comp-editor.c                  |   24 +++++++----
 calendar/gui/e-comp-editor.h                  |    2 +
 11 files changed, 208 insertions(+), 19 deletions(-)
---
diff --git a/calendar/gui/e-comp-editor-event.c b/calendar/gui/e-comp-editor-event.c
index 1089040..fa7f967 100644
--- a/calendar/gui/e-comp-editor-event.c
+++ b/calendar/gui/e-comp-editor-event.c
@@ -134,7 +134,7 @@ ece_event_dtend_changed_cb (EDateEdit *date_edit,
 }
 
 static void
-ece_editor_all_day_toggled_cb (ECompEditorEvent *event_editor)
+ece_event_all_day_toggled_cb (ECompEditorEvent *event_editor)
 {
        GtkWidget *edit_widget;
 
@@ -152,15 +152,45 @@ ece_event_sensitize_widgets (ECompEditor *comp_editor,
                             gboolean force_insensitive)
 {
        ECompEditorEvent *event_editor;
+       gboolean is_organizer;
+       GtkAction *action;
+       guint32 flags;
 
        g_return_if_fail (E_IS_COMP_EDITOR_EVENT (comp_editor));
 
        E_COMP_EDITOR_CLASS (e_comp_editor_event_parent_class)->sensitize_widgets (comp_editor, 
force_insensitive);
 
+       flags = e_comp_editor_get_flags (comp_editor);
+       is_organizer = (flags & (E_COMP_EDITOR_FLAG_IS_NEW | E_COMP_EDITOR_FLAG_ORGANIZER_IS_USER)) != 0;
        event_editor = E_COMP_EDITOR_EVENT (comp_editor);
-       gtk_widget_set_sensitive (event_editor->priv->all_day_check, !force_insensitive);
 
-       if (force_insensitive) {
+       gtk_widget_set_sensitive (event_editor->priv->all_day_check, !force_insensitive && is_organizer);
+
+       #define sensitize_part(x) G_STMT_START { \
+               GtkWidget *widget; \
+               \
+               widget = e_comp_editor_property_part_get_label_widget (x); \
+               if (widget) \
+                       gtk_widget_set_sensitive (widget, !force_insensitive && is_organizer); \
+               \
+               widget = e_comp_editor_property_part_get_edit_widget (x); \
+               if (widget) \
+                       gtk_widget_set_sensitive (widget, !force_insensitive && is_organizer); \
+       } G_STMT_END
+
+       sensitize_part (event_editor->priv->dtstart);
+       sensitize_part (event_editor->priv->dtend);
+       sensitize_part (event_editor->priv->timezone);
+
+       #undef sensitize_part
+
+       action = e_comp_editor_get_action (comp_editor, "all-day-event");
+       gtk_action_set_sensitive (action, !force_insensitive && is_organizer);
+
+       action = e_comp_editor_get_action (comp_editor, "classification-menu");
+       gtk_action_set_sensitive (action, !force_insensitive && is_organizer);
+
+       if (force_insensitive || !is_organizer) {
                ECalClient *client;
                const gchar *message = NULL;
 
@@ -169,6 +199,8 @@ ece_event_sensitize_widgets (ECompEditor *comp_editor,
                        message = _("Event cannot be edited, because the selected calendar could not be 
opened");
                else if (e_client_is_readonly (E_CLIENT (client)))
                        message = _("Event cannot be edited, because the selected calendar is read only");
+               else if (!is_organizer)
+                       message = _("Event cannot be fully edited, because you are not the organizer");
 
                if (message) {
                        EAlert *alert;
@@ -604,14 +636,17 @@ e_comp_editor_event_constructed (GObject *object)
 
        part = e_comp_editor_property_part_dtstart_new (C_("ECompEditor", "_Start time:"), FALSE, FALSE);
        e_comp_editor_page_add_property_part (page, part, 0, 4, 2, 1);
+       e_comp_editor_property_part_set_sensitize_handled (part, TRUE);
        event_editor->priv->dtstart = part;
 
        part = e_comp_editor_property_part_dtend_new (C_("ECompEditor", "_End time:"), FALSE, FALSE);
        e_comp_editor_page_add_property_part (page, part, 0, 5, 2, 1);
+       e_comp_editor_property_part_set_sensitize_handled (part, TRUE);
        event_editor->priv->dtend = part;
 
        part = e_comp_editor_property_part_timezone_new ();
        e_comp_editor_page_add_property_part (page, part, 0, 6, 3, 1);
+       e_comp_editor_property_part_set_sensitize_handled (part, TRUE);
        event_editor->priv->timezone = part;
 
        widget = gtk_check_button_new_with_mnemonic (C_("ECompEditor", "All da_y event"));
@@ -665,7 +700,7 @@ e_comp_editor_event_constructed (GObject *object)
        g_signal_connect (widget, "changed", G_CALLBACK (ece_event_dtend_changed_cb), event_editor);
 
        e_signal_connect_notify_swapped (event_editor->priv->all_day_check, "notify::active",
-               G_CALLBACK (ece_editor_all_day_toggled_cb), event_editor);
+               G_CALLBACK (ece_event_all_day_toggled_cb), event_editor);
 
        e_comp_editor_add_page (comp_editor, C_("ECompEditorPage", "General"), page);
 
diff --git a/calendar/gui/e-comp-editor-memo.c b/calendar/gui/e-comp-editor-memo.c
index b8112e0..50c6347 100644
--- a/calendar/gui/e-comp-editor-memo.c
+++ b/calendar/gui/e-comp-editor-memo.c
@@ -34,11 +34,64 @@
 
 struct _ECompEditorMemoPrivate {
        ECompEditorPropertyPart *categories;
+
+       gpointer insensitive_info_alert;
 };
 
 G_DEFINE_TYPE (ECompEditorMemo, e_comp_editor_memo, E_TYPE_COMP_EDITOR)
 
 static void
+ece_memo_sensitize_widgets (ECompEditor *comp_editor,
+                           gboolean force_insensitive)
+{
+       ECompEditorMemo *memo_editor;
+       gboolean is_organizer;
+       guint32 flags;
+
+       g_return_if_fail (E_IS_COMP_EDITOR_MEMO (comp_editor));
+
+       E_COMP_EDITOR_CLASS (e_comp_editor_memo_parent_class)->sensitize_widgets (comp_editor, 
force_insensitive);
+
+       flags = e_comp_editor_get_flags (comp_editor);
+       is_organizer = (flags & (E_COMP_EDITOR_FLAG_IS_NEW | E_COMP_EDITOR_FLAG_ORGANIZER_IS_USER)) != 0;
+       memo_editor = E_COMP_EDITOR_MEMO (comp_editor);
+
+       if (force_insensitive || !is_organizer) {
+               ECalClient *client;
+               const gchar *message = NULL;
+
+               client = e_comp_editor_get_target_client (comp_editor);
+               if (!client)
+                       message = _("Memo cannot be edited, because the selected memo list could not be 
opened");
+               else if (e_client_is_readonly (E_CLIENT (client)))
+                       message = _("Memo cannot be edited, because the selected memo list is read only");
+               else if (!is_organizer)
+                       message = _("Memo cannot be fully edited, because you are not the organizer");
+
+               if (message) {
+                       EAlert *alert;
+
+                       alert = e_comp_editor_add_information (comp_editor, message, NULL);
+
+                       if (memo_editor->priv->insensitive_info_alert)
+                               e_alert_response (memo_editor->priv->insensitive_info_alert, GTK_RESPONSE_OK);
+
+                       memo_editor->priv->insensitive_info_alert = alert;
+
+                       if (alert)
+                               g_object_add_weak_pointer (G_OBJECT (alert), 
&memo_editor->priv->insensitive_info_alert);
+
+                       g_clear_object (&alert);
+               } else  if (memo_editor->priv->insensitive_info_alert) {
+                       e_alert_response (memo_editor->priv->insensitive_info_alert, GTK_RESPONSE_OK);
+               }
+
+       } else if (memo_editor->priv->insensitive_info_alert) {
+               e_alert_response (memo_editor->priv->insensitive_info_alert, GTK_RESPONSE_OK);
+       }
+}
+
+static void
 ece_memo_setup_ui (ECompEditorMemo *memo_editor)
 {
        const gchar *ui =
@@ -175,4 +228,5 @@ e_comp_editor_memo_class_init (ECompEditorMemoClass *klass)
        comp_editor_class->title_format_with_attendees = _("Assigned Memo - %s");
        comp_editor_class->title_format_without_attendees = _("Memo - %s");
        comp_editor_class->icon_name = "stock_insert-note";
+       comp_editor_class->sensitize_widgets = ece_memo_sensitize_widgets;
 }
diff --git a/calendar/gui/e-comp-editor-page-attachments.c b/calendar/gui/e-comp-editor-page-attachments.c
index f2e860b..4b6276f 100644
--- a/calendar/gui/e-comp-editor-page-attachments.c
+++ b/calendar/gui/e-comp-editor-page-attachments.c
@@ -225,15 +225,29 @@ ecep_attachments_sensitize_widgets (ECompEditorPage *page,
                                    gboolean force_insensitive)
 {
        ECompEditorPageAttachments *page_attachments;
+       ECompEditor *comp_editor;
+       GtkAction *action;
+       guint32 flags;
+       gboolean is_organizer;
 
        g_return_if_fail (E_IS_COMP_EDITOR_PAGE_ATTACHMENTS (page));
 
        E_COMP_EDITOR_PAGE_CLASS (e_comp_editor_page_attachments_parent_class)->sensitize_widgets (page, 
force_insensitive);
 
+       comp_editor = e_comp_editor_page_ref_editor (page);
+       flags = e_comp_editor_get_flags (comp_editor);
+
+       is_organizer = (flags & (E_COMP_EDITOR_FLAG_IS_NEW | E_COMP_EDITOR_FLAG_ORGANIZER_IS_USER)) != 0;
+
        page_attachments = E_COMP_EDITOR_PAGE_ATTACHMENTS (page);
 
-       gtk_widget_set_sensitive (page_attachments->priv->controls_container, !force_insensitive);
-       gtk_widget_set_sensitive (page_attachments->priv->notebook, !force_insensitive);
+       gtk_widget_set_sensitive (page_attachments->priv->controls_container, !force_insensitive && 
is_organizer);
+       gtk_widget_set_sensitive (page_attachments->priv->notebook, !force_insensitive && is_organizer);
+
+       action = e_comp_editor_get_action (comp_editor, "attachments-attach");
+       gtk_action_set_sensitive (action, !force_insensitive && is_organizer);
+
+       g_clear_object (&comp_editor);
 }
 
 static void
diff --git a/calendar/gui/e-comp-editor-page-general.c b/calendar/gui/e-comp-editor-page-general.c
index 965c6da..ab8f63a 100644
--- a/calendar/gui/e-comp-editor-page-general.c
+++ b/calendar/gui/e-comp-editor-page-general.c
@@ -342,15 +342,17 @@ ecep_general_attendees_remove_clicked_cb (GtkButton *button,
 
        if (errors) {
                ECompEditor *comp_editor;
+               EAlert *alert;
 
                comp_editor = e_comp_editor_page_ref_editor (E_COMP_EDITOR_PAGE (page_general));
 
-               e_comp_editor_add_error (comp_editor, g_dngettext (GETTEXT_PACKAGE,
+               alert = e_comp_editor_add_error (comp_editor, g_dngettext (GETTEXT_PACKAGE,
                        "Failed to delete selected attendee",
                        "Failed to delete selected attendees",
                        failures), errors->str);
 
                g_string_free (errors, TRUE);
+               g_clear_object (&alert);
                g_clear_object (&comp_editor);
        }
 }
@@ -697,6 +699,7 @@ ecep_general_sensitize_widgets (ECompEditorPage *page,
 {
        ECompEditorPageGeneral *page_general;
        GtkTreeSelection *selection;
+       GtkAction *action;
        gboolean sensitive, organizer_is_user, delegate, delegate_to_many = FALSE, read_only = TRUE, 
any_selected = FALSE;
        ECompEditor *comp_editor;
        ECalClient *client;
@@ -742,6 +745,9 @@ ecep_general_sensitize_widgets (ECompEditorPage *page,
        e_meeting_list_view_set_editable (E_MEETING_LIST_VIEW (page_general->priv->attendees_list_view), 
sensitive && !force_insensitive);
        gtk_widget_set_sensitive (page_general->priv->attendees_list_view, !read_only && !force_insensitive);
 
+       action = e_comp_editor_get_action (comp_editor, "option-attendees");
+       gtk_action_set_sensitive (action, !force_insensitive && !read_only && organizer_is_user);
+
        g_clear_object (&comp_editor);
 }
 
@@ -792,6 +798,8 @@ ecep_general_fill_widgets (ECompEditorPage *page,
                        flags = e_comp_editor_get_flags (comp_editor);
                        registry = e_shell_get_registry (e_comp_editor_get_shell (comp_editor));
 
+                       flags = flags & E_COMP_EDITOR_FLAG_ORGANIZER_IS_USER;
+
                        if (itip_address_is_user (registry, itip_strip_mailto (organizer))) {
                                flags = flags | E_COMP_EDITOR_FLAG_ORGANIZER_IS_USER;
                        } else {
@@ -835,6 +843,8 @@ ecep_general_fill_widgets (ECompEditorPage *page,
                                gtk_entry_set_text (combo_box_entry, value);
                        }
 
+                       e_comp_editor_set_flags (comp_editor, flags);
+
                        g_clear_object (&comp_editor);
                        g_free (value);
                }
diff --git a/calendar/gui/e-comp-editor-page-recurrence.c b/calendar/gui/e-comp-editor-page-recurrence.c
index 5b933d7..aad72f9 100644
--- a/calendar/gui/e-comp-editor-page-recurrence.c
+++ b/calendar/gui/e-comp-editor-page-recurrence.c
@@ -1424,13 +1424,19 @@ ecep_recurrence_sensitize_widgets (ECompEditorPage *page,
                                   gboolean force_insensitive)
 {
        ECompEditorPageRecurrence *page_recurrence;
+       ECompEditor *comp_editor;
        GtkTreeSelection *selection;
-       gboolean create_recurrence, any_selected;
+       gboolean create_recurrence, any_selected, is_organizer;
+       guint32 flags;
 
        g_return_if_fail (E_IS_COMP_EDITOR_PAGE_RECURRENCE (page));
 
        E_COMP_EDITOR_PAGE_CLASS (e_comp_editor_page_recurrence_parent_class)->sensitize_widgets (page, 
force_insensitive);
 
+       comp_editor = e_comp_editor_page_ref_editor (page);
+       flags = e_comp_editor_get_flags (comp_editor);
+       g_clear_object (&comp_editor);
+
        page_recurrence = E_COMP_EDITOR_PAGE_RECURRENCE (page);
 
        selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (page_recurrence->priv->exceptions_tree_view));
@@ -1438,6 +1444,8 @@ ecep_recurrence_sensitize_widgets (ECompEditorPage *page,
        force_insensitive = force_insensitive || page_recurrence->priv->is_custom;
        create_recurrence = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON 
(page_recurrence->priv->recr_check_box));
        any_selected = gtk_tree_selection_count_selected_rows (selection) > 0;
+       is_organizer = (flags & (E_COMP_EDITOR_FLAG_IS_NEW | E_COMP_EDITOR_FLAG_ORGANIZER_IS_USER)) != 0;
+       force_insensitive = force_insensitive || !is_organizer;
 
        gtk_widget_set_sensitive (page_recurrence->priv->recr_check_box, !force_insensitive);
        gtk_widget_set_sensitive (page_recurrence->priv->recr_hbox, !force_insensitive && create_recurrence);
diff --git a/calendar/gui/e-comp-editor-page.c b/calendar/gui/e-comp-editor-page.c
index 896eed9..8cf9fb5 100644
--- a/calendar/gui/e-comp-editor-page.c
+++ b/calendar/gui/e-comp-editor-page.c
@@ -76,7 +76,7 @@ ecep_sensitize_widgets (ECompEditorPage *page,
                GtkWidget *widget;
 
                g_warn_if_fail (ppd != NULL);
-               if (!ppd)
+               if (!ppd || e_comp_editor_property_part_get_sensitize_handled (ppd->part))
                        continue;
 
                widget = e_comp_editor_property_part_get_label_widget (ppd->part);
diff --git a/calendar/gui/e-comp-editor-property-part.c b/calendar/gui/e-comp-editor-property-part.c
index 306376d..80fbe0c 100644
--- a/calendar/gui/e-comp-editor-property-part.c
+++ b/calendar/gui/e-comp-editor-property-part.c
@@ -31,10 +31,12 @@ struct _ECompEditorPropertyPartPrivate {
        GtkWidget *label_widget;
        GtkWidget *edit_widget;
        gboolean visible;
+       gboolean sensitize_handled;
 };
 
 enum {
        PROPERTY_PART_PROP_0,
+       PROPERTY_PART_PROP_SENSITIZE_HANDLED,
        PROPERTY_PART_PROP_VISIBLE
 };
 
@@ -54,6 +56,12 @@ e_comp_editor_property_part_set_property (GObject *object,
                                          GParamSpec *pspec)
 {
        switch (property_id) {
+               case PROPERTY_PART_PROP_SENSITIZE_HANDLED:
+                       e_comp_editor_property_part_set_sensitize_handled (
+                               E_COMP_EDITOR_PROPERTY_PART (object),
+                               g_value_get_boolean (value));
+                       return;
+
                case PROPERTY_PART_PROP_VISIBLE:
                        e_comp_editor_property_part_set_visible (
                                E_COMP_EDITOR_PROPERTY_PART (object),
@@ -71,6 +79,13 @@ e_comp_editor_property_part_get_property (GObject *object,
                                          GParamSpec *pspec)
 {
        switch (property_id) {
+               case PROPERTY_PART_PROP_SENSITIZE_HANDLED:
+                       g_value_set_boolean (
+                               value,
+                               e_comp_editor_property_part_get_sensitize_handled (
+                               E_COMP_EDITOR_PROPERTY_PART (object)));
+                       return;
+
                case PROPERTY_PART_PROP_VISIBLE:
                        g_value_set_boolean (
                                value,
@@ -137,6 +152,7 @@ e_comp_editor_property_part_init (ECompEditorPropertyPart *property_part)
                E_TYPE_COMP_EDITOR_PROPERTY_PART,
                ECompEditorPropertyPartPrivate);
        property_part->priv->visible = TRUE;
+       property_part->priv->sensitize_handled = FALSE;
 }
 
 static void
@@ -163,6 +179,17 @@ e_comp_editor_property_part_class_init (ECompEditorPropertyPartClass *klass)
                        G_PARAM_READWRITE |
                        G_PARAM_STATIC_STRINGS));
 
+       g_object_class_install_property (
+               object_class,
+               PROPERTY_PART_PROP_SENSITIZE_HANDLED,
+               g_param_spec_boolean (
+                       "sensitize-handled",
+                       "Sensitize Handled",
+                       "Whether the part's sensitive property is handled by the owner of it",
+                       FALSE,
+                       G_PARAM_READWRITE |
+                       G_PARAM_STATIC_STRINGS));
+
        property_part_signals[PROPERTY_PART_CHANGED] = g_signal_new (
                "changed",
                G_TYPE_FROM_CLASS (klass),
@@ -195,6 +222,28 @@ e_comp_editor_property_part_set_visible (ECompEditorPropertyPart *property_part,
        g_object_notify (G_OBJECT (property_part), "visible");
 }
 
+gboolean
+e_comp_editor_property_part_get_sensitize_handled (ECompEditorPropertyPart *property_part)
+{
+       g_return_val_if_fail (E_IS_COMP_EDITOR_PROPERTY_PART (property_part), FALSE);
+
+       return property_part->priv->sensitize_handled;
+}
+
+void
+e_comp_editor_property_part_set_sensitize_handled (ECompEditorPropertyPart *property_part,
+                                                  gboolean sensitize_handled)
+{
+       g_return_if_fail (E_IS_COMP_EDITOR_PROPERTY_PART (property_part));
+
+       if ((property_part->priv->sensitize_handled ? 1 : 0) == (sensitize_handled ? 1 : 0))
+               return;
+
+       property_part->priv->sensitize_handled = sensitize_handled;
+
+       g_object_notify (G_OBJECT (property_part), "sensitize-handled");
+}
+
 void
 e_comp_editor_property_part_create_widgets (ECompEditorPropertyPart *property_part,
                                            GtkWidget **out_label_widget,
diff --git a/calendar/gui/e-comp-editor-property-part.h b/calendar/gui/e-comp-editor-property-part.h
index 35895b7..0435f2a 100644
--- a/calendar/gui/e-comp-editor-property-part.h
+++ b/calendar/gui/e-comp-editor-property-part.h
@@ -177,6 +177,11 @@ GType              e_comp_editor_property_part_get_type            (void) G_GNUC_CONST;
 gboolean       e_comp_editor_property_part_get_visible         (ECompEditorPropertyPart *property_part);
 void           e_comp_editor_property_part_set_visible         (ECompEditorPropertyPart *property_part,
                                                                 gboolean visible);
+gboolean       e_comp_editor_property_part_get_sensitize_handled
+                                                               (ECompEditorPropertyPart *property_part);
+void           e_comp_editor_property_part_set_sensitize_handled
+                                                               (ECompEditorPropertyPart *property_part,
+                                                                gboolean sensitize_handled);
 void           e_comp_editor_property_part_create_widgets      (ECompEditorPropertyPart *property_part,
                                                                 GtkWidget **out_label_widget,
                                                                 GtkWidget **out_edit_widget);
diff --git a/calendar/gui/e-comp-editor-task.c b/calendar/gui/e-comp-editor-task.c
index 5cf0c56..630aba3 100644
--- a/calendar/gui/e-comp-editor-task.c
+++ b/calendar/gui/e-comp-editor-task.c
@@ -287,14 +287,18 @@ ece_task_sensitize_widgets (ECompEditor *comp_editor,
                            gboolean force_insensitive)
 {
        ECompEditorTask *task_editor;
+       gboolean is_organizer;
+       guint32 flags;
 
        g_return_if_fail (E_IS_COMP_EDITOR_TASK (comp_editor));
 
        E_COMP_EDITOR_CLASS (e_comp_editor_task_parent_class)->sensitize_widgets (comp_editor, 
force_insensitive);
 
+       flags = e_comp_editor_get_flags (comp_editor);
+       is_organizer = (flags & (E_COMP_EDITOR_FLAG_IS_NEW | E_COMP_EDITOR_FLAG_ORGANIZER_IS_USER)) != 0;
        task_editor = E_COMP_EDITOR_TASK (comp_editor);
 
-       if (force_insensitive) {
+       if (force_insensitive || !is_organizer) {
                ECalClient *client;
                const gchar *message = NULL;
 
@@ -303,6 +307,8 @@ ece_task_sensitize_widgets (ECompEditor *comp_editor,
                        message = _("Task cannot be edited, because the selected task list could not be 
opened");
                else if (e_client_is_readonly (E_CLIENT (client)))
                        message = _("Task cannot be edited, because the selected task list is read only");
+               else if (!is_organizer)
+                       message = _("Task cannot be fully edited, because you are not the organizer");
 
                if (message) {
                        EAlert *alert;
diff --git a/calendar/gui/e-comp-editor.c b/calendar/gui/e-comp-editor.c
index 248f6b0..12688c6 100644
--- a/calendar/gui/e-comp-editor.c
+++ b/calendar/gui/e-comp-editor.c
@@ -287,15 +287,6 @@ e_comp_editor_set_component (ECompEditor *comp_editor,
        g_warn_if_fail (comp_editor->priv->component != NULL);
 }
 
-static void
-e_comp_editor_set_flags (ECompEditor *comp_editor,
-                        guint32 flags)
-{
-       g_return_if_fail (E_IS_COMP_EDITOR (comp_editor));
-
-       comp_editor->priv->flags = flags;
-}
-
 typedef struct _SaveData {
        ECompEditor *comp_editor;
        ECalClient *source_client;
@@ -339,6 +330,7 @@ save_data_free (SaveData *sd)
 
                                sd->comp_editor->priv->flags = sd->comp_editor->priv->flags & 
(~E_COMP_EDITOR_FLAG_IS_NEW);
 
+                               e_comp_editor_sensitize_widgets (sd->comp_editor);
                                e_comp_editor_set_changed (sd->comp_editor, FALSE);
                        }
                } else if (sd->alert_ident) {
@@ -2713,6 +2705,20 @@ e_comp_editor_get_flags (ECompEditor *comp_editor)
        return comp_editor->priv->flags;
 }
 
+void
+e_comp_editor_set_flags (ECompEditor *comp_editor,
+                        guint32 flags)
+{
+       g_return_if_fail (E_IS_COMP_EDITOR (comp_editor));
+
+       if (comp_editor->priv->flags == flags)
+               return;
+
+       comp_editor->priv->flags = flags;
+
+       g_object_notify (G_OBJECT (comp_editor), "flags");
+}
+
 EFocusTracker *
 e_comp_editor_get_focus_tracker (ECompEditor *comp_editor)
 {
diff --git a/calendar/gui/e-comp-editor.h b/calendar/gui/e-comp-editor.h
index 6b5dc2f..ac0d4c9 100644
--- a/calendar/gui/e-comp-editor.h
+++ b/calendar/gui/e-comp-editor.h
@@ -107,6 +107,8 @@ ESource *   e_comp_editor_get_origin_source (ECompEditor *comp_editor);
 const icalcomponent *
                e_comp_editor_get_component     (ECompEditor *comp_editor);
 guint32                e_comp_editor_get_flags         (ECompEditor *comp_editor);
+void           e_comp_editor_set_flags         (ECompEditor *comp_editor,
+                                                guint32 flags);
 EFocusTracker *        e_comp_editor_get_focus_tracker (ECompEditor *comp_editor);
 GtkUIManager * e_comp_editor_get_ui_manager    (ECompEditor *comp_editor);
 GtkAction *    e_comp_editor_get_action        (ECompEditor *comp_editor,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]