After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 784818 - Add Wi-Fi panel
Add Wi-Fi panel
Status: RESOLVED FIXED
Product: gnome-control-center
Classification: Core
Component: Network
unspecified
Other All
: Normal normal
: ---
Assigned To: Control-Center Maintainers
Control-Center Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-07-11 20:20 UTC by Georges Basile Stavracas Neto
Modified: 2017-07-18 16:31 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
network: Replace the notebook with a stack (21.32 KB, patch)
2017-07-11 20:20 UTC, Georges Basile Stavracas Neto
committed Details | Review
network: Don't manage Wi-Fi devices (1.28 KB, patch)
2017-07-11 20:20 UTC, Georges Basile Stavracas Neto
committed Details | Review
network: Cleanup code (6.87 KB, patch)
2017-07-11 20:20 UTC, Georges Basile Stavracas Neto
accepted-commit_now Details | Review
network: Rework NetDeviceWifi interface (16.35 KB, patch)
2017-07-11 20:20 UTC, Georges Basile Stavracas Neto
committed Details | Review
wifi: Introduce Wi-Fi panel (28.61 KB, patch)
2017-07-11 20:20 UTC, Georges Basile Stavracas Neto
none Details | Review
network: Add Wi-Fi widgets using device product as title (2.02 KB, patch)
2017-07-11 20:20 UTC, Georges Basile Stavracas Neto
committed Details | Review
wifi: Introduce Wi-Fi panel (29.00 KB, patch)
2017-07-11 21:37 UTC, Georges Basile Stavracas Neto
none Details | Review
wifi: disable "activatable" property in the Airplane Mode row (1.19 KB, patch)
2017-07-13 10:54 UTC, Miguel Vaello Martínez
none Details | Review
wifi: Introduce Wi-Fi panel (40.21 KB, patch)
2017-07-18 13:50 UTC, Georges Basile Stavracas Neto
none Details | Review
wifi: Introduce Wi-Fi panel (40.61 KB, patch)
2017-07-18 15:58 UTC, Georges Basile Stavracas Neto
committed Details | Review

Description Georges Basile Stavracas Neto 2017-07-11 20:20:27 UTC
Per mockups [1], the new Wi-Fi panel is part of the Network panel redesign.

See patches below.

[1] https://raw.githubusercontent.com/gnome-design-team/gnome-mockups/master/system-settings/network/aday2/network-wires.png
Comment 1 Georges Basile Stavracas Neto 2017-07-11 20:20:31 UTC
Created attachment 355348 [details] [review]
network: Replace the notebook with a stack

The Network panel uses a GtkNotebook internally to manage
the different setup pages of the network devices. While it
does the job, we now have a modern widget for that: GtkStack.

With GtkStack, managing the pages becomes a lot easier and
we gain almost for free the nice transition between pages,
besides of course being a widget that consumes slightly less
resources.

Besides all these gains, using a GtkStack will allow us to
implement the new Wi-Fi panel in a more cohesive manner,
sharing large portions of code and avoiding copy pasta.

This commit then turns the GtkNotebook into a GtkStack, and
renames and adapts the code to reflect that. Fortunately,
the code got actually simpler with the move.
Comment 2 Georges Basile Stavracas Neto 2017-07-11 20:20:37 UTC
Created attachment 355349 [details] [review]
network: Don't manage Wi-Fi devices

The Wi-Fi devices are going to managed with the
to-be-introduced Wi-Fi panel, and don't need to
be available in the Networks panel anymore.

This patch then blacklists Wi-Fi devices and don't
let the Networks panel manage them.
Comment 3 Georges Basile Stavracas Neto 2017-07-11 20:20:43 UTC
Created attachment 355350 [details] [review]
network: Cleanup code

Now that we're splitting the Network panel into the
Wi-Fi, we can make a few cleanups.
Comment 4 Georges Basile Stavracas Neto 2017-07-11 20:20:48 UTC
Created attachment 355351 [details] [review]
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.
Comment 5 Georges Basile Stavracas Neto 2017-07-11 20:20:53 UTC
Created attachment 355352 [details] [review]
wifi: Introduce Wi-Fi panel

