[gnome-control-center] mouse: Set min-content-height on the scrolled window



commit 6b3233359c3640c47dacf6e6e28fc6e1bbfd3d5b
Author: Felipe Borges <felipeborges gnome org>
Date:   Mon Oct 17 15:01:21 2016 +0200

    mouse: Set min-content-height on the scrolled window
    
    Set a minimum content height of 490px for the panel when the
    allocated height is smaller than 490px.
    
    490 is an estimated value for the panels to properly fit on netbook
    screens. See https://wiki.gnome.org/Design/SystemSettings#Notes
    
    This also drops the max-content-height limit for the scrolled window,
    as it is no longer necessary.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=771743

 panels/mouse/gnome-mouse-properties.c  |   16 ++++++++++++++++
 panels/mouse/gnome-mouse-properties.ui |    1 -
 2 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/panels/mouse/gnome-mouse-properties.c b/panels/mouse/gnome-mouse-properties.c
index 9fd8c1a..126b762 100644
--- a/panels/mouse/gnome-mouse-properties.c
+++ b/panels/mouse/gnome-mouse-properties.c
@@ -312,6 +312,20 @@ device_changed (GsdDeviceManager *device_manager,
                                show_touchpad_enabling_switch (d));
 }
 
+static void
+on_content_size_changed (GtkWidget     *widget,
+                         GtkAllocation *allocation,
+                         gpointer       data)
+{
+       if (allocation->height < 490) {
+               gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (widget),
+                                               GTK_POLICY_NEVER, GTK_POLICY_NEVER);
+       } else {
+               gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (widget),
+                                               GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+               gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (widget), 490);
+       }
+}
 
 static void
 cc_mouse_properties_finalize (GObject *object)
@@ -380,6 +394,8 @@ cc_mouse_properties_init (CcMouseProperties *object)
        gtk_container_add (GTK_CONTAINER (object), WID ("scrolled-window"));
 
        setup_dialog (d);
+
+       g_signal_connect (WID ("scrolled-window"), "size-allocate", G_CALLBACK (on_content_size_changed), 
NULL);
 }
 
 GtkWidget *
diff --git a/panels/mouse/gnome-mouse-properties.ui b/panels/mouse/gnome-mouse-properties.ui
index a5c93d7..b62442c 100644
--- a/panels/mouse/gnome-mouse-properties.ui
+++ b/panels/mouse/gnome-mouse-properties.ui
@@ -21,7 +21,6 @@
     <property name="can_focus">True</property>
     <property name="shadow_type">none</property>
     <property name="hscrollbar_policy">never</property>
-    <property name="max_content_height">440</property>
     <child>
       <object class="GtkBox" id="prefs_widget">
         <property name="visible">True</property>


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