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
This commit is contained in:
parent
46f852a249
commit
b62ed2f87b
2 changed files with 9 additions and 100 deletions
|
@ -3,7 +3,7 @@
|
||||||
<!-- interface-requires gtk+ 3.0 -->
|
<!-- interface-requires gtk+ 3.0 -->
|
||||||
<object class="GtkDialog" id="details_dialog">
|
<object class="GtkDialog" id="details_dialog">
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="border_width">5</property>
|
<property name="border_width">0</property>
|
||||||
<property name="resizable">False</property>
|
<property name="resizable">False</property>
|
||||||
<property name="modal">True</property>
|
<property name="modal">True</property>
|
||||||
<property name="default_width">600</property>
|
<property name="default_width">600</property>
|
||||||
|
@ -33,7 +33,8 @@
|
||||||
<object class="GtkBox" id="dialog-vbox">
|
<object class="GtkBox" id="dialog-vbox">
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="orientation">vertical</property>
|
<property name="orientation">vertical</property>
|
||||||
<property name="spacing">2</property>
|
<property name="spacing">0</property>
|
||||||
|
<property name="border_width">0</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkNotebook" id="details_toplevel_notebook">
|
<object class="GtkNotebook" id="details_toplevel_notebook">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
@ -44,61 +45,12 @@
|
||||||
<object class="GtkBox" id="box6">
|
<object class="GtkBox" id="box6">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<child>
|
|
||||||
<object class="GtkScrolledWindow" id="details_sidebar">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="hscrollbar_policy">never</property>
|
|
||||||
<property name="shadow_type">in</property>
|
|
||||||
<child>
|
|
||||||
<object class="GtkTreeView" id="details_page_list">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="model">details_store</property>
|
|
||||||
<property name="headers_visible">False</property>
|
|
||||||
<property name="headers_clickable">False</property>
|
|
||||||
<property name="enable-search">False</property>
|
|
||||||
<child internal-child="selection">
|
|
||||||
<object class="GtkTreeSelection" id="details_page_list_selection"/>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkTreeViewColumn" id="details_column">
|
|
||||||
<child>
|
|
||||||
<object class="GtkCellRendererText" id="details_cell">
|
|
||||||
<property name="xpad">10</property>
|
|
||||||
</object>
|
|
||||||
<attributes>
|
|
||||||
<attribute name="text">0</attribute>
|
|
||||||
</attributes>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkCellRendererText" id="padding_cell">
|
|
||||||
<property name="xpad">20</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">True</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">0</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkNotebook" id="details_notebook">
|
<object class="GtkNotebook" id="details_notebook">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="show_tabs">False</property>
|
|
||||||
<property name="show_border">False</property>
|
<property name="show_border">False</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">1</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
@ -175,12 +127,4 @@
|
||||||
<action-widget response="apply" default="true">details_apply_button</action-widget>
|
<action-widget response="apply" default="true">details_apply_button</action-widget>
|
||||||
</action-widgets>
|
</action-widgets>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkListStore" id="details_store">
|
|
||||||
<columns>
|
|
||||||
<!-- column-name name -->
|
|
||||||
<column type="gchararray"/>
|
|
||||||
<!-- column-name page -->
|
|
||||||
<column type="gint"/>
|
|
||||||
</columns>
|
|
||||||
</object>
|
|
||||||
</interface>
|
</interface>
|
||||||
|
|
|
@ -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 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
|
static void
|
||||||
cancel_editing (NetConnectionEditor *editor)
|
cancel_editing (NetConnectionEditor *editor)
|
||||||
{
|
{
|
||||||
|
@ -164,7 +147,6 @@ static void
|
||||||
net_connection_editor_init (NetConnectionEditor *editor)
|
net_connection_editor_init (NetConnectionEditor *editor)
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
GtkTreeSelection *selection;
|
|
||||||
|
|
||||||
editor->builder = gtk_builder_new ();
|
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"));
|
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
|
void
|
||||||
|
@ -431,6 +409,7 @@ page_initialized (CEPage *page, GError *error, NetConnectionEditor *editor)
|
||||||
{
|
{
|
||||||
GtkNotebook *notebook;
|
GtkNotebook *notebook;
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
|
GtkWidget *label;
|
||||||
gint position;
|
gint position;
|
||||||
GList *children, *l;
|
GList *children, *l;
|
||||||
gint i;
|
gint i;
|
||||||
|
@ -446,7 +425,10 @@ page_initialized (CEPage *page, GError *error, NetConnectionEditor *editor)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
g_list_free (children);
|
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->initializing_pages = g_slist_remove (editor->initializing_pages, page);
|
||||||
editor->pages = g_slist_append (editor->pages, page);
|
editor->pages = g_slist_append (editor->pages, page);
|
||||||
|
@ -506,20 +488,11 @@ get_secrets_for_page (NetConnectionEditor *editor,
|
||||||
static void
|
static void
|
||||||
add_page (NetConnectionEditor *editor, CEPage *page)
|
add_page (NetConnectionEditor *editor, CEPage *page)
|
||||||
{
|
{
|
||||||
GtkListStore *store;
|
|
||||||
GtkTreeIter iter;
|
|
||||||
const gchar *title;
|
|
||||||
gint position;
|
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);
|
position = g_slist_length (editor->initializing_pages);
|
||||||
g_object_set_data (G_OBJECT (page), "position", GINT_TO_POINTER (position));
|
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);
|
editor->initializing_pages = g_slist_append (editor->initializing_pages, page);
|
||||||
|
|
||||||
g_signal_connect (page, "changed", G_CALLBACK (page_changed), editor);
|
g_signal_connect (page, "changed", G_CALLBACK (page_changed), editor);
|
||||||
|
@ -533,8 +506,6 @@ net_connection_editor_set_connection (NetConnectionEditor *editor,
|
||||||
GSList *pages, *l;
|
GSList *pages, *l;
|
||||||
NMSettingConnection *sc;
|
NMSettingConnection *sc;
|
||||||
const gchar *type;
|
const gchar *type;
|
||||||
GtkTreeSelection *selection;
|
|
||||||
GtkTreePath *path;
|
|
||||||
|
|
||||||
editor->is_new_connection = !nm_client_get_connection_by_uuid (editor->client,
|
editor->is_new_connection = !nm_client_get_connection_by_uuid (editor->client,
|
||||||
nm_connection_get_uuid (connection));
|
nm_connection_get_uuid (connection));
|
||||||
|
@ -596,12 +567,6 @@ net_connection_editor_set_connection (NetConnectionEditor *editor,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_slist_free (pages);
|
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 *
|
static NMConnection *
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue