[network-manager-applet/lr/import] fixup! editor: add connection argument to the new page function
- From: Lubomir Rintel <lkundrak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet/lr/import] fixup! editor: add connection argument to the new page function
- Date: Fri, 11 Nov 2016 10:09:44 +0000 (UTC)
commit 450708d35cc198b4d4076e7447f9e5d9cdc5861c
Author: Lubomir Rintel <lkundrak v3 sk>
Date: Fri Nov 11 10:39:24 2016 +0100
fixup! editor: add connection argument to the new page function
src/connection-editor/connection-helpers.c | 11 ++++++-----
src/connection-editor/main.c | 6 ++++--
src/connection-editor/nm-connection-list.c | 2 +-
src/connection-editor/page-bluetooth.c | 2 +-
src/connection-editor/page-bond.c | 4 +---
src/connection-editor/page-bridge.c | 3 ---
src/connection-editor/page-dsl.c | 4 ----
src/connection-editor/page-ethernet.c | 3 ---
src/connection-editor/page-infiniband.c | 3 ---
src/connection-editor/page-mobile.c | 2 +-
src/connection-editor/page-team.c | 5 +----
src/connection-editor/page-vlan.c | 3 ---
src/connection-editor/page-vpn.c | 3 ---
src/connection-editor/page-wifi.c | 4 ----
14 files changed, 15 insertions(+), 40 deletions(-)
---
diff --git a/src/connection-editor/connection-helpers.c b/src/connection-editor/connection-helpers.c
index 568b714..a9ab69d 100644
--- a/src/connection-editor/connection-helpers.c
+++ b/src/connection-editor/connection-helpers.c
@@ -286,12 +286,13 @@ vpn_connection_import (GtkWindow *parent,
GtkWidget *dialog;
const char *home_folder;
- /* We must not use these -- we're determining what service type
- * the connection type will be and the actual settings from the
- * interactively selected file. */
- g_return_if_fail (!connection);
+ /* The import function decides about the type. */
g_return_if_fail (!detail);
+ /* We're not going to need this one. We'll create another
+ * when we know the file name to import from. */
+ g_object_unref (connection);
+
info = g_slice_new (ImportVpnInfo);
info->parent = g_object_ref (parent);
info->result_func = result_func;
@@ -683,7 +684,7 @@ new_connection_dialog_full (GtkWindow *parent_window,
new_connection_of_type (parent_window,
detail,
detail_data,
- NULL,
+ nm_simple_connection_new (),
client,
new_func,
result_func,
diff --git a/src/connection-editor/main.c b/src/connection-editor/main.c
index 23cf4c2..48cb4bd 100644
--- a/src/connection-editor/main.c
+++ b/src/connection-editor/main.c
@@ -61,12 +61,14 @@ idle_create_connection (gpointer user_data)
{
CreateConnectionInfo *info = user_data;
+ if (!info->connection)
+ info->connection = nm_simple_connection_new ();
nm_connection_list_create (info->list, info->ctype,
info->detail, info->connection);
g_object_unref (info->list);
g_free (info->detail);
- nm_g_object_unref (info->connection);
+ g_object_unref (info->connection);
g_slice_free (CreateConnectionInfo, info);
return FALSE;
}
@@ -120,7 +122,7 @@ handle_arguments (NMConnectionList *list,
info = g_slice_new0 (CreateConnectionInfo);
info->list = g_object_ref (list);
info->ctype = NM_TYPE_SETTING_VPN;
- info->connection = nm_g_object_ref (vpn_connection_from_file (import));
+ info->connection = vpn_connection_from_file (import);
g_idle_add (idle_create_connection, info);
show_list = FALSE;
} else if (edit_uuid) {
diff --git a/src/connection-editor/nm-connection-list.c b/src/connection-editor/nm-connection-list.c
index 4a41fcc..dfe6f28 100644
--- a/src/connection-editor/nm-connection-list.c
+++ b/src/connection-editor/nm-connection-list.c
@@ -927,7 +927,7 @@ nm_connection_list_create (NMConnectionList *self, GType ctype, const char *deta
new_connection_of_type (GTK_WINDOW (self->dialog),
detail,
NULL,
- nm_g_object_ref (connection),
+ g_object_ref (connection),
self->client,
types[i].new_connection_func,
really_add_connection,
diff --git a/src/connection-editor/page-bluetooth.c b/src/connection-editor/page-bluetooth.c
index 6a1c5a0..0b2966a 100644
--- a/src/connection-editor/page-bluetooth.c
+++ b/src/connection-editor/page-bluetooth.c
@@ -303,7 +303,7 @@ bluetooth_connection_new (GtkWindow *parent,
info->client = g_object_ref (client);
info->user_data = user_data;
info->type = NM_SETTING_BLUETOOTH_TYPE_PANU;
- info->connection = connection ? g_object_ref (connection) : nm_simple_connection_new ();
+ info->connection = g_object_ref (connection);
dialog = gtk_dialog_new_with_buttons (_("Bluetooth Type"),
parent,
diff --git a/src/connection-editor/page-bond.c b/src/connection-editor/page-bond.c
index 4bbfaac..812b3ce 100644
--- a/src/connection-editor/page-bond.c
+++ b/src/connection-editor/page-bond.c
@@ -389,7 +389,7 @@ add_slave (CEPageMaster *master, NewConnectionResultFunc result_func)
new_connection_of_type (priv->toplevel,
NULL,
NULL,
- NULL,
+ nm_simple_connection_new (),
CE_PAGE (self)->client,
infiniband_connection_new,
result_func,
@@ -614,7 +614,6 @@ bond_connection_new (GtkWindow *parent,
const char *iface;
char *my_iface;
- connection = connection ? g_object_ref (connection) : nm_simple_connection_new ();
ce_page_complete_connection (connection,
_("Bond connection %d"),
NM_SETTING_BOND_SETTING_NAME,
@@ -646,6 +645,5 @@ bond_connection_new (GtkWindow *parent,
g_free (my_iface);
(*result_func) (connection, FALSE, NULL, user_data);
- g_object_unref (connection);
}
diff --git a/src/connection-editor/page-bridge.c b/src/connection-editor/page-bridge.c
index fd2b0f1..b7b7d6c 100644
--- a/src/connection-editor/page-bridge.c
+++ b/src/connection-editor/page-bridge.c
@@ -308,7 +308,6 @@ bridge_connection_new (GtkWindow *parent,
const char *iface;
char *my_iface;
- connection = connection ? g_object_ref (connection) : nm_simple_connection_new ();
ce_page_complete_connection (connection,
_("Bridge connection %d"),
NM_SETTING_BRIDGE_SETTING_NAME,
@@ -340,6 +339,4 @@ bridge_connection_new (GtkWindow *parent,
g_free (my_iface);
(*result_func) (connection, FALSE, NULL, user_data);
- g_object_unref (connection);
}
-
diff --git a/src/connection-editor/page-dsl.c b/src/connection-editor/page-dsl.c
index 8249e12..95fdd7c 100644
--- a/src/connection-editor/page-dsl.c
+++ b/src/connection-editor/page-dsl.c
@@ -212,7 +212,6 @@ dsl_connection_new (GtkWindow *parent,
{
NMSetting *setting;
- connection = connection ? g_object_ref (connection) : nm_simple_connection_new ();
ce_page_complete_connection (connection,
_("DSL connection %d"),
NM_SETTING_PPPOE_SETTING_NAME,
@@ -229,7 +228,4 @@ dsl_connection_new (GtkWindow *parent,
nm_connection_add_setting (connection, setting);
(*result_func) (connection, FALSE, NULL, user_data);
- g_object_unref (connection);
}
-
-
diff --git a/src/connection-editor/page-ethernet.c b/src/connection-editor/page-ethernet.c
index b330ebb..7564cd7 100644
--- a/src/connection-editor/page-ethernet.c
+++ b/src/connection-editor/page-ethernet.c
@@ -495,7 +495,6 @@ ethernet_connection_new (GtkWindow *parent,
PageNewConnectionResultFunc result_func,
gpointer user_data)
{
- connection = connection ? g_object_ref (connection) : nm_simple_connection_new ();
ce_page_complete_connection (connection,
_("Ethernet connection %d"),
NM_SETTING_WIRED_SETTING_NAME,
@@ -504,6 +503,4 @@ ethernet_connection_new (GtkWindow *parent,
nm_connection_add_setting (connection, nm_setting_wired_new ());
(*result_func) (connection, FALSE, NULL, user_data);
- g_object_unref (connection);
}
-
diff --git a/src/connection-editor/page-infiniband.c b/src/connection-editor/page-infiniband.c
index 6b0b2e6..c45e16d 100644
--- a/src/connection-editor/page-infiniband.c
+++ b/src/connection-editor/page-infiniband.c
@@ -246,7 +246,6 @@ infiniband_connection_new (GtkWindow *parent,
PageNewConnectionResultFunc result_func,
gpointer user_data)
{
- connection = connection ? g_object_ref (connection) : nm_simple_connection_new ();
ce_page_complete_connection (connection,
_("InfiniBand connection %d"),
NM_SETTING_INFINIBAND_SETTING_NAME,
@@ -255,6 +254,4 @@ infiniband_connection_new (GtkWindow *parent,
nm_connection_add_setting (connection, nm_setting_infiniband_new ());
(*result_func) (connection, FALSE, NULL, user_data);
- g_object_unref (connection);
}
-
diff --git a/src/connection-editor/page-mobile.c b/src/connection-editor/page-mobile.c
index 6259dec..205a659 100644
--- a/src/connection-editor/page-mobile.c
+++ b/src/connection-editor/page-mobile.c
@@ -526,7 +526,7 @@ mobile_connection_new (GtkWindow *parent,
info->result_func = result_func;
info->client = g_object_ref (client);
info->user_data = user_data;
- info->connection = connection ? g_object_ref (connection) : nm_simple_connection_new ();
+ info->connection = g_object_ref (connection);
wizard = nma_mobile_wizard_new (parent, NULL, NM_DEVICE_MODEM_CAPABILITY_NONE, FALSE,
new_connection_mobile_wizard_done, info);
diff --git a/src/connection-editor/page-team.c b/src/connection-editor/page-team.c
index e399960..af09a0b 100644
--- a/src/connection-editor/page-team.c
+++ b/src/connection-editor/page-team.c
@@ -1103,7 +1103,7 @@ add_slave (CEPageMaster *master, NewConnectionResultFunc result_func)
new_connection_of_type (GTK_WINDOW (toplevel),
NULL,
NULL,
- NULL,
+ nm_simple_connection_new (),
CE_PAGE (self)->client,
infiniband_connection_new,
result_func,
@@ -1244,7 +1244,6 @@ team_connection_new (GtkWindow *parent,
const char *iface;
char *my_iface;
- connection = connection ? g_object_ref (connection) : nm_simple_connection_new ();
ce_page_complete_connection (connection,
_("Team connection %d"),
NM_SETTING_TEAM_SETTING_NAME,
@@ -1277,6 +1276,4 @@ team_connection_new (GtkWindow *parent,
g_free (my_iface);
(*result_func) (connection, FALSE, NULL, user_data);
- g_object_unref (connection);
}
-
diff --git a/src/connection-editor/page-vlan.c b/src/connection-editor/page-vlan.c
index 8bb7511..f72f4bd 100644
--- a/src/connection-editor/page-vlan.c
+++ b/src/connection-editor/page-vlan.c
@@ -792,7 +792,6 @@ vlan_connection_new (GtkWindow *parent,
PageNewConnectionResultFunc result_func,
gpointer user_data)
{
- connection = connection ? g_object_ref (connection) : nm_simple_connection_new ();
ce_page_complete_connection (connection,
_("VLAN connection %d"),
NM_SETTING_VLAN_SETTING_NAME,
@@ -801,6 +800,4 @@ vlan_connection_new (GtkWindow *parent,
nm_connection_add_setting (connection, nm_setting_vlan_new ());
(*result_func) (connection, FALSE, NULL, user_data);
- g_object_unref (connection);
}
-
diff --git a/src/connection-editor/page-vpn.c b/src/connection-editor/page-vpn.c
index 3691572..d5923f2 100644
--- a/src/connection-editor/page-vpn.c
+++ b/src/connection-editor/page-vpn.c
@@ -307,8 +307,6 @@ vpn_connection_new (GtkWindow *parent,
if (!service_type)
service_type = detail;
- connection = connection ? g_object_ref (connection) : nm_simple_connection_new ();
-
s_vpn = nm_setting_vpn_new ();
g_object_set (s_vpn, NM_SETTING_VPN_SERVICE_TYPE, service_type, NULL);
@@ -321,5 +319,4 @@ vpn_connection_new (GtkWindow *parent,
complete_vpn_connection (connection, client);
(*result_func) (connection, FALSE, NULL, user_data);
- g_object_unref (connection);
}
diff --git a/src/connection-editor/page-wifi.c b/src/connection-editor/page-wifi.c
index 649167c..9585d03 100644
--- a/src/connection-editor/page-wifi.c
+++ b/src/connection-editor/page-wifi.c
@@ -610,7 +610,6 @@ wifi_connection_new (GtkWindow *parent,
{
NMSetting *s_wifi;
- connection = connection ? g_object_ref (connection) : nm_simple_connection_new ();
ce_page_complete_connection (connection,
_("Wi-Fi connection %d"),
NM_SETTING_WIRELESS_SETTING_NAME,
@@ -621,7 +620,4 @@ wifi_connection_new (GtkWindow *parent,
nm_connection_add_setting (connection, s_wifi);
(*result_func) (connection, FALSE, NULL, user_data);
- g_object_unref (connection);
}
-
-
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]