[gnome-control-center/wip/networking2] network: fall back to nm-connection-editor for unknown types
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/wip/networking2] network: fall back to nm-connection-editor for unknown types
- Date: Mon, 21 Jan 2013 17:32:20 +0000 (UTC)
commit db6bb2ab29d9cdfc8cf4a6c2850e4211b1128c89
Author: Dan Winship <danw gnome org>
Date: Fri Jan 18 10:25:00 2013 -0500
network: fall back to nm-connection-editor for unknown types
If asked to create or edit an unrecognized type, hand it off to
nm-connection-editor.
.../connection-editor/net-connection-editor.c | 31 ++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/panels/network/connection-editor/net-connection-editor.c b/panels/network/connection-editor/net-connection-editor.c
index d262815..b40f647 100644
--- a/panels/network/connection-editor/net-connection-editor.c
+++ b/panels/network/connection-editor/net-connection-editor.c
@@ -247,6 +247,32 @@ net_connection_editor_error_dialog (NetConnectionEditor *editor,
}
static void
+net_connection_editor_do_fallback (NetConnectionEditor *editor, const gchar *type)
+{
+ gchar *cmdline;
+ GError *error = NULL;
+
+ if (editor->is_new_connection) {
+ cmdline = g_strdup_printf ("nm-connection-editor --type='%s' --create", type);
+ } else {
+ cmdline = g_strdup_printf ("nm-connection-editor --edit='%s'",
+ nm_connection_get_uuid (editor->connection));
+ }
+
+ g_spawn_command_line_async (cmdline, &error);
+ g_free (cmdline);
+
+ if (error) {
+ net_connection_editor_error_dialog (editor,
+ _("Unable to open connection editor"),
+ error->message);
+ g_error_free (error);
+ }
+
+ g_signal_emit (editor, signals[DONE], 0, FALSE);
+}
+
+static void
net_connection_editor_update_title (NetConnectionEditor *editor)
{
gchar *id;
@@ -496,6 +522,11 @@ net_connection_editor_set_connection (NetConnectionEditor *editor,
add_page (editor, ce_page_ethernet_new (editor->connection, editor->client, editor->settings));
else if (strcmp (type, NM_SETTING_VPN_SETTING_NAME) == 0)
add_page (editor, ce_page_vpn_new (editor->connection, editor->client, editor->settings));
+ else {
+ /* Unsupported type */
+ net_connection_editor_do_fallback (editor, type);
+ return;
+ }
add_page (editor, ce_page_ip4_new (editor->connection, editor->client, editor->settings));
add_page (editor, ce_page_ip6_new (editor->connection, editor->client, editor->settings));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]