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 785581 - Rework Network panel
Rework Network 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-30 00:49 UTC by Georges Basile Stavracas Neto
Modified: 2017-08-09 17:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
network: Remove Airplane Mode switch (7.42 KB, patch)
2017-07-30 00:49 UTC, Georges Basile Stavracas Neto
committed Details | Review
network: Turn into a final class (32.15 KB, patch)
2017-07-30 00:49 UTC, Georges Basile Stavracas Neto
committed Details | Review
network: Remove Wi-Fi related commands (3.97 KB, patch)
2017-07-30 00:49 UTC, Georges Basile Stavracas Neto
committed Details | Review
network: Cleanup GtkBuilder file (5.68 KB, patch)
2017-07-30 00:49 UTC, Georges Basile Stavracas Neto
committed Details | Review
network: Make it a template class (21.34 KB, patch)
2017-07-30 00:49 UTC, Georges Basile Stavracas Neto
committed Details | Review
network: Add connections and devices to different stack (36.66 KB, patch)
2017-07-30 00:49 UTC, Georges Basile Stavracas Neto
committed Details | Review
network: Wrap panel in a scrolled window (5.10 KB, patch)
2017-07-30 00:50 UTC, Georges Basile Stavracas Neto
committed Details | Review
network: Update "Wired" section UI (20.39 KB, patch)
2017-07-30 00:50 UTC, Georges Basile Stavracas Neto
committed Details | Review
network: Ensure WirelessSecurity type is initialized (2.86 KB, patch)
2017-07-30 00:50 UTC, Georges Basile Stavracas Neto
committed Details | Review
network: Update Proxy section widgets (56.05 KB, patch)
2017-07-30 00:50 UTC, Georges Basile Stavracas Neto
committed Details | Review
network: Prevent compile warning (1.20 KB, patch)
2017-07-30 00:50 UTC, Georges Basile Stavracas Neto
committed Details | Review
network: Add header to VPN section (5.30 KB, patch)
2017-07-30 00:50 UTC, Georges Basile Stavracas Neto
committed Details | Review
network: Update VPN section (32.91 KB, patch)
2017-07-30 00:50 UTC, Georges Basile Stavracas Neto
committed Details | Review
network: Make widgets cover a third of screen width (2.72 KB, patch)
2017-07-30 00:51 UTC, Georges Basile Stavracas Neto
committed Details | Review

Description Georges Basile Stavracas Neto 2017-07-30 00:49:27 UTC
See the commits below.
Comment 1 Georges Basile Stavracas Neto 2017-07-30 00:49:31 UTC
Created attachment 356570 [details] [review]
network: Remove Airplane Mode switch

The Network panel does not deal with Wi-Fi devices anymore,
and does not make sense to have the Airplane Mode switch in
there, since it is now available at the Wi-Fi panel.

This commit then removes the Airplane Mode switch from the
Network panel.
Comment 2 Georges Basile Stavracas Neto 2017-07-30 00:49:37 UTC
Created attachment 356571 [details] [review]
network: Turn into a final class

The Network panel is not really a deriverable type, and
since after 61d7abe795b4434fd1ae3d28a we can use the
utility macros.

Thus, this commit removes all the boilerplate code and
turns CcNetworkPanel into a final class.
Comment 3 Georges Basile Stavracas Neto 2017-07-30 00:49:43 UTC
Created attachment 356572 [details] [review]
network: Remove Wi-Fi related commands

This should be in the Wi-Fi patchset...
Comment 4 Georges Basile Stavracas Neto 2017-07-30 00:49:47 UTC
Created attachment 356573 [details] [review]
network: Cleanup GtkBuilder file

The Network panel UI file uses deprecated widgets and
has many lines of needless code. This commit just cleans
it up, as a preparation for turning the Network panel
into a template class.
Comment 5 Georges Basile Stavracas Neto 2017-07-30 00:49:52 UTC
Created attachment 356574 [details] [review]
network: Make it a template class

The current Network panel class relies on GtkBuilder
when it could use a more modern feature that is the
template class.

By making it a template class, not only the Network
panel is slightly more performant, but it's also
simpler and easier to read.

This commit, then, turns the Network panel into a
template class, and cleans up the code to make it
work.
Comment 6 Georges Basile Stavracas Neto 2017-07-30 00:49:57 UTC
Created attachment 356575 [details] [review]
network: Add connections and devices to different stack

The current Network panel is composed of a single stack and
a treeview to select the currently visible stack page. Each
stack page represents a connection or device.

The new Network panel, however, has none of the concept of
selectable pages. In the new layout, all connections and
devices appear all at once in a more compact and simpler
fashion.

