[gnome-control-center/wip/benzea/wifi-panel-with-editor-changes: 2/19] connection-editor: Use GtkStack instead of GtkNotebook



commit 2a76533e66851ee3b79353fdefbd394ba8cf807b
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Mon Dec 3 17:18:18 2018 +0100

    connection-editor: Use GtkStack instead of GtkNotebook
    
    Make the dialog's toplevel container a GtkStack instead of a GtkNotebook
    as it was used like a stack. This makes the code better fit current
    practices.

 .../network/connection-editor/connection-editor.ui | 26 +++-------------------
 .../connection-editor/net-connection-editor.c      | 12 +++++-----
 2 files changed, 9 insertions(+), 29 deletions(-)
---
diff --git a/panels/network/connection-editor/connection-editor.ui 
b/panels/network/connection-editor/connection-editor.ui
index 4773a5d58..980e14a41 100644
--- a/panels/network/connection-editor/connection-editor.ui
+++ b/panels/network/connection-editor/connection-editor.ui
@@ -40,11 +40,9 @@
         <property name="spacing">0</property>
         <property name="border_width">0</property>
         <child>
-          <object class="GtkNotebook" id="details_toplevel_notebook">
+          <object class="GtkStack" id="details_toplevel_notebook">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
-            <property name="show_tabs">False</property>
-            <property name="show_border">False</property>
             <child>
               <object class="GtkBox" id="box6">
                 <property name="visible">True</property>
@@ -57,15 +55,8 @@
                   </object>
                 </child>
               </object>
-            </child>
-            <child type="tab">
-              <object class="GtkLabel" id="label1">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="label">page 1</property>
-              </object>
               <packing>
-                <property name="tab_fill">False</property>
+                <property name="name">details</property>
               </packing>
             </child>
             <child>
@@ -103,18 +94,7 @@
                 </child>
               </object>
               <packing>
-                <property name="position">1</property>
-              </packing>
-            </child>
-            <child type="tab">
-              <object class="GtkLabel" id="label2">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="label">page 2</property>
-              </object>
-              <packing>
-                <property name="position">1</property>
-                <property name="tab_fill">False</property>
+                <property name="name">vpn</property>
               </packing>
             </child>
           </object>
diff --git a/panels/network/connection-editor/net-connection-editor.c 
b/panels/network/connection-editor/net-connection-editor.c
index c515fe289..609556b8d 100644
--- a/panels/network/connection-editor/net-connection-editor.c
+++ b/panels/network/connection-editor/net-connection-editor.c
@@ -598,14 +598,14 @@ complete_vpn_connection (NetConnectionEditor *editor, NMConnection *connection)
 static void
 finish_add_connection (NetConnectionEditor *editor, NMConnection *connection)
 {
-        GtkNotebook *notebook;
+        GtkStack *stack;
         GtkBin *frame;
 
         frame = GTK_BIN (editor->details_add_connection_frame);
         gtk_widget_destroy (gtk_bin_get_child (frame));
 
-        notebook = GTK_NOTEBOOK (editor->details_toplevel_notebook);
-        gtk_notebook_set_current_page (notebook, 0);
+        stack = GTK_STACK (editor->details_toplevel_notebook);
+        gtk_stack_set_visible_child_name (stack, "details");
         gtk_widget_show (editor->details_apply_button);
 
         if (connection)
@@ -737,11 +737,11 @@ select_vpn_type (NetConnectionEditor *editor, GtkListBox *list)
 static void
 net_connection_editor_add_connection (NetConnectionEditor *editor)
 {
-        GtkNotebook *notebook;
+        GtkStack *stack;
         GtkContainer *frame;
         GtkListBox *list;
 
-        notebook = GTK_NOTEBOOK (editor->details_toplevel_notebook);
+        stack = GTK_STACK (editor->details_toplevel_notebook);
         frame = GTK_CONTAINER (editor->details_add_connection_frame);
 
         list = GTK_LIST_BOX (gtk_list_box_new ());
@@ -753,7 +753,7 @@ net_connection_editor_add_connection (NetConnectionEditor *editor)
         gtk_widget_show_all (GTK_WIDGET (list));
         gtk_container_add (frame, GTK_WIDGET (list));
 
-        gtk_notebook_set_current_page (notebook, 1);
+        gtk_stack_set_visible_child_name (stack, "vpn");
         gtk_widget_hide (editor->details_apply_button);
         gtk_window_set_title (GTK_WINDOW (editor), _("Add VPN"));
 }


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