[gnome-control-center/T20818: 14/54] network: adapt dialog do small screens



commit 39c9c81363f2df08b62f069e9b1cb8d07e915c95
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Tue Feb 2 13:24:08 2016 -0200

    network: adapt dialog do small screens
    
    When in small screens, the connection editor dialog
    doesn't scale down to the screen size due to the
    minimum width and height of it's children.
    
    Fix that by adding a scrolled window that makes the
    dialog scrollable when in small screens.
    
    [endlessm/eos-shell#6226]

 .../network/connection-editor/connection-editor.ui |   15 +++++++++++++++
 .../connection-editor/net-connection-editor.c      |   15 +++++++++++++++
 .../connection-editor/net-connection-editor.h      |    2 ++
 3 files changed, 32 insertions(+), 0 deletions(-)
---
diff --git a/panels/network/connection-editor/connection-editor.ui 
b/panels/network/connection-editor/connection-editor.ui
index 4495c72..1472d3e 100644
--- a/panels/network/connection-editor/connection-editor.ui
+++ b/panels/network/connection-editor/connection-editor.ui
@@ -36,6 +36,17 @@
         <property name="spacing">0</property>
         <property name="border_width">0</property>
         <child>
+          <object class="GtkScrolledWindow" id="toplevel_scrolled_window">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="hscrollbar_policy">never</property>
+            <property name="vscrollbar_policy">never</property>
+            <child>
+              <object class="GtkViewport">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="shadow_type">none</property>
+        <child>
           <object class="GtkNotebook" id="details_toplevel_notebook">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
@@ -114,6 +125,10 @@
               </packing>
             </child>
           </object>
+        </child>
+              </object>
+            </child>
+          </object>
           <packing>
             <property name="expand">True</property>
             <property name="fill">True</property>
diff --git a/panels/network/connection-editor/net-connection-editor.c 
b/panels/network/connection-editor/net-connection-editor.c
index 8c21667..1c1d7e2 100644
--- a/panels/network/connection-editor/net-connection-editor.c
+++ b/panels/network/connection-editor/net-connection-editor.c
@@ -21,6 +21,8 @@
 
 #include "config.h"
 
+#include <shell/cc-panel.h>
+
 #include <glib-object.h>
 #include <glib/gi18n.h>
 
@@ -159,6 +161,7 @@ net_connection_editor_init (NetConnectionEditor *editor)
         }
 
         editor->window = GTK_WIDGET (gtk_builder_get_object (editor->builder, "details_dialog"));
+        editor->scrolled_window = GTK_WIDGET (gtk_builder_get_object (editor->builder, 
"toplevel_scrolled_window"));
 }
 
 void
@@ -833,6 +836,18 @@ net_connection_editor_new (GtkWindow        *parent_window,
         else
                 net_connection_editor_add_connection (editor);
 
+        /* Show scrollbars when on low resolution displays */
+        if (CC_IS_SHELL (parent_window) && cc_shell_is_small_screen (CC_SHELL (parent_window))) {
+                gint width, height;
+
+                gtk_window_get_size (parent_window, &width, &height);
+                gtk_widget_set_size_request (editor->window, width, height);
+
+                gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (editor->scrolled_window),
+                                                GTK_POLICY_AUTOMATIC,
+                                                GTK_POLICY_AUTOMATIC);
+            }
+
         return editor;
 }
 
diff --git a/panels/network/connection-editor/net-connection-editor.h 
b/panels/network/connection-editor/net-connection-editor.h
index 431edf2..22ea552 100644
--- a/panels/network/connection-editor/net-connection-editor.h
+++ b/panels/network/connection-editor/net-connection-editor.h
@@ -43,6 +43,8 @@ struct _NetConnectionEditor
 {
          GObject parent;
 
+        GtkWidget        *scrolled_window;
+
         GtkWidget        *parent_window;
         NMClient         *client;
         NMDevice         *device;


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