[PATCH 1/3] nm-c-e: Fixes for including a new page "Proxy"



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(+)

diff --git a/src/connection-editor/Makefile.am b/src/connection-editor/Makefile.am
index 36df551..2d859f2 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 \
@@ -103,6 +105,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 89d499a..e8537c9 100644
--- a/src/connection-editor/connection-helpers.c
+++ b/src/connection-editor/connection-helpers.c
@@ -627,6 +627,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 128c7b5..fca7e3f 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 5c092dc..e7e85a8 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))
-- 
2.5.5



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