The glory moment has come. The new Wi-Fi panel is finally
introduced using a different code style from the rest of
the Network panel, since Control Center itself is written
using the GTK+ C code style.

The Wi-Fi panel uses modern GTK+ features like template
classes and new widgets. The files are stored together
with the Network panel so that we can reuse the abstraction
layer that the Network panel has to manage devices.
Comment 6 Georges Basile Stavracas Neto 2017-07-11 20:20:58 UTC
Created attachment 355353 [details] [review]
network: Add Wi-Fi widgets using device product as title

When there are multiple Wi-Fi devices, we must show a stack
switcher in the header if the Wi-Fi panel with the name of
the device.

The problem is that, currently, NetDeviceWifi does not add
its widgets to the main stack setting a stack title, and so
the stack switcher is empty.

Fix that by always adding the widgets to the stack using the
device product name as title.
Comment 7 Georges Basile Stavracas Neto 2017-07-11 21:37:18 UTC
Created attachment 355360 [details] [review]
wifi: Introduce Wi-Fi panel

The glory moment has come. The new Wi-Fi panel is finally
introduced using a different code style from the rest of
the Network panel, since Control Center itself is written
using the GTK+ C code style.

The Wi-Fi panel uses modern GTK+ features like template
classes and new widgets. The files are stored together
with the Network panel so that we can reuse the abstraction
layer that the Network panel has to manage devices.
Comment 8 Miguel Vaello Martínez 2017-07-13 10:54:27 UTC
Created attachment 355501 [details] [review]
wifi: disable "activatable" property in the Airplane Mode row

The Airplane Mode box contains a 'GtkListBoxRow' widget which
does not provide any extra functionality if it's clicked.
So it makes sense to disable the activatable property for
avoiding possible confusions about the funcionality.
Comment 9 Rui Matos 2017-07-17 15:56:38 UTC
Review of attachment 355348 [details] [review]:

looks better indeed
Comment 10 Rui Matos 2017-07-17 16:07:03 UTC
Review of attachment 355349 [details] [review]:

just commit message nits:
... are going to *be* managed ... the *Network* panel anymore.
... devices and *doesn't* let... the *Network* panel...
Comment 11 Rui Matos 2017-07-17 16:08:25 UTC
Review of attachment 355350 [details] [review]:

... splitting Wi-Fi out of the Network panel... sounds better, also, I'd merge this commit with the previous but it can stay separate as well
Comment 12 Rui Matos 2017-07-17 16:43:55 UTC
Review of attachment 355351 [details] [review]:

lgtm
Comment 13 Rui Matos 2017-07-17 16:47:29 UTC
Review of attachment 355353 [details] [review]:

... in the header *of* the Wi-Fi panel...
Comment 14 Rui Matos 2017-07-17 17:25:56 UTC
Review of attachment 355360 [details] [review]:

what happens if NM is not running or has 0 wifi devices?

::: panels/network/cc-wifi-panel.c
@@ +123,3 @@
+
+  result = g_dbus_proxy_get_cached_property (self->rfkill_proxy, "HasAirplaneMode");
+  enabled = g_variant_get_boolean (result);

result might be NULL and must be unrefed

@@ +126,3 @@
+
+  result = g_dbus_proxy_get_cached_property (self->rfkill_proxy, "ShouldShowAirplaneMode");
+  should_show = g_variant_get_boolean (result);

idem

@@ +133,3 @@
+
+  result = g_dbus_proxy_get_cached_property (self->rfkill_proxy, "AirplaneMode");
+  enabled = g_variant_get_boolean (result);

idem

@@ +136,3 @@
+
+  result = g_dbus_proxy_get_cached_property (self->rfkill_proxy, "HardwareAirplaneMode");
+  hw_enabled = !!g_variant_get_boolean (result);

!! ??
idem

