[network-manager-applet/th/proxy: 4/5] nm-connection-editor: Fixes for including Proxy page



commit ca7b32430a2b7627ca729e66bf6ef19e026acec5
Author: Atul Anand <atulhjp gmail com>
Date:   Tue Aug 16 05:58:06 2016 +0530

    nm-connection-editor: Fixes for including Proxy page
    
    A new GUI page Proxy has been added which appears next to IP Settings
    when configuring a connection in nm-connection-editor. Proxy settings
    can be kept in same queue with IP settings wherever the later appears.
    Easy note: Proxy setting depends on them.

 src/connection-editor/Makefile.am            |    3 +++
 src/connection-editor/connection-helpers.c   |   12 ++++++++++++
 src/connection-editor/connection-helpers.h   |    1 +
 src/connection-editor/nm-connection-editor.c |    4 ++++
 src/connection-editor/nm-connection-list.c   |    2 ++
 5 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/src/connection-editor/Makefile.am b/src/connection-editor/Makefile.am
index b6f31a5..c05d061 100644
--- a/src/connection-editor/Makefile.am
+++ b/src/connection-editor/Makefile.am
@@ -38,6 +38,8 @@ nm_connection_editor_SOURCES = \
        page-wifi-security.c \
        page-infiniband.h \
        page-infiniband.c \
+       page-proxy.h \
+       page-proxy.c \
        page-ip4.h \
        page-ip4.c \
        page-ip6.h \
@@ -104,6 +106,7 @@ ui_DATA = \
        ce-page-team-port.ui \
        ce-page-bridge.ui \
        ce-page-bridge-port.ui \
+       ce-page-proxy.ui \
        ce-page-ip4.ui \
        ce-ip4-routes.ui \
        ce-page-ip6.ui \
diff --git a/src/connection-editor/connection-helpers.c b/src/connection-editor/connection-helpers.c
index 85261ef..c405a20 100644
--- a/src/connection-editor/connection-helpers.c
+++ b/src/connection-editor/connection-helpers.c
@@ -634,6 +634,18 @@ delete_connection (GtkWindow *parent_window,
 }
 
 gboolean
+connection_supports_proxy (NMConnection *connection)
+{
+       NMSettingConnection *s_con;
+
+       g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE);
+
+       /* Same Stuff as IP4 */
+       s_con = nm_connection_get_setting_connection (connection);
+       return (nm_setting_connection_get_slave_type (s_con) == NULL);
+}
+
+gboolean
 connection_supports_ip4 (NMConnection *connection)
 {
        NMSettingConnection *s_con;
diff --git a/src/connection-editor/connection-helpers.h b/src/connection-editor/connection-helpers.h
index 0ddb2d3..ed1b2ad 100644
--- a/src/connection-editor/connection-helpers.h
+++ b/src/connection-editor/connection-helpers.h
@@ -69,6 +69,7 @@ void delete_connection (GtkWindow *parent_window,
                         DeleteConnectionResultFunc result_func,
                         gpointer user_data);
 
+gboolean connection_supports_proxy (NMConnection *connection);
 gboolean connection_supports_ip4 (NMConnection *connection);
 gboolean connection_supports_ip6 (NMConnection *connection);
 
diff --git a/src/connection-editor/nm-connection-editor.c b/src/connection-editor/nm-connection-editor.c
index aefe858..0a7416e 100644
--- a/src/connection-editor/nm-connection-editor.c
+++ b/src/connection-editor/nm-connection-editor.c
@@ -38,6 +38,7 @@
 #include "page-8021x-security.h"
 #include "page-wifi.h"
 #include "page-wifi-security.h"
+#include "page-proxy.h"
 #include "page-ip4.h"
 #include "page-ip6.h"
 #include "page-dsl.h"
@@ -830,6 +831,9 @@ nm_connection_editor_set_connection (NMConnectionEditor *editor,
                        goto out;
        }
 
+       if (   nm_connection_get_setting_proxy (editor->connection)
+           && !add_page (editor, ce_page_proxy_new, editor->connection, error))
+               goto out;
        if (   nm_connection_get_setting_ip4_config (editor->connection)
            && !add_page (editor, ce_page_ip4_new, editor->connection, error))
                goto out;
diff --git a/src/connection-editor/nm-connection-list.c b/src/connection-editor/nm-connection-list.c
index 3210168..85173fc 100644
--- a/src/connection-editor/nm-connection-list.c
+++ b/src/connection-editor/nm-connection-list.c
@@ -277,6 +277,8 @@ really_add_connection (NMConnection *connection,
                return;
        }
 
+       if (connection_supports_proxy (connection) && !nm_connection_get_setting_proxy (connection))
+               nm_connection_add_setting (connection, nm_setting_proxy_new ());
        if (connection_supports_ip4 (connection) && !nm_connection_get_setting_ip4_config (connection))
                nm_connection_add_setting (connection, nm_setting_ip4_config_new ());
        if (connection_supports_ip6 (connection) && !nm_connection_get_setting_ip6_config (connection))


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