[gnome-control-center/wip/feborges/new-search-panel: 3/9] search: Set min-content-height on the scrolled window



commit 935ea8098a9f9db5a86690eb48a28da929839d3a
Author: Felipe Borges <felipeborges gnome org>
Date:   Thu Nov 3 15:14:06 2016 +0100

    search: 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

 panels/search/cc-search-panel.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/panels/search/cc-search-panel.c b/panels/search/cc-search-panel.c
index d370d93..f6c11c2 100644
--- a/panels/search/cc-search-panel.c
+++ b/panels/search/cc-search-panel.c
@@ -680,6 +680,24 @@ populate_search_providers (CcSearchPanel *self)
 }
 
 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_search_panel_dispose (GObject *object)
 {
   CcSearchPanelPrivate *priv = CC_SEARCH_PANEL (object)->priv;
@@ -716,6 +734,8 @@ cc_search_panel_constructed (GObject *object)
 
   /* add the disable all switch */
   search_box = WID ("search_vbox");
+  g_signal_connect (search_box, "size-allocate",
+                    G_CALLBACK (on_content_size_changed), NULL);
   box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
 
   widget = gtk_switch_new ();


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