wifi: Expose Airplane Mode row outside access point list

The current Wi-Fi panel ties the Airplane Mode row to the access
point list of a given Wi-Fi adapter. That has unintended but
bad side effects: when enabling Airplane Mode, the row disappears
and we have to switch to another panel (e.g. Bluetooth) in order
to disable it. This is functionally wrong: we should be able to
enable or disable Airplane Mode from where we initially changed
it.

This commit reorganizes the widget hierarchy in order to put the
Airplane Mode row outside of the main GtkStack page. This is
necessary in order to fully implement the proposed mockups[1]
and, in general, because it's the right thing to do.

Notice that the logic of the empty states in [1] is not fully
implemented yet; this commit only reorganizes the widgets that
already exist to get closer to the mockups. Subsequent commits
will implement more of the empty states.

[1] https://github.com/gnome-design-team/gnome-mockups/raw/master/system-settings/network/aday3/wi-fi-wires.png

Fixes https://gitlab.gnome.org/GNOME/gnome-control-center/issues/121
This commit is contained in:
Georges Basile Stavracas Neto 2018-07-22 13:03:58 -03:00
parent f9b9f105dd
commit 4ad1c5dea1

View file

@ -4,74 +4,16 @@
<template class="CcWifiPanel" parent="CcPanel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkStack" id="main_stack">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="homogeneous">False</property>
<property name="transition_type">crossfade</property>
<!-- "No Wi-Fi Adapter" page -->
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="expand">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">network-wireless-no-route-symbolic</property>
<property name="pixel_size">256</property>
<property name="margin-bottom">18</property>
<style>
<class name="dim-label" />
</style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="wrap">True</property>
<property name="label" translatable="yes">No Wi-Fi Adapter Found</property>
<attributes>
<attribute name="weight" value="bold" />
<attribute name="scale" value="1.2" />
</attributes>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="wrap">True</property>
<property name="label" translatable="yes">Make sure you have a Wi-Fi adapter plugged and turned on</property>
</object>
</child>
</object>
<packing>
<property name="name">no-wifi-devices</property>
</packing>
</child>
<!-- Wi-Fi connections and devices -->
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hscrollbar-policy">never</property>
<child>
<object class="GtkViewport">
<property name="visible">True</property>
<property name="shadow-type">none</property>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="border-width">32</property>
<property name="margin">32</property>
<!-- Empty boxes to enforce 1/3 width for the main widgets -->
<child>
@ -82,7 +24,6 @@
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
<property name="height">3</property>
</packing>
</child>
<child>
@ -93,10 +34,15 @@
<packing>
<property name="left-attach">2</property>
<property name="top-attach">0</property>
<property name="height">3</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="hexpand">True</property>
<property name="orientation">vertical</property>
<!-- Airplane Mode -->
<child>
<object class="GtkFrame" id="rfkill_widget">
@ -173,12 +119,69 @@
</object>
</child>
</object>
</child>
<child>
<object class="GtkStack" id="main_stack">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="homogeneous">False</property>
<property name="transition_type">crossfade</property>
<!-- "No Wi-Fi Adapter" page -->
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="expand">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">network-wireless-no-route-symbolic</property>
<property name="pixel_size">256</property>
<property name="margin-bottom">18</property>
<style>
<class name="dim-label" />
</style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="wrap">True</property>
<property name="label" translatable="yes">No Wi-Fi Adapter Found</property>
<attributes>
<attribute name="weight" value="bold" />
<attribute name="scale" value="1.2" />
</attributes>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="wrap">True</property>
<property name="label" translatable="yes">Make sure you have a Wi-Fi adapter plugged and turned on</property>
</object>
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
<property name="name">no-wifi-devices</property>
</packing>
</child>
<!-- Wi-Fi connections and devices -->
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<!-- Visible Networks label & spinner -->
<child>
<object class="GtkBox">
@ -203,10 +206,6 @@
</object>
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
<!-- Stack with a listbox for each Wi-Fi device -->
@ -226,14 +225,6 @@
</object>
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</packing>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
@ -295,6 +286,19 @@
</child>
</object>
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
</object>
</child>
</object>
</child>
</template>
<!-- End Stack -->