This commit, then, starts moving towards a unified, pageless
panel by adding all the connections and devices to different
stacks. These different stacks are transient to the network
object, and are added at appropriate boxes, giving the panel
a unified layout.

This has some serious implications in the design of the
current code. Most of the code removals were related to the
treeview and different pages handling. No more tree model
madness is present, and the devices are now stored in a
plain simple GPtrArray.

After this patch, NetObject:add_to_stack isn't a good code
design choice anymore. This will be addressed in a future
patch.
Comment 7 Georges Basile Stavracas Neto 2017-07-30 00:50:03 UTC
Created attachment 356576 [details] [review]
network: Wrap panel in a scrolled window

After introducing the new single-column layout,
we can easily hit the case where there are too
many connections and/or devices and the panel
gets way too tall.

To fix that, wrap all the widgets inside a
scrolled window that only scrolls vertically.
Comment 8 Georges Basile Stavracas Neto 2017-07-30 00:50:07 UTC
Created attachment 356577 [details] [review]
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.
Comment 9 Georges Basile Stavracas Neto 2017-07-30 00:50:37 UTC
Created attachment 356578 [details] [review]
network: Ensure WirelessSecurity type is initialized

When calling for the wireless security widgets, the code
simply assumes that the corresponding GType is initialized.
This may not always be true, which leads to a nasty crash
every time e.g. we open the network connection editor dialog.

This commit fixes that by introducing a new standard macro
wrapping wireless_security_get_type(), and ensuring the type
is initializing when calling wireless_security_init(), thus
protecting every code path from this crash.

This commit also makes CePageSecurity use the new macro for
better legibility.
Comment 10 Georges Basile Stavracas Neto 2017-07-30 00:50:42 UTC
Created attachment 356579 [details] [review]
network: Update Proxy section widgets

According to the lastest mockups [1], the Proxy section is now
composed of a row with the state of the proxy, and a settings
button that leads to a dialog where one can configure the different
proxy settings.

This commit ports the current code to do that, and various changes
took place to made this happen. Namely:

 * A new ProxyMode enum was added to improve readability and
   improve the semantic of the code. No more random numbers
   are present.

 * The current widgets for editing proxy settings were repacked
   into a GtkStack (so that we keep an homogeneous sizing), and
   the GtkStack itself was moved into a new dialog. With that,
   we can just set the stack page, rather than controlling the
   visibility of all individual widgets.

 * Many unused widgets were removed.

 * The combo box was replaced by 3 radio buttons. Now, there's
   no need to deal with GtkTreeIters anymore. Another refactoring
   of the code that led to more readable and smaller code.

Overall, these changes made the code be more readable, smaller
codebase with a smaller surface for mistakes.
Comment 11 Georges Basile Stavracas Neto 2017-07-30 00:50:47 UTC
Created attachment 356580 [details] [review]
network: Prevent compile warning

If we build with strict compile check, the pointer
alignment gets messed up. So just cast to gpointer
to satisfy the compiler.
Comment 12 Georges Basile Stavracas Neto 2017-07-30 00:50:52 UTC
Created attachment 356581 [details] [review]
network: Add header to VPN section

Since each VPN will be a row in a listbox, we
can't rely on NetVPN:add_to_stack() to handle
the header.

This header must, then, be handled by the panel
itself. For now, we just open the already available
dialog to add connections, when the ideal approach
(to be implemented yet) is to move the contents
of this dialog in a built-in popover.
Comment 13 Georges Basile Stavracas Neto 2017-07-30 00:50:57 UTC
Created attachment 356582 [details] [review]
network: Update VPN section

The last remaining network device to be updated is
the VPN device, and this patch is the result of this
effort.

The changes were mostly towards cleaning up and
removing unecessary code. By removing the info labels,
many getters were removed as well.

In order to achieve a listbox-like UI, a couple of
UI refactorings.
Comment 14 Georges Basile Stavracas Neto 2017-07-30 00:51:02 UTC
Created attachment 356583 [details] [review]
network: Make widgets cover a third of screen width

Following the design decision on other panels, make the central
column of the Network panel cover at most a third of the window,
or more depending on the width of the window.
Comment 15 Rui Matos 2017-08-07 17:25:59 UTC
Review of attachment 356570 [details] [review]:

yay for getting rid of the gvariant leaks too
Comment 16 Rui Matos 2017-08-07 17:33:46 UTC
Review of attachment 356571 [details] [review]:

++
Comment 17 Rui Matos 2017-08-07 17:36:24 UTC
Review of attachment 356572 [details] [review]:

oops, ok
Comment 18 Rui Matos 2017-08-07 17:37:43 UTC
Review of attachment 356573 [details] [review]:

sure
Comment 19 Rui Matos 2017-08-07 17:45:37 UTC
Review of attachment 356574 [details] [review]:

