Commit graph

283 commits

Author SHA1 Message Date
Robert Ancell
aba79986a5 network: Use a hash table to map NM device objects to our objects 2019-11-06 10:16:40 +13:00
Robert Ancell
50c4c805d4 network: Store VPNs separately to other network devices
This simplifies a lot of class checks.
2019-11-06 10:16:40 +13:00
Robert Ancell
51df8ccf15 network: Remove unused enum 2019-11-06 10:16:40 +13:00
Robert Ancell
4e5b7faf23 network: Don't add proxies to the device list - nothing every reads them back 2019-11-06 10:16:40 +13:00
Robert Ancell
a88f1b1bad network: Use function instead of GObject property getter 2019-11-06 10:16:40 +13:00
Robert Ancell
5244b01326 network: Merge together methods
A method was public, and not being used. Simplify the case it's used in.
2019-11-06 10:16:40 +13:00
Robert Ancell
06e38dac90 network: Tidy up use of modem object in NetDeviceMobile 2019-11-06 10:16:40 +13:00
Robert Ancell
966cb97d45 network: Remove net_object_get_cancellable
Only a few objects need it
2019-11-06 10:16:39 +13:00
Robert Ancell
c74d26bf3a network: Remove NetObject id property
This is better handled by comparing objects.
2019-11-06 10:16:39 +13:00
Robert Ancell
0b3ce1e15d network: Remove net_object_get_panel
It was only being used for WiFi devices
2019-11-06 10:16:39 +13:00
Robert Ancell
76de0ce408 network: Simplify net_object_add_to_stack function
Except in the WiFi case it was creating a stack with one child.
All the non-WiFi cases had the same logic.
2019-11-06 10:16:39 +13:00
Robert Ancell
8335c088ec network: Simplify handling bluetooth devices 2019-11-06 10:16:39 +13:00
Robert Ancell
a7e3f314e6 network: Rename NetDeviceSimple to NetDeviceBluetooth
It's only being used for bluetooth connections.
2019-11-06 10:16:39 +13:00
Robert Ancell
e90ed2df8a network: Stop NetDeviceEthernet deriving from NetDeviceSimple
It overrode everything anyway.
2019-11-06 10:16:39 +13:00
Robert Ancell
0c92c7b461 network: Replace g_object_new with constructors 2019-11-06 10:16:20 +13:00
Robert Ancell
0b481bfb83 network: Remove if statement that is always true 2019-11-06 10:16:20 +13:00
Robert Ancell
926063acb3 network: Remove unused GObject property 2019-10-22 20:11:45 +00:00
Robert Ancell
708b1fdaf7 network: Use self variable name consistently 2019-10-22 20:11:45 +00:00
Robert Ancell
54f8fce47f network: Connect signals in swapped form 2019-10-22 20:11:44 +00:00
Philip Withnall
fcefd51d7a network: Don’t suffix VPN devices with ‘VPN’
They’re already listed in a section titled ‘VPN’, and the user is likely
to have included ‘VPN’ in the device’s name already.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #701
2019-09-25 14:14:37 +01:00
Mohammed Sadiq
9c19eb6ead network: Fix possible invalid free 2019-09-24 21:25:44 +05:30
Robert Ancell
e70610fe74 network: Use g_autoptr for unref code 2019-09-13 14:20:50 +12:00
Robert Ancell
de84f7e344 network: Use g_autofree for strings 2019-09-13 14:20:50 +12:00
Robert Ancell
01190db349 network: Use g_autoptr for GError handling 2019-09-13 14:20:50 +12:00
Mohammed Sadiq
cef992e717 network: Don’t add proxy device if NM isn’t running 2019-08-08 22:53:47 +00:00
Carlos Garnacho
4c31ff5269 network: Handle Infiniband as a wired interface
The configuration/UI we expose for wired settings are meaningful for those
devices as well.

Closes: https://gitlab.gnome.org/GNOME/gnome-control-center/issues/489
2019-04-23 19:46:32 +02:00
Benjamin Berg
8e175bb562 network: Don't shorten names of bluetooth connections
This prevents a single bluetooth connection to be shortened to the name
"Bluetooth", which means we end up with one "Bluetooth" device in the
"Bluetooth" section. Rather, always use the long name of the bluetooth
device so that the user knows what they are connecting to.
2019-03-29 14:08:45 +01:00
Benjamin Berg
77cae9ce72 network: Only show bluetooth devices in Bluetooth section
Historically, the bluetooth section has been the dumping ground for any
device we don't handle in another way. It has had the "Bluetooth" title
for a long time now though, and many of the devices that end up in there
are actually not useful in the GNOME context.

There are some people complaining that we should support these devices
properly, but the status quo does not help any one either really, so
lets remove them entirely for now.

Obsoletes: !203
Fixes: #190
Touches: #167
2019-03-29 14:08:45 +01:00
Adrien Plazas
91af270cce connection-editor: Use GtkTemplate 2019-01-27 21:03:13 +00:00
Georges Basile Stavracas Neto
f9b9f105dd network: Rename UI files to match C files
This commit renames {network|wifi}.ui to cc-{network|wifi}-pane.ui,
in order to match the corresponding C files. This introduces no
functional changes.
2018-07-23 12:55:59 +00:00
Robert Ancell
a64ef75ad7 Simplify use of GCancellable
g_cancellable_cancell can be called without checking for a NULL value.
Use g_clear_object instead of g_object_unref
2018-06-01 21:03:19 +00:00
Benjamin Berg
a51dbcd8ca network: Fix Bluetooth panel showing up after connection removal
The test to check whether the Bluetooth (simple section) contains
elements was testing for NetObjectSimple. However, ethernet connections
are a subclass and check would count these. This causes issue when the
code is run after net object removal.

