Dre4m Shell
Server IP : 85.214.239.14  /  Your IP : 18.119.142.113
Web Server : Apache/2.4.62 (Debian)
System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.18
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /proc/self/root/usr/share/perl5/Debconf/Element/Gnome/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /proc/self/root/usr/share/perl5/Debconf/Element/Gnome/Multiselect.pm
#!/usr/bin/perl -w
# This file was preprocessed, do not edit!


package Debconf::Element::Gnome::Multiselect;
use strict;
use Gtk3;
use utf8;
use Debconf::Encoding qw(to_Unicode);
use base qw(Debconf::Element::Gnome Debconf::Element::Multiselect);

use constant SELECTED_COLUMN => 0;
use constant CHOICES_COLUMN  => 1;

sub init {
	my $this=shift;
	my @choices = map { to_Unicode($_) } $this->question->choices_split;
        my %default=map { to_Unicode($_) => 1 } $this->translate_default;

	$this->SUPER::init(@_);
	$this->multiline(1);

	$this->adddescription;

        $this->widget(Gtk3::ScrolledWindow->new);
        $this->widget->show;
        $this->widget->set_policy('automatic', 'automatic');
	
	my $list_store = Gtk3::ListStore->new('Glib::Boolean', 'Glib::String');
	$this->list_view(Gtk3::TreeView->new($list_store));
	$this->list_view->set_headers_visible(0);

	my $renderer_toggle = Gtk3::CellRendererToggle->new;
	$renderer_toggle->signal_connect(toggled => sub {
		my $path_string = $_[1];
		my $model = $_[2];
		my $iter = $model->get_iter_from_string($path_string);
		$model->set($iter, SELECTED_COLUMN,
		            not $model->get($iter, SELECTED_COLUMN));
	}, $list_store);

	$this->list_view->append_column(
		Gtk3::TreeViewColumn->new_with_attributes('Selected',
			$renderer_toggle, 'active', SELECTED_COLUMN));
	$this->list_view->append_column(
		Gtk3::TreeViewColumn->new_with_attributes('Choices',
			Gtk3::CellRendererText->new, 'text', CHOICES_COLUMN));
	$this->list_view->show;

	$this->widget->add($this->list_view);

	for (my $i=0; $i <= $#choices; $i++) {
		my $iter = $list_store->append();
		$list_store->set($iter, CHOICES_COLUMN, $choices[$i]);
		if ($default{$choices[$i]}) {
			$list_store->set($iter, SELECTED_COLUMN, 1);
		}
	}
	$this->addwidget($this->widget);
	$this->tip($this->list_view);
	$this->addhelp;

	$this->fill(1);
	$this->expand(1);

}


sub value {
	my $this=shift;
	my $list_view = $this->list_view;
	my $list_store = $list_view->get_model();
	my ($ret, $val);
	
	my @vals;
	$this->question->template->i18n('');
	my @choices=$this->question->choices_split;
	$this->question->template->i18n(1);
	
	my $iter = $list_store->get_iter_first();
	for (my $i=0; $i <= $#choices; $i++) {
		if ($list_store->get($iter, SELECTED_COLUMN)) {
			push @vals, $choices[$i];
		}
		$list_store->iter_next($iter) or last;
	}

	return join(', ', $this->order_values(@vals));
}

*visible = \&Debconf::Element::Multiselect::visible;


1

Anon7 - 2022
AnonSec Team