network: Split the proxy parts from the .c and .ui file

A source file with 4k lines of code is not understandable, and the glade file
was becoming quite a challenge for glade.
To add more features we need to split things up just to keep them maintainable.

This is the first patch that just splits out the proxy bits. Other device types
will follow in the next few days.
This commit is contained in:
Richard Hughes 2012-07-12 14:07:54 +01:00
parent 298489ee16
commit c26e14518e
10 changed files with 974 additions and 715 deletions

View file

@ -22,6 +22,8 @@ libnetwork_la_SOURCES = \
net-device.h \ net-device.h \
net-vpn.c \ net-vpn.c \
net-vpn.h \ net-vpn.h \
net-proxy.c \
net-proxy.h \
panel-cell-renderer-mode.c \ panel-cell-renderer-mode.c \
panel-cell-renderer-mode.h \ panel-cell-renderer-mode.h \
panel-cell-renderer-security.c \ panel-cell-renderer-security.c \
@ -37,7 +39,9 @@ libnetwork_la_LIBADD = $(PANEL_LIBS) $(NETWORK_PANEL_LIBS) $(NETWORK_MANAGER_LIB
libnetwork_la_LDFLAGS = $(PANEL_LDFLAGS) libnetwork_la_LDFLAGS = $(PANEL_LDFLAGS)
uidir = $(pkgdatadir)/ui uidir = $(pkgdatadir)/ui
dist_ui_DATA = network.ui dist_ui_DATA = \
network-proxy.ui \
network.ui
@INTLTOOL_DESKTOP_RULE@ @INTLTOOL_DESKTOP_RULE@

View file

@ -47,6 +47,7 @@
#include "net-object.h" #include "net-object.h"
#include "net-device.h" #include "net-device.h"
#include "net-proxy.h"
#include "net-vpn.h" #include "net-vpn.h"
#include "panel-common.h" #include "panel-common.h"
@ -73,7 +74,6 @@ typedef enum {
struct _CcNetworkPanelPrivate struct _CcNetworkPanelPrivate
{ {
GCancellable *cancellable; GCancellable *cancellable;
GSettings *proxy_settings;
GtkBuilder *builder; GtkBuilder *builder;
NMClient *client; NMClient *client;
NMRemoteSettings *remote_settings; NMRemoteSettings *remote_settings;
@ -197,8 +197,6 @@ cc_network_panel_dispose (GObject *object)
{ {
CcNetworkPanelPrivate *priv = CC_NETWORK_PANEL (object)->priv; CcNetworkPanelPrivate *priv = CC_NETWORK_PANEL (object)->priv;
g_clear_object (&priv->proxy_settings);
if (priv->cancellable != NULL) if (priv->cancellable != NULL)
g_cancellable_cancel (priv->cancellable); g_cancellable_cancel (priv->cancellable);
@ -263,59 +261,6 @@ cc_network_panel_class_finalize (CcNetworkPanelClass *klass)
{ {
} }
static void
check_wpad_warning (CcNetworkPanel *panel)
{
GtkWidget *widget;
gchar *autoconfig_url = NULL;
GString *string = NULL;
gboolean ret = FALSE;
guint mode;
string = g_string_new ("");
/* check we're using 'Automatic' */
mode = g_settings_get_enum (panel->priv->proxy_settings, "mode");
if (mode != 2)
goto out;
/* see if the PAC is blank */
autoconfig_url = g_settings_get_string (panel->priv->proxy_settings,
"autoconfig-url");
ret = autoconfig_url == NULL ||
autoconfig_url[0] == '\0';
if (!ret)
goto out;
g_string_append (string, "<small>");
/* TRANSLATORS: this is when the use leaves the PAC textbox blank */
g_string_append (string, _("Web Proxy Autodiscovery is used when a Configuration URL is not provided."));
g_string_append (string, "\n");
/* TRANSLATORS: WPAD is bad: if you enable it on an untrusted
* network, then anyone else on that network can tell your
* machine that it should proxy all of your web traffic
* through them. */
g_string_append (string, _("This is not recommended for untrusted public networks."));
g_string_append (string, "</small>");
out:
widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
"label_proxy_warning"));
gtk_label_set_markup (GTK_LABEL (widget), string->str);
g_free (autoconfig_url);
g_string_free (string, TRUE);
}
static void
panel_settings_changed (GSettings *settings,
const gchar *key,
CcNetworkPanel *panel)
{
check_wpad_warning (panel);
}
static NetObject * static NetObject *
get_selected_object (CcNetworkPanel *panel) get_selected_object (CcNetworkPanel *panel)
{ {
@ -339,117 +284,6 @@ get_selected_object (CcNetworkPanel *panel)
return object; return object;
} }
static void
panel_proxy_mode_combo_setup_widgets (CcNetworkPanel *panel, guint value)
{
GtkWidget *widget;
/* hide or show the PAC text box */
widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
"heading_proxy_url"));
gtk_widget_set_visible (widget, value == 2);
widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
"entry_proxy_url"));
gtk_widget_set_visible (widget, value == 2);
/* hide or show the manual entry text boxes */
widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
"heading_proxy_http"));
gtk_widget_set_visible (widget, value == 1);
widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
"entry_proxy_http"));
gtk_widget_set_visible (widget, value == 1);
widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
"spinbutton_proxy_http"));
gtk_widget_set_visible (widget, value == 1);
widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
"heading_proxy_https"));
gtk_widget_set_visible (widget, value == 1);
widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
"entry_proxy_https"));
gtk_widget_set_visible (widget, value == 1);
widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
"spinbutton_proxy_https"));
gtk_widget_set_visible (widget, value == 1);
widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
"heading_proxy_ftp"));
gtk_widget_set_visible (widget, value == 1);
widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
"entry_proxy_ftp"));
gtk_widget_set_visible (widget, value == 1);
widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
"spinbutton_proxy_ftp"));
gtk_widget_set_visible (widget, value == 1);
widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
"heading_proxy_socks"));
gtk_widget_set_visible (widget, value == 1);
widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
"entry_proxy_socks"));
gtk_widget_set_visible (widget, value == 1);
widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
"spinbutton_proxy_socks"));
gtk_widget_set_visible (widget, value == 1);
/* perhaps show the wpad warning */
check_wpad_warning (panel);
}
static void
panel_proxy_mode_combo_changed_cb (GtkWidget *widget, CcNetworkPanel *panel)
{
gboolean ret;
gint value;
GtkTreeIter iter;
GtkTreeModel *model;
/* no selection */
ret = gtk_combo_box_get_active_iter (GTK_COMBO_BOX (widget), &iter);
if (!ret)
return;
/* get entry */
model = gtk_combo_box_get_model (GTK_COMBO_BOX (widget));
gtk_tree_model_get (model, &iter,
1, &value,
-1);
/* set */
g_settings_set_enum (panel->priv->proxy_settings, "mode", value);
/* hide or show the correct widgets */
panel_proxy_mode_combo_setup_widgets (panel, value);
}
static void
panel_set_value_for_combo (CcNetworkPanel *panel, GtkComboBox *combo_box, gint value)
{
gboolean ret;
gint value_tmp;
GtkTreeIter iter;
GtkTreeModel *model;
/* get entry */
model = gtk_combo_box_get_model (combo_box);
ret = gtk_tree_model_get_iter_first (model, &iter);
if (!ret)
return;
/* try to make the UI match the setting */
do {
gtk_tree_model_get (model, &iter,
1, &value_tmp,
-1);
if (value == value_tmp) {
gtk_combo_box_set_active_iter (combo_box, &iter);
break;
}
} while (gtk_tree_model_iter_next (model, &iter));
/* hide or show the correct widgets */
panel_proxy_mode_combo_setup_widgets (panel, value);
}
static void static void
select_first_device (CcNetworkPanel *panel) select_first_device (CcNetworkPanel *panel)
{ {
@ -2376,6 +2210,41 @@ nm_device_refresh_vpn_ui (CcNetworkPanel *panel, NetVpn *vpn)
net_vpn_get_password (vpn)); net_vpn_get_password (vpn));
} }
static void
panel_set_notebook_page_for_object (CcNetworkPanel *panel, NetObject *object)
{
CcNetworkPanelPrivate *priv = panel->priv;
const gchar *id_tmp;
const gchar *needle;
GList *l;
GList *panels;
GtkNotebook *notebook;
GtkWidget *widget;
guint i = 0;
/* find the widget in the notebook that matches the object ID */
needle = net_object_get_id (object);
notebook = GTK_NOTEBOOK (gtk_builder_get_object (priv->builder,
"notebook_types"));
panels = gtk_container_get_children (GTK_CONTAINER (notebook));
for (l = panels; l != NULL; l = l->next) {
widget = GTK_WIDGET (l->data);
id_tmp = g_object_get_data (G_OBJECT (widget), "NetObject::id");
if (g_strcmp0 (needle, id_tmp) == 0) {
gtk_notebook_set_current_page (notebook, i);
/* object is deletable? */
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
"remove_toolbutton"));
gtk_widget_set_sensitive (widget,
net_object_get_removable (object));
break;
}
i++;
}
g_list_free (panels);
}
static gboolean static gboolean
refresh_ui_idle (gpointer data) refresh_ui_idle (gpointer data)
{ {
@ -2399,42 +2268,12 @@ refresh_ui_idle (gpointer data)
object = get_selected_object (panel); object = get_selected_object (panel);
/* this is the proxy settings device */ /* do we have a new-style NetObject-style panel widget */
if (object == NULL) { panel_set_notebook_page_for_object (panel, object);
/* set header to something sane */
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
"image_proxy_device"));
gtk_image_set_from_icon_name (GTK_IMAGE (widget),
"preferences-system-network",
GTK_ICON_SIZE_DIALOG);
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
"label_proxy_device"));
gtk_label_set_label (GTK_LABEL (widget),
_("Proxy"));
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
"label_proxy_status"));
gtk_label_set_label (GTK_LABEL (widget), "");
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
"notebook_types"));
gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), 2);
/* hide the switch until we get some more detail in the mockup */
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
"device_proxy_off_switch"));
if (widget != NULL)
gtk_widget_hide (widget);
/* we shoulnd't be able to delete the proxy device */
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
"remove_toolbutton"));
gtk_widget_set_sensitive (widget, FALSE);
goto out;
}
/* VPN */ /* VPN */
if (NET_IS_VPN (object)) { if (NET_IS_VPN (object)) {
nm_device_refresh_vpn_ui (panel, NET_VPN (object)); nm_device_refresh_vpn_ui (panel, NET_VPN (object));
/* we're able to remove the VPN connection */ /* we're able to remove the VPN connection */
@ -2482,20 +2321,35 @@ panel_add_proxy_device (CcNetworkPanel *panel)
gchar *title; gchar *title;
GtkListStore *liststore_devices; GtkListStore *liststore_devices;
GtkTreeIter iter; GtkTreeIter iter;
NetProxy *proxy;
GtkWidget *widget;
GtkNotebook *notebook;
GtkSizeGroup *size_group;
/* add proxy to notebook */
proxy = net_proxy_new ();
notebook = GTK_NOTEBOOK (gtk_builder_get_object (panel->priv->builder,
"notebook_types"));
size_group = GTK_SIZE_GROUP (gtk_builder_get_object (panel->priv->builder,
"sizegroup1"));
net_object_add_to_notebook (NET_OBJECT (proxy),
notebook,
size_group);
/* add proxy to device list */
liststore_devices = GTK_LIST_STORE (gtk_builder_get_object (panel->priv->builder, liststore_devices = GTK_LIST_STORE (gtk_builder_get_object (panel->priv->builder,
"liststore_devices")); "liststore_devices"));
title = g_strdup_printf ("%s", _("Network proxy")); title = g_strdup_printf ("%s", _("Network proxy"));
gtk_list_store_append (liststore_devices, &iter); gtk_list_store_append (liststore_devices, &iter);
gtk_list_store_set (liststore_devices, gtk_list_store_set (liststore_devices,
&iter, &iter,
PANEL_DEVICES_COLUMN_ICON, "preferences-system-network", PANEL_DEVICES_COLUMN_ICON, "preferences-system-network",
PANEL_DEVICES_COLUMN_TITLE, title, PANEL_DEVICES_COLUMN_TITLE, title,
PANEL_DEVICES_COLUMN_SORT, "9", PANEL_DEVICES_COLUMN_SORT, "9",
PANEL_DEVICES_COLUMN_OBJECT, NULL, PANEL_DEVICES_COLUMN_OBJECT, proxy,
-1); -1);
g_free (title); g_free (title);
g_object_unref (proxy);
} }
static void static void
@ -3678,9 +3532,6 @@ cc_network_panel_init (CcNetworkPanel *panel)
{ {
DBusGConnection *bus = NULL; DBusGConnection *bus = NULL;
GError *error = NULL; GError *error = NULL;
gint value;
GSettings *settings_tmp;
GtkAdjustment *adjustment;
GtkCellRenderer *renderer; GtkCellRenderer *renderer;
GtkComboBox *combobox; GtkComboBox *combobox;
GtkStyleContext *context; GtkStyleContext *context;
@ -3703,90 +3554,6 @@ cc_network_panel_init (CcNetworkPanel *panel)
panel->priv->cancellable = g_cancellable_new (); panel->priv->cancellable = g_cancellable_new ();
panel->priv->proxy_settings = g_settings_new ("org.gnome.system.proxy");
g_signal_connect (panel->priv->proxy_settings,
"changed",
G_CALLBACK (panel_settings_changed),
panel);
/* explicitly set this to false as the panel has no way of
* linking the http and https proxies them together */
g_settings_set_boolean (panel->priv->proxy_settings,
"use-same-proxy",
FALSE);
/* actions */
value = g_settings_get_enum (panel->priv->proxy_settings, "mode");
widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
"combobox_proxy_mode"));
panel_set_value_for_combo (panel, GTK_COMBO_BOX (widget), value);
g_signal_connect (widget, "changed",
G_CALLBACK (panel_proxy_mode_combo_changed_cb),
panel);
/* bind the proxy values */
widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
"entry_proxy_url"));
g_settings_bind (panel->priv->proxy_settings, "autoconfig-url",
widget, "text",
G_SETTINGS_BIND_DEFAULT);
/* bind the HTTP proxy values */
settings_tmp = g_settings_get_child (panel->priv->proxy_settings, "http");
widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
"entry_proxy_http"));
g_settings_bind (settings_tmp, "host",
widget, "text",
G_SETTINGS_BIND_DEFAULT);
adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (panel->priv->builder,
"adjustment_proxy_port_http"));
g_settings_bind (settings_tmp, "port",
adjustment, "value",
G_SETTINGS_BIND_DEFAULT);
g_object_unref (settings_tmp);
/* bind the HTTPS proxy values */
settings_tmp = g_settings_get_child (panel->priv->proxy_settings, "https");
widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
"entry_proxy_https"));
g_settings_bind (settings_tmp, "host",
widget, "text",
G_SETTINGS_BIND_DEFAULT);
adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (panel->priv->builder,
"adjustment_proxy_port_https"));
g_settings_bind (settings_tmp, "port",
adjustment, "value",
G_SETTINGS_BIND_DEFAULT);
g_object_unref (settings_tmp);
/* bind the FTP proxy values */
settings_tmp = g_settings_get_child (panel->priv->proxy_settings, "ftp");
widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
"entry_proxy_ftp"));
g_settings_bind (settings_tmp, "host",
widget, "text",
G_SETTINGS_BIND_DEFAULT);
adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (panel->priv->builder,
"adjustment_proxy_port_ftp"));
g_settings_bind (settings_tmp, "port",
adjustment, "value",
G_SETTINGS_BIND_DEFAULT);
g_object_unref (settings_tmp);
/* bind the SOCKS proxy values */
settings_tmp = g_settings_get_child (panel->priv->proxy_settings, "socks");
widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
"entry_proxy_socks"));
g_settings_bind (settings_tmp, "host",
widget, "text",
G_SETTINGS_BIND_DEFAULT);
adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (panel->priv->builder,
"adjustment_proxy_port_socks"));
g_settings_bind (settings_tmp, "port",
adjustment, "value",
G_SETTINGS_BIND_DEFAULT);
g_object_unref (settings_tmp);
widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder, widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
"treeview_devices")); "treeview_devices"));
panel_add_devices_columns (panel, GTK_TREE_VIEW (widget)); panel_add_devices_columns (panel, GTK_TREE_VIEW (widget));
@ -3841,7 +3608,6 @@ cc_network_panel_init (CcNetworkPanel *panel)
panel, panel,
NULL); NULL);
renderer = panel_cell_renderer_mode_new (); renderer = panel_cell_renderer_mode_new ();
gtk_cell_renderer_set_padding (renderer, 4, 0); gtk_cell_renderer_set_padding (renderer, 4, 0);
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox), gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox),
@ -3896,10 +3662,6 @@ cc_network_panel_init (CcNetworkPanel *panel)
"device_vpn_off_switch")); "device_vpn_off_switch"));
g_signal_connect (widget, "notify::active", g_signal_connect (widget, "notify::active",
G_CALLBACK (device_off_toggled), panel); G_CALLBACK (device_off_toggled), panel);
widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
"device_proxy_off_switch"));
g_signal_connect (widget, "notify::active",
G_CALLBACK (device_off_toggled), panel);
g_signal_connect (panel->priv->client, "notify::wireless-enabled", g_signal_connect (panel->priv->client, "notify::wireless-enabled",
G_CALLBACK (wireless_enabled_toggled), panel); G_CALLBACK (wireless_enabled_toggled), panel);
@ -3917,7 +3679,6 @@ cc_network_panel_init (CcNetworkPanel *panel)
g_signal_connect (widget, "clicked", g_signal_connect (widget, "clicked",
G_CALLBACK (stop_hotspot), panel); G_CALLBACK (stop_hotspot), panel);
widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder, widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
"button_wired_options")); "button_wired_options"));
g_signal_connect (widget, "clicked", g_signal_connect (widget, "clicked",

View file

@ -91,7 +91,9 @@ NetDevice *
net_device_new (void) net_device_new (void)
{ {
NetDevice *device; NetDevice *device;
device = g_object_new (NET_TYPE_DEVICE, NULL); device = g_object_new (NET_TYPE_DEVICE,
"removable", TRUE,
NULL);
return NET_DEVICE (device); return NET_DEVICE (device);
} }

View file

@ -110,6 +110,26 @@ net_object_set_title (NetObject *object, const gchar *title)
object->priv->title = g_strdup (title); object->priv->title = g_strdup (title);
} }
GtkWidget *
net_object_add_to_notebook (NetObject *object,
GtkNotebook *notebook,
GtkSizeGroup *heading_size_group)
{
GtkWidget *widget;
NetObjectClass *klass = NET_OBJECT_GET_CLASS (object);
if (klass->add_to_notebook != NULL) {
widget = klass->add_to_notebook (object,
notebook,
heading_size_group);
g_object_set_data_full (G_OBJECT (widget),
"NetObject::id",
g_strdup (object->priv->id),
g_free);
return widget;
}
return NULL;
}
/** /**
* net_object_get_property: * net_object_get_property:
**/ **/