@@ +250,3 @@
+  if (error)
+    {
+      g_printerr ("Error creating rfkill proxy: %s\n", error->message);

this should handle error being G_IO_ERROR_CANCELLED (panel finalized before the proxy shows up) and not print a message in that case

@@ +321,3 @@
+  g_clear_pointer (&self->device_id_to_listbox, g_hash_table_destroy);
+
+  G_OBJECT_CLASS (cc_wifi_panel_parent_class)->finalize (object);

needs to free ->client and ->devices too

@@ +339,3 @@
+                            GParamSpec   *pspec)
+{
+  CcWifiPanel *self = CC_WIFI_PANEL (object);

this raises a variable unused compilation warning

@@ +343,3 @@
+  switch (prop_id)
+    {
+    case PROP_PARAMETERS:

do you intend to add something here?

@@ +387,3 @@
+  gtk_widget_init_template (GTK_WIDGET (self));
+
+  self->device_id_to_listbox = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);

unused hash table

::: panels/network/gnome-wifi-panel.desktop.in.in
@@ +2,3 @@
+# Translators: Add soft hyphens to your translations so that the icon view won't clip your translations. See https://bugzilla.gnome.org/show_bug.cgi?id=647087#c13 for details
+_Name=Wi-Fi
+_Comment=Control how you connect to the Wi-Fi

not a native speaker but "... to Wi-Fi networks" sounds better to me

@@ +15,3 @@
+X-GNOME-Bugzilla-Component=network
+X-GNOME-Bugzilla-Version=@VERSION@
+# Translators: those are keywords for the network control-center panel

... the *wi-fi* ...

@@ +16,3 @@
+X-GNOME-Bugzilla-Version=@VERSION@
+# Translators: those are keywords for the network control-center panel
+_Keywords=Network;Wireless;Wi-Fi;Wifi;IP;LAN;Proxy;WAN;Broadband;Modem;DNS;

I'd leave at least Proxy, WAN and Modem out
Comment 15 Rui Matos 2017-07-17 17:27:59 UTC
Review of attachment 355501 [details] [review]:

nit: there are a few typos in the commit message

also, it would be nice if this was a done as a review since this is new code
Comment 16 Rui Matos 2017-07-17 17:36:10 UTC
Review of attachment 355360 [details] [review]:

should we remove the airplane switch from the network panel?

::: panels/network/wifi.ui
@@ +139,3 @@
+                    </child>
+                    <child>
+                      <object class="GtkSpinner" id="spinner">

unused?
Comment 17 Georges Basile Stavracas Neto 2017-07-17 17:36:48 UTC
(In reply to Rui Matos from comment #14)
> Review of attachment 355360 [details] [review] [review]:
> 
> what happens if NM is not running or has 0 wifi devices?

First case is legit, and I'll fix the code.

Second case will be addressed later, and not in the panel. The idea is to make panels dynamic, so that the Wi-Fi panel won't be visible when you don't have wi-fi adapters.
Comment 18 Rui Matos 2017-07-17 17:40:13 UTC
(In reply to Rui Matos from comment #16)
> ::: panels/network/wifi.ui
> @@ +139,3 @@
> +                    </child>
> +                    <child>
> +                      <object class="GtkSpinner" id="spinner">
> 
> unused?

disregard this comment, I see where it's used
Comment 19 Rui Matos 2017-07-17 17:44:29 UTC
A UI design comment regarding the height of the wifi panel overall. By default, I see the airplane mode switch plus 3 wifi networks only which doesn't seem ideal. We should find a way to show more wifi networks by default and perhaps the airplane mode row/switch doesn't need to be in such a central/top position as it's not used so often?
Comment 20 Miguel Vaello Martínez 2017-07-17 20:14:12 UTC
(In reply to Georges Basile Stavracas Neto from comment #17)
> (In reply to Rui Matos from comment #14)
> > Review of attachment 355360 [details] [review] [review] [review]:
> > 
> > what happens if NM is not running or has 0 wifi devices?
> 
> First case is legit, and I'll fix the code.
> 
> Second case will be addressed later, and not in the panel. The idea is to
> make panels dynamic, so that the Wi-Fi panel won't be visible when you don't
> have wi-fi adapters.


This is a interesting thing to discuss about. Consider the following use case or scenario:
It the user plugs a Wi-Fi dongle with the CC window already open, the Wi-Fi option will be shown instantanelly in the menu? or in other case, maybe like Bluetooth panel, show an empty state with the tipical "Unabailable blah blah" message.
Comment 21 Georges Basile Stavracas Neto 2017-07-18 02:42:45 UTC
Attachment 355348 [details] pushed as 158591a - network: Replace the notebook with a stack
Attachment 355349 [details] pushed as 3317e88 - network: Don't manage Wi-Fi devices
Attachment 355351 [details] pushed as cf62c0a - network: Rework NetDeviceWifi interface
Attachment 355353 [details] pushed as b12a56d - network: Add Wi-Fi widgets using device product as title
Comment 22 Georges Basile Stavracas Neto 2017-07-18 13:50:12 UTC
Created attachment 355828 [details] [review]
wifi: Introduce Wi-Fi panel

- Addressed all the code issues
 - Added "NetworkManager not running" and "No Wi-Fi Adapters" pages
 - Added capacity to handle command-line arguments
 - Merged changes from attachment 355501 [details] [review] (non-activatable Airplane Mode listbox row)
Comment 23 Rui Matos 2017-07-18 15:21:51 UTC
Review of attachment 355828 [details] [review]:

almost there :-)

::: panels/network/cc-wifi-panel.c
@@ +204,3 @@
+      title_widget = net_device_wifi_get_title_widget (NET_DEVICE_WIFI (net_device));
+
+      gtk_stack_add_named (self->center_stack, title_widget, "single");

if we add device A, then B and then B gets removed, won't we try to add the same widget with the same name to this stack again?

i.e. below on the else branch we should always remove the "single" named widget from the stack

@@ +235,3 @@
+	self->arg_operation = OPERATION_NULL;
+	g_clear_pointer (&self->arg_device, g_free);
+	g_clear_pointer (&self->arg_access_point, g_free);

inconsistent indentation and, please, no tabs!

@@ +334,3 @@
+		  return TRUE;
+	  }
+}

indentation is all over the place in this function, seems to have tabs

@@ +397,3 @@
+  self->rfkill_proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
+
+  if (error && !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))

if there's an error and it's CANCELLED we still need to free the error variable
Comment 24 Georges Basile Stavracas Neto 2017-07-18 15:58:32 UTC
Created attachment 355856 [details] [review]
wifi: Introduce Wi-Fi panel

- Remove tabs from the code (sorry!)
 - Fix header stack management
Comment 25 Rui Matos 2017-07-18 16:25:39 UTC
Review of attachment 355856 [details] [review]:

with that addressed, looks fine, thanks

::: panels/network/cc-wifi-panel.c
@@ +230,3 @@
+      if (single_page_widget)
+        {
+          g_object_ref (single_page_widget);

I believe this isn't needed (and is a leak without a corresponding unref) since the reference is kept in the NetDeviceWifi's GtkBuilder instance
Comment 26 Georges Basile Stavracas Neto 2017-07-18 16:29:23 UTC
(In reply to Rui Matos from comment #25)
> Review of attachment 355856 [details] [review] [review]:
> 
> with that addressed, looks fine, thanks
> 
> ::: panels/network/cc-wifi-panel.c
> @@ +230,3 @@
> +      if (single_page_widget)
> +        {
> +          g_object_ref (single_page_widget);
> 
> I believe this isn't needed (and is a leak without a corresponding unref)
> since the reference is kept in the NetDeviceWifi's GtkBuilder instance

I unfortunately don't have hardware to really test it, so for safety reasons, I'll wrap the gtk_container_remove() with the ref()/unref() standard.
Comment 27 Georges Basile Stavracas Neto 2017-07-18 16:31:45 UTC
Thanks for the reviews. I'm in beer/coffee/juice debt :)

Attachment 355856 [details] pushed as 016efdf - wifi: Introduce Wi-Fi panel