Commit graph

158 commits

Author SHA1 Message Date
Robert Ancell
b085a8af51 network: Fix string leak 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
ab8aa577e1 wifi: Use HdyDialog for known networks dialog 2019-09-09 21:36:19 +00:00
Georges Basile Stavracas Neto
e08bc03533 network: Add NetDeviceWifi::scanning property
This is a boolean property that notifies whether the
device is scanning for new access points. This is
implemented by monitoring the NMDeviceWifi::last-scan
property, as suggested by NetworkManager developers
(and due to the lack of a better API), since this
property is updated *after* the scan is completed.
2019-06-16 01:01:36 +00:00
Adrien Plazas
91af270cce connection-editor: Use GtkTemplate 2019-01-27 21:03:13 +00:00
Benjamin Berg
d126b3db5e wifi: Hook up new connection list widget 2019-01-07 15:29:23 +01:00
Benjamin Berg
5c81b12647 wifi: Handle multiple APs in a connection row
Note that this also changes the way to detect that the connection is
currently active. This change is not required but but does simplify the
code a little bit.
2019-01-07 15:29:23 +01:00
Benjamin Berg
8f706f45bd wifi: Remove unused code in wireless_try_to_connect
The code tries to establish a connect by using an existing connection.
However, if that is possible the function will not even be called.

Remove the code in question.
2019-01-07 15:29:23 +01:00
Benjamin Berg
fb089b7c55 wifi: Use new CcWifiConnectionRow widget
This is in preparation to optimise the AP list updating.
2019-01-07 15:29:23 +01:00
Benjamin Berg
88183c0e9f wifi: Remove old and unused column definitions 2019-01-07 15:28:38 +01:00
Benjamin Berg
0922f1095a wifi: Avoid one level of indentation
Convert an if into an early return rather than nesting the entire logic.
2019-01-07 15:28:38 +01:00
Adrien Plazas
943c90074c wifi: Allow the panel to reach narrower sizes 2018-11-26 15:36:34 +01:00
Georges Basile Stavracas Neto
ccd492d752
net-device-wifi: Remove private field
NetDeviceWifi is a final class, and thus does not need a private
field. Remove this field and use the NetDeviceWifi struct itself
to store the previously private variables.
2018-11-05 08:31:49 -02:00
Georges Basile Stavracas Neto
0ce486ecb5
net-device-wifi: Turn into a final class
Remove the old style GObject boilerplate and replace it by
G_DECLARE_FINAL_TYPE(). Move the NetDeviceWifi structure
definition to the .c file too.
2018-11-05 08:31:49 -02:00
Georges Basile Stavracas Neto
e1dcf21979
net-device-wifi: Remove macro to get private field
We can just use the standard, non-deprecated G_DEFINE_TYPE_WITH_PRIVATE
 and avoid g_type_class_add_private(), which is deprecated now.
2018-11-05 08:31:49 -02:00
Jonathan Kang
a0998bbb03 wifi: Disable periodic scan only when Wi-Fi is disabled
The periodic Wi-Fi scan is introduced in 84279c4a. It's designed to
scan the Wi-Fi list every 15 seconds and disable the scan when Wi-Fi is
disabled.

But currently the periodic check is disabled every time
wireless_enabled_toggled() is called, which is wrong. Because it can
mean Wi-Fi is enabled or disabled.

Fix that by disabling periodic scan only when Wi-Fi is disabled.

fixes 84279c4a
2018-10-24 04:38:53 +00:00
Robert Ancell
3642cb2d82 wifi: Use g_signal_connect_object
The previous code used the g_signal_connect which could leave the signals
connected even after the NetDeviceWifi object was destroyed.

Automatic crash reports in Ubuntu indicate that this might be happening:
https://bugs.launchpad.net/ubuntu/+source/gnome-control-center/+bug/1718727
2018-08-13 23:46:23 +00:00
Lubomir Rintel
3c61cee1bb network: use nm_device_get_description()
It's better for human-readable display than nm_device_get_product().
Unlike nm_device_get_product(), it never returns an empty string and
sanitizes the string.