View file

@ -23,6 +23,7 @@
#define __NET_OBJECT_H #define __NET_OBJECT_H
#include <glib-object.h> #include <glib-object.h>
#include <gtk/gtk.h>
G_BEGIN_DECLS G_BEGIN_DECLS
@ -45,9 +46,16 @@ struct _NetObject
struct _NetObjectClass struct _NetObjectClass
{ {
GObjectClass parent_class; GObjectClass parent_class;
void (* changed) (NetObject *object);
void (* removed) (NetObject *object); /* vtable */
GtkWidget *(*add_to_notebook) (NetObject *object,
GtkNotebook *notebook,
GtkSizeGroup *heading_size_group);
/* signal */
void (* changed) (NetObject *object);
void (* removed) (NetObject *object);
}; };
GType net_object_get_type (void); GType net_object_get_type (void);
@ -60,6 +68,9 @@ void net_object_set_title (NetObject *object,
const gchar *title); const gchar *title);
void net_object_emit_changed (NetObject *object); void net_object_emit_changed (NetObject *object);
void net_object_emit_removed (NetObject *object); void net_object_emit_removed (NetObject *object);
GtkWidget *net_object_add_to_notebook (NetObject *object,
GtkNotebook *notebook,
GtkSizeGroup *heading_size_group);
gboolean net_object_get_removable (NetObject *object); gboolean net_object_get_removable (NetObject *object);
void net_object_set_removable (NetObject *object, void net_object_set_removable (NetObject *object,
gboolean removable); gboolean removable);

