summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/drakproxy
blob: 1bd02ac773384f7d0a2e2884da11024ebf4ed379 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/usr/bin/perl

#
# DindinX (odin@mandrakesoft.com)
#
# Copyright 2001 MandrakeSoft
#
# This software may be freely redistributed under the terms of the GNU
# public license.
#
# 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., 675 Mass Ave, Cambridge, MA 02139, USA.
#

use lib qw(/usr/lib/libDrakX);

use common qw(:common :system :file);
use interactive;
use standalone;
use log;
use c;
# use netconnect;
# use detect_devices;

$::isEmbedded = ($::XID, $::CCPID) = "@ARGV" =~ /--embedded (\w+) (\w+)/;

local $_ = join '', @ARGV;

/-h/ and die "usage: drakproxy [--version]\n";
/-version/ and die 'version: drakproxy 1.0 2001/05/22 dindinx'."\n";
$::isEmbedded or $::isWizard = 1;
$::Wizard_pix_up = "wiz_drakgw.png";    # FIXME
$::Wizard_title = _("Proxy handling");

my $in = interactive::vnew('su', 'default');

pur_gtk_mode() if $::isEmbedded && ref($in) =~ /gtk/;

begin:

$::Wizard_no_previous = 1;

$in->ask_okcancel(_("Proxy configuration"), _("blabla proxy"), 1) or quit_global($in, 0);

my $url = $in->ask_from_entry($url, _("foo"), _("url"));
print STDERR $url, "\n";

undef $::Wizard_no_previous;

log::l("[drakproxy] Installation complete, exiting\n");
quit_global($in, 0);

sub quit_global {
    my ($in, $exitcode) = @_;
    $in->exit($exitcode);
    goto begin
}

sub pur_gtk_mode
{
    require Gtk;
    init Gtk;
    my $window1 = $::isEmbedded ? new Gtk::Plug ($::XID) : new Gtk::Window -toplevel;
    $window1->signal_connect ( delete_event => sub { Gtk->exit(0); });
    $window1->set_position(1);
    $window1->set_title(_("Proxy configuration"));
    $window1->border_width(10);
    my $vbox1 = new Gtk::VBox(0,0);
    $window1->add($vbox1);
    my $hbox1 = new Gtk::HBox(0,0);
    $vbox1->pack_start($hbox1,1,1,0);
    my $label1 = new Gtk::Label(
_("Welcome to the Proxy Connection utility!

Click on Configure to launch the setup wizard."));
    $hbox1->pack_start($label1,1,1,0);
    my $hbox2 = new Gtk::HBox(0,0);
    $vbox1->pack_start($hbox2,1,1,0);
    
    my $bbox1 = new Gtk::HButtonBox;
    $vbox1->pack_start($bbox1,0,0,0);
    $bbox1->set_layout(-end);
    my $button_conf = new Gtk::Button _("Configure");
    $button_conf->signal_connect ( clicked => sub {
					   system("/usr/sbin/drakgw --wizard");
				       });
    $bbox1->add($button_conf);
    my $button_cancel = new Gtk::Button _("Cancel");
    $button_cancel->signal_connect ( clicked => sub {
					 kill(USR1, $::CCPID);
				     });
    $bbox1->add($button_cancel);
    $window1->show_all();
    Gtk->main_iteration while Gtk->events_pending;
    $::isEmbedded and kill USR2, $::CCPID;
    Gtk->main;
    Gtk->exit(0);
    
}

#-------------------------------------------------
#- $Log$
#- Revision 1.1  2001/06/11 15:22:41  odin
#- first import of drakproxy
#-
#-