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



commit e5140343d769c48ff2516b18251881cb06e49601
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 69b012f..091c1dc 100644
--- a/src/connection-editor/Makefile.am
+++ b/src/connection-editor/Makefile.am
@@ -52,6 +52,8 @@ nm_connection_editor_SOURCES = \
        page-bluetooth.c \
        page-ppp.h \
        page-ppp.c \
+       page-proxy.h \
+       page-proxy.c \
        page-vpn.h \
        page-vpn.c \
        page-master.h \
@@ -106,6 +108,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 be9dd22..a4a37d4 100644
--- a/src/connection-editor/connection-helpers.c
+++ b/src/connection-editor/connection-helpers.c
@@ -789,6 +789,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 08fe583..17de569 100644
--- a/src/connection-editor/connection-helpers.h
+++ b/src/connection-editor/connection-helpers.h
@@ -83,6 +83,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 9d23390..ea7d399 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-ip-tunnel.h"
@@ -812,6 +813,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 37c7eb5..525b68b 100644
--- a/src/connection-editor/nm-connection-list.c
+++ b/src/connection-editor/nm-connection-list.c
@@ -278,6 +278,8 @@ really_add_connection (FUNC_TAG_NEW_CONNECTION_RESULT_IMPL,
                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]