From b62ed2f87b7db46515535d36c33cb58ffdad4062 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Sun, 21 May 2017 13:13:06 -0300 Subject: [PATCH] network: Rely on notebook tabs to switch connection editor pages Instead of using a sidebar, which is what the current implementation uses to switch pages, the latest mockups [1] rely on the notebook tabs. This patch then updates the connection editor dialog to use the notebook tabs as the page switcher widget. [1] https://github.com/gnome-design-team/gnome-mockups/blob/master/system-settings/network/aday2/network-wires.png https://bugzilla.gnome.org/show_bug.cgi?id=779841 --- .../connection-editor/connection-editor.ui | 62 +------------------ .../connection-editor/net-connection-editor.c | 47 ++------------ 2 files changed, 9 insertions(+), 100 deletions(-) diff --git a/panels/network/connection-editor/connection-editor.ui b/panels/network/connection-editor/connection-editor.ui index 462946165..6e3e1f7f7 100644 --- a/panels/network/connection-editor/connection-editor.ui +++ b/panels/network/connection-editor/connection-editor.ui @@ -3,7 +3,7 @@ False - 5 + 0 False True 600 @@ -33,7 +33,8 @@ False vertical - 2 + 0 + 0 True @@ -44,61 +45,12 @@ True False - - - True - True - never - in - - - True - True - details_store - False - False - False - - - - - - - - 10 - - - 0 - - - - - 20 - - - - - - - - - True - True - 0 - - True True - False False - - False - True - 1 - @@ -175,12 +127,4 @@ details_apply_button - - - - - - - - diff --git a/panels/network/connection-editor/net-connection-editor.c b/panels/network/connection-editor/net-connection-editor.c index 7d7f1ca07..203644bdd 100644 --- a/panels/network/connection-editor/net-connection-editor.c +++ b/panels/network/connection-editor/net-connection-editor.c @@ -52,23 +52,6 @@ G_DEFINE_TYPE (NetConnectionEditor, net_connection_editor, G_TYPE_OBJECT) static void page_changed (CEPage *page, gpointer user_data); -static void -selection_changed (GtkTreeSelection *selection, NetConnectionEditor *editor) -{ - GtkWidget *widget; - GtkTreeModel *model; - GtkTreeIter iter; - gint page; - - if (!gtk_tree_selection_get_selected (selection, &model, &iter)) - return; - gtk_tree_model_get (model, &iter, 1, &page, -1); - - widget = GTK_WIDGET (gtk_builder_get_object (editor->builder, - "details_notebook")); - gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), page); -} - static void cancel_editing (NetConnectionEditor *editor) { @@ -164,7 +147,6 @@ static void net_connection_editor_init (NetConnectionEditor *editor) { GError *error = NULL; - GtkTreeSelection *selection; editor->builder = gtk_builder_new (); @@ -178,10 +160,6 @@ net_connection_editor_init (NetConnectionEditor *editor) } editor->window = GTK_WIDGET (gtk_builder_get_object (editor->builder, "details_dialog")); - selection = GTK_TREE_SELECTION (gtk_builder_get_object (editor->builder, - "details_page_list_selection")); - g_signal_connect (selection, "changed", - G_CALLBACK (selection_changed), editor); } void @@ -431,6 +409,7 @@ page_initialized (CEPage *page, GError *error, NetConnectionEditor *editor) { GtkNotebook *notebook; GtkWidget *widget; + GtkWidget *label; gint position; GList *children, *l; gint i; @@ -446,7 +425,10 @@ page_initialized (CEPage *page, GError *error, NetConnectionEditor *editor) break; } g_list_free (children); - gtk_notebook_insert_page (notebook, widget, NULL, i); + + label = gtk_label_new (ce_page_get_title (page)); + + gtk_notebook_insert_page (notebook, widget, label, i); editor->initializing_pages = g_slist_remove (editor->initializing_pages, page); editor->pages = g_slist_append (editor->pages, page); @@ -506,20 +488,11 @@ get_secrets_for_page (NetConnectionEditor *editor, static void add_page (NetConnectionEditor *editor, CEPage *page) { - GtkListStore *store; - GtkTreeIter iter; - const gchar *title; gint position; - store = GTK_LIST_STORE (gtk_builder_get_object (editor->builder, - "details_store")); - title = ce_page_get_title (page); position = g_slist_length (editor->initializing_pages); g_object_set_data (G_OBJECT (page), "position", GINT_TO_POINTER (position)); - gtk_list_store_insert_with_values (store, &iter, -1, - 0, title, - 1, position, - -1); + editor->initializing_pages = g_slist_append (editor->initializing_pages, page); g_signal_connect (page, "changed", G_CALLBACK (page_changed), editor); @@ -533,8 +506,6 @@ net_connection_editor_set_connection (NetConnectionEditor *editor, GSList *pages, *l; NMSettingConnection *sc; const gchar *type; - GtkTreeSelection *selection; - GtkTreePath *path; editor->is_new_connection = !nm_client_get_connection_by_uuid (editor->client, nm_connection_get_uuid (connection)); @@ -596,12 +567,6 @@ net_connection_editor_set_connection (NetConnectionEditor *editor, } } g_slist_free (pages); - - selection = GTK_TREE_SELECTION (gtk_builder_get_object (editor->builder, - "details_page_list_selection")); - path = gtk_tree_path_new_first (); - gtk_tree_selection_select_path (selection, path); - gtk_tree_path_free (path); } static NMConnection *