From 965ef931435f686010518c024c17d123948db964 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Mon, 17 Jul 2017 23:21:08 -0300 Subject: [PATCH] network: Update "Wired" section UI The current "Wired" section UI is still optimized for the old, multi-page panel layout. Recent work [1], however, suggest that this should change and the standard widgets be rearranged. This commit, then, implements this new UI for the wired devices UI by using a listbox row when there's only one profile (ditching out the old info labels), and moving and deleting the bottom action buttons. https://bugzilla.gnome.org/show_bug.cgi?id=785581 --- panels/network/net-device-ethernet.c | 37 +--- panels/network/network-ethernet.ui | 305 ++++++++++----------------- 2 files changed, 115 insertions(+), 227 deletions(-) diff --git a/panels/network/net-device-ethernet.c b/panels/network/net-device-ethernet.c index 7cc0e4315..86689b20e 100644 --- a/panels/network/net-device-ethernet.c +++ b/panels/network/net-device-ethernet.c @@ -209,16 +209,11 @@ device_ethernet_refresh_ui (NetDeviceEthernet *device) widget = GTK_WIDGET (gtk_builder_get_object (device->builder, "label_device")); gtk_label_set_label (GTK_LABEL (widget), net_object_get_title (NET_OBJECT (device))); - widget = GTK_WIDGET (gtk_builder_get_object (device->builder, "image_device")); - gtk_image_set_from_icon_name (GTK_IMAGE (widget), - panel_device_to_icon_name (nm_device, FALSE), - GTK_ICON_SIZE_DIALOG); - widget = GTK_WIDGET (gtk_builder_get_object (device->builder, "device_off_switch")); state = nm_device_get_state (nm_device); - gtk_widget_set_visible (widget, - state != NM_DEVICE_STATE_UNAVAILABLE - && state != NM_DEVICE_STATE_UNMANAGED); + gtk_widget_set_sensitive (widget, + state != NM_DEVICE_STATE_UNAVAILABLE + && state != NM_DEVICE_STATE_UNMANAGED); device->updating_device = TRUE; gtk_switch_set_active (GTK_SWITCH (widget), device_state_to_off_switch (state)); device->updating_device = FALSE; @@ -251,7 +246,7 @@ show_details (GtkButton *button, NetDeviceEthernet *device, const gchar *title) window = gtk_widget_get_toplevel (GTK_WIDGET (button)); - row = GTK_WIDGET (g_object_get_data (G_OBJECT (button), "row")); + row = g_object_get_data (G_OBJECT (button), "row"); connection = NM_CONNECTION (g_object_get_data (G_OBJECT (row), "connection")); nmdev = net_device_get_nm_device (NET_DEVICE (device)); @@ -347,7 +342,7 @@ add_row (NetDeviceEthernet *device, NMConnection *connection) gtk_widget_set_valign (widget, GTK_ALIGN_CENTER); atk_object_set_name (gtk_widget_get_accessible (widget), _("Options…")); gtk_box_pack_start (GTK_BOX (box), widget, FALSE, TRUE, 0); - g_object_set_data (G_OBJECT (row), "edit", widget); + g_object_set_data (G_OBJECT (widget), "edit", widget); g_object_set_data (G_OBJECT (widget), "row", row); g_signal_connect (widget, "clicked", G_CALLBACK (show_details_for_row), device); @@ -382,12 +377,6 @@ populate_ui (NetDeviceEthernet *device) } g_list_free (children); - children = gtk_container_get_children (GTK_CONTAINER (device->details)); - for (c = children; c; c = c->next) { - gtk_container_remove (GTK_CONTAINER (device->details), c->data); - } - g_list_free (children); - connections = net_device_get_valid_connections (NET_DEVICE (device)); for (l = connections; l; l = l->next) { NMConnection *connection = l->data; @@ -397,21 +386,8 @@ populate_ui (NetDeviceEthernet *device) } n_connections = g_slist_length (connections); - if (n_connections > 4) { - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (device->scrolled_window), - GTK_POLICY_NEVER, - GTK_POLICY_AUTOMATIC); - gtk_widget_set_vexpand (device->scrolled_window, TRUE); - } else { - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (device->scrolled_window), - GTK_POLICY_NEVER, - GTK_POLICY_NEVER); - gtk_widget_set_vexpand (device->scrolled_window, FALSE); - } - if (n_connections > 1) { gtk_widget_hide (device->details); - gtk_widget_hide (device->details_button); for (l = connections; l; l = l->next) { NMConnection *connection = l->data; add_row (device, connection); @@ -420,16 +396,13 @@ populate_ui (NetDeviceEthernet *device) } else if (n_connections == 1) { connection = connections->data; gtk_widget_hide (device->scrolled_window); - add_details (device->details, net_device_get_nm_device (NET_DEVICE (device)), connection); gtk_widget_show_all (device->details); - gtk_widget_show (device->details_button); g_object_set_data (G_OBJECT (device->details_button), "row", device->details_button); g_object_set_data (G_OBJECT (device->details_button), "connection", connection); } else { gtk_widget_hide (device->scrolled_window); gtk_widget_hide (device->details); - gtk_widget_hide (device->details_button); } g_slist_free (connections); diff --git a/panels/network/network-ethernet.ui b/panels/network/network-ethernet.ui index 062aa2f23..2971e2462 100644 --- a/panels/network/network-ethernet.ui +++ b/panels/network/network-ethernet.ui @@ -1,219 +1,134 @@ - + True False - emblem-system-symbolic - 1 - - + 6 + vertical + + True False - 12 - + True False - vertical - 6 - - - True - False - end - start - 1 - 48 - network-wired - 6 - - - 0 - 0 - 1 - 1 - - - - - True - False - start - True - - - True - False - 0 - Wired - end - - - - - - - False - False - 0 - - - - - True - False - 0 - Cable unplugged - - - False - False - 1 - - - - - 1 - 0 - 1 - 1 - - - - - True - True - 12 - True - never - in - - - - - - 0 - 1 - 3 - 1 - - - - - True - False - 12 - True - True - 10 - 10 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - 2 - 3 - 1 - - - - - True - True - end - center - True - - - 2 - 0 - 1 - 1 - - + True + 0 + Wired + end + + + - - True - True - 0 - - + True - False - 18 + True + True + none - - _Add Profile… + True True - True - start - True + list-add-symbolic - - True - True - 0 - - - - - True - True - True - end - image1 - - - Options… - - - - - - True - True - 1 - - - False - True - 1 - + + + + + True + False + vertical + 6 + + + True + True + True + never + never + in + + + + + + + True + False + True + + + True + False + none + + + True + False + False + + + True + False + horizontal + 12 + 12 + + + True + False + True + 0 + Cable unplugged + + + + + True + True + end + center + + + + + True + True + True + end + + + True + False + emblem-system-symbolic + + + + + + Options… + + + + + + + + + + + + + + +