388
panels/network/net-proxy.c Normal file
View file

@ -0,0 +1,388 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2011-2012 Richard Hughes <richard@hughsie.com>
*
* Licensed under the GNU General Public License Version 2
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include <glib-object.h>
#include <glib/gi18n.h>
#include <gio/gio.h>
#include "net-proxy.h"
#define NET_PROXY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NET_TYPE_PROXY, NetProxyPrivate))
struct _NetProxyPrivate
{
GSettings *settings;
GtkBuilder *builder;
};
G_DEFINE_TYPE (NetProxy, net_proxy, NET_TYPE_OBJECT)
static void
check_wpad_warning (NetProxy *proxy)
{
GtkWidget *widget;
gchar *autoconfig_url = NULL;
GString *string = NULL;
gboolean ret = FALSE;
guint mode;
string = g_string_new ("");
/* check we're using 'Automatic' */
mode = g_settings_get_enum (proxy->priv->settings, "mode");
if (mode != 2)
goto out;
/* see if the PAC is blank */
autoconfig_url = g_settings_get_string (proxy->priv->settings,
"autoconfig-url");
ret = autoconfig_url == NULL ||
autoconfig_url[0] == '\0';
if (!ret)
goto out;
g_string_append (string, "<small>");
/* TRANSLATORS: this is when the use leaves the PAC textbox blank */
g_string_append (string, _("Web Proxy Autodiscovery is used when a Configuration URL is not provided."));
g_string_append (string, "\n");
/* TRANSLATORS: WPAD is bad: if you enable it on an untrusted
* network, then anyone else on that network can tell your
* machine that it should proxy all of your web traffic
* through them. */
g_string_append (string, _("This is not recommended for untrusted public networks."));
g_string_append (string, "</small>");
out:
widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
"label_proxy_warning"));
gtk_label_set_markup (GTK_LABEL (widget), string->str);
g_free (autoconfig_url);
g_string_free (string, TRUE);
}
static void
settings_changed_cb (GSettings *settings,
const gchar *key,
NetProxy *proxy)
{
check_wpad_warning (proxy);
}
static void
panel_proxy_mode_combo_setup_widgets (NetProxy *proxy, guint value)
{
GtkWidget *widget;
/* hide or show the PAC text box */
widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
"heading_proxy_url"));
gtk_widget_set_visible (widget, value == 2);
widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
"entry_proxy_url"));
gtk_widget_set_visible (widget, value == 2);
/* hide or show the manual entry text boxes */
widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
"heading_proxy_http"));
gtk_widget_set_visible (widget, value == 1);
widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
"entry_proxy_http"));
gtk_widget_set_visible (widget, value == 1);
widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
"spinbutton_proxy_http"));
gtk_widget_set_visible (widget, value == 1);
widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
"heading_proxy_https"));
gtk_widget_set_visible (widget, value == 1);
widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
"entry_proxy_https"));
gtk_widget_set_visible (widget, value == 1);
widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
"spinbutton_proxy_https"));
gtk_widget_set_visible (widget, value == 1);
widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
"heading_proxy_ftp"));
gtk_widget_set_visible (widget, value == 1);
widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
"entry_proxy_ftp"));
gtk_widget_set_visible (widget, value == 1);
widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
"spinbutton_proxy_ftp"));
gtk_widget_set_visible (widget, value == 1);
widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
"heading_proxy_socks"));
gtk_widget_set_visible (widget, value == 1);
widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
"entry_proxy_socks"));
gtk_widget_set_visible (widget, value == 1);
widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
"spinbutton_proxy_socks"));
gtk_widget_set_visible (widget, value == 1);
/* perhaps show the wpad warning */
check_wpad_warning (proxy);
}
static void
panel_set_value_for_combo (NetProxy *proxy, GtkComboBox *combo_box, gint value)
{
gboolean ret;
gint value_tmp;
GtkTreeIter iter;
GtkTreeModel *model;
/* get entry */
model = gtk_combo_box_get_model (combo_box);
ret = gtk_tree_model_get_iter_first (model, &iter);
if (!ret)
return;
/* try to make the UI match the setting */
do {
gtk_tree_model_get (model, &iter,
1, &value_tmp,
-1);
if (value == value_tmp) {
gtk_combo_box_set_active_iter (combo_box, &iter);
break;
}
} while (gtk_tree_model_iter_next (model, &iter));
/* hide or show the correct widgets */
panel_proxy_mode_combo_setup_widgets (proxy, value);
}
static void
panel_proxy_mode_combo_changed_cb (GtkWidget *widget, NetProxy *proxy)
{
gboolean ret;
gint value;
GtkTreeIter iter;
GtkTreeModel *model;
/* no selection */
ret = gtk_combo_box_get_active_iter (GTK_COMBO_BOX (widget), &iter);
if (!ret)
return;
/* get entry */
model = gtk_combo_box_get_model (GTK_COMBO_BOX (widget));
gtk_tree_model_get (model, &iter,
1, &value,
-1);
/* set */
g_settings_set_enum (proxy->priv->settings, "mode", value);
/* hide or show the correct widgets */
panel_proxy_mode_combo_setup_widgets (proxy, value);
}
static GtkWidget *
net_proxy_add_to_notebook (NetObject *object,
GtkNotebook *notebook,
GtkSizeGroup *heading_size_group)
{
GtkWidget *widget;
GtkWindow *window;
NetProxy *proxy = NET_PROXY (object);
/* add widgets to size group */
widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
"heading_proxy_method"));
gtk_size_group_add_widget (heading_size_group, widget);
/* reparent */
window = GTK_WINDOW (gtk_builder_get_object (proxy->priv->builder,
"window_tmp"));
widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
"grid5"));
g_object_ref (widget);
gtk_container_remove (GTK_CONTAINER (window), widget);
gtk_notebook_append_page (notebook, widget, NULL);
g_object_unref (widget);
return widget;
}
static void
net_proxy_finalize (GObject *object)
{
NetProxy *proxy = NET_PROXY (object);
NetProxyPrivate *priv = proxy->priv;
g_clear_object (&priv->settings);
g_clear_object (&priv->builder);
G_OBJECT_CLASS (net_proxy_parent_class)->finalize (object);
}
static void
net_proxy_class_init (NetProxyClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
NetObjectClass *parent_class = NET_OBJECT_CLASS (klass);
object_class->finalize = net_proxy_finalize;
parent_class->add_to_notebook = net_proxy_add_to_notebook;
g_type_class_add_private (klass, sizeof (NetProxyPrivate));
}
static void
net_proxy_init (NetProxy *proxy)
{
GError *error = NULL;
gint value;
GSettings *settings_tmp;
GtkAdjustment *adjustment;
GtkWidget *widget;
proxy->priv = NET_PROXY_GET_PRIVATE (proxy);
proxy->priv->builder = gtk_builder_new ();
gtk_builder_add_from_file (proxy->priv->builder,
GNOMECC_UI_DIR "/network-proxy.ui",
&error);
if (error != NULL) {
g_warning ("Could not load interface file: %s", error->message);
g_error_free (error);
return;
}
proxy->priv->settings = g_settings_new ("org.gnome.system.proxy");
g_signal_connect (proxy->priv->settings,
"changed",
G_CALLBACK (settings_changed_cb),
proxy);
/* explicitly set this to false as the panel has no way of
* linking the http and https proxies them together */
g_settings_set_boolean (proxy->priv->settings,
"use-same-proxy",
FALSE);
/* actions */
value = g_settings_get_enum (proxy->priv->settings, "mode");
widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
"combobox_proxy_mode"));
panel_set_value_for_combo (proxy, GTK_COMBO_BOX (widget), value);
g_signal_connect (widget, "changed",
G_CALLBACK (panel_proxy_mode_combo_changed_cb),
proxy);
/* bind the proxy values */
widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
"entry_proxy_url"));
g_settings_bind (proxy->priv->settings, "autoconfig-url",
widget, "text",
G_SETTINGS_BIND_DEFAULT);
/* bind the HTTP proxy values */
settings_tmp = g_settings_get_child (proxy->priv->settings, "http");
widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
"entry_proxy_http"));
g_settings_bind (settings_tmp, "host",
widget, "text",
G_SETTINGS_BIND_DEFAULT);
adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (proxy->priv->builder,
"adjustment_proxy_port_http"));
g_settings_bind (settings_tmp, "port",
adjustment, "value",
G_SETTINGS_BIND_DEFAULT);
g_object_unref (settings_tmp);
/* bind the HTTPS proxy values */
settings_tmp = g_settings_get_child (proxy->priv->settings, "https");
widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
"entry_proxy_https"));
g_settings_bind (settings_tmp, "host",
widget, "text",
G_SETTINGS_BIND_DEFAULT);
adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (proxy->priv->builder,
"adjustment_proxy_port_https"));
g_settings_bind (settings_tmp, "port",
adjustment, "value",
G_SETTINGS_BIND_DEFAULT);
g_object_unref (settings_tmp);
/* bind the FTP proxy values */
settings_tmp = g_settings_get_child (proxy->priv->settings, "ftp");
widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
"entry_proxy_ftp"));
g_settings_bind (settings_tmp, "host",
widget, "text",
G_SETTINGS_BIND_DEFAULT);
adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (proxy->priv->builder,
"adjustment_proxy_port_ftp"));
g_settings_bind (settings_tmp, "port",
adjustment, "value",
G_SETTINGS_BIND_DEFAULT);
g_object_unref (settings_tmp);
/* bind the SOCKS proxy values */
settings_tmp = g_settings_get_child (proxy->priv->settings, "socks");
widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
"entry_proxy_socks"));
g_settings_bind (settings_tmp, "host",
widget, "text",
G_SETTINGS_BIND_DEFAULT);
adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (proxy->priv->builder,
"adjustment_proxy_port_socks"));
g_settings_bind (settings_tmp, "port",
adjustment, "value",
G_SETTINGS_BIND_DEFAULT);
g_object_unref (settings_tmp);
/* set header to something sane */
widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
"image_proxy_device"));
gtk_image_set_from_icon_name (GTK_IMAGE (widget),
"preferences-system-network",
GTK_ICON_SIZE_DIALOG);
widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
"label_proxy_device"));
gtk_label_set_label (GTK_LABEL (widget),
_("Proxy"));
widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
"label_proxy_status"));
gtk_label_set_label (GTK_LABEL (widget), "");
/* hide the switch until we get some more detail in the mockup */
widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
"device_proxy_off_switch"));
if (widget != NULL)
gtk_widget_hide (widget);
}
NetProxy *
net_proxy_new (void)
{
NetProxy *proxy;
proxy = g_object_new (NET_TYPE_PROXY,
"removable", FALSE,
"id", "proxy",
NULL);
return NET_PROXY (proxy);
}

