[gnome-control-center/wip/networking2: 67/101] network: Implement "Reset" in the connection editor
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/wip/networking2: 67/101] network: Implement "Reset" in the connection editor
- Date: Wed, 23 Jan 2013 19:38:40 +0000 (UTC)
commit 860345c595b713ab798cbd8d569209a7e260b9e4
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 575b781..2744689 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 ffaa9a8..0be0518 100644
--- a/panels/network/connection-editor/net-connection-editor.c
+++ b/panels/network/connection-editor/net-connection-editor.c
@@ -492,3 +492,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]