diff --git a/panels/network/cc-network-panel.c b/panels/network/cc-network-panel.c
index 1bf09e8a8d3207adc96f5c07c0025880489b3a17..aa271fd1e2cfc14e808bae61fe5aa8cda2a47c4e 100644
--- a/panels/network/cc-network-panel.c
+++ b/panels/network/cc-network-panel.c
@@ -71,6 +71,7 @@ struct _CcNetworkPanel
GtkWidget *box_wired;
GtkWidget *container_bluetooth;
GtkWidget *empty_listbox;
+ GtkWidget *vpn_stack;
/* wireless dialog stuff */
CmdlineOperation arg_operation;
@@ -268,9 +269,9 @@ panel_refresh_device_titles (CcNetworkPanel *self)
titles = nm_device_disambiguate_names (nm_devices, num_devices);
for (i = 0; i < num_devices; i++) {
if (NM_IS_DEVICE_BT (nm_devices[i]))
- net_device_bluetooth_set_title (NET_DEVICE_BLUETOOTH (devices[i]), nm_device_bt_get_name (NM_DEVICE_BT (nm_devices[i])));
+ adw_preferences_row_set_title (ADW_PREFERENCES_ROW (devices[i]), nm_device_bt_get_name (NM_DEVICE_BT (nm_devices[i])));
else if (NET_IS_DEVICE_ETHERNET (devices[i]))
- net_device_ethernet_set_title (NET_DEVICE_ETHERNET (devices[i]), titles[i]);
+ adw_preferences_group_set_title (ADW_PREFERENCES_GROUP (devices[i]), titles[i]);
else if (NET_IS_DEVICE_MOBILE (devices[i]))
net_device_mobile_set_title (NET_DEVICE_MOBILE (devices[i]), titles[i]);
}
@@ -350,35 +351,16 @@ handle_argv (CcNetworkPanel *self)
g_debug ("Could not handle argv operation, no matching device yet?");
}
-/* HACK: this function is basically a workaround. We don't have a single
- * listbox in the VPN section, thus we need to track the separators and the
- * stub row manually.
- */
static void
update_vpn_section (CcNetworkPanel *self)
{
- guint i, n_vpns;
-
- for (i = 0, n_vpns = 0; i < self->vpns->len; i++) {
- NetVpn *vpn = g_ptr_array_index (self->vpns, i);
-
- net_vpn_set_show_separator (vpn, n_vpns > 0);
- n_vpns++;
- }
-
- gtk_widget_set_visible (self->empty_listbox, n_vpns == 0);
+ gtk_stack_set_visible_child (GTK_STACK (self->vpn_stack),
+ self->vpns->len == 0 ? self->empty_listbox : self->box_vpn);
}
static void
update_bluetooth_section (CcNetworkPanel *self)
{
- guint i;
-
- for (i = 0; i < self->bluetooth_devices->len; i++) {
- NetDeviceBluetooth *device = g_ptr_array_index (self->bluetooth_devices, i);
- net_device_bluetooth_set_show_separator (device, i > 0);
- }
-
gtk_widget_set_visible (self->container_bluetooth, self->bluetooth_devices->len > 0);
}
@@ -458,7 +440,7 @@ panel_add_device (CcNetworkPanel *self, NMDevice *device)
break;
case NM_DEVICE_TYPE_BT:
device_bluetooth = net_device_bluetooth_new (self->client, device);
- gtk_box_append (GTK_BOX (self->box_bluetooth), GTK_WIDGET (device_bluetooth));
+ gtk_list_box_append (GTK_LIST_BOX (self->box_bluetooth), GTK_WIDGET (device_bluetooth));
g_ptr_array_add (self->bluetooth_devices, device_bluetooth);
g_hash_table_insert (self->nm_device_to_device, device, device_bluetooth);
@@ -611,7 +593,7 @@ panel_add_vpn_device (CcNetworkPanel *self, NMConnection *connection)
}
net_vpn = net_vpn_new (self->client, connection);
- gtk_box_append (GTK_BOX (self->box_vpn), GTK_WIDGET (net_vpn));
+ gtk_list_box_append (GTK_LIST_BOX (self->box_vpn), GTK_WIDGET (net_vpn));
/* store in the devices array */
g_ptr_array_add (self->vpns, net_vpn);
@@ -653,7 +635,7 @@ client_connection_removed_cb (CcNetworkPanel *self, NMConnection *connection)
NetVpn *vpn = g_ptr_array_index (self->vpns, i);
if (net_vpn_get_connection (vpn) == connection) {
g_ptr_array_remove (self->vpns, vpn);
- gtk_box_remove (GTK_BOX (self->box_vpn), GTK_WIDGET (vpn));
+ gtk_list_box_remove (GTK_LIST_BOX (self->box_vpn), GTK_WIDGET (vpn));
update_vpn_section (self);
return;
}
@@ -745,6 +727,7 @@ cc_network_panel_class_init (CcNetworkPanelClass *klass)
gtk_widget_class_bind_template_child (widget_class, CcNetworkPanel, box_wired);
gtk_widget_class_bind_template_child (widget_class, CcNetworkPanel, container_bluetooth);
gtk_widget_class_bind_template_child (widget_class, CcNetworkPanel, empty_listbox);
+ gtk_widget_class_bind_template_child (widget_class, CcNetworkPanel, vpn_stack);
gtk_widget_class_bind_template_callback (widget_class, create_connection_cb);
}
diff --git a/panels/network/cc-network-panel.ui b/panels/network/cc-network-panel.ui
index a3647fddeb929b559ba283499c4f440189eb589a..2f28304422ab5e62e9dd57d79dbb2ecf05093295 100644
--- a/panels/network/cc-network-panel.ui
+++ b/panels/network/cc-network-panel.ui
@@ -3,121 +3,71 @@
-
diff --git a/panels/network/net-device-bluetooth.c b/panels/network/net-device-bluetooth.c
index 350d8b8f9663998094822f67c0110058296d8fde..7dff45b29fc5589363dfa8596669af193a4995c7 100644
--- a/panels/network/net-device-bluetooth.c
+++ b/panels/network/net-device-bluetooth.c
@@ -24,7 +24,6 @@
#include
#include
-#include
#include
@@ -34,27 +33,17 @@
struct _NetDeviceBluetooth
{
- GtkBox parent;
+ AdwActionRow parent;
- AdwActionRow *row;
GtkSwitch *device_off_switch;
GtkButton *options_button;
- GtkSeparator *separator;
NMClient *client;
NMDevice *device;
gboolean updating_device;
};
-G_DEFINE_TYPE (NetDeviceBluetooth, net_device_bluetooth, GTK_TYPE_BOX)
-
-void
-net_device_bluetooth_set_show_separator (NetDeviceBluetooth *self,
- gboolean show_separator)
-{
- /* add widgets to size group */
- gtk_widget_set_visible (GTK_WIDGET (self->separator), show_separator);
-}
+G_DEFINE_TYPE (NetDeviceBluetooth, net_device_bluetooth, ADW_TYPE_ACTION_ROW)
static void
update_off_switch_from_device_state (GtkSwitch *sw,
@@ -169,10 +158,8 @@ net_device_bluetooth_class_init (NetDeviceBluetoothClass *klass)
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/network/network-bluetooth.ui");
- gtk_widget_class_bind_template_child (widget_class, NetDeviceBluetooth, row);
gtk_widget_class_bind_template_child (widget_class, NetDeviceBluetooth, device_off_switch);
gtk_widget_class_bind_template_child (widget_class, NetDeviceBluetooth, options_button);
- gtk_widget_class_bind_template_child (widget_class, NetDeviceBluetooth, separator);
gtk_widget_class_bind_template_callback (widget_class, device_off_switch_changed_cb);
gtk_widget_class_bind_template_callback (widget_class, options_button_clicked_cb);
@@ -212,10 +199,3 @@ net_device_bluetooth_get_device (NetDeviceBluetooth *self)
g_return_val_if_fail (NET_IS_DEVICE_BLUETOOTH (self), NULL);
return self->device;
}
-
-void
-net_device_bluetooth_set_title (NetDeviceBluetooth *self, const gchar *title)
-{
- g_return_if_fail (NET_IS_DEVICE_BLUETOOTH (self));
- adw_preferences_row_set_title (ADW_PREFERENCES_ROW (self->row), title);
-}
diff --git a/panels/network/net-device-bluetooth.h b/panels/network/net-device-bluetooth.h
index d87752e82937302621b5d4256e07a390148e36c8..b0ce5aeaf33e6d5e5d1f789a4d20c8436c2a6520 100644
--- a/panels/network/net-device-bluetooth.h
+++ b/panels/network/net-device-bluetooth.h
@@ -22,22 +22,17 @@
#pragma once
+#include
#include
#include
G_BEGIN_DECLS
-G_DECLARE_FINAL_TYPE (NetDeviceBluetooth, net_device_bluetooth, NET, DEVICE_BLUETOOTH, GtkBox)
+G_DECLARE_FINAL_TYPE (NetDeviceBluetooth, net_device_bluetooth, NET, DEVICE_BLUETOOTH, AdwActionRow)
NetDeviceBluetooth *net_device_bluetooth_new (NMClient *client,
NMDevice *device);
NMDevice *net_device_bluetooth_get_device (NetDeviceBluetooth *device);
-void net_device_bluetooth_set_title (NetDeviceBluetooth *device,
- const gchar *title);
-
-void net_device_bluetooth_set_show_separator (NetDeviceBluetooth *device,
- gboolean show_separator);
-
G_END_DECLS
diff --git a/panels/network/net-device-ethernet.c b/panels/network/net-device-ethernet.c
index 81e4687d9c62aae27105b32beda2e60a07ca0e41..ead711cf1f88d0c00233edaac401f4fb210ddf47 100644
--- a/panels/network/net-device-ethernet.c
+++ b/panels/network/net-device-ethernet.c
@@ -23,7 +23,6 @@
#include
#include
-#include
#include
#include "panel-common.h"
@@ -35,23 +34,22 @@
struct _NetDeviceEthernet
{
- GtkBox parent;
-
- GtkListBox *connection_list;
- GtkButton *details_button;
- GtkListBox *details_listbox;
- AdwActionRow *details_row;
- GtkLabel *device_label;
- GtkSwitch *device_off_switch;
- GtkScrolledWindow *scrolled_window;
-
- NMClient *client;
- NMDevice *device;
- gboolean updating_device;
- GHashTable *connections;
+ AdwPreferencesGroup parent;
+
+ GtkListBox *connection_list;
+ GtkStack *connection_stack;
+ GtkButton *details_button;
+ GtkListBox *details_listbox;
+ AdwActionRow *details_row;
+ GtkSwitch *device_off_switch;
+
+ NMClient *client;
+ NMDevice *device;
+ gboolean updating_device;
+ GHashTable *connections;
};
-G_DEFINE_TYPE (NetDeviceEthernet, net_device_ethernet, GTK_TYPE_BOX)
+G_DEFINE_TYPE (NetDeviceEthernet, net_device_ethernet, ADW_TYPE_PREFERENCES_GROUP)
static void
add_details_row (GtkWidget *details, gint top, const gchar *heading, const gchar *value)
@@ -364,24 +362,23 @@ populate_ui (NetDeviceEthernet *self)
n_connections = g_slist_length (connections);
if (n_connections > 1) {
- gtk_widget_hide (GTK_WIDGET (self->details_listbox));
for (l = connections; l; l = l->next) {
NMConnection *connection = l->data;
add_row (self, connection);
}
- gtk_widget_show (GTK_WIDGET (self->scrolled_window));
+ gtk_stack_set_visible_child (self->connection_stack,
+ GTK_WIDGET (self->connection_list));
} else if (n_connections == 1) {
connection = connections->data;
- gtk_widget_hide (GTK_WIDGET (self->scrolled_window));
- gtk_widget_show (GTK_WIDGET (self->details_listbox));
+ gtk_stack_set_visible_child (self->connection_stack,
+ GTK_WIDGET (self->details_listbox));
g_object_set_data (G_OBJECT (self->details_button), "row", self->details_button);
g_object_set_data (G_OBJECT (self->details_button), "connection", connection);
- } else {
- gtk_widget_hide (GTK_WIDGET (self->scrolled_window));
- gtk_widget_hide (GTK_WIDGET (self->details_listbox));
}
+ gtk_widget_set_visible (GTK_WIDGET (self->connection_stack), n_connections >= 1);
+
g_slist_free (connections);
}
@@ -488,12 +485,11 @@ net_device_ethernet_class_init (NetDeviceEthernetClass *klass)
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/network/network-ethernet.ui");
gtk_widget_class_bind_template_child (widget_class, NetDeviceEthernet, connection_list);
+ gtk_widget_class_bind_template_child (widget_class, NetDeviceEthernet, connection_stack);
gtk_widget_class_bind_template_child (widget_class, NetDeviceEthernet, details_button);
gtk_widget_class_bind_template_child (widget_class, NetDeviceEthernet, details_listbox);
gtk_widget_class_bind_template_child (widget_class, NetDeviceEthernet, details_row);
- gtk_widget_class_bind_template_child (widget_class, NetDeviceEthernet, device_label);
gtk_widget_class_bind_template_child (widget_class, NetDeviceEthernet, device_off_switch);
- gtk_widget_class_bind_template_child (widget_class, NetDeviceEthernet, scrolled_window);
gtk_widget_class_bind_template_callback (widget_class, connection_list_row_activated_cb);
gtk_widget_class_bind_template_callback (widget_class, device_off_switch_changed_cb);
@@ -536,10 +532,3 @@ net_device_ethernet_get_device (NetDeviceEthernet *self)
g_return_val_if_fail (NET_IS_DEVICE_ETHERNET (self), NULL);
return self->device;
}
-
-void
-net_device_ethernet_set_title (NetDeviceEthernet *self, const gchar *title)
-{
- g_return_if_fail (NET_IS_DEVICE_ETHERNET (self));
- gtk_label_set_label (self->device_label, title);
-}
diff --git a/panels/network/net-device-ethernet.h b/panels/network/net-device-ethernet.h
index e05358859c8d44d706f3eb0e694f9582ae4770ce..8a6acb8fd074b25f34285175bcf4f32f489cffad 100644
--- a/panels/network/net-device-ethernet.h
+++ b/panels/network/net-device-ethernet.h
@@ -21,19 +21,17 @@
#pragma once
+#include
#include
#include
G_BEGIN_DECLS
-G_DECLARE_FINAL_TYPE (NetDeviceEthernet, net_device_ethernet, NET, DEVICE_ETHERNET, GtkBox)
+G_DECLARE_FINAL_TYPE (NetDeviceEthernet, net_device_ethernet, NET, DEVICE_ETHERNET, AdwPreferencesGroup)
NetDeviceEthernet *net_device_ethernet_new (NMClient *client,
NMDevice *device);
NMDevice *net_device_ethernet_get_device (NetDeviceEthernet *device);
-void net_device_ethernet_set_title (NetDeviceEthernet *device,
- const gchar *title);
-
G_END_DECLS
diff --git a/panels/network/net-vpn.c b/panels/network/net-vpn.c
index 3e2c84745b7149de09cf08ffd617517deb0efbc7..d1bd8fd417f0e04923529e96371de2ea9d71c234 100644
--- a/panels/network/net-vpn.c
+++ b/panels/network/net-vpn.c
@@ -33,12 +33,10 @@
struct _NetVpn
{
- GtkBox parent;
+ AdwActionRow parent;
GtkBox *box;
- GtkLabel *device_label;
GtkSwitch *device_off_switch;
- GtkSeparator *separator;
NMClient *client;
NMConnection *connection;
@@ -46,7 +44,7 @@ struct _NetVpn
gboolean updating_device;
};
-G_DEFINE_TYPE (NetVpn, net_vpn, GTK_TYPE_BOX)
+G_DEFINE_TYPE (NetVpn, net_vpn, ADW_TYPE_ACTION_ROW)
static void
nm_device_refresh_vpn_ui (NetVpn *self)
@@ -63,7 +61,7 @@ nm_device_refresh_vpn_ui (NetVpn *self)
* vpn connections in the device list.
*/
title = g_strdup_printf (_("%s VPN"), nm_connection_get_id (self->connection));
- gtk_label_set_label (self->device_label, title);
+ adw_preferences_row_set_title (ADW_PREFERENCES_ROW (self), title);
if (self->active_connection) {
g_signal_handlers_disconnect_by_func (self->active_connection,
@@ -189,9 +187,7 @@ net_vpn_class_init (NetVpnClass *klass)
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/network/network-vpn.ui");
- gtk_widget_class_bind_template_child (widget_class, NetVpn, device_label);
gtk_widget_class_bind_template_child (widget_class, NetVpn, device_off_switch);
- gtk_widget_class_bind_template_child (widget_class, NetVpn, separator);
gtk_widget_class_bind_template_callback (widget_class, device_off_toggled);
gtk_widget_class_bind_template_callback (widget_class, edit_connection);
@@ -234,11 +230,3 @@ net_vpn_get_connection (NetVpn *self)
g_return_val_if_fail (NET_IS_VPN (self), NULL);
return self->connection;
}
-
-void
-net_vpn_set_show_separator (NetVpn *self,
- gboolean show_separator)
-{
- g_return_if_fail (NET_IS_VPN (self));
- gtk_widget_set_visible (GTK_WIDGET (self->separator), show_separator);
-}
diff --git a/panels/network/net-vpn.h b/panels/network/net-vpn.h
index ea334be30d52e5d856e351e68270506f1c929588..183545814668a4eb9fa64c1f1a265f585ce1812d 100644
--- a/panels/network/net-vpn.h
+++ b/panels/network/net-vpn.h
@@ -21,20 +21,17 @@
#pragma once
+#include
#include
#include
G_BEGIN_DECLS
-G_DECLARE_FINAL_TYPE (NetVpn, net_vpn, NET, VPN, GtkBox)
+G_DECLARE_FINAL_TYPE (NetVpn, net_vpn, NET, VPN, AdwActionRow)
NetVpn *net_vpn_new (NMClient *client,
NMConnection *connection);
NMConnection *net_vpn_get_connection (NetVpn *vpn);
-
-void net_vpn_set_show_separator (NetVpn *vpn,
- gboolean show_separator);
-
G_END_DECLS
diff --git a/panels/network/network-bluetooth.ui b/panels/network/network-bluetooth.ui
index 216c95c8d9205bb8a09519e0890ee02db81750c9..fe3f8c10f2a857e6f9054a1a703e6f9806e83835 100644
--- a/panels/network/network-bluetooth.ui
+++ b/panels/network/network-bluetooth.ui
@@ -1,45 +1,26 @@
-
-
- vertical
-
-
- horizontal
+
+ device_off_switch
+ Wired
+
+
+ center
+
+
+ Turn device off
+
-
-
- none
-
-
- device_off_switch
- Wired
-
-
- center
-
-
- Turn device off
-
-
-
-
-
- center
- True
- emblem-system-symbolic
-
-
- Options…
-
-
-
-
-
-
+
+
+ center
+ True
+ emblem-system-symbolic
+
+
+ Options…
+
diff --git a/panels/network/network-ethernet.ui b/panels/network/network-ethernet.ui
index d6efae569ff1287f7ca1ba78107af3d7a763a424..a716fe0b56a40da79b348cf2929c945347f4fb0a 100644
--- a/panels/network/network-ethernet.ui
+++ b/panels/network/network-ethernet.ui
@@ -1,49 +1,27 @@
-
- 6
- vertical
-
-
-
-
- True
- 0
- Wired
- end
-
-
-
-
-
-
-
- list-add-symbolic
-
-
-
-
+
+ Wired
+
+
+ list-add-symbolic
+
+
-
+
-
- vertical
- 6
+
-
- True
- never
- never
-
-
- none
-
-
-
+
+ none
+
+
@@ -56,18 +34,15 @@
- False
- Cable unplugged
+ device_off_switch
- end
center
- end
center
emblem-system-symbolic
diff --git a/panels/network/network-vpn.ui b/panels/network/network-vpn.ui
index 6bd0a2b0478cfa05f2ec9bcf07fceee295c15d9d..85f6171c7617ec56993d8aa3235df9eef182e26c 100644
--- a/panels/network/network-vpn.ui
+++ b/panels/network/network-vpn.ui
@@ -1,65 +1,25 @@
-
- True
- vertical
-
-
-
-
- horizontal
+
+ device_off_switch
+
+
+ center
+
+
+ Turn VPN connection off
+
-
-
-
-
- none
-
-
-
- False
-
-
- start
- 8
- 8
- 12
- 12
- 12
-
-
- 0
- end
- True
-
-
-
-
- end
- center
-
-
- Turn VPN connection off
-
-
-
-
-
- emblem-system-symbolic
-
-
- Options…
-
-
-
-
-
-
-
+
+
+ center
+ emblem-system-symbolic
+
+
+ Options…
+