Commit graph

278 commits

Author SHA1 Message Date
Lukáš Tyrychtr
e55a4feefe network: Add mnemonic widgets to the Wireguard peer list row, fixing label reading 2023-10-24 09:17:00 +00:00
Lukáš Tyrychtr
caa7650081 network: Add mnemonic widgets to the wireguard editor page, fixing reading of the labels of the fields 2023-10-24 09:17:00 +00:00
Maximiliano Sandoval R
4ee4fa3428 network: Port connection editor to AdwWindow
GtkDialog is deprecated. We also took the opportunity to use AdwToolbarView.

See https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/2624.
2023-10-23 14:25:12 +00:00
Maximiliano Sandoval R
92d0a5d50c network: Port add VPN connection to action rows
By using action rows we can actually use the boxed-list class.
2023-10-23 14:25:12 +00:00
Maximiliano Sandoval R
77090f4ccd network: Define margins in the UI file 2023-10-23 14:25:12 +00:00
Maximiliano Sandoval R
5cd582bef6 network: Remove orientation=vertical from box
These boxes cannot have more than a single child.
2023-10-23 14:25:12 +00:00
Marco Melorio
7363ca800e network: Fix "Missing initializer for field" warning 2023-10-12 10:09:44 +02:00
Michael Catanzaro
6219cbdca5 network: fix editing connections without a device
For example, fix adding new VPN connections.

In 60b4956c05 I correctly observed that we
need to not run code that requires a device when there is no device.
NetConnectionEditor is a multipurpose dialog and self->device is
optional when creating the dialog. E.g. when modifying VPN
configuration, we update just the configuration, not an NMDevice.

However, I added this check too soon, before updating the connection
configuration. We need to update the configuration first, then only bail
before proceeding to update the device, not sooner.

Fix #2668
2023-10-03 11:03:06 +00:00
Alexandre Franke
e8a08f0fd7 data: fix label string 2023-09-18 13:00:43 +02:00
Sabri Ünal
6a4a70f6a6 data: mark translatable strings yes
Marking translatable strings as 'yes' is a convenient practice
across the GNOME project. Follow the common practice.
2023-09-18 00:31:24 +03:00
Michael Catanzaro
be535df39b Don't warn about failure to apply changes on inactive device
If the NMDevice is not active (i.e. if we are editing a connection that
is not active) then don't warn when failing to reapply changes to the
device. That's expected and not something we should warn about.

We could perhaps not even try, but the device could become inactive
between the time of our check and this error, so better ignore the error
regardless.
2023-08-30 08:44:55 +00:00
Michael Catanzaro
60b4956c05 network: don't try to update device if it doesn't exist
All of the following code assumes that self->device is valid, so we need
to skip over it. It's confusing, but this is a multipurpose dialog and
self->device is optional when creating the dialog. E.g. when modifying
VPN configuration, we update just the configuration, not an NMDevice.
2023-08-30 08:44:55 +00:00
Michael Catanzaro
3f6737dbf7 network: fix criticals when updating connection
If the operation is cancelled (because the dialog was closed, because
the Apply button was pressed), then trying to make further use of the
source_object is a use after free, which is bad. At first I tried to fix
this by simply avoiding the use after free when the operation is
canceled, but then I realized it is ridiculous to always try committing
connection changes when closing the dialog, then immediately cancel the
operation by destroying the dialog.

So instead I've decided to not pass the cancellable along to these
operations, and instead ref the dialog to keep it alive until the
operations complete. Instead, let's just hide the window.

This commit also removes an inaccurate comment /* Leave the editor open
*/ placed right before the call to the function that hides the editor.
There's no need to leave the editor open when updating the device fails.
The connection properties at least are still saved.

Fixes #2618
2023-08-30 08:44:55 +00:00
Felipe Borges
0c9498d1f8 Mark some strings as translatable
These are strings that are presented in the UI that were not marked
for translation.

