[pitivi] timeline: Fix timeline layer controls expanding the parent widget



commit 2c0ec3872464cbc6e5059423f5d0ae48d1af05b1
Author: Renà Stadler <mail renestadler de>
Date:   Mon Aug 27 14:34:39 2012 -0700

    timeline: Fix timeline layer controls expanding the parent widget
    
    This wasn't needed in gtk2 because all widgets could shrink. Scrolled window +
    viewport is supposed to provide the same shrinking logic for gtk3. That would
    only work without scrollbar policy NEVER, so we need this little scrollbar hide
    hack to get what we need.
    
    Setting "shrink" on the paned doesn't fix this either, because we still
    wouldn't be able to shrink the controls at all.

 pitivi/timeline/timeline.py |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index 37cbdda..25ebe5d 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -1014,11 +1014,23 @@ class Timeline(gtk.Table, Loggable, Zoomable):
 
         # controls for tracks and layers
         self.controls = TimelineControls(self.app)
-        controlwindow = gtk.Viewport(None, self.vadj)
+        controlwindow = gtk.Viewport(None, None)
         controlwindow.add(self.controls)
         controlwindow.set_size_request(-1, 1)
         controlwindow.set_shadow_type(gtk.SHADOW_OUT)
-        self.attach(controlwindow, 0, 1, 1, 2, xoptions=gtk.FILL)
+        scrolledwindow = gtk.ScrolledWindow()
+        scrolledwindow.add(controlwindow)
+        scrolledwindow.props.hscrollbar_policy = gtk.POLICY_NEVER
+        scrolledwindow.props.vscrollbar_policy = gtk.POLICY_ALWAYS
+        scrolledwindow.props.vadjustment = self.vadj
+        # We need ALWAYS policy for correct sizing, but we don't want the
+        # scrollbar to be visible. Yay gtk3!
+        scrollbar = scrolledwindow.get_vscrollbar()
+        def scrollbar_show_cb(scrollbar):
+            scrollbar.hide()
+        scrollbar.connect("show", scrollbar_show_cb)
+        scrollbar.hide()
+        self.attach(scrolledwindow, 0, 1, 1, 2, xoptions=gtk.FILL)
 
         # timeline ruler
         self.ruler = ruler.ScaleRuler(self.app, self.hadj)



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