[network-manager-applet/bbs: 1/3] c



commit 11b3a7a44bf9ed2265115679a967a189eb08b16e
Author: Lubomir Rintel <lkundrak v3 sk>
Date:   Mon Oct 24 10:02:44 2016 +0200

    c

 src/connection-editor/ce-page.c         |   19 +++++++------------
 src/connection-editor/ce-page.h         |   10 +++++-----
 src/connection-editor/page-bluetooth.c  |   11 ++++++-----
 src/connection-editor/page-bond.c       |   11 ++++++-----
 src/connection-editor/page-bridge.c     |   11 ++++++-----
 src/connection-editor/page-dsl.c        |   11 ++++++-----
 src/connection-editor/page-ethernet.c   |   11 ++++++-----
 src/connection-editor/page-infiniband.c |   11 ++++++-----
 src/connection-editor/page-mobile.c     |    7 ++++++-
 src/connection-editor/page-team.c       |   11 ++++++-----
 src/connection-editor/page-vlan.c       |   11 ++++++-----
 src/connection-editor/page-vpn.c        |   11 ++++++-----
 src/connection-editor/page-wifi.c       |   11 ++++++-----
 13 files changed, 78 insertions(+), 68 deletions(-)
---
diff --git a/src/connection-editor/ce-page.c b/src/connection-editor/ce-page.c
index 4b17fde..de111a5 100644
--- a/src/connection-editor/ce-page.c
+++ b/src/connection-editor/ce-page.c
@@ -808,20 +808,17 @@ ce_page_class_init (CEPageClass *page_class)
 }
 
 
