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


package Debconf::FrontEnd::Gnome;
use warnings;
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(Gtk3::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));
	$this-&gt;assistant-&gt;set_page_type($this-&gt;assistant_page, 'custom');
	$this-&gt;forward_button-&gt;grab_default;
	$this-&gt;forward_button-&gt;show;
	if ($this-&gt;capb_backup) {
		$this-&gt;back_button-&gt;show;
	} else {
		$this-&gt;back_button-&gt;hide;
	}
	$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 (Gtk3::main_level()) {
			Gtk3::main_quit();
		}
	} elsif ($prev_page &gt; $current_page) {
		$this-&gt;goback(1);
		if (Gtk3::main_level()) {
			Gtk3::main_quit();
		}
	}
	$prev_page = $current_page;
}

sub close_callback {
	my ($assistant) = @_;

	my $title = gettext("Really quit configuration?");
	my $text = gettext("If you quit this configuration dialog, then the package being configured will probably fail to install, and you may have to fix it manually. This may be especially difficult if you are in the middle of a large upgrade.")."\n\n".gettext("You may need to quit anyway if you are stuck in a configuration loop due to a buggy package.")."\n";
	my $quit = gettext("_Quit");
	my $continue = gettext("Continue");

	my $dialog = Gtk3::Dialog-&gt;new_with_buttons(to_Unicode($title),
	                                            $assistant, "modal",
	                                            to_Unicode($quit), "yes",
	                                            to_Unicode($continue),
	                                            "no");
	$dialog-&gt;set_default_response("no");
	$dialog-&gt;set_border_width(3);

	my $grid = Gtk3::Grid-&gt;new();
	$grid-&gt;set_orientation("horizontal");
	$grid-&gt;set_column_homogeneous(0);
	$dialog-&gt;get_content_area-&gt;pack_start($grid, 1, 1, 5);
	$grid-&gt;show;

	my $alignment = Gtk3::Alignment-&gt;new(0.5, 0.0, 1.0, 0.0);
	$grid-&gt;add($alignment);
	$alignment-&gt;show;

	my $image = Gtk3::Image-&gt;new_from_icon_name("dialog-information", "dialog");
	$alignment-&gt;add($image);
	$image-&gt;show;

	my $label = Gtk3::Label-&gt;new(to_Unicode($text));
	$label-&gt;set_line_wrap(1);
	$grid-&gt;add($label);
	$label-&gt;show;

	my $response = $dialog-&gt;run;
	$dialog-&gt;destroy;

	exit 1 if $response eq "yes";
}

sub delete_event_callback {
	my ($assistant, $event) = @_;

	close_callback($assistant);
}

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

	return $current_page + 1;
}

sub on_forward {
	my ($button) = @_;

	my $assistant = $button-&gt;get_ancestor("Gtk3::Assistant");
	$assistant-&gt;next_page;
}

sub on_back {
	my ($button) = @_;

	my $assistant = $button-&gt;get_ancestor("Gtk3::Assistant");
	$assistant-&gt;previous_page;
}

sub init {
	my $this=shift;

	if (fork) {
		wait(); # for child
		if ($? != 0) {
			die "DISPLAY problem?\n";
		}
	}
	else {
		use Gtk3;

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

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

		exit(0); # success
	}

	eval q{use Gtk3;};
	die "Unable to load Gtk -- is libgtk3-perl installed?\n" if $@;

	my @gnome_sucks=@ARGV;
	@ARGV=@ARGV_for_gnome;
	Gtk3-&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(Gtk3::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", \&amp;delete_event_callback);

	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(Gtk3::Gdk::Pixbuf-&gt;new_from_file($logo));
	}

	$this-&gt;assistant-&gt;signal_connect("close", \&amp;close_callback);
	$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;forward_button(Gtk3::Button-&gt;new_with_mnemonic(to_Unicode(gettext("_Next"))));
	$this-&gt;forward_button-&gt;set_can_focus(1);
	$this-&gt;forward_button-&gt;set_can_default(1);
	$this-&gt;forward_button-&gt;set_receives_default(1);
	$this-&gt;forward_button-&gt;signal_connect("clicked", \&amp;on_forward);
	$this-&gt;assistant-&gt;add_action_widget($this-&gt;forward_button);

	$this-&gt;back_button(Gtk3::Button-&gt;new_with_mnemonic(to_Unicode(gettext("_Back"))));
	$this-&gt;back_button-&gt;set_can_focus(1);
	$this-&gt;back_button-&gt;set_receives_default(1);
	$this-&gt;back_button-&gt;signal_connect("clicked", \&amp;on_back);
	$this-&gt;assistant-&gt;add_action_widget($this-&gt;back_button);

	$this-&gt;create_assistant_page();

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


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();
		}
		Gtk3::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;
	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_page_complete($this-&gt;assistant_page, 0);
	$this-&gt;assistant-&gt;show_all;

	while (Gtk3::events_pending()) {
		Gtk3::main_iteration();
	}
}

sub progress_set {
	my $this=shift;

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

	while (Gtk3::events_pending()) {
		Gtk3::main_iteration();
	}

	return $ret;
}

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

	while (Gtk3::events_pending()) {
		Gtk3::main_iteration();
	}

	return $ret;
}

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

	while (Gtk3::events_pending) {
		Gtk3::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>