With NM 1.12 it goes to great lengths to clean up the messy udev
strings.
2018-07-17 08:44:16 +02:00
Benjamin Berg
c2f601a9d4 Move common panel code from shell/ to panel/common
This creates a new static library called libwidget which the shell links
against.
2018-04-17 15:26:59 +02:00
Bastien Nocera
84279c4aaa network: Request periodic Wi-Fi scans
As NetworkManager from version 1.10 doesn't handle background scanning
itself, to minimise battery drain, we need to periodically request it to
scan for Wi-Fi Access Points.

We now do this request every 15 seconds, as NetworkManager-applet and
gnome-shell do, and disable that periodic scan if Wi-Fi is disabled.

https://bugzilla.gnome.org/show_bug.cgi?id=793647
2018-02-21 12:29:40 +01:00
Felipe Borges
849e50b70e wifi: Revert "Add a refresh button"
This reverts commit 5ad72b6faa.

See https://bugzilla.gnome.org/793238
2018-02-20 10:04:48 +01:00
Xiang Fan
5ad72b6faa wifi: Add a refresh button
This way, user can scan anytime without having to wait.

https://bugzilla.gnome.org/show_bug.cgi?id=789869
2018-01-21 13:12:29 -02:00
Xiang Fan
823c4868a6 wifi: Update the list when AP properties change
The best AP can be chosen even if no AP is added/removed.

https://bugzilla.gnome.org/show_bug.cgi?id=786736
2018-01-21 13:03:19 -02:00
Rui Matos
338719a876 network/wifi: Use cancellables for NM async operations
Our NM async callbacks already handle being cancelled and we already
have a cancellable in the base NetObject class, we just weren't wiring
it up to the async calls. Do that to prevent use after free crashes.

https://bugzilla.gnome.org/show_bug.cgi?id=787010
2017-10-03 19:18:59 +02:00
Georges Basile Stavracas Neto
b12a56d97c 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 of 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.

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

https://bugzilla.gnome.org/show_bug.cgi?id=784818
2017-07-17 23:41:25 -03: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
Georges Basile Stavracas Neto
4ac4f4a04e network: Make the history dialog use a headerbar
In order to start moving towards the new redesigned Network
panel [1], it is necessary to make the dialogs use a headerbar.

Currently, however, they don't, making the dialog sinconsistent
with the rest of the panels, and the GNOME desktop as a whole.

Fix that by setting the headerbar to the History dialog, and
adjusting the elements so hat they match the "Known Wi-Fi Networks"
dialog in the mockup [1].

[1] https://github.com/gnome-design-team/gnome-mockups/blob/master/system-settings/network/aday2/network-wires.png

https://bugzilla.gnome.org/show_bug.cgi?id=779841
2017-05-22 12:40:13 -03:00
Jonathan Kang
9cc065bb04 network: Update the hotspot dialog
Update the hotspot dialog according to the new redesigned Network
panel[1].

[1] https://github.com/gnome-design-team/gnome-mockups/blob/master/system-settings/network/aday2/network-wires.png

https://bugzilla.gnome.org/show_bug.cgi?id=779841
2017-05-22 12:28:32 -03:00
Bastien Nocera
4ee2055027 network: Better debug when creating a hotspot 2017-05-05 19:05:45 +02:00
Bastien Nocera
87928a5d6f network: Add hotspot setup debug 2017-04-29 14:11:22 +02:00
Bastien Nocera
937a518889 network: Fix return value type
We're supposed to return a pointer to GBytes, not a boolean.
2017-04-27 19:44:05 +02:00
Bastien Nocera
c7800dd22f network: Fix initial state of Wi-Fi device
This ensures that:
- the AP list shown on startup when the Hotspot is disabled on
  startup, or when disabling it at run-time
- the hotspot page is shown on startup when the Hotspot is enabled,
  or when it gets enabled at runtime

