[evolution] Bug 782210 - Divide message list and preview panel size proportionally ][



commit fdbd5810735fa3878ffc82a107df21fabf9667ab
Author: Milan Crha <mcrha redhat com>
Date:   Tue Jun 27 18:28:44 2017 +0200

    Bug 782210 - Divide message list and preview panel size proportionally ][

 src/e-util/e-paned.c               |    8 ++--
 src/shell/e-shell-window-private.c |    1 +
 src/shell/e-shell-window-private.h |    2 +
 src/shell/e-shell-window.c         |   56 ++++++++++++++++++++++++++++++++++++
 4 files changed, 63 insertions(+), 4 deletions(-)
---
diff --git a/src/e-util/e-paned.c b/src/e-util/e-paned.c
index 7c158fb..59c459e 100644
--- a/src/e-util/e-paned.c
+++ b/src/e-util/e-paned.c
@@ -284,9 +284,6 @@ paned_size_allocate (GtkWidget *widget,
        /* Chain up to parent's size_allocate() method. */
        GTK_WIDGET_CLASS (e_paned_parent_class)->size_allocate (widget, allocation);
 
-       if (!paned->priv->toplevel_ready)
-               return;
-
        if (paned->priv->sync_request == SYNC_REQUEST_PROPORTION &&
            old_proportion != e_paned_get_proportion (paned) && old_proportion > 0.0) {
                paned->priv->proportion = old_proportion;
@@ -295,6 +292,9 @@ paned_size_allocate (GtkWidget *widget,
                corrected_portion = TRUE;
        }
 
+       if (!paned->priv->toplevel_ready)
+               return;
+
        if (paned->priv->sync_request == SYNC_REQUEST_NONE) {
                paned_recalc_positions (paned, FALSE);
                return;
@@ -330,7 +330,7 @@ paned_size_allocate (GtkWidget *widget,
                "max-position", &max_position,
                NULL);
 
-       clamp_position = position = MAX (0, CLAMP (position, min_position, max_position));
+       clamp_position = MAX (0, CLAMP (position, min_position, max_position));
 
        if (clamp_position != gtk_paned_get_position (GTK_PANED (paned)))
                gtk_paned_set_position (GTK_PANED (paned), clamp_position);
diff --git a/src/shell/e-shell-window-private.c b/src/shell/e-shell-window-private.c
index f9614f7..fae3b7f 100644
--- a/src/shell/e-shell-window-private.c
+++ b/src/shell/e-shell-window-private.c
@@ -660,6 +660,7 @@ e_shell_window_private_finalize (EShellWindow *shell_window)
 
        g_hash_table_destroy (priv->loaded_views);
 
+       g_slist_free_full (priv->postponed_alerts, g_object_unref);
        g_free (priv->geometry);
 }
 
diff --git a/src/shell/e-shell-window-private.h b/src/shell/e-shell-window-private.h
index 68d0832..6a7f227 100644
--- a/src/shell/e-shell-window-private.h
+++ b/src/shell/e-shell-window-private.h
@@ -98,6 +98,8 @@ struct _EShellWindowPrivate {
        guint is_main_instance : 1;
 
        gulong delayed_menubar_show_id;
+
+       GSList *postponed_alerts; /* EAlert * */
 };
 
 void           e_shell_window_private_init     (EShellWindow *shell_window);
diff --git a/src/shell/e-shell-window.c b/src/shell/e-shell-window.c
index 8f0fc95..6919c58 100644
--- a/src/shell/e-shell-window.c
+++ b/src/shell/e-shell-window.c
@@ -844,6 +844,14 @@ shell_window_submit_alert (EAlertSink *alert_sink,
        GtkWidget *dialog;
 
        shell_window = E_SHELL_WINDOW (alert_sink);
+
+       if (!gtk_widget_get_mapped (GTK_WIDGET (shell_window)) ||
+           shell_window->priv->postponed_alerts) {
+               shell_window->priv->postponed_alerts = g_slist_prepend (
+                       shell_window->priv->postponed_alerts, g_object_ref (alert));
+               return;
+       }
+
        alert_bar = e_shell_window_get_alert_bar (shell_window);
 
        switch (e_alert_get_message_type (alert)) {
@@ -863,6 +871,53 @@ shell_window_submit_alert (EAlertSink *alert_sink,
        }
 }
 
+static gboolean
+shell_window_submit_postponed_alerts_idle_cb (gpointer user_data)
+{
+       EShellWindow *shell_window = user_data;
+       EAlertSink *alert_sink;
+       GSList *postponed_alerts, *link;
+
+       g_return_val_if_fail (E_IS_SHELL_WINDOW (shell_window), FALSE);
+
+       postponed_alerts = g_slist_reverse (shell_window->priv->postponed_alerts);
+       shell_window->priv->postponed_alerts = NULL;
+
+       alert_sink = E_ALERT_SINK (shell_window);
+
+       for (link = postponed_alerts; link; link = g_slist_next (link)) {
+               EAlert *alert = link->data;
+
+               shell_window_submit_alert (alert_sink, alert);
+       }
+
+       g_slist_free_full (postponed_alerts, g_object_unref);
+
+       return FALSE;
+}
+
+static gboolean
+shell_window_map_event (GtkWidget *widget,
+                       GdkEventAny *event)
+{
+       EShellWindow *shell_window;
+       gboolean res;
+
+       g_return_val_if_fail (E_IS_SHELL_WINDOW (widget), FALSE);
+
+       shell_window = E_SHELL_WINDOW (widget);
+
+       /* Chain up to parent's method */
+       res = GTK_WIDGET_CLASS (e_shell_window_parent_class)->map_event (widget, event);
+
+       g_idle_add_full (
+               G_PRIORITY_LOW,
+               shell_window_submit_postponed_alerts_idle_cb,
+               g_object_ref (shell_window), g_object_unref);
+
+       return res;
+}
+
 static void
 e_shell_window_class_init (EShellWindowClass *class)
 {
@@ -881,6 +936,7 @@ e_shell_window_class_init (EShellWindowClass *class)
 
        widget_class = GTK_WIDGET_CLASS (class);
        widget_class->get_preferred_width = shell_window_get_preferred_width;
+       widget_class->map_event = shell_window_map_event;
 
        class->close_alert = shell_window_close_alert;
        class->construct_menubar = shell_window_construct_menubar;


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