diff options
author | Olivier Blin <oblin@mandriva.org> | 2005-02-07 10:54:55 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.org> | 2005-02-07 10:54:55 +0000 |
commit | 792fbcbd41bff962b7e4db4478f067ce6663bab9 (patch) | |
tree | 4820de2425f7a3f8c1fccad5d5ae336a1244346f | |
parent | 149736ca0cd7c709b8b5d09e38c37f4b531bc6ce (diff) | |
download | drakx-792fbcbd41bff962b7e4db4478f067ce6663bab9.tar drakx-792fbcbd41bff962b7e4db4478f067ce6663bab9.tar.gz drakx-792fbcbd41bff962b7e4db4478f067ce6663bab9.tar.bz2 drakx-792fbcbd41bff962b7e4db4478f067ce6663bab9.tar.xz drakx-792fbcbd41bff962b7e4db4478f067ce6663bab9.zip |
make it easy to use other GConf interfaces
-rw-r--r-- | perl-install/network/network.pm | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/perl-install/network/network.pm b/perl-install/network/network.pm index 5e66f6ee0..411b5030b 100644 --- a/perl-install/network/network.pm +++ b/perl-install/network/network.pm @@ -351,40 +351,45 @@ xml:readonly:$defaults_dir my $gconf = Gnome2::GConf::Client->get_source("xml::$p_defaults_dir", 1); my $use_alternate_proxy; + my $gconf_set = sub { + my ($key, $type, $value) = @_; + $gconf->set($key, { type => $type, value => $value }); + }; + #- http proxy if (my ($user, $password, $host, $port) = $u->{http_proxy} =~ m,^http://(?:([^:\@]+)(?::([^:\@]+))?\@)?([^\:]+)(?::(\d+))?$,) { $port ||= 80; - $gconf->set_bool("/system/http_proxy/use_http_proxy", 1); - $gconf->set_string("/system/http_proxy/host", $host); - $gconf->set_int("/system/http_proxy/port", $port); - $gconf->set_bool("/system/http_proxy/use_authentication", to_bool($user)); - $user and $gconf->set_string("/system/http_proxy/authentication_user", $user); - $password and $gconf->set_string("/system/http_proxy/authentication_password", $password); + $gconf_set->("/system/http_proxy/use_http_proxy", "bool", 1); + $gconf_set->("/system/http_proxy/host", "string", $host); + $gconf_set->("/system/http_proxy/port", "int", $port); + $gconf_set->("/system/http_proxy/use_authentication", "bool", to_bool($user)); + $user and $gconf_set->("/system/http_proxy/authentication_user", "string", $user); + $password and $gconf_set->("/system/http_proxy/authentication_password", "string", $password); #- https proxy (ssl) - $gconf->set_string("/system/proxy/secure_host", $host); - $gconf->set_int("/system/proxy/secure_port", $port); + $gconf_set->("/system/proxy/secure_host", "string", $host); + $gconf_set->("/system/proxy/secure_port", "int", $port); $use_alternate_proxy = 1; } else { - $gconf->set_bool("/system/http_proxy/use_http_proxy", 0); + $gconf_set->("/system/http_proxy/use_http_proxy", "bool", 0); #- clear the ssl host so that it isn't used if the manual proxy is activated for ftp - $gconf->set_string("/system/proxy/secure_host", ""); + $gconf_set->("/system/proxy/secure_host", "string", ""); } #- ftp proxy if (my ($host, $port) = $u->{ftp_proxy} =~ m,^(?:http|ftp)://(?:[^:\@]+(?::[^:\@]+)?\@)?([^\:]+)(?::(\d+))?$,) { $port ||= 21; - $gconf->set_string("/system/proxy/mode", "manual"); - $gconf->set_string("/system/proxy/ftp_host", $host); - $gconf->set_int("/system/proxy/ftp_port", $port); + $gconf_set->("/system/proxy/mode", "string", "manual"); + $gconf_set->("/system/proxy/ftp_host", "string", $host); + $gconf_set->("/system/proxy/ftp_port", "int", $port); $use_alternate_proxy = 1; } else { #- clear the ftp host so that it isn't used if the manual proxy is activated for ssl - $gconf->set_string("/system/proxy/ftp_host", ""); + $gconf_set->("/system/proxy/ftp_host", "string", ""); } #- set proxy mode to manual if either https or ftp is used - $gconf->set_string("/system/proxy/mode", $use_alternate_proxy ? "manual" : "none"); + $gconf_set->("/system/proxy/mode", "string", $use_alternate_proxy ? "manual" : "none"); #- apply settings in local file $gconf->suggest_sync; |