https://bugzilla.gnome.org/show_bug.cgi?id=705546
2017-03-10 19:17:19 +01:00
Bastien Nocera
7fbb1435a9 network: Remove use of temporary variable 2017-03-10 19:17:17 +01:00
Bastien Nocera
fe6e71198c network: Add checks for cancelled calls 2017-03-10 19:17:13 +01:00
Bastien Nocera
700e5e544c network: Save new SSID to disk before enabling the hotspot
Commit e824868 was supposed to do this, but needed to write the changes
out to disk before activating the hotspot.

https://bugzilla.gnome.org/show_bug.cgi?id=705546
2017-03-10 19:17:12 +01:00
Bastien Nocera
277ac7de02 network: Move hotspot connection search into a helper function
https://bugzilla.gnome.org/show_bug.cgi?id=705546
2017-03-10 19:17:08 +01:00
Bastien Nocera
e824868976 network: Re-set the SSID when enabling the Hotspot
Instead of expecting the hostname to stay the same.

https://bugzilla.gnome.org/show_bug.cgi?id=705546
2016-08-30 17:17:27 +02:00
Bastien Nocera
cdb6a6c682 network: Fix warning when enabling hotspot
GLib-GObject-WARNING **: g_object_set_valist: object class 'NMSettingWireless' has no property named 'security'

https://bugzilla.gnome.org/show_bug.cgi?id=769230
2016-08-30 17:15:33 +02:00
Bastien Nocera
44c16fc6ff network: Use the correct type for the "ssid" property
Set the Hotspot SSID property correctly for libnm 1.2.
2016-06-10 17:21:40 +02:00
Bastien Nocera
e66941753b network: Fix hotspot silently failing with long hostname
By truncating the SSID to 32 bytes.

network-cc-panel-WARNING **: Failed to add new connection: (32) 802-11-wireless.ssid: SSID length is out of range <1-32> bytes

See https://bugzilla.redhat.com/show_bug.cgi?id=1309331
2016-06-10 17:10:35 +02:00
Bastien Nocera
7250d49513 network: Fix warning when Wi-Fi connections are removed
Bug introduced with the fix from 199bd2c. For Wi-Fi, a row might not
have an associated connection.
2016-06-07 18:50:38 +02:00
Dan Williams
1428912da0 network: fix some SSID escaping issues
nm_utils_escape_ssid() should only be used for debugging purposes,
but was used in one place for UI display and another place
for doing actual AP comparison.  Instead, the comparison should
just operate on the SSID bytes, and the UI display should use
nm_utils_ssid_to_utf8() which tries to interpret non-ASCII
characters for better display.

https://bugzilla.gnome.org/show_bug.cgi?id=767205
https://bugzilla.redhat.com/show_bug.cgi?id=1336714
2016-06-07 10:53:40 -05:00
Bastien Nocera
199bd2c343 network: Fix removed connections not disappearing
A regression introduced in commit 9183d34, when we ported to libnm 1.2.
2016-06-07 13:10:09 +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
Jonathan Kang
28c54f3d55 network: Fix empty Wifi list
Add a callback function for signals "access-point-added" and
"access-point-removed" to update the Wifi list.

https://bugzilla.gnome.org/show_bug.cgi?id=709641
2016-04-05 14:15:20 +08:00
Rui Matos
d8d0c71318 network/device-wifi: Silence a critical when creating a connection 2016-04-01 16:08:28 +02:00
Mathieu Bridon
df54973136 network: Only share a new wifi connection if the user is allowed to
Making a new connection available to other users requires being an
admin, or entering an admin password.

If we enable that option by default for new connections, we effectively
prevent non-admin users from connecting to new networks when they go to
the coffee shop without their laptop admin.

https://bugzilla.gnome.org/show_bug.cgi?id=751378
2015-06-29 17:49:04 +02:00
Bastien Nocera
99d675856a network: Fix all Wi-Fi networks having gear buttons
Only the networks with existing connection should have gear buttons.
This is a regression from 9ffaff7472.

If the widget we add as a stack page isn't visible, the page will not be
shown. As we later add another page with that button, we'd end up
showing that by default.

https://bugzilla.gnome.org/show_bug.cgi?id=750841
2015-06-12 15:40:48 +02:00