[evolution/wip/webkit2] Pack editors which implement GtkScrollable in a scrolled window



commit 1bb2f30abd927a0d8c1d3ade0387e63a6d4b0096
Author: Milan Crha <mcrha redhat com>
Date:   Fri Jun 10 16:21:33 2016 +0200

    Pack editors which implement GtkScrollable in a scrolled window

 composer/e-composer-private.c |    5 +++++
 e-util/e-html-editor.c        |   18 +++++++++++++++++-
 2 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/composer/e-composer-private.c b/composer/e-composer-private.c
index c0b0db9..4023bd7 100644
--- a/composer/e-composer-private.c
+++ b/composer/e-composer-private.c
@@ -255,6 +255,11 @@ e_composer_private_constructed (EMsgComposer *composer)
        gtk_widget_show (widget);
 
        widget = GTK_WIDGET (cnt_editor);
+       if (GTK_IS_SCROLLABLE (cnt_editor)) {
+               /* Scrollables are packed in a scrolled window */
+               widget = gtk_widget_get_parent (widget);
+               g_warn_if_fail (GTK_IS_SCROLLED_WINDOW (widget));
+       }
        gtk_widget_reparent (widget, container);
 
        /* Construct the picture gallery. */
diff --git a/e-util/e-html-editor.c b/e-util/e-html-editor.c
index 3e436fb..30d256e 100644
--- a/e-util/e-html-editor.c
+++ b/e-util/e-html-editor.c
@@ -645,7 +645,23 @@ html_editor_constructed (GObject *object)
 
        /* Construct the main editing area. */
        widget = GTK_WIDGET (e_html_editor_get_content_editor (editor));
-       gtk_grid_attach (GTK_GRID (editor), widget, 0, 4, 1, 1);
+
+       /* Pack editors which implement GtkScrollable in a scrolled window */
+       if (GTK_IS_SCROLLABLE (widget)) {
+               GtkWidget *scrolled_window;
+
+               scrolled_window = gtk_scrolled_window_new (NULL, NULL);
+               gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
+                       GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+               gtk_widget_show (scrolled_window);
+
+               gtk_grid_attach (GTK_GRID (editor), scrolled_window, 0, 4, 1, 1);
+
+               gtk_container_add (GTK_CONTAINER (scrolled_window), widget);
+       } else {
+               gtk_grid_attach (GTK_GRID (editor), widget, 0, 4, 1, 1);
+       }
+
        gtk_widget_show (widget);
 
        g_signal_connect (


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