[gtk+] bgo #721407 - Fix scrolled window to work with template subclasses.



commit 07d6c69128bae1191980ed2a72fb274055cc5392
Author: Tristan Van Berkom <tristan upstairslabs com>
Date:   Sat Jan 4 11:55:41 2014 +0900

    bgo #721407 - Fix scrolled window to work with template subclasses.
    
    Ensure the hscrollbar & vscrollbar at gtk_scrolled_window_add() time,
    this allows one to subclass GtkScrolledWindow with templates and add
    children, as this will happen at instance initialization time before
    the construct adjustment properties take effect.

 gtk/gtkscrolledwindow.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index 56cf662..e17376e 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -2926,6 +2926,15 @@ gtk_scrolled_window_add (GtkContainer *container,
   scrolled_window = GTK_SCROLLED_WINDOW (container);
   priv = scrolled_window->priv;
 
+  /* gtk_scrolled_window_set_[hv]adjustment have the side-effect
+   * of creating the scrollbars
+   */
+  if (!priv->hscrollbar)
+    gtk_scrolled_window_set_hadjustment (scrolled_window, NULL);
+
+  if (!priv->vscrollbar)
+    gtk_scrolled_window_set_vadjustment (scrolled_window, NULL);
+
   hadj = gtk_range_get_adjustment (GTK_RANGE (priv->hscrollbar));
   vadj = gtk_range_get_adjustment (GTK_RANGE (priv->vscrollbar));
 


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