From 5dc7525463fc6989825282f577970b2508d51807 Mon Sep 17 00:00:00 2001 From: damien Date: Fri, 2 Feb 2001 04:15:58 +0000 Subject: recoded wizard mode corrected some stuff. trying not to break draknet for cooker snapshot --- perl-install/interactive_gtk.pm | 2 +- perl-install/my_gtk.pm | 37 ++++++++++++++++++++++++++++++++----- perl-install/standalone/diskdrake | 6 ++++++ perl-install/standalone/draknet | 6 +++--- 4 files changed, 42 insertions(+), 9 deletions(-) diff --git a/perl-install/interactive_gtk.pm b/perl-install/interactive_gtk.pm index f1804d281..523d5302c 100644 --- a/perl-install/interactive_gtk.pm +++ b/perl-install/interactive_gtk.pm @@ -393,7 +393,7 @@ sub wait_messageW($$$) { $box->pack_start($_, 1, 1, 4) foreach my @l = map { new Gtk::Label($_) } @$messages; ($w->{wait_messageW} = $l[$#l])->signal_connect(expose_event => sub { $w->{displayed} = 1 }); - $w->{rwindow}->set_position('center') if ($::isStandalone && !$::isEmbedded); + $w->{rwindow}->set_position('center') if ($::isStandalone && !$::isEmbedded && !$::isWizard); $w->{window}->show_all; $w->sync until $w->{displayed}; $w; diff --git a/perl-install/my_gtk.pm b/perl-install/my_gtk.pm index 2ad4a2207..0b4d42923 100644 --- a/perl-install/my_gtk.pm +++ b/perl-install/my_gtk.pm @@ -41,6 +41,33 @@ sub new { $o->{rwindow}->set_position('center_always') if $::isStandalone; $o->{rwindow}->set_modal(1) if $my_gtk::grab || $o->{grab}; + if ($::isWizard) { + my $rc = "/etc/gtk/wizard.rc"; + -r $rc or $rc = dirname(__FILE__) . "/wizard.rc"; + Gtk::Rc->parse($rc); + $o->{window} = new Gtk::VBox(0,0); + $o->{window}->set_border_width(10); + $o->{rwindow} = $o->{window}; + if (!defined($::WizardWindow)) { + $::WizardWindow = new Gtk::Window; + $::WizardWindow->set_position('center_always'); + $::WizardTable = new Gtk::Table(2, 2, 0); + $::WizardWindow->add($::WizardTable); + my $draw1 = new Gtk::DrawingArea; + $draw1->set_usize(50,50); + my $draw2 = new Gtk::DrawingArea; + $draw1->set_usize(50,50); + my $draw3 = new Gtk::DrawingArea; + $draw1->set_usize(50,50); + $::WizardTable->attach($draw1, 0, 1, 0, 1, 'fill', 'fill', 0, 0); + $::WizardTable->attach($draw2, 0, 1, 1, 2, 'fill', 'fill', 0, 0); + $::WizardTable->attach($draw3, 1, 2, 0, 1, 'fill', 'fill', 0, 0); + $::WizardWindow->show_all; + my_gtk::flush(); + } + $::WizardTable->attach($o->{window}, 1, 2, 1, 2, {'fill', 'expand'}, {'fill', 'expand'}, 0, 0); + } + $::isEmbedded or return $o; $o->{window} = new Gtk::VBox(0,0); $o->{rwindow} = $o->{window}; @@ -248,12 +275,12 @@ sub gtkxpm { new Gtk::Pixmap(gtkcreate_xpm(@_)) } sub create_okcancel { my ($w, $ok, $cancel, $spread, @other) = @_; my $one = ($ok xor $cancel); - $spread ||= $::isWizard ? "edge" : "spread"; - $ok ||= $::isWizard ? _("Next ->") : _("Ok"); - - my $b1 = gtksignal_connect($w->{ok} = new Gtk::Button($ok), clicked => $w->{ok_clicked} || sub { $::isWizard or $w->{retval} = 1; Gtk->main_quit }); + $spread ||= $::isWizard ? "end" : "spread"; + $ok ||= _("Ok"); + $::isWizard and $ok = _("Next ->"); + my $b1 = gtksignal_connect($w->{ok} = new Gtk::Button($ok), clicked => $w->{ok_clicked} || sub { $w->{retval} = 1; Gtk->main_quit }); my $b2 = !$one && gtksignal_connect($w->{cancel} = new Gtk::Button($cancel || _("Cancel")), clicked => $w->{cancel_clicked} || sub { log::l("default cancel_clicked"); undef $w->{retval}; Gtk->main_quit }); - my @l = grep { $_ } $::isWizard ? ($b2, $b1) : ($b1, $b2); + my @l = grep { $_ } ($b1, $b2); push @l, map { gtksignal_connect(new Gtk::Button($_->[0]), clicked => $_->[1]) } @other; $_->can_default($::isWizard) foreach @l; diff --git a/perl-install/standalone/diskdrake b/perl-install/standalone/diskdrake index 1902069c8..4ecab2b75 100755 --- a/perl-install/standalone/diskdrake +++ b/perl-install/standalone/diskdrake @@ -33,6 +33,12 @@ use fs; use log; use c; +$::isEmbedded = ($::XID, $::CCPID) = "@ARGV" =~ /--embedded (\S*) (\S*)/; + +print "EMBED\n" if $::isEmbedded; +print "XID : $::XID\n"; +print "CCPID : $::CCPID\n"; + local $_ = join '', @ARGV; /-h/ and die "usage: diskdrake [--expert] [--testing]\n"; diff --git a/perl-install/standalone/draknet b/perl-install/standalone/draknet index 5698c54c5..174481d9a 100755 --- a/perl-install/standalone/draknet +++ b/perl-install/standalone/draknet @@ -56,7 +56,7 @@ $::wizard_xpm = "/usr/share/pixmaps/internet.xpm"; my $in = vnew interactive('su'); -#goto dd; +goto dd; my $window1 = new Gtk::Window -toplevel; $window1->signal_connect ( delete_event => sub { Gtk->exit(0); }); $window1->set_position(1); @@ -75,7 +75,8 @@ $hbox1->pack_start($combo1,0,0,0); my $hbox2 = new Gtk::HBox(0,0); $vbox1->pack_start($hbox2,1,1,0); $hbox2->pack_start(new Gtk::Label(_("Hostname: ")),0,0,0); -$hbox2->pack_start(new Gtk::Label("petite.mandrakesoft.com"),0,0,0); +chop (my $hostname = `hostname`); +$hbox2->pack_start(new Gtk::Label($hostname),0,0,0); $vbox1->pack_start(new Gtk::HSeparator,1,1,5); @@ -107,7 +108,6 @@ $button1->signal_connect( 'clicked', \&configure_net ); my $button2 = new Gtk::Button(_("Connect...")); $table1->attach($button2, 2, 3, 2, 3, 'fill', 'fill',0,0); - my $separator2 = new Gtk::HSeparator; $vbox1->pack_start($separator2,1,1,5); -- cgit v1.2.1