Fixes #2596
2023-08-11 12:07:00 +02:00
Lukáš Tyrychtr
b706f1261b network-connection-editor: Fix a keyboard trapped on the Cancel button when adding a VPN connection
It required two changes:
* Setting the stack page only after all pages are initialized
* And removing the VPN choices list from its bin only after that
2023-06-30 09:37:21 +00:00
Robert Ancell
a01e179830 network: Connect signal handlers in swapped form 2023-06-07 09:12:54 +12:00
Christopher Davis
590506add3 vpn-helpers: Use GtkFileDialog and AdwMessageDialog
GtkFileChooser and GtkMessageDialog are both deprecated.
This commit replaces them with the most appropriate API
for each use case.
2023-06-06 13:33:29 +00:00
Felipe Borges
b80f154f80 network: Close Connection Editor dialog when clicking Apply button
Fixes #2499
2023-05-31 08:15:32 +00:00
Felipe Borges
e6336ec433 network: Add ToastOverlay to connection-editor 2023-05-26 02:04:52 +00:00
Felipe Borges
3f482559ea network: Make "Import VPN from file" use GtkFileDialog
Since the gtk_file_chooser_dialog APIs are deprecated.
2023-05-26 02:04:52 +00:00
Felipe Borges
e580c309e8 network: Drop legacy vpn_export function
This was a leftover from the old connection-editor.
2023-05-26 02:04:52 +00:00
Ismael
497f599517 network-panel: fix crash when importing wrong vpn file 2023-05-26 02:04:52 +00:00
Pablo Correa Gómez
a2b9620b1b network: keep track of radio buttons in connection editor with action
Hooking to all the toggled signals from all the buttons for executing
the same action is inneficient, and can potenticall end up in a segmentation
 fault due to some race in the signal emmission, where the active button
 gets deactivated before the clicked button is activated

Looking at the GTK4 code, in a radio group:

- The button which was previously active gets de-activated, emitting its
corresponding toggled signal.
- The active property for the clicked button gets set.
- The clicked button emits its toggled signal.

Therefore, if the first toggle signal gets processed before the active
property is set, there can be a race condition. We are seeing this downstream
at pmOS: https://gitlab.com/postmarketOS/pmaports/-/issues/1816

Instead of this racy behavior, follow upstream recommendation and keep track
of the state through a stateful signal.
2023-05-24 08:54:06 +00:00
Pablo Correa Gómez
7f7b65545c all: meson: do not specify resources from gresource files as dependencies
Meson extracts them by itself and add them as dependencies for the target.
It means one less location to keep track of files, and a lot less boilerplate
around the meson files
2023-05-24 08:34:14 +00:00
Felipe Borges
58a0d8fd32 network: Add quotes to network name in Forget Connection dialog
See https://gitlab.gnome.org/GNOME/gnome-control-center/-/merge_requests/1765#note_1726456
2023-04-20 17:30:55 +02:00
Felipe Borges
e3965a6586 wifi: Include network name in the Forget dialog
See https://gitlab.gnome.org/GNOME/gnome-control-center/-/merge_requests/1701#note_1719089
2023-04-20 09:24:21 +00:00
Jonathan Kang
14b3652289 network/connection-editor: fix crash when removing a connection
This was caused by commit 6f1567f23.
2023-04-12 16:01:51 +08:00
Cyber Phantom
4b450409c5 wifi: Add a confirmation dialog when forgetting a connection
Destructive actions are supposed to have a dialog asking the user for confirmation.

This commit adds the confirmation dialog when user tries to forget a wifi network.

Fixes #2371
2023-04-11 11:28:26 +00:00
Maksym Hazevych
08c2e69851 Resolving suggestions 2023-03-29 14:26:55 +13:00
Maksym Hazevych
5b988a6943 Replace all occurrences of 'gtk_widget_hide'
Replace all occurrences of 'gtk_widget_hide(smth)' with
'gtk_widget_set_visible(smth, FALSE)'.
2023-03-29 14:26:55 +13:00
Maksym Hazevych
d831e5cb48 Replace all occurrences of 'gtk_widget_show'
Replace all occurrences of 'gtk_widget_show(smth)' with
'gtk_widget_set_visible(smth, TRUE)'.
2023-03-29 14:26:55 +13:00
Simon Arlott
019cbc6a54 network: Increase maximum MTU value from 10000 to 65536
The maximum MTU value of 10000 is too low for USB Ethernet, which has a
maximum (for Linux USB gadgets) of 15412 bytes (although the upper limit
is the USB wMaxPacketSize which goes up to 4294967295 bytes):
  linux/drivers/usb/gadget/function/u_ether.c:#define GETHER_MAX_MTU_SIZE 15412

Multiple Intel NICs can use an MTU of 16110 bytes:
  linux/drivers/net/ethernet/intel/e1000/e1000_hw.h:#define MAX_JUMBO_FRAME_SIZE         0x3F00
  linux/drivers/net/ethernet/intel/e1000e/defines.h:#define MAX_JUMBO_FRAME_SIZE    0x3F00
  linux/drivers/net/ethernet/intel/igbvf/defines.h:#define MAX_JUMBO_FRAME_SIZE         0x3F00

