[gnome-control-center/wip/carlosg/network-ce-follow-focus] network: Make IPv4/v6 pages drive the scrolledwindow adjustments



commit 24dfaae4f87e6e1f7204497bf8f04cc055536ca7
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Dec 12 16:20:57 2019 +0100

    network: Make IPv4/v6 pages drive the scrolledwindow adjustments
    
    Those 2 pages in the connection editor dialog are scrollable, but don't
    hook focus changes so they drive the adjustments. Make them do so.

 panels/network/connection-editor/ce-page-ip4.c | 5 +++++
 panels/network/connection-editor/ce-page-ip6.c | 5 +++++
 panels/network/connection-editor/ip4-page.ui   | 2 +-
 panels/network/connection-editor/ip6-page.ui   | 2 +-
 4 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/panels/network/connection-editor/ce-page-ip4.c b/panels/network/connection-editor/ce-page-ip4.c
index 609bea3bd..475b989c4 100644
--- a/panels/network/connection-editor/ce-page-ip4.c
+++ b/panels/network/connection-editor/ce-page-ip4.c
@@ -39,6 +39,7 @@ struct _CEPageIP4
 {
         GtkScrolledWindow parent;
 
+        GtkWidget         *main_box;
         GtkBox            *address_box;
         GtkSizeGroup      *address_sizegroup;
         GtkSwitch         *auto_dns_switch;
@@ -504,6 +505,9 @@ connect_ip4_page (CEPageIP4 *self)
         const gchar *str_method;
         guint method;
 
+        gtk_container_set_focus_vadjustment (GTK_CONTAINER (self->main_box),
+                                             gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW 
(self)));
+
         add_address_box (self);
         add_dns_section (self);
         add_routes_box (self);
@@ -876,6 +880,7 @@ ce_page_ip4_class_init (CEPageIP4Class *klass)
 
         gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/control-center/network/ip4-page.ui");
 
+        gtk_widget_class_bind_template_child (widget_class, CEPageIP4, main_box);
         gtk_widget_class_bind_template_child (widget_class, CEPageIP4, address_box);
         gtk_widget_class_bind_template_child (widget_class, CEPageIP4, address_sizegroup);
         gtk_widget_class_bind_template_child (widget_class, CEPageIP4, auto_dns_switch);
diff --git a/panels/network/connection-editor/ce-page-ip6.c b/panels/network/connection-editor/ce-page-ip6.c
index 6a27200c8..25010837a 100644
--- a/panels/network/connection-editor/ce-page-ip6.c
+++ b/panels/network/connection-editor/ce-page-ip6.c
@@ -40,6 +40,7 @@ struct _CEPageIP6
 {
         GtkScrolledWindow parent;
 
+        GtkWidget         *main_box;
         GtkBox            *address_box;
         GtkSizeGroup      *address_sizegroup;
         GtkSwitch         *auto_dns_switch;
@@ -474,6 +475,9 @@ connect_ip6_page (CEPageIP6 *self)
         const gchar *str_method;
         guint method;
 
+        gtk_container_set_focus_vadjustment (GTK_CONTAINER (self->main_box),
+                                             gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW 
(self)));
+
         add_address_box (self);
         add_dns_section (self);
         add_routes_box (self);
@@ -807,6 +811,7 @@ ce_page_ip6_class_init (CEPageIP6Class *klass)
 
         gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/control-center/network/ip6-page.ui");
 
+        gtk_widget_class_bind_template_child (widget_class, CEPageIP6, main_box);
         gtk_widget_class_bind_template_child (widget_class, CEPageIP6, address_box);
         gtk_widget_class_bind_template_child (widget_class, CEPageIP6, address_sizegroup);
         gtk_widget_class_bind_template_child (widget_class, CEPageIP6, auto_dns_switch);
diff --git a/panels/network/connection-editor/ip4-page.ui b/panels/network/connection-editor/ip4-page.ui
index 60f9b30c7..57a75e22c 100644
--- a/panels/network/connection-editor/ip4-page.ui
+++ b/panels/network/connection-editor/ip4-page.ui
@@ -10,7 +10,7 @@
         <property name="visible">True</property>
         <property name="can_focus">False</property>
         <child>
-          <object class="GtkGrid">
+          <object class="GtkGrid" id="main_box">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <property name="margin_start">24</property>
diff --git a/panels/network/connection-editor/ip6-page.ui b/panels/network/connection-editor/ip6-page.ui
index ed3f21141..529409c4d 100644
--- a/panels/network/connection-editor/ip6-page.ui
+++ b/panels/network/connection-editor/ip6-page.ui
@@ -10,7 +10,7 @@
         <property name="visible">True</property>
         <property name="can_focus">False</property>
         <child>
-          <object class="GtkGrid">
+          <object class="GtkGrid" id="main_box">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <property name="margin_start">24</property>


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