From cf62c0abb74e77cb6d90b63b7263e3adc9020ab2 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Tue, 11 Jul 2017 16:31:56 -0300 Subject: [PATCH] network: Rework NetDeviceWifi interface The UI definitions of the Wi-Fi devices currently contain many widgets in the stack, such as the tower icon, the enable/disable switch and the status. In the new Wi-Fi panel, all those widgets will clutter the interface and break the entire UI. Fix that by splitting those widgets in two different containers: 1. The header_box container, with the menu button and the enable/disable switch. 2. The center_box widget, with the title and status labels, which will be consumed by the Wi-Fi panel to be the center widget of the headerbar. This commit also introduces two getters that expose those two containers. With that, another load of code could be simplified. https://bugzilla.gnome.org/show_bug.cgi?id=784818 --- panels/network/net-device-wifi.c | 12 ++ panels/network/net-device-wifi.h | 4 +- panels/network/network-wifi.ui | 278 ++++++++++++------------------- 3 files changed, 124 insertions(+), 170 deletions(-) diff --git a/panels/network/net-device-wifi.c b/panels/network/net-device-wifi.c index ad7844f53..990021fb8 100644 --- a/panels/network/net-device-wifi.c +++ b/panels/network/net-device-wifi.c @@ -80,6 +80,18 @@ enum { COLUMN_LAST }; +GtkWidget * +net_device_wifi_get_header_widget (NetDeviceWifi *device_wifi) +{ + return GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder, "header_box")); +} + +GtkWidget * +net_device_wifi_get_title_widget (NetDeviceWifi *device_wifi) +{ + return GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder, "center_box")); +} + static GtkWidget * device_wifi_proxy_add_to_stack (NetObject *object, GtkStack *stack, diff --git a/panels/network/net-device-wifi.h b/panels/network/net-device-wifi.h index 9ccee9f7a..d8baf5075 100644 --- a/panels/network/net-device-wifi.h +++ b/panels/network/net-device-wifi.h @@ -50,7 +50,9 @@ struct _NetDeviceWifiClass NetDeviceClass parent_class; }; -GType net_device_wifi_get_type (void); +GType net_device_wifi_get_type (void) G_GNUC_CONST; +GtkWidget *net_device_wifi_get_header_widget (NetDeviceWifi *device_wifi); +GtkWidget *net_device_wifi_get_title_widget (NetDeviceWifi *device_wifi); G_END_DECLS diff --git a/panels/network/network-wifi.ui b/panels/network/network-wifi.ui index 22287bdb2..e2e81bcf4 100644 --- a/panels/network/network-wifi.ui +++ b/panels/network/network-wifi.ui @@ -1489,178 +1489,13 @@ here False vertical - + True - False - 18 - vertical - - - True - False - 12 - 12 - 12 - 12 - 6 - - - True - False - network-wireless - 6 - - - False - True - 0 - - - - - True - False - True - vertical - - - True - False - 0 - Wi-Fi - - - - - - - False - True - 0 - - - - - True - False - 0 - Connected - - - False - True - 1 - - - - - False - True - 1 - - - - - True - True - end - center - True - - - Turn Wi-Fi off - - - - - True - True - 2 - - - - - True - False - 0 - - - - - True - True - none - True - True - - - - - True - True - 0 - - - - - True - False - 12 - 12 - 12 + True + none True - 6 - - - _Use as Hotspot… - True - True - True - start - True - - - False - False - 0 - - - - - _Connect to Hidden Network… - True - True - True - center - True - - - True - False - 1 - - - - - _History - True - True - True - end - True - - - False - False - 2 - - + True - - False - True - 1 - @@ -1915,4 +1750,109 @@ here + + + + True + False + vertical + center + center + + + True + False + Wi-Fi + + + + + + True + False + + + + + + + + True + False + 6 + end + + + True + True + center + + + Turn Wi-Fi off + + + + + + + True + False + header_button_popover + + + True + False + open-menu-symbolic + + + + + + + + + + + True + False + 12 + 6 + vertical + + + _Connect to Hidden Network… + True + True + True + True + 0.0 + + + + + _Turn On Wi-Fi Hotspot… + True + True + True + True + 0.0 + + + + + _Known Wi-Fi Networks + True + True + True + True + 0.0 + + + + +