[evolution/wip/webkit2] [ECompEditor] Change order of an alert add and remove



commit 9764722dbb17f0f7a8754552502f3d86879b3d4b
Author: Milan Crha <mcrha redhat com>
Date:   Wed Nov 18 11:47:31 2015 +0100

    [ECompEditor] Change order of an alert add and remove
    
    The previous order of "add new, then remove old" was meant to workaround
    bug in GtkInfoBar which can be left hidden due to the animation of it when
    it contains the alert. It was forgotten that the alert bar avoids duplicates,
    thus it could happen that the alert had been removed from the UI, because
    it was already in the alert bar.
    
    The previous commit workaround the GtkInfoBar issue differently, by disabling
    the animation of it, which makes things much easier in the code.

 calendar/gui/e-comp-editor-event.c |   11 +++--------
 calendar/gui/e-comp-editor-memo.c  |   11 +++--------
 calendar/gui/e-comp-editor-task.c  |   19 ++++++-------------
 3 files changed, 12 insertions(+), 29 deletions(-)
---
diff --git a/calendar/gui/e-comp-editor-event.c b/calendar/gui/e-comp-editor-event.c
index fa7f967..db28281 100644
--- a/calendar/gui/e-comp-editor-event.c
+++ b/calendar/gui/e-comp-editor-event.c
@@ -190,6 +190,9 @@ ece_event_sensitize_widgets (ECompEditor *comp_editor,
        action = e_comp_editor_get_action (comp_editor, "classification-menu");
        gtk_action_set_sensitive (action, !force_insensitive && is_organizer);
 
+       if (event_editor->priv->insensitive_info_alert)
+               e_alert_response (event_editor->priv->insensitive_info_alert, GTK_RESPONSE_OK);
+
        if (force_insensitive || !is_organizer) {
                ECalClient *client;
                const gchar *message = NULL;
@@ -207,21 +210,13 @@ ece_event_sensitize_widgets (ECompEditor *comp_editor,
 
                        alert = e_comp_editor_add_information (comp_editor, message, NULL);
 
-                       if (event_editor->priv->insensitive_info_alert)
-                               e_alert_response (event_editor->priv->insensitive_info_alert, 
GTK_RESPONSE_OK);
-
                        event_editor->priv->insensitive_info_alert = alert;
 
                        if (alert)
                                g_object_add_weak_pointer (G_OBJECT (alert), 
&event_editor->priv->insensitive_info_alert);
 
                        g_clear_object (&alert);
-               } else  if (event_editor->priv->insensitive_info_alert) {
-                       e_alert_response (event_editor->priv->insensitive_info_alert, GTK_RESPONSE_OK);
                }
-
-       } else if (event_editor->priv->insensitive_info_alert) {
-               e_alert_response (event_editor->priv->insensitive_info_alert, GTK_RESPONSE_OK);
        }
 }
 
diff --git a/calendar/gui/e-comp-editor-memo.c b/calendar/gui/e-comp-editor-memo.c
index 50c6347..2114c0d 100644
--- a/calendar/gui/e-comp-editor-memo.c
+++ b/calendar/gui/e-comp-editor-memo.c
@@ -56,6 +56,9 @@ ece_memo_sensitize_widgets (ECompEditor *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 (memo_editor->priv->insensitive_info_alert)
+               e_alert_response (memo_editor->priv->insensitive_info_alert, GTK_RESPONSE_OK);
+
        if (force_insensitive || !is_organizer) {
                ECalClient *client;
                const gchar *message = NULL;
@@ -73,21 +76,13 @@ ece_memo_sensitize_widgets (ECompEditor *comp_editor,
 
                        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);
        }
 }
 
diff --git a/calendar/gui/e-comp-editor-task.c b/calendar/gui/e-comp-editor-task.c
index 630aba3..90f8917 100644
--- a/calendar/gui/e-comp-editor-task.c
+++ b/calendar/gui/e-comp-editor-task.c
@@ -59,6 +59,9 @@ ece_task_check_dates_in_the_past (ECompEditorTask *task_editor)
 
        flags = e_comp_editor_get_flags (E_COMP_EDITOR (task_editor));
 
+       if (task_editor->priv->in_the_past_alert)
+               e_alert_response (task_editor->priv->in_the_past_alert, GTK_RESPONSE_OK);
+
        if ((flags & E_COMP_EDITOR_FLAG_IS_NEW) != 0) {
                GString *message = NULL;
                struct icaltimetype dtstart_itt, due_date_itt;
@@ -85,9 +88,6 @@ ece_task_check_dates_in_the_past (ECompEditorTask *task_editor)
 
                        alert = e_comp_editor_add_warning (E_COMP_EDITOR (task_editor), message->str, NULL);
 
-                       if (task_editor->priv->in_the_past_alert)
-                               e_alert_response (task_editor->priv->in_the_past_alert, GTK_RESPONSE_OK);
-
                        task_editor->priv->in_the_past_alert = alert;
 
                        if (alert)
@@ -95,8 +95,6 @@ ece_task_check_dates_in_the_past (ECompEditorTask *task_editor)
 
                        g_string_free (message, TRUE);
                        g_clear_object (&alert);
-               } else if (task_editor->priv->in_the_past_alert) {
-                       e_alert_response (task_editor->priv->in_the_past_alert, GTK_RESPONSE_OK);
                }
        }
 }
@@ -298,6 +296,9 @@ ece_task_sensitize_widgets (ECompEditor *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 (task_editor->priv->insensitive_info_alert)
+               e_alert_response (task_editor->priv->insensitive_info_alert, GTK_RESPONSE_OK);
+
        if (force_insensitive || !is_organizer) {
                ECalClient *client;
                const gchar *message = NULL;
@@ -315,21 +316,13 @@ ece_task_sensitize_widgets (ECompEditor *comp_editor,
 
                        alert = e_comp_editor_add_information (comp_editor, message, NULL);
 
-                       if (task_editor->priv->insensitive_info_alert)
-                               e_alert_response (task_editor->priv->insensitive_info_alert, GTK_RESPONSE_OK);
-
                        task_editor->priv->insensitive_info_alert = alert;
 
                        if (alert)
                                g_object_add_weak_pointer (G_OBJECT (alert), 
&task_editor->priv->insensitive_info_alert);
 
                        g_clear_object (&alert);
-               } else  if (task_editor->priv->insensitive_info_alert) {
-                       e_alert_response (task_editor->priv->insensitive_info_alert, GTK_RESPONSE_OK);
                }
-
-       } else if (task_editor->priv->insensitive_info_alert) {
-               e_alert_response (task_editor->priv->insensitive_info_alert, GTK_RESPONSE_OK);
        }
 
        ece_task_check_dates_in_the_past (task_editor);


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