-NMConnection *
-ce_page_new_connection (const char *format,
-                        const char *ctype,
-                        gboolean autoconnect,
-                        NMClient *client,
-                        gpointer user_data)
-{
-       NMConnection *connection;
+void
+ce_page_complete_connection (NMConnection *connection,
+                             const char *format,
+                             const char *ctype,
+                             gboolean autoconnect,
+                             NMClient *client)
+{
        NMSettingConnection *s_con;
        char *uuid, *id;
        const GPtrArray *connections;
 
-       connection = nm_simple_connection_new ();
-
        s_con = NM_SETTING_CONNECTION (nm_setting_connection_new ());
        nm_connection_add_setting (connection, NM_SETTING (s_con));
 
@@ -839,8 +836,6 @@ ce_page_new_connection (const char *format,
 
        g_free (uuid);
        g_free (id);
-
-       return connection;
 }
 
 CEPage *
diff --git a/src/connection-editor/ce-page.h b/src/connection-editor/ce-page.h
index f375ed4..b4016b7 100644
--- a/src/connection-editor/ce-page.h
+++ b/src/connection-editor/ce-page.h
@@ -160,11 +160,11 @@ gboolean ce_page_get_initialized (CEPage *self);
 char *ce_page_get_next_available_name (const GPtrArray *connections, const char *format);
 
 /* Only for subclasses */
-NMConnection *ce_page_new_connection (const char *format,
-                                      const char *ctype,
-                                      gboolean autoconnect,
-                                      NMClient *client,
-                                      gpointer user_data);
+void ce_page_complete_connection (NMConnection *connection,
+                                  const char *format,
+                                  const char *ctype,
+                                  gboolean autoconnect,
+                                  NMClient *client);
 
 CEPage *ce_page_new (GType page_type,
                      NMConnectionEditor *editor,
diff --git a/src/connection-editor/page-bluetooth.c b/src/connection-editor/page-bluetooth.c
index 2d36c57..9fbe779 100644
--- a/src/connection-editor/page-bluetooth.c
+++ b/src/connection-editor/page-bluetooth.c
@@ -256,11 +256,12 @@ new_connection_mobile_wizard_done (NMAMobileWizard *wizard,
 
        if (!detail)
                detail = g_strdup (_("Bluetooth connection %d"));
-       connection = ce_page_new_connection (detail,
-                                            NM_SETTING_BLUETOOTH_SETTING_NAME,
-                                            FALSE,
-                                            info->client,
-                                            user_data);
+       connection = nm_simple_connection_new ();
+       ce_page_complete_connection (connection,
+                                    detail,
+                                    NM_SETTING_BLUETOOTH_SETTING_NAME,
+                                    FALSE,
+                                    info->client);
        g_free (detail);
        nm_connection_add_setting (connection, nm_setting_bluetooth_new ());
        g_object_set (nm_connection_get_setting_bluetooth (connection),
diff --git a/src/connection-editor/page-bond.c b/src/connection-editor/page-bond.c
index e43940c..576773a 100644
--- a/src/connection-editor/page-bond.c
+++ b/src/connection-editor/page-bond.c
@@ -613,11 +613,12 @@ bond_connection_new (GtkWindow *parent,
        const char *iface;
        char *my_iface;
 
-       connection = ce_page_new_connection (_("Bond connection %d"),
-                                            NM_SETTING_BOND_SETTING_NAME,
-                                            TRUE,
-                                            client,
-                                            user_data);
+       connection = nm_simple_connection_new ();
+       ce_page_complete_connection (connection,
+                                    _("Bond connection %d"),
+                                    NM_SETTING_BOND_SETTING_NAME,
+                                    TRUE,
+                                    client);
        nm_connection_add_setting (connection, nm_setting_bond_new ());
 
        /* Find an available interface name */
diff --git a/src/connection-editor/page-bridge.c b/src/connection-editor/page-bridge.c
index 136c97c..8b963b7 100644
--- a/src/connection-editor/page-bridge.c
+++ b/src/connection-editor/page-bridge.c
@@ -308,11 +308,12 @@ bridge_connection_new (GtkWindow *parent,
        const char *iface;
        char *my_iface;
 
-       connection = ce_page_new_connection (_("Bridge connection %d"),
-                                            NM_SETTING_BRIDGE_SETTING_NAME,
-                                            TRUE,
-                                            client,
-                                            user_data);
+       connection = nm_simple_connection_new ();
+       ce_page_complete_connection (connection,
+                                    _("Bridge connection %d"),
+                                    NM_SETTING_BRIDGE_SETTING_NAME,
+                                    TRUE,
+                                    client);
        nm_connection_add_setting (connection, nm_setting_bridge_new ());
 
        /* Find an available interface name */
diff --git a/src/connection-editor/page-dsl.c b/src/connection-editor/page-dsl.c
index 6419fa0..9ed3003 100644
--- a/src/connection-editor/page-dsl.c
+++ b/src/connection-editor/page-dsl.c
@@ -212,11 +212,12 @@ dsl_connection_new (GtkWindow *parent,
        NMConnection *connection;
        NMSetting *setting;
 
-       connection = ce_page_new_connection (_("DSL connection %d"),
-                                            NM_SETTING_PPPOE_SETTING_NAME,
-                                            FALSE,
-                                            client,
-                                            user_data);
+       connection = nm_simple_connection_new ();
+       ce_page_complete_connection (connection,
+                                    _("DSL connection %d"),
+                                    NM_SETTING_PPPOE_SETTING_NAME,
+                                    FALSE,
+                                    client);
        nm_connection_add_setting (connection, nm_setting_pppoe_new ());
        nm_connection_add_setting (connection, nm_setting_wired_new ());
        setting = nm_setting_ppp_new ();
diff --git a/src/connection-editor/page-ethernet.c b/src/connection-editor/page-ethernet.c
index 54b0353..f5c891b 100644
--- a/src/connection-editor/page-ethernet.c
+++ b/src/connection-editor/page-ethernet.c
@@ -496,11 +496,12 @@ ethernet_connection_new (GtkWindow *parent,
 {
        NMConnection *connection;
 
-       connection = ce_page_new_connection (_("Ethernet connection %d"),
-                                            NM_SETTING_WIRED_SETTING_NAME,
-                                            TRUE,
-                                            client,
-                                            user_data);
+       connection = nm_simple_connection_new ();
+       ce_page_complete_connection (connection,
+                                    _("Ethernet connection %d"),
+                                    NM_SETTING_WIRED_SETTING_NAME,
+                                    TRUE,
+                                    client);
        nm_connection_add_setting (connection, nm_setting_wired_new ());
 
        (*result_func) (connection, FALSE, NULL, user_data);
diff --git a/src/connection-editor/page-infiniband.c b/src/connection-editor/page-infiniband.c
index 1441737..8412118 100644
--- a/src/connection-editor/page-infiniband.c
+++ b/src/connection-editor/page-infiniband.c
@@ -247,11 +247,12 @@ infiniband_connection_new (GtkWindow *parent,
 {
        NMConnection *connection;
 
-       connection = ce_page_new_connection (_("InfiniBand connection %d"),
-                                            NM_SETTING_INFINIBAND_SETTING_NAME,
-                                            TRUE,
-                                            client,
-                                            user_data);
+       connection = nm_simple_connection_new ();
+       ce_page_complete_connection (connection,
+                                    _("InfiniBand connection %d"),
+                                    NM_SETTING_INFINIBAND_SETTING_NAME,
+                                    TRUE,
+                                    client);
        nm_connection_add_setting (connection, nm_setting_infiniband_new ());
 
        (*result_func) (connection, FALSE, NULL, user_data);
diff --git a/src/connection-editor/page-mobile.c b/src/connection-editor/page-mobile.c
index 572d386..e15c098 100644
--- a/src/connection-editor/page-mobile.c
+++ b/src/connection-editor/page-mobile.c
@@ -477,7 +477,12 @@ new_connection_mobile_wizard_done (NMAMobileWizard *wizard,
                        detail = g_strdup_printf ("%s %s %%d", method->provider_name, method->plan_name);
                else
                        detail = g_strdup_printf ("%s connection %%d", method->provider_name);
-               connection = ce_page_new_connection (detail, ctype, FALSE, info->client, info->user_data);
+               connection = nm_simple_connection_new ();
+               ce_page_complete_connection (connection,
+                                            detail,
+                                             ctype,
+                                             FALSE,
+                                             info->client);
                g_free (detail);
 
                nm_connection_add_setting (connection, type_setting);
diff --git a/src/connection-editor/page-team.c b/src/connection-editor/page-team.c
index 9be28be..f72508d 100644
--- a/src/connection-editor/page-team.c
+++ b/src/connection-editor/page-team.c
@@ -1243,11 +1243,12 @@ team_connection_new (GtkWindow *parent,
        const char *iface;
        char *my_iface;
 
-       connection = ce_page_new_connection (_("Team connection %d"),
-                                            NM_SETTING_TEAM_SETTING_NAME,
-                                            TRUE,
-                                            client,
-                                            user_data);
+       connection = nm_simple_connection_new ();
+       ce_page_complete_connection (connection,
+                                    _("Team connection %d"),
+                                    NM_SETTING_TEAM_SETTING_NAME,
+                                    TRUE,
+                                    client);
        nm_connection_add_setting (connection, nm_setting_team_new ());
 
        /* Find an available interface name */
diff --git a/src/connection-editor/page-vlan.c b/src/connection-editor/page-vlan.c
index ef39a7d..d9fa62c 100644
--- a/src/connection-editor/page-vlan.c
+++ b/src/connection-editor/page-vlan.c
@@ -793,11 +793,12 @@ vlan_connection_new (GtkWindow *parent,
 {
        NMConnection *connection;
 
-       connection = ce_page_new_connection (_("VLAN connection %d"),
-                                            NM_SETTING_VLAN_SETTING_NAME,
-                                            TRUE,
-                                            client,
-                                            user_data);
+       connection = nm_simple_connection_new ();
+       ce_page_complete_connection (connection,
+                                    _("VLAN connection %d"),
+                                    NM_SETTING_VLAN_SETTING_NAME,
+                                    TRUE,
+                                    client);
        nm_connection_add_setting (connection, nm_setting_vlan_new ());
 
        (*result_func) (connection, FALSE, NULL, user_data);
diff --git a/src/connection-editor/page-vpn.c b/src/connection-editor/page-vpn.c
index 7ae8e8d..1a519e4 100644
--- a/src/connection-editor/page-vpn.c
+++ b/src/connection-editor/page-vpn.c
@@ -439,11 +439,12 @@ vpn_connection_new (GtkWindow *parent,
        if (!service_type)
                service_type = detail;
 
-       connection = ce_page_new_connection (_("VPN connection %d"),
-                                            NM_SETTING_VPN_SETTING_NAME,
-                                            FALSE,
-                                            client,
-                                            user_data);
+       connection = nm_simple_connection_new ();
+       ce_page_complete_connection (connection,
+                                    _("VPN connection %d"),
+                                    NM_SETTING_VPN_SETTING_NAME,
+                                    FALSE,
+                                    client);
        s_vpn = nm_setting_vpn_new ();
        g_object_set (s_vpn, NM_SETTING_VPN_SERVICE_TYPE, service_type, NULL);
 
diff --git a/src/connection-editor/page-wifi.c b/src/connection-editor/page-wifi.c
index 8f7c6c1..c15af9a 100644
--- a/src/connection-editor/page-wifi.c
+++ b/src/connection-editor/page-wifi.c
@@ -610,11 +610,12 @@ wifi_connection_new (GtkWindow *parent,
        NMConnection *connection;
        NMSetting *s_wifi;
 
-       connection = ce_page_new_connection (_("Wi-Fi connection %d"),
-                                            NM_SETTING_WIRELESS_SETTING_NAME,
-                                            TRUE,
-                                            client,
-                                            user_data);
+       connection = nm_simple_connection_new ();
+       ce_page_complete_connection (connection,
+                                    _("Wi-Fi connection %d"),
+                                    NM_SETTING_WIRELESS_SETTING_NAME,
+                                    TRUE,
+                                    client);
        s_wifi = nm_setting_wireless_new ();
        g_object_set (s_wifi, NM_SETTING_WIRELESS_MODE, "infrastructure", NULL);
        nm_connection_add_setting (connection, s_wifi);


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