<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/perl -w
# This file was preprocessed, do not edit!


package Debconf::FrontEnd::Gnome;
use strict;
use utf8;
use Debconf::Gettext;
use Debconf::Config;
use Debconf::Encoding qw(to_Unicode);
use base qw{Debconf::FrontEnd};


our @ARGV_for_gnome=('--sm-disable');

sub create_assistant_page {
	my $this=shift;

	$this-&gt;assistant_page(Gtk2::VBox-&gt;new);
	$this-&gt;assistant-&gt;append_page($this-&gt;assistant_page);

	if ($this-&gt;logo) {
		$this-&gt;assistant-&gt;set_page_header_image($this-&gt;assistant_page, $this-&gt;logo);
	}

	$this-&gt;configure_assistant_page;
	$this-&gt;assistant_page-&gt;show_all;
}

sub configure_assistant_page {
	my $this=shift;

	$this-&gt;assistant-&gt;set_page_title($this-&gt;assistant_page, to_Unicode($this-&gt;title));
	if ($this-&gt;capb_backup) {
		$this-&gt;assistant-&gt;set_page_type($this-&gt;assistant_page, 'content');
	} else {
		$this-&gt;assistant-&gt;set_page_type($this-&gt;assistant_page, 'intro');
	}
	$this-&gt;assistant-&gt;set_page_complete($this-&gt;assistant_page, 1);
}

sub reset_assistant_page {
	my $this=shift;

	$this-&gt;assistant_page($this-&gt;assistant-&gt;get_nth_page($this-&gt;assistant-&gt;get_current_page));
	foreach my $element ($this-&gt;assistant_page-&gt;get_children) {
		$this-&gt;assistant_page-&gt;remove($element);
	}
}

my $prev_page = 0;

sub prepare_callback {
	my ($assistant, $page, $this) = @_;
	my $current_page = $assistant-&gt;get_current_page;

	if ($prev_page &lt; $current_page) {
		$this-&gt;goback(0);
		if (Gtk2-&gt;main_level) {
			Gtk2-&gt;main_quit;
		}
	} elsif ($prev_page &gt; $current_page) {
		$this-&gt;goback(1);
		if (Gtk2-&gt;main_level) {
			Gtk2-&gt;main_quit;
		}
	}
	$prev_page = $current_page;
}

sub forward_page_func {
	my ($current_page, $assistant) = @_;

	if ($current_page == $assistant-&gt;get_n_pages - 1) {
		return 0;
	} else {
		return $current_page + 1;
	}
}