The NetworkManager limit is 4294967295 bytes but this is unreasonable
in a typical enivornment because of the memory required for packets of
that size.

The maximum IPv4 and IPv6 (without using Jumbograms) packet size is 65535
bytes so increase the maximum MTU value to 65536 allow full size IP
packets to be used.

There is a corresponding change in network-manager-applet.
2023-03-24 01:47:09 +00:00
Aryan Kaushik
8a4a80b7b2 network: Disable DNS entry if the automatic option is enabled
Fixes: #2243
2023-02-07 22:51:45 +00:00
faultline
fee8351c67 network: Init editor when secrets are missing
When NetworkManager doesn't give us any secrets for a connection, the
connection editor still needs to be opened. This change ensures that
initialization of the editor completes even when there's an error when
fetching secrets.

Fixes #2329
2023-02-05 16:59:45 +00:00
Alynx Zhou
ebc986030d network: Make metered connection label a child of its check button
GtkCheckButton accepts a widget as its child and will toggle when
clicking its child, currently we put check button and label of metered
connection into a box, then clicking the label won't toggle the check
button, this differs from the other two check buttons.

This commit makes the label a child widget of the check button, so the
three check buttons behave the same.
2023-01-30 11:47:02 +00:00
Martin Pobaschnig
8c7a286511 network: Remove "close-request" signal handler for VPN file import dialog
When the dialog is closed using ESC key, the "close-request" signal is
emitted in addition to the "response" signal. When the "close-request"
is handled, it frees the memory to which info points. In the "response"
signal handler, the memory of info pointer is accessed again, leading
to a segmentation fault.

Fix this by removing the "close-request" function callback, which shares
the same behaviour as the "response" callback function.

Fixes: https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/2320
2023-01-30 11:39:11 +00:00
Dylan Van Assche
571a69d36e
network: fix tabs/spaces mixing
Some functions were using tabs instead of spaces, unify the file to use spaces everywhere.
2023-01-27 18:39:19 +01:00
Dylan Van Assche
9b08433599
network: add missing cancellable
Add missing GCancellables to resolve the FIXME statements and
avoid possible crashes if the properties in NetConnectionEditor
outlive themselves.
2023-01-27 18:39:12 +01:00
Dylan Van Assche
3c4939bdbd
network: reapply connection on device
Changing an active connection applies the changes onto the
NetworkManager connection, but not on the device. This is because
NetworkManager clones the connection when it is applied on a device.
This behavior is expected and documented in the NetworkManager
documentation [1]. To effectively apply the connection changes onto a
device, a reapply operation must be performed. This will make NetworkManager
apply the new connection onto the active device without having to
disable and re-enable the device.

Perform this reapply operation when the Apply button is pressed in the
Connection Editor so the changes effectively propagate to the network
device.

