diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2021-11-04 13:48:11 +0100 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2021-11-04 13:48:11 +0100 |
commit | 4961000db9ccfa875dd79996b66e81336ae057cb (patch) | |
tree | da7bba4192c9eeeba59710dff83fe782de2f3563 | |
parent | fb1ebd05e02048b0d1a4ab3ff3b942c05639152d (diff) | |
parent | af1b49926b06d3a01fa7785a2706f4ad814bf621 (diff) | |
download | network-manager-applet-4961000db9ccfa875dd79996b66e81336ae057cb.tar.gz |
merge: branch 'lr/ethernet-dialog'
https://gitlab.gnome.org/GNOME/network-manager-applet/-/merge_requests/106
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile.am | 22 | ||||
-rw-r--r-- | meson.build | 1 | ||||
-rw-r--r-- | src/8021x.ui | 13 | ||||
-rw-r--r-- | src/ethernet-dialog.c | 3 | ||||
-rw-r--r-- | src/meson.build | 4 | ||||
-rw-r--r-- | src/tests/ethernet-dialog.c | 66 | ||||
-rw-r--r-- | src/tests/meson.build | 14 |
8 files changed, 119 insertions, 5 deletions
@@ -124,6 +124,7 @@ src/nm-applet src/applet-dbus-bindings.h src/applet-resources.c src/applet-resources.h +src/tests/ethernet-dialog man/*.1 /test-driver diff --git a/Makefile.am b/Makefile.am index d97d54cc..ad8407a9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -234,6 +234,28 @@ EXTRA_DIST += src/utils/meson.build ############################################################################### +check_PROGRAMS_norun += src/tests/ethernet-dialog + +src_tests_ethernet_dialog_SOURCES = \ + src/applet-resources.h \ + src/applet-resources.c \ + src/applet-dialogs.c \ + src/applet-dialogs.h \ + src/ethernet-dialog.c \ + src/ethernet-dialog.h \ + src/tests/ethernet-dialog.c + +src_tests_ethernet_dialog_CPPFLAGS = \ + "-I$(srcdir)/src/" \ + $(src_nm_applet_CPPFLAGS) + +src_tests_ethernet_dialog_LDADD = \ + $(src_nm_applet_LDADD) + +EXTRA_DIST += src/tests/meson.build + +############################################################################### + wireless_security_c_real = \ src/wireless-security/eap-method.h \ src/wireless-security/eap-method.c diff --git a/meson.build b/meson.build index 6af3879c..33adb632 100644 --- a/meson.build +++ b/meson.build @@ -237,6 +237,7 @@ subdir('po') subdir('icons') subdir('shared') subdir('src') +subdir('src/tests') subdir('man') i18n = import('i18n') diff --git a/src/8021x.ui b/src/8021x.ui index e35d5188..92a3a1d5 100644 --- a/src/8021x.ui +++ b/src/8021x.ui @@ -4,10 +4,6 @@ <requires lib="gtk+" version="3.10"/> <object class="GtkDialog" id="8021x_dialog"> <property name="can_focus">False</property> - <property name="margin_start">5</property> - <property name="margin_end">5</property> - <property name="margin_top">5</property> - <property name="margin_bottom">5</property> <property name="title" translatable="yes">802.1X authentication</property> <property name="resizable">False</property> <property name="modal">True</property> @@ -21,6 +17,10 @@ <property name="can_focus">False</property> <property name="orientation">vertical</property> <property name="spacing">2</property> + <property name="margin_start">5</property> + <property name="margin_end">5</property> + <property name="margin_top">5</property> + <property name="margin_bottom">5</property> <child internal-child="action_area"> <object class="GtkButtonBox" id="dialog-action_area1"> <property name="visible">True</property> @@ -186,4 +186,9 @@ <action-widget response="-5">ok_button</action-widget> </action-widgets> </object> + <object class="GtkSizeGroup" id="size_group"> + <widgets> + <widget name="network_name_label"/> + </widgets> + </object> </interface> diff --git a/src/ethernet-dialog.c b/src/ethernet-dialog.c index 21e29565..c558542b 100644 --- a/src/ethernet-dialog.c +++ b/src/ethernet-dialog.c @@ -47,6 +47,9 @@ dialog_set_security (NMConnection *connection, if (G_IS_INITIALLY_UNOWNED (ws)) g_object_ref_sink (ws); + nma_ws_add_to_size_group (NMA_WS (ws), GTK_SIZE_GROUP ( + gtk_builder_get_object (builder, "size_group"))); + /* Remove any previous wireless security widgets */ children = gtk_container_get_children (GTK_CONTAINER (box)); for (iter = children; iter; iter = iter->next) diff --git a/src/meson.build b/src/meson.build index 2d910bb2..fade5afa 100644 --- a/src/meson.build +++ b/src/meson.build @@ -27,12 +27,14 @@ resource_data = files( 'info.ui' ) -sources += gnome.compile_resources( +resource_sources = gnome.compile_resources( 'applet-resources', 'applet.gresource.xml', dependencies: resource_data ) +sources += resource_sources + incs = [ top_inc, utils_inc, diff --git a/src/tests/ethernet-dialog.c b/src/tests/ethernet-dialog.c new file mode 100644 index 00000000..34260ff4 --- /dev/null +++ b/src/tests/ethernet-dialog.c @@ -0,0 +1,66 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2021 Red Hat, Inc. + */ + +#include "nm-default.h" +#include "ethernet-dialog.h" + +#include <gtk/gtk.h> +#include <NetworkManager.h> + +int +main (int argc, char *argv[]) +{ + NMConnection *connection, *new_connection; + GHashTable *diff = NULL, *setting_diff; + GHashTableIter iter, setting_iter; + const char *setting, *key; + GtkWidget *dialog; + GError *error = NULL; + gs_unref_bytes GBytes *ssid = g_bytes_new_static ("<Secured Wired>", + NM_STRLEN ("<Secured Wired>")); + + gtk_init (&argc, &argv); + + connection = nm_simple_connection_new (); + nm_connection_add_setting (connection, + g_object_new (NM_TYPE_SETTING_CONNECTION, + NM_SETTING_CONNECTION_ID, "<Secured Wired>", + NULL)); + nm_connection_add_setting (connection, + g_object_new (NM_TYPE_SETTING_WIRED, + NULL)); + nm_connection_add_setting (connection, + g_object_new (NM_TYPE_SETTING_802_1X, + NM_SETTING_802_1X_EAP, (const char * const []){ "peap", NULL }, + NM_SETTING_802_1X_IDENTITY, "budulinek", + NM_SETTING_802_1X_PHASE2_AUTH, "gtc", + NULL)); + + if (!nm_connection_normalize (connection, NULL, NULL, &error)) { + nm_connection_dump (connection); + g_printerr ("Error: %s\n", error->message); + g_error_free (error); + return 1; + } + + dialog = nma_ethernet_dialog_new (nm_simple_connection_new_clone (connection)); + if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) { + g_print ("settings changed:\n"); + new_connection = nma_ethernet_dialog_get_connection (dialog); + nm_connection_diff (connection, new_connection, NM_SETTING_COMPARE_FLAG_EXACT, &diff); + if (diff) { + g_hash_table_iter_init (&iter, diff); + while (g_hash_table_iter_next (&iter, (gpointer) &setting, (gpointer) &setting_diff)) { + g_hash_table_iter_init (&setting_iter, setting_diff); + while (g_hash_table_iter_next (&setting_iter, (gpointer) &key, NULL)) + g_print (" %s.%s\n", setting, key); + } + + g_hash_table_destroy (diff); + } + } + gtk_widget_destroy (dialog); + g_object_unref (connection); +} diff --git a/src/tests/meson.build b/src/tests/meson.build new file mode 100644 index 00000000..5a2fecfa --- /dev/null +++ b/src/tests/meson.build @@ -0,0 +1,14 @@ +executable( + 'ethernet-dialog', + [resource_sources, + '../applet-dialogs.c', + '../applet-dialogs.h', + '../ethernet-dialog.c', + '../ethernet-dialog.h', + 'ethernet-dialog.c'], + include_directories: incs, + dependencies: deps, + c_args: cflags, + link_whole: libwireless_security_libnm, + install: false +) |