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



commit cecb12d6f07235fd24a06be9fe2f632ba6c5076d
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 94da531..55b1c7c 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 - 2010 Red Hat, Inc.
+ * (C) Copyright 2008 - 2012 Red Hat, Inc.
  */
 
 #include <string.h>
@@ -224,6 +224,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,
@@ -232,7 +233,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 fa5e28b..4c8e361 100644
--- a/src/connection-editor/page-ppp.c
+++ b/src/connection-editor/page-ppp.c
@@ -288,10 +288,6 @@ ce_page_ppp_new (NMConnection *connection,
 	priv->setting = (NMSettingPPP *) nm_connection_get_setting (connection, NM_TYPE_SETTING_PPP);
 	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]