55 lines
1.7 KiB
Diff
55 lines
1.7 KiB
Diff
From e4508e013089cf788fd7386e189b311bdedd88e0 Mon Sep 17 00:00:00 2001
|
|
From: Iain Lane <iainl@gnome.org>
|
|
Date: Sat, 5 Oct 2019 11:57:48 +0100
|
|
Subject: [PATCH] network: Accept empty values for the cloned mac address
|
|
|
|
Empty is a valid value here. It means the setting is not set. Two places
|
|
need to be updated:
|
|
|
|
- the validation function
|
|
- when retrieving the value from the combo, empty strings need to be
|
|
mapped to a setting value of NULL
|
|
|
|
Closes #677
|
|
---
|
|
panels/network/connection-editor/ce-page.c | 10 ++++++++--
|
|
1 file changed, 8 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/panels/network/connection-editor/ce-page.c b/panels/network/connection-editor/ce-page.c
|
|
index 4059ad328..adec1ae10 100644
|
|
--- a/panels/network/connection-editor/ce-page.c
|
|
+++ b/panels/network/connection-editor/ce-page.c
|
|
@@ -416,13 +416,19 @@ ce_page_setup_cloned_mac_combo (GtkComboBoxText *combo, const char *current)
|
|
char *
|
|
ce_page_cloned_mac_get (GtkComboBoxText *combo)
|
|
{
|
|
+ g_autofree gchar *active_text = NULL;
|
|
const char *id;
|
|
|
|
id = gtk_combo_box_get_active_id (GTK_COMBO_BOX (combo));
|
|
if (id)
|
|
return g_strdup (id);
|
|
|
|
- return gtk_combo_box_text_get_active_text (combo);
|
|
+ active_text = gtk_combo_box_text_get_active_text (combo);
|
|
+
|
|
+ if (active_text[0] == '\0')
|
|
+ return NULL;
|
|
+
|
|
+ return g_steal_pointer (&active_text);
|
|
}
|
|
|
|
gboolean
|
|
@@ -471,7 +477,7 @@ ce_page_cloned_mac_combo_valid (GtkComboBoxText *combo)
|
|
|
|
active_text = gtk_combo_box_text_get_active_text (combo);
|
|
|
|
- return ce_page_address_is_valid (active_text);
|
|
+ return active_text[0] == '\0' || ce_page_address_is_valid (active_text);
|
|
}
|
|
|
|
const gchar *
|
|
--
|
|
2.22.0
|
|
|