[NetworkManager-openvpn: 3/4] editor: add push-peer-info support



commit faa15cde7193aecbe955df143cdb7f09be1e56aa
Author: Emmanuel Pacaud <emmanuel gnome org>
Date:   Mon Mar 30 08:34:20 2020 +0200

    editor: add push-peer-info support

 properties/nm-openvpn-dialog.ui | 191 ++++++++++++++++++++++------------------
 properties/nm-openvpn-editor.c  |   9 +-
 2 files changed, 114 insertions(+), 86 deletions(-)
---
diff --git a/properties/nm-openvpn-dialog.ui b/properties/nm-openvpn-dialog.ui
index 773e0dc..98cd828 100644
--- a/properties/nm-openvpn-dialog.ui
+++ b/properties/nm-openvpn-dialog.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.2 -->
+<!-- Generated with glade 3.22.2 -->
 <interface>
   <requires lib="gtk+" version="3.4"/>
   <object class="GtkAdjustment" id="adjustment1">
@@ -9,6 +9,11 @@
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
   </object>
+  <object class="GtkAdjustment" id="adjustment10">
+    <property name="upper">65535</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
   <object class="GtkAdjustment" id="adjustment2">
     <property name="upper">604800</property>
     <property name="step_increment">1</property>
@@ -59,11 +64,6 @@
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
   </object>
-  <object class="GtkAdjustment" id="adjustment10">
-    <property name="upper">65535</property>
-    <property name="step_increment">1</property>
-    <property name="page_increment">10</property>
-  </object>
   <object class="GtkListStore" id="compression">
     <columns>
       <!-- column-name gchararray -->
@@ -876,6 +876,9 @@ config: static &lt;file&gt; [direction]</property>
     <property name="icon_name">stock-preferences</property>
     <property name="type_hint">dialog</property>
     <property name="skip_pager_hint">True</property>
+    <child type="titlebar">
+      <placeholder/>
+    </child>
     <child internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox1">
         <property name="visible">True</property>
@@ -1333,19 +1336,19 @@ config: tun-ipv6</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkBox" id="hbox9">
+                  <object class="GtkBox" id="hbox8">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="spacing">6</property>
                     <child>
-                      <object class="GtkCheckButton" id="ping_exit_restart_checkbutton">
-                        <property name="label" translatable="yes">Specify _exit or restart ping:</property>
+                      <object class="GtkCheckButton" id="ping_checkbutton">
+                        <property name="label" translatable="yes">Specify pin_g interval:</property>
                         <property name="use_action_appearance">False</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">False</property>
-                        <property name="tooltip_text" translatable="yes">Exit or restart after n seconds 
pass without reception of a ping or other packet from remote.
-config: ping-exit | ping-restart &lt;n&gt;</property>
+                        <property name="tooltip_text" translatable="yes">Ping remote over the TCP/UDP 
control channel if no packets have been sent for at least n seconds.
+config: ping &lt;n&gt;</property>
                         <property name="use_underline">True</property>
                         <property name="xalign">0.5</property>
                         <property name="draw_indicator">True</property>
@@ -1357,39 +1360,19 @@ config: ping-exit | ping-restart &lt;n&gt;</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkComboBox" id="ping_exit_restart_combo">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="tooltip_text" translatable="yes">Exit or restart after n seconds 
pass without reception of a ping or other packet from remote.
-config: ping-exit | ping-restart &lt;n&gt;</property>
-                        <property name="model">model8</property>
-                        <child>
-                          <object class="GtkCellRendererText" id="renderer11"/>
-                          <attributes>
-                            <attribute name="text">0</attribute>
-                          </attributes>
-                        </child>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">False</property>
-                        <property name="position">1</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkSpinButton" id="ping_exit_restart_spinbutton">
+                      <object class="GtkSpinButton" id="ping_spinbutton">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
-                        <property name="tooltip_text" translatable="yes">Exit or restart after n seconds 
pass without reception of a ping or other packet from remote.
-config: ping-exit | ping-restart &lt;n&gt;</property>
-                        <property name="adjustment">adjustment8</property>
+                        <property name="tooltip_text" translatable="yes">Ping remote over the TCP/UDP 
control channel if no packets have been sent for at least n seconds.
+config: ping &lt;n&gt;</property>
+                        <property name="adjustment">adjustment7</property>
                         <property name="climb_rate">1</property>
                         <property name="numeric">True</property>
                       </object>
                       <packing>
                         <property name="expand">False</property>
                         <property name="fill">False</property>
-                        <property name="position">2</property>
+                        <property name="position">1</property>
                       </packing>
                     </child>
                   </object>
