nm: Make remote identity editable in GUI
authorTobias Brunner <tobias@strongswan.org>
Tue, 17 Dec 2019 15:28:00 +0000 (16:28 +0100)
committerTobias Brunner <tobias@strongswan.org>
Fri, 14 Feb 2020 10:19:49 +0000 (11:19 +0100)
src/frontends/gnome/properties/nm-strongswan-dialog.ui
src/frontends/gnome/properties/nm-strongswan.c

index 8681c42..0d9d62d 100644 (file)
                 <property name="top_attach">1</property>
               </packing>
             </child>
+            <child>
+              <object class="GtkLabel" id="remote-identity-label">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">_Identity:</property>
+                <property name="use_underline">True</property>
+                <property name="xalign">0</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="remote-identity-entry">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="tooltip_text" translatable="yes">Defaults to the server address or the server certificate's subject DN (if configured). Custom values are explicitly sent to the server and enforced during authentication.</property>
+                <property name="hexpand">True</property>
+                <property name="primary_icon_activatable">False</property>
+                <property name="secondary_icon_activatable">False</property>
+                <property name="placeholder_text" translatable="yes">(Defaults to address or certificate subject)</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">2</property>
+              </packing>
+            </child>
           </object>
           <packing>
             <property name="expand">False</property>
index d261dcb..5204d9a 100644 (file)
@@ -299,6 +299,12 @@ init_plugin_ui (StrongswanPluginUiWidget *self, NMConnection *connection, GError
                gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), value);
        g_signal_connect (G_OBJECT (widget), "selection-changed", G_CALLBACK (settings_changed_cb), self);
 
+       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "remote-identity-entry"));
+       value = nm_setting_vpn_get_data_item (settings, "remote-identity");
+       if (value)
+               gtk_entry_set_text (GTK_ENTRY (widget), value);
+       g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (settings_changed_cb), self);
+
        widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "user-entry"));
        value = nm_setting_vpn_get_data_item (settings, "user");
        if (value)
@@ -483,6 +489,12 @@ update_connection (NMVpnEditor *iface,
                nm_setting_vpn_add_data_item (settings, "certificate", str);
        }
 
+       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "remote-identity-entry"));
+       str = (char *) gtk_entry_get_text (GTK_ENTRY (widget));
+       if (str && strlen (str)) {
+               nm_setting_vpn_add_data_item (settings, "remote-identity", str);
+       }
+
        widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "method-combo"));
        switch (gtk_combo_box_get_active (GTK_COMBO_BOX (widget)))
        {