[1] https://networkmanager.dev/docs/api/1.32.10/gdbus-org.freedesktop.NetworkManager.Device.html#gdbus-method-org-freedesktop-NetworkManager-Device.Reapply
2023-01-27 18:39:07 +01:00
Christian Glombek
fcc092430f network: Mark imported VPN conn as private to user, and non-autoconnect 2023-01-16 20:35:02 +00:00
Christian Glombek
475faaf26b network: Add support for WireGuard (GNOME/gnome-control-center#982)
Adds support for managing WireGuard VPN connections:

- Listing WireGuard connections as VPN connections
- Toggling connection state
- Creating, updating and deleting WireGuard connections
- Creating, updating and deleting WireGuard peers
- Importing WireGuard config files

Co-authored-by: Nathan-J. Hirschauer <nathanhi@deepserve.info>
2023-01-16 20:35:02 +00:00
Felipe Borges
294156c0f9 Drop most uses of deprecated gtk_style_context_add/remove_class
GtkStyleContext will be deprecated in gtk 4.10.
https://docs.gtk.org/gtk4/class.StyleContext.html

This preserves code blocks where additional GtkStyleContext operations
were used, such as gtk_style_context_save/restore.
2023-01-05 18:55:51 +00:00
Lubomir Rintel
6c26647154 network: replace wireless-security with libnma's NMAWs
panels/network/wireless-security is essentially an old fork of the part
of nm-connection-editor that is now part of libnma.

The UI elements provided by libnma adhere to the same look as the rest
of gnome-control-center for quite some time now. The functinality they
implement the same functionality and more. In particular, libnma uses
Gcr to provide Smart Card access for keys and certificates.

https://bugzilla.redhat.com/show_bug.cgi?id=1992836
2022-11-30 13:40:09 +01:00
Lubomir Rintel
ad0db360e2 network: Fix an assertion failure
Entering the Wi-Fi page without connected to a network trips an
assertion failure:

  (gnome-control-center:14943): nm-CRITICAL **: 16:36:16.732: nm_access_point_get_frequency: assertion 'NM_IS_ACCESS_POINT(ap)' failed

  Thread 1 "gnome-control-c" received signal SIGTRAP, Trace/breakpoint trap.
  0x00007ffff7c8ee51 in g_logv () from /lib64/libglib-2.0.so.0
  (gdb) bt
  #0  0x00007ffff7c8ee51 in g_logv () at /lib64/libglib-2.0.so.0
  #1  0x00007ffff7c8f0d3 in g_log () at /lib64/libglib-2.0.so.0
  #2  0x00007ffff63b7b8a in nm_access_point_get_frequency () at /lib64/libnm.so.0
  #3  0x00000000005965b1 in connect_details_page (self=0x4658210) at ../panels/network/connection-editor/ce-page-details.c:264
  #4  0x0000000000597f9e in ce_page_details_new (connection=0xfbde70, device=0xd52360, ap=0x0, editor=0x50a4350) at ../panels/network/connection-editor/ce-page-details.c:570
  #5  0x0000000000593273 in net_connection_editor_set_connection (self=0x50a4350, connection=0x7fffcc096770) at ../panels/network/connection-editor/net-connection-editor.c:522
  #6  0x0000000000593f7d in net_connection_editor_new (connection=0x7fffcc096770, device=0xd52360, ap=0x0, client=0xd3a0c0) at ../panels/network/connection-editor/net-connection-editor.c:790
  #7  0x0000000000582b16 in show_details_for_row (self=0xcc3040, row=0x46587b0, list=0x4273b40) at ../panels/network/net-device-wifi.c:987
  #8  0x00007ffff7d83845 in g_cclosure_marshal_VOID__OBJECTv () at /lib64/libgobject-2.0.so.0
  #9  0x00007ffff7da1b79 in g_signal_emit_valist () at /lib64/libgobject-2.0.so.0
  #10 0x00007ffff7da1eb8 in g_signal_emit_by_name () at /lib64/libgobject-2.0.so.0
  #11 0x000000000058d41f in on_row_configured_cb (self=0x4273b40, row=0x46587b0) at ../panels/network/cc-wifi-connection-list.c:251
  #12 0x00007ffff7da1b79 in g_signal_emit_valist () at /lib64/libgobject-2.0.so.0
  #13 0x00007ffff7da1eb8 in g_signal_emit_by_name () at /lib64/libgobject-2.0.so.0
  #14 0x000000000058c4c4 in configure_clicked_cb (self=0x46587b0) at ../panels/network/cc-wifi-connection-row.c:513
  #15 0x00007ffff7da1b79 in g_signal_emit_valist () at /lib64/libgobject-2.0.so.0
  #16 0x00007ffff7da1cb3 in g_signal_emit () at /lib64/libgobject-2.0.so.0
  ...
2022-09-22 09:22:12 +00:00
Christian Glombek
0fbe2ada5a network/ce: Provide error tooltip in connection editor
Pass through localized libnm error messages as tooltips
to the apply button. That way, users can easily identify
configuration errors.
2022-06-20 23:37:44 +00:00
Maximiliano Sandoval R
2252ee27b4 connection-editor: Set default height to 600
If the dialog cannot be resized might as well be big enough to not
require scrolling on a big enough screen.
2022-06-20 00:30:58 +00:00
David Bauer
533b698f60 network: implement handling for OWE TM
Implement handling for OWE-TM networks.

 * Correctly display encryption type when connected to a OWE-TM network
   with an open profile (Previously showed as WPA2
 * Mask out hidden transition SSID when connected to the OWE-TM network
 * Don't display OWE-TM network with lock icon

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-06-19 23:53:24 +00:00
Maximiliano Sandoval R
3a96f428ca ce-page-details: Do not set children for CheckBtn
This widget does not support adding arbitrary children, a warning was
issued when it was disposed for still having children.
2022-06-19 22:17:18 +00:00
Christian Glombek
1e06a0e0dd network/ce: Fix address label ids on ip4-page
In 861d762ce5,
the address labels on the IPv4 page were renamed, however the corresponding
change was not made in the respective .ui file, which results in a crash upon
construction of the page. This change fixes that.
2022-06-19 21:50:23 +00:00
Lukáš Tyrychtr
861d762ce5 Address review feedback 2022-05-10 21:26:05 +00:00