Commit graph

249 commits

Author SHA1 Message Date
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
Benjamin Berg
2c95c6a5d0 network: Include the connection title in the sort string
The list of networks is sorted by connection type. If a user has e.g. a
lot of VPN connections, then the unsorted list is hard to browse.
To fix this, include the title of the connection in the sort order and
ensure the list is kept sorted when a title is changed.

Reported-by: Oliver Haessler <oliver@redhat.com>

https://bugzilla.gnome.org/show_bug.cgi?id=778685
2017-05-17 15:14:10 +02:00
Benjamin Berg
f70ac1d863 network: Re-render connection title whenever it changes
The title of network connections may change if the user edits it or if
it was changed programatically by another program. This worked fine, but
the UI was not updated. This patch ensures the network list in the UI is
updated.

Reported-by: Oliver Haessler <oliver@redhat.com>

https://bugzilla.gnome.org/show_bug.cgi?id=778685
2017-05-17 11:24:39 +02:00
Benjamin Berg
93fc508061 network: Remove unused "title" column from devices liststore
The title column is not used as the title is fetched from the net object
on the fly when it is needed.

https://bugzilla.gnome.org/show_bug.cgi?id=778685
2017-05-17 11:24:39 +02:00
Bastien Nocera
9183d34947 network: Port to libnm 1.2
We also remove support for WiMAX (now unsupported by NetworkManager),
and InfiniBand (Enterprise feature), and the use of
the deprecated NM_SETTING_WIRELESS_SEC property.

With help from network-manager-applet patches by Jiří Klimeš and
Dan Winship.

https://bugzilla.gnome.org/show_bug.cgi?id=765910
2016-05-27 18:23:33 +02:00
Bastien Nocera
8861d44099 network: Remove now unused virtual devices support
https://bugzilla.gnome.org/show_bug.cgi?id=747443
2016-05-26 14:49:28 +02:00
Bastien Nocera
da96effab7 network: Remove HAVE_NM_UNSTABLE check
We don't have any code that relies on it anymore.

https://bugzilla.gnome.org/show_bug.cgi?id=747443
2016-05-26 14:49:28 +02:00
Bastien Nocera
a4729411b5 network: Remove VLAN support
It is supported by Cockpit already:
https://github.com/cockpit-project/cockpit/issues/1007

https://bugzilla.gnome.org/show_bug.cgi?id=747443
2016-05-26 14:49:28 +02:00
Bastien Nocera
b38bf8b672 network: Remove bond support
It is supported by Cockpit already:
https://github.com/cockpit-project/cockpit/issues/458

https://bugzilla.gnome.org/show_bug.cgi?id=747443
2016-05-26 14:49:28 +02:00
Bastien Nocera
20b634b454 network: Remove bridge support
It is supported by Cockpit already:
https://github.com/cockpit-project/cockpit/issues/459

https://bugzilla.gnome.org/show_bug.cgi?id=747443
2016-05-26 14:49:28 +02:00
Bastien Nocera
67c1755fe7 network: Fix warning about renamed theme property
Theme parsing error: <data>:1:54: The 'outline-radius' property has been renamed to '-gtk-outline-radius'
2016-04-13 13:44:30 +02:00
Christophe Fergeau
c84722248e shell: Revert "Let panels have their own commandline flags"
This reverts commit 31a8a99440.

This was meant for bgo#695885 which has stalled for a while, so this
feature has no in-tree user. This commit removes it for now, this can be
readded when users for it materialize.

https://bugzilla.gnome.org/show_bug.cgi?id=751597
2015-07-16 11:49:34 +02:00
Bastien Nocera
e9294e5cc7 network: Fix possible crash when changing airplane mode
When changing the airplane mode, either from the Bluetooth panel, or
through gnome-shell's status menu, we would receive signals from the
Rfkill gnome-settings-daemon service, even after the network panel was
closed, as we didn't unref' it. Except that the panel was mostly gone.
So splat.

https://bugzilla.gnome.org/show_bug.cgi?id=751482
2015-06-29 17:49:04 +02:00
Bastien Nocera
3569b2d289 network: Fix gtk_tree_model_get_iter_first() retval
And don't select the first item when removing the item fails.

https://bugzilla.gnome.org/show_bug.cgi?id=749892
2015-05-27 11:06:02 +02:00
Matthias Clasen
0622883025 network: Follow through on the original design
GTK+ can now do circular buttons with ease, so make
this page a little more fancy by following the original
design.

https://bugzilla.gnome.org/show_bug.cgi?id=745703
2015-05-23 11:57:30 -04:00
Bastien Nocera
f6f4e7b774 network: Remove use of temporary variable
No need to copy a static string before using it.