@@ -1400,19 +1383,19 @@ config: ping-exit | ping-restart &lt;n&gt;</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkBox" id="hbox8">
+                  <object class="GtkBox" id="hbox9">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="spacing">6</property>
                     <child>
-                      <object class="GtkCheckButton" id="ping_checkbutton">
-                        <property name="label" translatable="yes">Specify pin_g interval:</property>
+                      <object class="GtkCheckButton" id="ping_exit_restart_checkbutton">
+                        <property name="label" translatable="yes">Specify _exit or restart ping:</property>
                         <property name="use_action_appearance">False</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">False</property>
-                        <property name="tooltip_text" translatable="yes">Ping remote over the TCP/UDP 
control channel if no packets have been sent for at least n seconds.
-config: ping &lt;n&gt;</property>
+                        <property name="tooltip_text" translatable="yes">Exit or restart after n seconds 
pass without reception of a ping or other packet from remote.
+config: ping-exit | ping-restart &lt;n&gt;</property>
                         <property name="use_underline">True</property>
                         <property name="xalign">0.5</property>
                         <property name="draw_indicator">True</property>
@@ -1424,19 +1407,39 @@ config: ping &lt;n&gt;</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkSpinButton" id="ping_spinbutton">
+                      <object class="GtkComboBox" id="ping_exit_restart_combo">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
-                        <property name="tooltip_text" translatable="yes">Ping remote over the TCP/UDP 
control channel if no packets have been sent for at least n seconds.
-config: ping &lt;n&gt;</property>
-                        <property name="adjustment">adjustment7</property>
+                        <property name="tooltip_text" translatable="yes">Exit or restart after n seconds 
pass without reception of a ping or other packet from remote.
+config: ping-exit | ping-restart &lt;n&gt;</property>
+                        <property name="model">model8</property>
+                        <child>
+                          <object class="GtkCellRendererText" id="renderer11"/>
+                          <attributes>
+                            <attribute name="text">0</attribute>
+                          </attributes>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkSpinButton" id="ping_exit_restart_spinbutton">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="tooltip_text" translatable="yes">Exit or restart after n seconds 
pass without reception of a ping or other packet from remote.
+config: ping-exit | ping-restart &lt;n&gt;</property>
+                        <property name="adjustment">adjustment8</property>
                         <property name="climb_rate">1</property>
                         <property name="numeric">True</property>
                       </object>
                       <packing>
                         <property name="expand">False</property>
                         <property name="fill">False</property>
-                        <property name="position">1</property>
+                        <property name="position">2</property>
                       </packing>
                     </child>
                   </object>
@@ -1662,8 +1665,6 @@ config: ncp-disable</property>
                       <packing>
                         <property name="left_attach">0</property>
                         <property name="top_attach">7</property>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
                       </packing>
                     </child>
                     <child>
@@ -1719,6 +1720,21 @@ config: ncp-disable</property>
                         <property name="top_attach">4</property>
                       </packing>
                     </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </object>
                 </child>
               </object>
@@ -2153,11 +2169,11 @@ config: extra-certs &lt;file&gt;</property>
                           <object class="GtkGrid">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="row_spacing">6</property>
-                            <property name="column_spacing">12</property>
                             <property name="valign">start</property>
                             <property name="margin_left">24</property>
                             <property name="hexpand">True</property>
+                            <property name="row_spacing">6</property>
+                            <property name="column_spacing">12</property>
                             <child>
                               <object class="GtkLabel" id="tls_version_min_lbl">
                                 <property name="visible">True</property>
@@ -2502,17 +2518,21 @@ config: http-proxy-retry or socks-proxy-retry</property>
               </packing>
             </child>
             <child>
-              <object class="GtkBox">
+              <object class="GtkAlignment">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="border_width">12</property>
-                <property name="orientation">vertical</property>
-                <property name="spacing">6</property>
+                <property name="top_padding">12</property>
+                <property name="bottom_padding">12</property>
+                <property name="left_padding">12</property>
+                <property name="right_padding">12</property>
                 <child>
-                  <object class="GtkBox">
+                  <object class="GtkGrid">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="spacing">6</property>
+                    <property name="valign">start</property>
+                    <property name="row_spacing">6</property>
+                    <property name="column_spacing">12</property>
+                    <property name="row_homogeneous">True</property>
                     <child>
                       <object class="GtkCheckButton" id="mtu_disc_checkbutton">
                         <property name="label" translatable="yes">Path mtu discovery</property>
