[gnome-control-center/wip/networking2: 12/36] network: Implement "Reset" in the connection editor



commit edb6fa848aa24eb984325298397c80f28dc58a1e
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Dec 14 22:50:57 2012 -0500

    network: Implement "Reset" in the connection editor
    
    For now, this has the same effect as canceling and reopening the
    dialog. Maybe something else is desired here, but I don't know
    where those defaults should come from.

 panels/network/connection-editor/ce-page-reset.c   |    2 +-
 .../connection-editor/net-connection-editor.c      |   10 ++++++++++
 .../connection-editor/net-connection-editor.h      |    1 +
 3 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/panels/network/connection-editor/ce-page-reset.c b/panels/network/connection-editor/ce-page-reset.c
index 4c73793..eb80508 100644
--- a/panels/network/connection-editor/ce-page-reset.c
+++ b/panels/network/connection-editor/ce-page-reset.c
@@ -39,7 +39,7 @@ forget_cb (GtkButton *button, CEPageReset *page)
 static void
 reset_cb (GtkButton *button, CEPageReset *page)
 {
-        g_print ("Reset is not implemented yet\n");
+        net_connection_editor_reset (page->editor);
 }
 
 static void
diff --git a/panels/network/connection-editor/net-connection-editor.c b/panels/network/connection-editor/net-connection-editor.c
index c2e0faf..b3d0672 100644
--- a/panels/network/connection-editor/net-connection-editor.c
+++ b/panels/network/connection-editor/net-connection-editor.c
@@ -489,3 +489,13 @@ net_connection_editor_forget (NetConnectionEditor *editor)
 {
         nm_remote_connection_delete (NM_REMOTE_CONNECTION (editor->orig_connection), forgotten_cb, editor);
 }
+
+void
+net_connection_editor_reset (NetConnectionEditor *editor)
+{
+        GHashTable *settings;
+
+        settings = nm_connection_to_hash (editor->orig_connection, NM_SETTING_HASH_FLAG_ALL);
+        nm_connection_replace_settings (editor->connection, settings, NULL);
+        g_hash_table_destroy (settings);
+}
diff --git a/panels/network/connection-editor/net-connection-editor.h b/panels/network/connection-editor/net-connection-editor.h
index 8a93dbe..3870bea 100644
--- a/panels/network/connection-editor/net-connection-editor.h
+++ b/panels/network/connection-editor/net-connection-editor.h
@@ -81,6 +81,7 @@ NetConnectionEditor *net_connection_editor_new      (GtkWindow        *parent_wi
 void                 net_connection_editor_run      (NetConnectionEditor   *editor);
 void                 net_connection_editor_present  (NetConnectionEditor   *editor);
 void                 net_connection_editor_forget   (NetConnectionEditor   *editor);
+void                 net_connection_editor_reset    (NetConnectionEditor   *editor);
 
 G_END_DECLS
 



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