https://bugzilla.gnome.org/show_bug.cgi?id=746411
2015-03-19 16:32:45 +01:00
Bastien Nocera
2cf597eb97 network: Fix reference leak of NetProxy
Every time we got the list of devices from the devices GtkListStore, we
were leaking the only element that wasn't a NetDevice, the proxy page.
Make sure to unref' it by hand if we're not going to add it to the list
(the elements of which will be unref'ed properly).

https://bugzilla.gnome.org/show_bug.cgi?id=746411
2015-03-19 16:32:45 +01:00
Bastien Nocera
a6781932e9 network: Fix reference leak of NetVirtualDevices
The only reference is owned by the devices GtkListStore.

https://bugzilla.gnome.org/show_bug.cgi?id=746411
2015-03-19 16:32:45 +01:00
Bastien Nocera
eb14e558e5 network: Fix reference leak of NetVpn
The only reference is owned by the devices GtkListStore.

https://bugzilla.gnome.org/show_bug.cgi?id=746411
2015-03-19 16:32:45 +01:00
Rui Matos
386a996a19 network: Remove unused variable 2015-01-20 14:09:09 +01:00
Rui Matos
b45d08b603 network: Display an error instead of the panel on NM absence
This is more in line with current GNOME UI and allows us to drop
deprecated gtk+ API usage.

https://bugzilla.gnome.org/show_bug.cgi?id=740986
2015-01-20 14:08:41 +01:00
Bastien Nocera
f30e6df1d4 network: Also work with NM 1.0
Remove the NetworkManager version checking altogether. The code was made
to check for now very old versions of NetworkManager, and anything newer
than ancient should degrade gracefully if we support newer features.

https://bugzilla.gnome.org/show_bug.cgi?id=741661
2015-01-15 14:59:44 +01:00
Cosimo Cecchi
436d220f88 network: hide airplane switch when g-s-d says so
https://bugzilla.gnome.org/show_bug.cgi?id=736291
2014-09-22 22:11:23 +02:00
Bastien Nocera
dbd1a539f6 network: Don't show underlying device for VPN connections
We don't need to see "tun0" with its IP address in there, separate
from the VPN configuration.
2014-09-09 17:07:07 +02:00
Bastien Nocera
034d269fe0 network: Really hide all of the virtualisation bridges
Follow-up to ddc35609bd.
2014-09-08 14:29:21 +02:00
Felix Zhang
064cb89675 network: Fix typo in NetworkManager version checking
The code is meant to work with NetworkManager of version 0.9.0+ or 0.8.992+

https://bugzilla.gnome.org/show_bug.cgi?id=733309
2014-08-07 13:05:09 +02:00
Bastien Nocera
ddc35609bd network: Hide the Virtualisation bridge
There's no need for anyone to poke at the libvirt bridge that's not an
admin. It should probably be locked down more as well, but that would be
NetworkManager's business.
2014-05-19 17:55:47 +02:00
Matthias Clasen
4ad99703ac network: don't pretend we can overrule hw rfkill
If the airplane mode is forced by the hw switch, make the switch
in the network panel insensitive, so we don't give the wrong
impression.

https://bugzilla.gnome.org/show_bug.cgi?id=728511
2014-04-22 09:53:56 -04:00
Giovanni Campagna
741f09f6f4 network: handle argv after cold-plugging connections
To pick up show-device with a connection path (VPN or virtual),
we need to handle the arguments again after the connections are
read.

https://bugzilla.gnome.org/show_bug.cgi?id=724547
2014-02-17 21:02:17 +01:00
Giovanni Campagna
10ffa301b7 network: allow selecting a specific VPN or virtual interface
Overload the show-device operation to accept paths to NMConnections,
which can be matched to VPN connections or unadopted virtual
interfaces.
This will be used by gnome-shell to implement the VPN Settings
menu item.

https://bugzilla.gnome.org/show_bug.cgi?id=724547
2014-02-17 21:02:17 +01:00
Daniel Mustieles
2c5951819d Updated FSF's address 2014-01-29 11:27:38 +01:00
Rui Matos
c5b70a7876 network: Remove unused toplevel windows from .ui files
https://bugzilla.gnome.org/show_bug.cgi?id=708286
2013-10-01 10:05:02 +02:00
Rui Matos
fecc2eca87 network: Correctly unref NetDevice instances when needed
We have to take the GtkListStore own reference into account.

https://bugzilla.gnome.org/show_bug.cgi?id=708468
2013-10-01 10:01:24 +02:00
Dan Winship
fea9da1b2e network: don't show unmanaged devices
And in particular, in NM 0.9.10, don't show NM_DEVICE_TYPE_GENERIC
devices.

https://bugzilla.gnome.org/show_bug.cgi?id=706868
2013-09-10 15:54:30 -04:00
Debarshi Ray
0c1ac731ff network: Silence compiler warning
Use an explicit typecast from gpointer to const gchar **.
2013-09-09 16:17:56 +02:00