diff options
author | Guillaume Cottenceau <gc@mandriva.com> | 2002-08-30 18:15:36 +0000 |
---|---|---|
committer | Guillaume Cottenceau <gc@mandriva.com> | 2002-08-30 18:15:36 +0000 |
commit | 825a6a0d7b41e624c01d0236ec73d31296c352c6 (patch) | |
tree | 9932bf3bb6ca7b5d10ca80aca7e4d122a402d5bd /edit-urpm-sources.pl | |
parent | 0e08c3052db01f30ac90f56c6d57a8ec3b01e29b (diff) | |
download | rpmdrake-825a6a0d7b41e624c01d0236ec73d31296c352c6.tar rpmdrake-825a6a0d7b41e624c01d0236ec73d31296c352c6.tar.gz rpmdrake-825a6a0d7b41e624c01d0236ec73d31296c352c6.tar.bz2 rpmdrake-825a6a0d7b41e624c01d0236ec73d31296c352c6.tar.xz rpmdrake-825a6a0d7b41e624c01d0236ec73d31296c352c6.zip |
handle /etc/urpmi/proxy.cfg proxies, have a proxy dialog config in
edit-urpm-sources
Diffstat (limited to 'edit-urpm-sources.pl')
-rwxr-xr-x | edit-urpm-sources.pl | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/edit-urpm-sources.pl b/edit-urpm-sources.pl index 2d53c58f..d72dfbc1 100755 --- a/edit-urpm-sources.pl +++ b/edit-urpm-sources.pl @@ -211,6 +211,40 @@ sub update_callback { } } +sub proxy_callback { + my $w = my_gtk->new(_("Configure proxies")); + my ($proxy, $proxy_user) = curl_download::readproxy; + my ($user, $pass) = $proxy_user =~ /^([^:]+):([^:]+)$/; + gtkadd($w->{window}, + gtkpack__(new Gtk::VBox(0, 5), + new Gtk::Label(_("If you need a proxy, enter the hostname and an optional port (syntax: <proxyhost[:port]>):")), + gtkpack_(new Gtk::HBox(0, 10), + 0, gtkset_active(my $proxybutton = new Gtk::CheckButton(_("Proxy hostname:")), to_bool($proxy)), + 1, gtkset_sensitive(my $proxyentry = gtkentry($proxy), to_bool($proxy))), + new Gtk::Label(_("You may specify a user/password for the proxy authentication:")), + gtkpack_(new Gtk::HBox(0, 10), + 0, gtkset_active(my $proxyuserbutton = new Gtk::CheckButton(_("User:")), to_bool($proxy_user)), + 1, gtkset_sensitive(my $proxyuserentry = gtkentry($user), to_bool($proxy_user)), + 0, new Gtk::Label(_("Password:")), + 1, gtkset_sensitive(my $proxypasswordentry = gtkentry($pass), to_bool($proxy_user))), + new Gtk::HSeparator, + gtkpack(create_hbox(), + gtksignal_connect(new Gtk::Button(_("Ok")), clicked => sub { $w->{retval} = 1; Gtk->main_quit }), + gtksignal_connect(new Gtk::Button(_("Cancel")), clicked => sub { $w->{retval} = 0; Gtk->main_quit })))); + $proxybutton->signal_connect(clicked => sub { $proxyentry->set_sensitive($_[0]->get_active); + $_[0]->get_active and return; + $proxyuserbutton->set_active(0); + $proxyuserentry->set_sensitive(0); + $proxypasswordentry->set_sensitive(0); }); + $proxyuserbutton->signal_connect(clicked => sub { $proxyuserentry->set_sensitive($_[0]->get_active); + $proxypasswordentry->set_sensitive($_[0]->get_active) }); + $w->{rwindow}->set_position('center'); + if ($w->main) { + curl_download::writeproxy($proxybutton->get_active ? $proxyentry->get_text : '', + $proxyuserbutton->get_active ? ($proxyuserentry->get_text.':'.$proxypasswordentry->get_text) : ''); + } +} + sub mainwindow { my %pixmaps = (selected => [ gtkcreate_png('selected') ], unselected => [ gtkcreate_png('unselected') ]); my $mainw = my_gtk->new(_("Configure sources")); @@ -248,7 +282,8 @@ sub mainwindow { clicked => sub { edit_callback and $reread_media->() }), 0), gtksignal_connect(new Gtk::Button(but(_("Add..."))), clicked => sub { add_callback and $reread_media->(); }), - gtksignal_connect(new Gtk::Button(but(_("Update..."))), clicked => \&update_callback))), + gtksignal_connect(new Gtk::Button(but(_("Update..."))), clicked => \&update_callback), + gtksignal_connect(new Gtk::Button(but(_("Proxy..."))), clicked => \&proxy_callback))), 0, new Gtk::HSeparator, 0, gtkpack(create_hbox(), gtksignal_connect(new Gtk::Button(_("Save and quit")), clicked => sub { $mainw->{retval} = 1; Gtk->main_quit }), |