[gnome-control-center] network: Replace GtkNotebook with GtkStack
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] network: Replace GtkNotebook with GtkStack
- Date: Wed, 6 Nov 2019 12:38:14 +0000 (UTC)
commit fc25e17a9f50114f2269ddc2a2491bcd93c1897e
Author: Robert Ancell <robert ancell canonical com>
Date: Wed Nov 6 15:21:51 2019 +1300
network: Replace GtkNotebook with GtkStack
.../network/connection-editor/connection-editor.ui | 18 +++++-------------
.../connection-editor/net-connection-editor.c | 21 ++++++++++++---------
2 files changed, 17 insertions(+), 22 deletions(-)
---
diff --git a/panels/network/connection-editor/connection-editor.ui
b/panels/network/connection-editor/connection-editor.ui
index 550110195..7c7f8bebc 100644
--- a/panels/network/connection-editor/connection-editor.ui
+++ b/panels/network/connection-editor/connection-editor.ui
@@ -40,26 +40,18 @@
<property name="spacing">0</property>
<property name="border_width">0</property>
<child>
- <object class="GtkNotebook" id="toplevel_notebook">
+ <object class="GtkStack" id="toplevel_stack">
<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">
+ <object class="GtkNotebook" id="notebook">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkNotebook" id="notebook">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="show_border">False</property>
- </object>
- </child>
+ <property name="can_focus">True</property>
+ <property name="show_border">False</property>
</object>
</child>
<child>
- <object class="GtkBox">
+ <object class="GtkBox" id="add_connection_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="vexpand">True</property>
diff --git a/panels/network/connection-editor/net-connection-editor.c
b/panels/network/connection-editor/net-connection-editor.c
index 9ba8f1dc0..191239056 100644
--- a/panels/network/connection-editor/net-connection-editor.c
+++ b/panels/network/connection-editor/net-connection-editor.c
@@ -51,6 +51,13 @@ struct _NetConnectionEditor
{
GtkDialog parent;
+ GtkBox *add_connection_box;
+ GtkFrame *add_connection_frame;
+ GtkButton *apply_button;
+ GtkButton *cancel_button;
+ GtkNotebook *notebook;
+ GtkStack *toplevel_stack;
+
GtkWidget *parent_window;
NMClient *client;
NMDevice *device;
@@ -61,12 +68,6 @@ struct _NetConnectionEditor
gboolean is_changed;
NMAccessPoint *ap;
- GtkButton *cancel_button;
- GtkButton *apply_button;
- GtkNotebook *notebook;
- GtkFrame *add_connection_frame;
- GtkNotebook *toplevel_notebook;
-
GSList *initializing_pages;
GSList *pages;
@@ -228,11 +229,13 @@ net_connection_editor_class_init (NetConnectionEditorClass *class)
gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/control-center/network/connection-editor.ui");
+ gtk_widget_class_bind_template_child (widget_class, NetConnectionEditor, add_connection_box);
gtk_widget_class_bind_template_child (widget_class, NetConnectionEditor, add_connection_frame);
gtk_widget_class_bind_template_child (widget_class, NetConnectionEditor, apply_button);
gtk_widget_class_bind_template_child (widget_class, NetConnectionEditor, cancel_button);
gtk_widget_class_bind_template_child (widget_class, NetConnectionEditor, notebook);
- gtk_widget_class_bind_template_child (widget_class, NetConnectionEditor, toplevel_notebook);
+ gtk_widget_class_bind_template_child (widget_class, NetConnectionEditor, toplevel_stack);
+
gtk_widget_class_bind_template_callback (widget_class, delete_event_cb);
gtk_widget_class_bind_template_callback (widget_class, cancel_clicked_cb);
gtk_widget_class_bind_template_callback (widget_class, apply_clicked_cb);
@@ -623,7 +626,7 @@ finish_add_connection (NetConnectionEditor *self, NMConnection *connection)
frame = GTK_BIN (self->add_connection_frame);
gtk_widget_destroy (gtk_bin_get_child (frame));
- gtk_notebook_set_current_page (self->toplevel_notebook, 0);
+ gtk_stack_set_visible_child (self->toplevel_stack, GTK_WIDGET (self->notebook));
gtk_widget_show (GTK_WIDGET (self->apply_button));
if (connection)
@@ -768,7 +771,7 @@ net_connection_editor_add_connection (NetConnectionEditor *self)
gtk_widget_show_all (GTK_WIDGET (list));
gtk_container_add (frame, GTK_WIDGET (list));
- gtk_notebook_set_current_page (self->toplevel_notebook, 1);
+ gtk_stack_set_visible_child (self->toplevel_stack, GTK_WIDGET (self->add_connection_box));
gtk_widget_hide (GTK_WIDGET (self->apply_button));
gtk_window_set_title (GTK_WINDOW (self), _("Add VPN"));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]