View file

@ -0,0 +1,59 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2011-2012 Richard Hughes <richard@hughsie.com>
*
* Licensed under the GNU General Public License Version 2
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef __NET_PROXY_H
#define __NET_PROXY_H
#include <glib-object.h>
#include "net-object.h"
G_BEGIN_DECLS
#define NET_TYPE_PROXY (net_proxy_get_type ())
#define NET_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), NET_TYPE_PROXY, NetProxy))
#define NET_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), NET_TYPE_PROXY, NetProxyClass))
#define NET_IS_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), NET_TYPE_PROXY))
#define NET_IS_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), NET_TYPE_PROXY))
#define NET_PROXY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), NET_TYPE_PROXY, NetProxyClass))
typedef struct _NetProxyPrivate NetProxyPrivate;
typedef struct _NetProxy NetProxy;
typedef struct _NetProxyClass NetProxyClass;
struct _NetProxy
{
NetObject parent;
NetProxyPrivate *priv;
};
struct _NetProxyClass
{
NetObjectClass parent_class;
};
GType net_proxy_get_type (void);
NetProxy *net_proxy_new (void);
G_END_DECLS
#endif /* __NET_PROXY_H */

View file

@ -0,0 +1,427 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkAdjustment" id="adjustment_proxy_port_ftp">
<property name="upper">65535</property>
<property name="step_increment">1</property>
</object>
<object class="GtkAdjustment" id="adjustment_proxy_port_http">
<property name="upper">65535</property>
<property name="step_increment">1</property>
</object>
<object class="GtkAdjustment" id="adjustment_proxy_port_https">
<property name="upper">65535</property>
<property name="step_increment">1</property>
</object>
<object class="GtkAdjustment" id="adjustment_proxy_port_socks">
<property name="upper">65535</property>
<property name="step_increment">1</property>
</object>
<object class="GtkListStore" id="liststore_proxy_method">
<columns>
<!-- column-name text -->
<column type="gchararray"/>
<!-- column-name type -->
<column type="gint"/>
</columns>
<data>
<row>
<col id="0" translatable="yes" context="proxy method">None</col>
<col id="1">0</col>
</row>
<row>
<col id="0" translatable="yes" context="proxy method">Manual</col>
<col id="1">1</col>
</row>
<row>
<col id="0" translatable="yes" context="proxy method">Automatic</col>
<col id="1">2</col>
</row>
</data>
</object>
<object class="GtkWindow" id="window_tmp">
<property name="can_focus">False</property>
<child>
<object class="GtkGrid" id="grid5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">start</property>
<property name="border_width">12</property>
<property name="row_spacing">10</property>
<property name="column_spacing">6</property>
<child>
<object class="GtkImage" id="image_proxy_device">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="valign">start</property>
<property name="xalign">1</property>
<property name="pixel_size">48</property>
<property name="icon_name">preferences-system-network</property>
<property name="icon-size">6</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkVBox" id="vbox13">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">start</property>
<property name="hexpand">True</property>
<property name="spacing">3</property>
<child>
<object class="GtkLabel" id="label_proxy_device">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label">Proxy</property>
<property name="ellipsize">end</property>
<attributes>
<attribute name="weight" value="bold"/>
<attribute name="scale" value="1.2"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_proxy_status">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label">Not connected</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkAlignment" id="alignment_proxy_switch">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="valign">start</property>
<child>
<object class="GtkSwitch" id="device_proxy_off_switch">
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">end</property>
<property name="valign">start</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="heading_proxy_method">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">_Method</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">combobox_proxy_mode</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="combobox_proxy_mode">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="entry_text_column">0</property>
<property name="id_column">1</property>
<property name="model">liststore_proxy_method</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="width">2</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="heading_proxy_url">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">_Configuration URL</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">entry_proxy_url</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="entry_proxy_url">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="invisible_char_set">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
<property name="width">2</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="heading_proxy_http">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">_HTTP Proxy</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">entry_proxy_http</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="heading_proxy_https">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">H_TTPS Proxy</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">entry_proxy_https</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="heading_proxy_ftp">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">_FTP Proxy</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">entry_proxy_ftp</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">5</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="heading_proxy_socks">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">_Socks Host</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">entry_proxy_socks</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">6</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_proxy_warning">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label">WPAD warning...</property>
<property name="wrap">True</property>
<property name="width_chars">50</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">7</property>
<property name="width">3</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="entry_proxy_http">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="invisible_char_set">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="spinbutton_proxy_http">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="xalign">1</property>
<property name="invisible_char_set">True</property>
<property name="adjustment">adjustment_proxy_port_http</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">3</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="entry_proxy_https">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="invisible_char_set">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">4</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="entry_proxy_ftp">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="invisible_char_set">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">5</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="entry_proxy_socks">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="invisible_char_set">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">6</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="spinbutton_proxy_https">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="xalign">1</property>
<property name="invisible_char_set">True</property>
<property name="adjustment">adjustment_proxy_port_https</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">4</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="spinbutton_proxy_ftp">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="xalign">1</property>
<property name="invisible_char_set">True</property>
<property name="adjustment">adjustment_proxy_port_ftp</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">5</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="spinbutton_proxy_socks">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="xalign">1</property>
<property name="invisible_char_set">True</property>
<property name="adjustment">adjustment_proxy_port_socks</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">6</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
</child>
</object>
<object class="GtkSizeGroup" id="sizegroup3">
<widgets>
<widget name="combobox_proxy_mode"/>
<widget name="entry_proxy_url"/>
</widgets>
</object>
</interface>