The fix is to check for the exact object type rather than also allowing
subclasses.
2018-05-29 15:16:43 +02:00
Benjamin Berg
ec50cbcdff network: Ensure devices are removed from UI when disappearing
The "removed" callback from NMObject is never called when the object is
simply finalised because the UI drops the reference. Explicitly call the
handler so that UI elements are removed.
2018-05-02 22:29:30 +00:00
Georges Basile Stavracas Neto
250eb01931 network: Cache D-Bus proxies and objects 2018-04-06 22:23:38 -03:00
Rui Matos
cb4a7e1773 network: Avoid crashing if NM reports no devices or no connections
Seems like NM changed behavior recently but, in any case, better safe
than sorry.

https://bugzilla.gnome.org/show_bug.cgi?id=788716
2017-11-01 16:47:36 +01:00
Georges Basile Stavracas Neto
5a3b19ef33 network: Don't unref device after when parsing arguments
When we add the NetDevice pointer to the GPtrArray, we have
a single reference owned by the panel. When iterating over
this GPtrArray, no reference is taken.

The problem is that the code to handle command-line arguments
was unreferencing the NetDevices when iterating over it,
creating a disparity in the ref/unref pairs.

Fix that by simply not unreferencing the NetDevice instance
when iterating over it.

https://bugzilla.gnome.org/show_bug.cgi?id=786514
2017-08-29 18:11:30 -03:00
Georges Basile Stavracas Neto
d5de1d2b3c network: Show simple devices in an isolated section
As a temporary solution until we don't have the Mobile Broadband
panel, the Network panel should take care of simple devices such
as Bluetooth and metered connections, and should do so in such a
way that is consistent with how the rest of devices is managed.

Currently, however, NetDeviceSimple objects still present the old,
grid-based layout, breaking the expectations and completely destroying
the consistency of the panel

This patch moves simple devices to a section of its own. The next
patch will update the visuals to match the other devices.

https://bugzilla.gnome.org/show_bug.cgi?id=786662
2017-08-23 15:15:52 +02:00
Georges Basile Stavracas Neto
aabc1621b8 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.

https://bugzilla.gnome.org/show_bug.cgi?id=785581
2017-08-09 19:32:43 +02:00
Georges Basile Stavracas Neto
bcc8a9ce27 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.

https://bugzilla.gnome.org/show_bug.cgi?id=785581
2017-08-09 19:32:43 +02:00
Georges Basile Stavracas Neto
331d7fbf11 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.

https://bugzilla.gnome.org/show_bug.cgi?id=785581
2017-08-09 19:32:43 +02:00
Georges Basile Stavracas Neto
e35ecd5468 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.

https://bugzilla.gnome.org/show_bug.cgi?id=785581
2017-08-09 19:32:43 +02:00
Georges Basile Stavracas Neto
e49496048f 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.

https://bugzilla.gnome.org/show_bug.cgi?id=785581
2017-08-07 20:23:40 +01:00
Georges Basile Stavracas Neto
71d9e5c5f1 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.

https://bugzilla.gnome.org/show_bug.cgi?id=785581
2017-08-07 20:23:40 +01:00
Georges Basile Stavracas Neto
29c6bab4d2 network: Remove Wi-Fi related commands
This should be in the Wi-Fi patchset...

https://bugzilla.gnome.org/show_bug.cgi?id=785581
2017-08-07 20:23:40 +01:00
Georges Basile Stavracas Neto
09c202528f network: Turn into a final class
The Network panel is not really a deriverable type, and
since after 61d7abe795 we can use the
utility macros.

Thus, this commit removes all the boilerplate code and
turns CcNetworkPanel into a final class.

https://bugzilla.gnome.org/show_bug.cgi?id=785581
2017-08-07 20:23:40 +01:00
Georges Basile Stavracas Neto
f07c35747c 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.

https://bugzilla.gnome.org/show_bug.cgi?id=785581
2017-08-07 20:23:40 +01:00
Georges Basile Stavracas Neto
3317e88de8 network: Don't manage Wi-Fi devices
The Wi-Fi devices are going to be managed with the
to-be-introduced Wi-Fi panel, and don't need to
be available in the Network panel anymore.

This patch then blacklists Wi-Fi devices and doesn't
let the Network panel manage them.

https://bugzilla.gnome.org/show_bug.cgi?id=784818
2017-07-17 23:41:08 -03:00
Georges Basile Stavracas Neto
158591a346 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.

https://bugzilla.gnome.org/show_bug.cgi?id=784818
2017-07-17 23:40:58 -03:00
Bastien Nocera
11c81f1809 network: Simplify the ignored Network interface types
We might want to add more ignored types later on, but this is a simple
cleanup.

https://bugzilla.gnome.org/show_bug.cgi?id=783998
2017-06-21 13:24:38 +02:00
Bastien Nocera
b7c4b30f63 network: Fix runtime warning
Create 2 veth interfaces without any names with, as root:
ip link add veth0 type veth peer name veth1
ip link set dev veth0 up
ip link set dev veth1 up

And run:
(gnome-control-center:28176): GLib-CRITICAL **: g_utf8_collate: assertion 'str1 != NULL' failed
(gnome-control-center:28176): GLib-CRITICAL **: g_utf8_collate: assertion 'str2 != NULL' failed

https://bugzilla.gnome.org/show_bug.cgi?id=783996
2017-06-21 13:24:38 +02:00