[network-manager-applet] editor: fix defaults for lcp-echo-failure and lcp-echo-interval (bgo #663970)



commit 0e013c9f9d754390e6db05627631a6e19da670a5
Author: JiÅÃ KlimeÅ <jklimes redhat com>
Date:   Mon May 28 13:45:40 2012 +0200

    editor: fix defaults for lcp-echo-failure and lcp-echo-interval (bgo #663970)
    
    The default values have to be set in dsl_connection_new() so that the change
    only applies for new connections. ce_page_ppp_new() is called every time a
    connection is edited and thus we can't change the properties values in it. Else
    "Send PPP echo packets" won't be initialized properly for connections that have
    PPP settings all default and thus no PPP setting was present.

 src/connection-editor/page-dsl.c |   11 +++++++++--
 src/connection-editor/page-ppp.c |    4 ----
 2 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/src/connection-editor/page-dsl.c b/src/connection-editor/page-dsl.c
index 5485a55..52dac57 100644
--- a/src/connection-editor/page-dsl.c
+++ b/src/connection-editor/page-dsl.c
@@ -17,7 +17,7 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * (C) Copyright 2008 - 2011 Red Hat, Inc.
+ * (C) Copyright 2008 - 2012 Red Hat, Inc.
  */
 
 #include "config.h"
@@ -227,6 +227,7 @@ dsl_connection_new (GtkWindow *parent,
                     gpointer user_data)
 {
 	NMConnection *connection;
+	NMSetting *setting;
 
 	connection = ce_page_new_connection (_("DSL connection %d"),
 	                                     NM_SETTING_PPPOE_SETTING_NAME,
@@ -235,7 +236,13 @@ dsl_connection_new (GtkWindow *parent,
 	                                     user_data);
 	nm_connection_add_setting (connection, nm_setting_pppoe_new ());
 	nm_connection_add_setting (connection, nm_setting_wired_new ());
-	nm_connection_add_setting (connection, nm_setting_ppp_new ());
+	setting = nm_setting_ppp_new ();
+	/* Set default values for lcp-echo-failure and lcp-echo-interval */
+	g_object_set (G_OBJECT (setting),
+	              NM_SETTING_PPP_LCP_ECHO_FAILURE, 5,
+	              NM_SETTING_PPP_LCP_ECHO_INTERVAL, 30,
+	              NULL);
+	nm_connection_add_setting (connection, setting);
 
 	(*result_func) (connection, FALSE, NULL, user_data);
 }
diff --git a/src/connection-editor/page-ppp.c b/src/connection-editor/page-ppp.c
index db74245..e2050cc 100644
--- a/src/connection-editor/page-ppp.c
+++ b/src/connection-editor/page-ppp.c
@@ -291,10 +291,6 @@ ce_page_ppp_new (NMConnection *connection,
 	priv->setting = nm_connection_get_setting_ppp (connection);
 	if (!priv->setting) {
 		priv->setting = NM_SETTING_PPP (nm_setting_ppp_new ());
-		g_object_set (G_OBJECT (priv->setting),
-		              NM_SETTING_PPP_LCP_ECHO_FAILURE, 5,
-		              NM_SETTING_PPP_LCP_ECHO_INTERVAL, 30,
-		              NULL);
 		nm_connection_add_setting (connection, NM_SETTING (priv->setting));
 	}
 



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