@@ -2522,15 +2542,15 @@ config: http-proxy-retry or socks-proxy-retry</property>
                         <property name="draw_indicator">True</property>
                       </object>
                       <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="position">1</property>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">0</property>
                       </packing>
                     </child>
                     <child>
                       <object class="GtkComboBox" id="mtu_disc_combo">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
+                        <property name="halign">start</property>
                         <property name="model">model11</property>
                         <property name="active">0</property>
                         <property name="id_column">0</property>
@@ -2542,23 +2562,10 @@ config: http-proxy-retry or socks-proxy-retry</property>
                         </child>
                       </object>
                       <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="position">2</property>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">0</property>
                       </packing>
                     </child>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkBox">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="spacing">6</property>
                     <child>
                       <object class="GtkCheckButton" id="connect_timeout_checkbutton">
                         <property name="label" translatable="yes">Connect timeout</property>
@@ -2570,9 +2577,8 @@ config: connect-timeout &lt;n&gt; | server-poll-timeout &lt;n&gt;</property>
                         <property name="draw_indicator">True</property>
                       </object>
                       <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="position">0</property>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">1</property>
                       </packing>
                     </child>
                     <child>
@@ -2581,20 +2587,35 @@ config: connect-timeout &lt;n&gt; | server-poll-timeout &lt;n&gt;</property>
                         <property name="can_focus">True</property>
                         <property name="tooltip_text" translatable="yes">The timeout in seconds before 
trying the next server. This timeout includes proxy and TCP connect timeouts.
 config: connect-timeout &lt;n&gt; | server-poll-timeout &lt;n&gt;</property>
+                        <property name="halign">start</property>
+                        <property name="text" translatable="yes">0</property>
                         <property name="adjustment">adjustment10</property>
                       </object>
                       <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="position">1</property>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkCheckButton" id="push_peer_info_checkbutton">
+                        <property name="label" translatable="yes">Push peer info</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="tooltip_text" translatable="yes">Push additional information about 
the client to server.
+config: push-peer-info</property>
+                        <property name="use_underline">True</property>
+                        <property name="xalign">0</property>
+                        <property name="draw_indicator">True</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">2</property>
+                        <property name="width">2</property>
                       </packing>
                     </child>
                   </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">1</property>
-                  </packing>
                 </child>
               </object>
               <packing>
diff --git a/properties/nm-openvpn-editor.c b/properties/nm-openvpn-editor.c
index 00b200a..74c9ddf 100644
--- a/properties/nm-openvpn-editor.c
+++ b/properties/nm-openvpn-editor.c
@@ -674,6 +674,7 @@ static const char *const advanced_keys[] = {
        NM_OPENVPN_KEY_PROXY_RETRY,
        NM_OPENVPN_KEY_PROXY_SERVER,
        NM_OPENVPN_KEY_PROXY_TYPE,
+       NM_OPENVPN_KEY_PUSH_PEER_INFO,
        NM_OPENVPN_KEY_REMOTE_CERT_TLS,
        NM_OPENVPN_KEY_REMOTE_RANDOM,
        NM_OPENVPN_KEY_RENEG_SECONDS,
@@ -1565,7 +1566,6 @@ advanced_dialog_new (GHashTable *hash, const char *contype)
        _builder_init_toggle_button (builder, "tcp_checkbutton", _hash_get_boolean (hash, 
NM_OPENVPN_KEY_PROTO_TCP));
        _builder_init_toggle_button (builder, "ncp_disable_checkbutton", _hash_get_boolean (hash, 
NM_OPENVPN_KEY_NCP_DISABLE));
 
-
        /* Populate device-related widgets */
        dev =      g_hash_table_lookup (hash, NM_OPENVPN_KEY_DEV);
        dev_type = g_hash_table_lookup (hash, NM_OPENVPN_KEY_DEV_TYPE);
@@ -1784,6 +1784,9 @@ advanced_dialog_new (GHashTable *hash, const char *contype)
                gtk_entry_set_text (GTK_ENTRY (widget), value);
        }
 
+       _builder_init_toggle_button (builder, "push_peer_info_checkbutton",
+                                    _hash_get_boolean (hash, NM_OPENVPN_KEY_PUSH_PEER_INFO));
+
        return dialog;
 }
 
@@ -2184,6 +2187,10 @@ advanced_dialog_new_hash_from_dialog (GtkWidget *dialog)
                }
        }
 
+       widget = GTK_WIDGET (gtk_builder_get_object (builder, "push_peer_info_checkbutton"));
+       if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
+               g_hash_table_insert (hash, NM_OPENVPN_KEY_PUSH_PEER_INFO, g_strdup ("yes"));
+
        return hash;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]