Against svn HEAD (previous was agains Ubuntu 9.04 package)
Also removes the use Gnome2 mentioned above.
Index: FrontEnd/Gnome.pm
===================================================================
--- FrontEnd/Gnome.pm	(revision 2355)
+++ FrontEnd/Gnome.pm	(working copy)
@@ -18,9 +18,8 @@
 # installed.
 eval q{
 	use Gtk2;
-	use Gnome2;
 };
-die "Unable to load Gnome -- is libgnome2-perl installed?\n" if $@;
+die "Unable to load Gtk -- is libgtk2-perl installed?\n" if $@;
 
 =head1 DESCRIPTION
 
@@ -38,27 +37,46 @@
 
 our @ARGV_for_gnome=('--sm-disable');
 
-sub create_druid_page {
+sub create_assistant_page {
 	my $this=shift;
-	
-   	$this->druid_page(Gnome2::DruidPageStandard->new);
-	$this->druid_page->set_logo($this->logo);
-	$this->druid_page->signal_connect("back", sub {
-		$this->goback(1);
-		Gtk2->main_quit;
-		return 1;
-	});
-	$this->druid_page->signal_connect("next", sub {
+
+	$this->assistant_page(Gtk2::VBox->new);
+
+	if ($this->logo) {
+		$this->assistant->set_page_header_image($this->assistant_page, $this->logo);
+	}
+
+	$this->assistant->append_page($this->assistant_page);
+	$this->assistant->set_page_type($this->assistant_page, 'content');
+	$this->assistant->set_page_complete($this->assistant_page, 'false');
+	$this->assistant_page->show_all;
+}
+
+my $max_page= 0;
+
+sub prepare_callback {
+	my ($assistant, $page, $this) = @_;
+	my $current_page = $assistant->get_current_page;
+
+	if ($max_page < $current_page) {
+		$max_page = $current_page;
 		$this->goback(0);
 		Gtk2->main_quit;
-		return 1;
-	});
-	$this->druid_page->signal_connect("cancel", sub { exit 1 });
-	$this->druid_page->show;
-	$this->druid->append_page($this->druid_page);
-	$this->druid->set_page($this->druid_page);
+	} else {
+		$this->goback(1);
+	}
 }
 
+sub forward_page_func {
+	my ($current_page, $assistant) = @_;
+
+	if ($current_page == $assistant->get_n_pages - 1) {
+		return 0;
+	} else {
+		return $current_page + 1;
+	}
+}
+
 sub init {
 	my $this=shift;
 	
@@ -75,13 +93,13 @@
 	}
 	else {
 		@ar...@argv_for_gnome; # temporary change at first
-		Gnome2::Program->init('GNOME Debconf', '2.0');
+		Gtk2->init;
 		exit(0); # success
 	}
 	
 	my @gnome_suc...@argv;
 	@ar...@argv_for_gnome;
-	Gnome2::Program->init('GNOME Debconf', '2.0');
+	Gtk2->init;
 	@ar...@gnome_sucks;
 	
 	$this->SUPER::init(@_);
@@ -89,14 +107,14 @@
 	$this->capb('backup');
 	$this->need_tty(0);
 	
-	$this->win(Gtk2::Window->new("toplevel"));
-	$this->win->set_position("center");
-	$this->win->set_default_size(600, 400);
+	$this->assistant(Gtk2::Assistant->new);
+	$this->assistant->set_position("center");
+	$this->assistant->set_default_size(600, 400);
 	my $hostname = `hostname`;
 	chomp $hostname;
-	$this->win->set_title(to_Unicode(sprintf(gettext("Debconf on %s"), $hostname)));
-	$this->win->signal_connect("delete_event", sub { exit 1 });
-	
+	$this->assistant->set_title(to_Unicode(sprintf(gettext("Debconf on %s"), $hostname)));
+	$this->assistant->signal_connect("delete_event", sub { exit 1 });
+
 	my $distribution='';
 	if (system('type lsb_release >/dev/null 2>&1') == 0) {
 		$distribution=lc(`lsb_release -is`);
@@ -110,11 +128,13 @@
 		$this->logo(Gtk2::Gdk::Pixbuf->new_from_file($logo));
 	}
 	
-	$this->druid(Gnome2::Druid->new);
-	$this->druid->show;
-	$this->win->add($this->druid);
-	
-	$this->create_druid_page ();
+	$this->assistant->signal_connect("cancel", sub { exit 1 });
+ 	$this->assistant->signal_connect("close", sub { exit 1 });
+ 	$this->assistant->signal_connect("prepare", \&prepare_callback, $this);
+ 	$this->assistant->set_forward_page_func(\&forward_page_func, $this->assistant);
+ 	$this->create_assistant_page();
+ 
+ 	$this->assistant->show;
 }
 
 =item go
@@ -130,24 +150,23 @@
 	
 	my $interactive='';
 	foreach my $element (@elements) {
-		# Noninteractive elemements have no hboxes.
+		# Noninteractive elements have no hboxes.
 		next unless $element->hbox;
 
 		$interactive=1;
-		$this->druid_page->vbox->pack_start($element->hbox, $element->fill, $element->expand, 0);
+		$this->assistant_page->pack_start($element->hbox, $element->fill, $element->expand, 0);
 	}
 
 	if ($interactive) {
-	        $this->druid_page->set_title(to_Unicode($this->title));
+	        $this->assistant->set_page_title($this->assistant_page, to_Unicode($this->title));
 		if ($this->capb_backup) {
-			$this->druid->set_buttons_sensitive(1, 1, 1, 1);
+#			$this->assistant->set_page_complete($this->assistant_page, 'false');
 		}
 		else {
-			$this->druid->set_buttons_sensitive(0, 1, 1, 1);
+#			$this->assistant->set_page_complete($this->assistant_page, 'false');
 		}
-		$this->win->show;
+		$this->create_assistant_page();
 		Gtk2->main;
-		$this->create_druid_page ();
 	}
 
 	# Display all elements. This does nothing for gnome
@@ -166,11 +185,11 @@
 	$this->SUPER::progress_start(@_);
 
 	my $element=$this->progress_bar;
-	$this->druid_page->vbox->pack_start($element->hbox, $element->fill, $element->expand, 0);
-	$this->druid_page->set_title(to_Unicode($this->title));
+	$this->assistant_page->pack_start($element->hbox, $element->fill, $element->expand, 0);
+	$this->assistant->set_page_title($this->assitant_page, to_Unicode($this->title));
 	# TODO: no backup support yet
-	$this->druid->set_buttons_sensitive(0, 0, 1, 1);
-	$this->win->show;
+	$this->assistant->set_page_complete($this->assistant_page, 'false');
+	$this->assistant->show_all;
 
 	while (Gtk2->events_pending) {
 		Gtk2->main_iteration;
@@ -208,7 +227,7 @@
 		Gtk2->main_iteration;
 	}
 
-	$this->create_druid_page();
+	$this->create_assistant_page();
 }
 
 =back
Index: Element/Gnome/Select.pm
===================================================================
--- Element/Gnome/Select.pm	(revision 2355)
+++ Element/Gnome/Select.pm	(working copy)
@@ -9,7 +9,6 @@
 package Debconf::Element::Gnome::Select;
 use strict;
 use Gtk2;
-use Gnome2;
 use utf8;
 use Debconf::Encoding qw(to_Unicode);
 use base qw(Debconf::Element::Gnome Debconf::Element::Select);

Reply via email to