sub init {
	my $this=shift;
	
	if (fork) {
		wait(); # for child
		if ($? != 0) {
			die "DISPLAY problem?\n";
		}
	}
	else {
		use Gtk2;

		@ARGV=@ARGV_for_gnome; # temporary change at first
		Gtk2-&gt;init;

		my $window = Gtk2::Window-&gt;new('toplevel');

		exit(0); # success
	}
	
	eval q{use Gtk2;};
	die "Unable to load Gtk -- is libgtk2-perl installed?\n" if $@;

	my @gnome_sucks=@ARGV;
	@ARGV=@ARGV_for_gnome;
	Gtk2-&gt;init;
	@ARGV=@gnome_sucks;
	
	$this-&gt;SUPER::init(@_);
	$this-&gt;interactive(1);
	$this-&gt;capb('backup');
	$this-&gt;need_tty(0);
	
	$this-&gt;assistant(Gtk2::Assistant-&gt;new);
	$this-&gt;assistant-&gt;set_position("center");
	$this-&gt;assistant-&gt;set_default_size(600, 400);
	my $hostname = `hostname`;
	chomp $hostname;
	$this-&gt;assistant-&gt;set_title(to_Unicode(sprintf(gettext("Debconf on %s"), $hostname)));
	$this-&gt;assistant-&gt;signal_connect("delete_event", sub { exit 1 });

	my $distribution='';
	if (system('type lsb_release &gt;/dev/null 2&gt;&amp;1') == 0) {
		$distribution=lc(`lsb_release -is`);
		chomp $distribution;
	} elsif (-e '/etc/debian_version') {
		$distribution='debian';
	}

	my $logo="/usr/share/pixmaps/$distribution-logo.png";
	if (-e $logo) {
		$this-&gt;logo(Gtk2::Gdk::Pixbuf-&gt;new_from_file($logo));
	}
	
	$this-&gt;assistant-&gt;signal_connect("cancel", sub { exit 1 });
	$this-&gt;assistant-&gt;signal_connect("close", sub { exit 1 });
	$this-&gt;assistant-&gt;signal_connect("prepare", \&amp;prepare_callback, $this);
	$this-&gt;assistant-&gt;set_forward_page_func(\&amp;forward_page_func, $this-&gt;assistant);
	$this-&gt;create_assistant_page();
 
	$this-&gt;assistant-&gt;signal_connect("realize", sub { 
		$this-&gt;assistant-&gt;window-&gt;set_functions(["resize","move","maximize"]) 
	});
	$this-&gt;assistant-&gt;get_cancel_button-&gt;signal_connect("show", sub { 
		$this-&gt;assistant-&gt;get_cancel_button-&gt;hide 
	});

	$this-&gt;assistant-&gt;show;
	$this-&gt;assistant-&gt;get_cancel_button-&gt;hide;
}


sub go {
        my $this=shift;
	my @elements=@{$this-&gt;elements};

	$this-&gt;reset_assistant_page;

	my $interactive='';
	foreach my $element (@elements) {
		next unless $element-&gt;hbox;

		$interactive=1;
		$this-&gt;assistant_page-&gt;pack_start($element-&gt;hbox, $element-&gt;fill, $element-&gt;expand, 0);
	}

	if ($interactive) {
		$this-&gt;configure_assistant_page;
		if ($this-&gt;assistant-&gt;get_current_page == $this-&gt;assistant-&gt;get_n_pages - 1) {
			$this-&gt;create_assistant_page();
		}
		Gtk2-&gt;main;
	}

	foreach my $element (@elements) {
		$element-&gt;show;
	}

	return '' if $this-&gt;goback;
	return 1;
}

sub progress_start {
	my $this=shift;
	$this-&gt;SUPER::progress_start(@_);

	$this-&gt;reset_assistant_page;

	my $element=$this-&gt;progress_bar;
	$this-&gt;assistant_page-&gt;pack_start($element-&gt;hbox, $element-&gt;fill, $element-&gt;expand, 0);
	$this-&gt;configure_assistant_page;
	$this-&gt;assistant-&gt;set_page_complete($this-&gt;assistant_page, 0);
	$this-&gt;assistant-&gt;show_all;

	while (Gtk2-&gt;events_pending) {
		Gtk2-&gt;main_iteration;
	}
}

sub progress_set {
	my $this=shift;

	my $ret=$this-&gt;SUPER::progress_set(@_);

	while (Gtk2-&gt;events_pending) {
		Gtk2-&gt;main_iteration;
	}

	return $ret;
}

sub progress_info {
	my $this=shift;
	my $ret=$this-&gt;SUPER::progress_info(@_);

	while (Gtk2-&gt;events_pending) {
		Gtk2-&gt;main_iteration;
	}

	return $ret;
}

sub progress_stop {
	my $this=shift;
	$this-&gt;SUPER::progress_stop(@_);

	while (Gtk2-&gt;events_pending) {
		Gtk2-&gt;main_iteration;
	}

	if ($this-&gt;assistant-&gt;get_current_page == $this-&gt;assistant-&gt;get_n_pages - 1) {
		$this-&gt;create_assistant_page();
	}
	$this-&gt;assistant-&gt;set_current_page($prev_page + 1);
}


1
</pre></body></html>