looks fine
Comment 20 Rui Matos 2017-08-07 18:11:36 UTC
Review of attachment 356575 [details] [review]:

what do you mean by "These different stacks are transient to the network object" ?

looks good anyway

::: panels/network/cc-network-panel.c
@@ +480,2 @@
         /* add as a panel */
+        if (device_g_type != NET_TYPE_DEVICE) {

this check can go. it doesn't do anything since, it seems, commit ecdb1d847794b43dc0d1ae3b107d811fe52e5846

@@ +786,3 @@
         panel->cancellable = g_cancellable_new ();
+        panel->devices = g_ptr_array_new_with_free_func (g_object_unref);
+        panel->device_to_stack = g_hash_table_new (g_direct_hash, g_direct_equal);

could simply use the hash table everywhere instead of having the array as well, but it's ok
Comment 21 Rui Matos 2017-08-07 18:15:34 UTC
Review of attachment 356576 [details] [review]:

::: panels/network/network.ui
@@ +32,2 @@
     <child>
+      <object class="GtkScrolledWindow">

this could have a min-content-height so that the window doesn't resize all the way down to the title bar only

@@ +57,2 @@
                     <property name="orientation">vertical</property>
+                    <property name="width_request">350</property>

is this really needed?
Comment 22 Rui Matos 2017-08-07 18:38:05 UTC
Review of attachment 356577 [details] [review]:

missing the [1] reference in the commit message

::: panels/network/network-ethernet.ui
@@ +92,3 @@
+                        </child>
+                        <child>
+                          <object class="GtkSwitch" id="device_off_switch">

the device off switch is now only available when there's one connection? doesn't seem right
Comment 23 Rui Matos 2017-08-07 18:39:18 UTC
Review of attachment 356578 [details] [review]:

++
Comment 24 Rui Matos 2017-08-07 18:50:18 UTC
Review of attachment 356579 [details] [review]:

seems fine

::: panels/network/net-proxy.c
@@ -101,3 @@
-        widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
-                                                     "heading_proxy_url"));
-        gtk_widget_set_visible (widget, value == 2);

wow, I'd never looked at this code :-P

@@ +396,3 @@
+        gtk_toggle_button_set_active (proxy->priv->mode_radios[value], TRUE);
+        panel_proxy_mode_setup_widgets (proxy, value);
+        panel_update_status_label (proxy, value);

updating the label could be done from a gsettings "changed" handler but it's only called in 2 places, so, fine

::: panels/network/network-proxy.ui
@@ +127,3 @@
             <property name="visible">True</property>
             <property name="can_focus">False</property>
+            <property name="transition_type">crossfade</property>

This stack should be non-homogeneous so that the dialog doesn't have a big empty area when Disabled is selected
Comment 25 Rui Matos 2017-08-07 18:51:49 UTC
Review of attachment 356580 [details] [review]:

right
Comment 26 Rui Matos 2017-08-07 19:00:03 UTC
Review of attachment 356581 [details] [review]:

lgtm
Comment 27 Rui Matos 2017-08-07 19:10:32 UTC
Review of attachment 356582 [details] [review]:

this is convoluted... I think you could create two GtkFrame instances and show one or the other depending on whether we have > 0 connections
Comment 28 Rui Matos 2017-08-07 19:12:19 UTC
Review of attachment 356583 [details] [review]:

sure
Comment 29 Georges Basile Stavracas Neto 2017-08-07 19:24:06 UTC
Attachment 356570 [details] pushed as f07c357 - network: Remove Airplane Mode switch
Attachment 356571 [details] pushed as 09c2025 - network: Turn into a final class
Attachment 356572 [details] pushed as 29c6bab - network: Remove Wi-Fi related commands
Attachment 356573 [details] pushed as 71d9e5c - network: Cleanup GtkBuilder file
Attachment 356574 [details] pushed as e494960 - network: Make it a template class
Comment 30 Rui Matos 2017-08-09 17:44:54 UTC
Attachment 356575 [details] pushed as e35ecd5 - network: Add connections and devices to different stack
Attachment 356576 [details] pushed as a87d804 - network: Wrap panel in a scrolled window
Attachment 356577 [details] pushed as 965ef93 - network: Update "Wired" section UI
Attachment 356578 [details] pushed as 21943a4 - network: Ensure WirelessSecurity type is initialized
Attachment 356579 [details] pushed as b64c605 - network: Update Proxy section widgets
Attachment 356580 [details] pushed as 331d7fb - network: Prevent compile warning
Attachment 356581 [details] pushed as bcc8a9c - network: Add header to VPN section
Attachment 356582 [details] pushed as aabc162 - network: Update VPN section
Attachment 356583 [details] pushed as 6bdbf68 - network: Make widgets cover a third of screen width