View file

@ -1931,414 +1931,6 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkVBox" id="vbox8">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">12</property>
<property name="spacing">6</property>
<child>
<object class="GtkGrid" id="grid5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">start</property>
<property name="row_spacing">10</property>
<property name="column_spacing">6</property>
<child>
<object class="GtkImage" id="image_proxy_device">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="valign">start</property>
<property name="xalign">1</property>
<property name="pixel_size">48</property>
<property name="icon_name">preferences-system-network</property>
<property name="icon-size">6</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkVBox" id="vbox13">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">start</property>
<property name="hexpand">True</property>
<property name="spacing">3</property>
<child>
<object class="GtkLabel" id="label_proxy_device">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label">Proxy</property>
<property name="ellipsize">end</property>
<attributes>
<attribute name="weight" value="bold"/>
<attribute name="scale" value="1.2"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_proxy_status">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label">Not connected</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkAlignment" id="alignment_proxy_switch">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="valign">start</property>
<child>
<object class="GtkSwitch" id="device_proxy_off_switch">
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">end</property>
<property name="valign">start</property>
<property name="use_action_appearance">False</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="heading_proxy_method">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">_Method</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">combobox_proxy_mode</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="combobox_proxy_mode">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="model">liststore_proxy_method</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="width">2</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="heading_proxy_url">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">_Configuration URL</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">entry_proxy_url</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="entry_proxy_url">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="invisible_char_set">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
<property name="width">2</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="heading_proxy_http">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">_HTTP Proxy</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">entry_proxy_http</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="heading_proxy_https">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">H_TTPS Proxy</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">entry_proxy_https</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="heading_proxy_ftp">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">_FTP Proxy</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">entry_proxy_ftp</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">5</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="heading_proxy_socks">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">_Socks Host</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">entry_proxy_socks</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">6</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_proxy_warning">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label">WPAD warning...</property>
<property name="wrap">True</property>
<property name="width_chars">50</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">7</property>
<property name="width">3</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="entry_proxy_http">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="invisible_char_set">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="spinbutton_proxy_http">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="xalign">1</property>
<property name="invisible_char_set">True</property>
<property name="adjustment">adjustment_proxy_port_http</property>
<child internal-child="accessible">
<object class="AtkObject" id="proxy_http_a11y">
<property name="accessible-name" translatable="yes">HTTP Port</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">3</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="entry_proxy_https">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="invisible_char_set">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">4</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="entry_proxy_ftp">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="invisible_char_set">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">5</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="entry_proxy_socks">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="invisible_char_set">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">6</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="spinbutton_proxy_https">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="xalign">1</property>
<property name="invisible_char_set">True</property>
<property name="adjustment">adjustment_proxy_port_https</property>
<child internal-child="accessible">
<object class="AtkObject" id="proxy_https_a11y">
<property name="accessible-name" translatable="yes">HTTPS Port</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">4</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="spinbutton_proxy_ftp">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="xalign">1</property>
<property name="invisible_char_set">True</property>
<property name="adjustment">adjustment_proxy_port_ftp</property>
<child internal-child="accessible">
<object class="AtkObject" id="proxy_ftp_a11y">
<property name="accessible-name" translatable="yes">FTP Port</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">5</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="spinbutton_proxy_socks">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="xalign">1</property>
<property name="invisible_char_set">True</property>
<property name="adjustment">adjustment_proxy_port_socks</property>
<child internal-child="accessible">
<object class="AtkObject" id="proxy_socks_a11y">
<property name="accessible-name" translatable="yes">Socks Port</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">6</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="position">2</property>
</packing>
</child> </child>
<child type="tab"> <child type="tab">
<object class="GtkLabel" id="label46"> <object class="GtkLabel" id="label46">
@ -2392,13 +1984,6 @@
<widget name="heading_wireless_mac"/> <widget name="heading_wireless_mac"/>
<widget name="heading_mobilebb_imei"/> <widget name="heading_mobilebb_imei"/>
<widget name="heading_vpn_gateway"/> <widget name="heading_vpn_gateway"/>
<widget name="heading_proxy_method"/>
</widgets>
</object>
<object class="GtkSizeGroup" id="sizegroup3">
<widgets>
<widget name="combobox_proxy_mode"/>
<widget name="entry_proxy_url"/>
</widgets> </widgets>
</object> </object>
</interface> </interface>

View file

@ -41,6 +41,8 @@ panels/network/cc-network-panel.c
panels/network/gnome-network-panel.desktop.in.in panels/network/gnome-network-panel.desktop.in.in
[type: gettext/glade]panels/network/network.ui [type: gettext/glade]panels/network/network.ui
panels/network/panel-common.c panels/network/panel-common.c
panels/network/net-proxy.c
[type: gettext/glade]panels/network/network-proxy.ui
panels/online-accounts/cc-online-accounts-add-account-dialog.c panels/online-accounts/cc-online-accounts-add-account-dialog.c
panels/online-accounts/cc-online-accounts-panel.c panels/online-accounts/cc-online-accounts-panel.c
panels/online-accounts/gnome-online-accounts-panel.desktop.in.in panels/online-accounts/gnome-online-accounts-panel.desktop.in.in