diff --git a/capplets/network/ChangeLog b/capplets/network/ChangeLog index 5ec507c89..55c3e56f0 100644 --- a/capplets/network/ChangeLog +++ b/capplets/network/ChangeLog @@ -1,3 +1,9 @@ +2002-07-10 Jody Goldberg + + http://bugzilla.gnome.org/show_bug.cgi?id=85929 + * gnome-network-preferences.c (extract_proxy_host) : validate. + This is not the prettiest way to do this, but it is effective. + 2002-06-17 Jody Goldberg * Release 2.0.0 diff --git a/capplets/network/gnome-network-preferences.c b/capplets/network/gnome-network-preferences.c index 2697d5866..04cc13749 100644 --- a/capplets/network/gnome-network-preferences.c +++ b/capplets/network/gnome-network-preferences.c @@ -28,6 +28,7 @@ #include #include #include +#include #include "capplet-util.h" #include "gconf-property-editor.h" @@ -50,6 +51,29 @@ cb_dialog_response (GtkDialog *dialog, gint response_id) gtk_main_quit (); } +static GConfValue * +extract_proxy_host (GConfPropertyEditor *peditor, const GConfValue *orig) +{ + char const *entered_text = gconf_value_get_string (orig); + GConfValue *res = NULL; + + if (entered_text != NULL) { + GnomeVFSURI *uri = gnome_vfs_uri_new (entered_text); + if (uri != NULL) { + char const *host = gnome_vfs_uri_get_host_name (uri); + if (host != NULL) { + res = gconf_value_new (GCONF_VALUE_STRING); + gconf_value_set_string (res, host); + } + gnome_vfs_uri_unref (uri); + } + } + + if (res != NULL) + return res; + return gconf_value_copy (orig); +} + static void setup_dialog (GladeXML *dialog) { @@ -60,7 +84,9 @@ setup_dialog (GladeXML *dialog) gconf_peditor_widget_set_guard (peditor, WID ("host_port_table")); peditor = GCONF_PROPERTY_EDITOR (gconf_peditor_new_string ( - NULL, PROXY_HOST_KEY, WID ("host_entry"), NULL)); + NULL, PROXY_HOST_KEY, WID ("host_entry"), + "conv-from-widget-cb", extract_proxy_host, + NULL)); peditor = GCONF_PROPERTY_EDITOR (gconf_peditor_new_integer ( NULL, PROXY_PORT_KEY, WID ("port_entry"), NULL)); @@ -84,6 +110,7 @@ main (int argc, char **argv) { GladeXML *dialog; GConfClient *client; + GtkWidget *widget; bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); @@ -101,8 +128,9 @@ main (int argc, char **argv) "network_dialog", NULL); setup_dialog (dialog); - - gtk_widget_show_all (WID ("network_dialog")); + widget = WID ("network_dialog"); + capplet_set_icon (widget, "gnome-globe.png"); + gtk_widget_show_all (widget); gtk_main (); g_object_unref (client); diff --git a/capplets/network/gnome-network-preferences.desktop.in b/capplets/network/gnome-network-preferences.desktop.in index ef57a8906..f681f179f 100644 --- a/capplets/network/gnome-network-preferences.desktop.in +++ b/capplets/network/gnome-network-preferences.desktop.in @@ -1,6 +1,6 @@ [Desktop Entry] -_Name=Network -_Comment=Network Preferences +_Name=Network Proxy +_Comment=Network Proxy Preferences Exec=gnome-network-preferences Icon=gnome-globe.png Terminal=0 diff --git a/capplets/network/gnome-network-preferences.glade b/capplets/network/gnome-network-preferences.glade index 8bf334e1c..91f32861a 100644 --- a/capplets/network/gnome-network-preferences.glade +++ b/capplets/network/gnome-network-preferences.glade @@ -4,7 +4,7 @@ - Network Preferences + Network Proxy Preferences GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE False @@ -45,6 +45,7 @@ True True + True True gtk-close True @@ -62,270 +63,262 @@ - - 4 + + 8 True - HTTP Proxy Settings - 0 - GTK_SHADOW_ETCHED_IN + False + 2 - - 8 + True + True + _Use HTTP proxy + True + GTK_RELIEF_NORMAL + False + False + True + + + 0 + False + False + + + + + + True + 2 + 2 False - 2 + 4 + 4 - + + True + _Location: + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + host_entry + + + 0 + 1 + 0 + 1 + fill + + + + + + True True - _Use HTTP proxy - True - GTK_RELIEF_NORMAL - False - False - True + True + True + 0 + + True + * + False - 0 - False - False + 1 + 2 + 0 + 1 + - + True - 2 - 2 - False - 4 - 4 - - - - True - _Location: - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - 0 - 1 - 0 - 1 - fill - - - - - - - True - True - True - True - 0 - - True - * - False - - - 1 - 2 - 0 - 1 - - - - - - - True - P_ort: - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - 0 - 1 - 1 - 2 - fill - - - - - - - True - True - True - True - 0 - - True - * - False - - - 1 - 2 - 1 - 2 - - - + P_ort: + True + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + port_entry - 0 - False - False + 0 + 1 + 1 + 2 + fill + - + True True - Pro_xy requires a username and password - True - GTK_RELIEF_NORMAL - False - False - True + True + True + 0 + + True + * + False - 0 - False - False - - - - - - True - 2 - 2 - False - 4 - 4 - - - - True - User_name: - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - user_entry - - - 0 - 1 - 0 - 1 - fill - - - - - - - True - Pass_word: - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - passwd_entry - - - 0 - 1 - 1 - 2 - fill - - - - - - - True - True - True - True - 0 - - True - * - False - - - 1 - 2 - 0 - 1 - - - - - - - True - True - True - False - 0 - - True - * - False - - - 1 - 2 - 1 - 2 - - - - - - 0 - True - True + 1 + 2 + 1 + 2 + + + 0 + False + False + + + + + + True + True + Pro_xy requires username and password + True + GTK_RELIEF_NORMAL + False + False + True + + + 0 + False + False + + + + + + True + 2 + 2 + False + 4 + 4 + + + + True + User_name: + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + user_entry + + + 0 + 1 + 0 + 1 + fill + + + + + + + True + Pass_word: + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + passwd_entry + + + 0 + 1 + 1 + 2 + fill + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 0 + 1 + + + + + + + True + True + True + False + 0 + + True + * + False + + + 1 + 2 + 1 + 2 + + + + + + 0 + True + True +