3 Tails::Persistence::Step::Configure - configure which bits are persistent
7 package Tails
::Persistence
::Step
::Configure
;
12 use Glib
qw{TRUE FALSE
};
14 use Carp
::Assert
::More
;
15 use Number
::Format
qw(:subs);
16 use Tails
::Persistence
::Configuration
::Button
;
21 setlocale
(LC_MESSAGES
, "");
22 textdomain
("tails-persistence-setup");
34 has
'configuration' => (
37 isa
=> 'Tails::Persistence::Configuration',
40 has
'persistence_partition_device_file' => (
45 has
'persistence_partition_size' => (
60 isa
=> 'ArrayRef[Tails::Persistence::Configuration::Button]',
61 handles_via
=> [ 'Array' ],
63 all_buttons
=> 'elements',
64 push_button
=> 'push',
76 # Force initialization in the right order
77 assert_defined
($self->configuration);
78 assert_defined
($self->buttons);
79 assert_defined
($self->list_box);
81 $self->title->set_text($self->encoding->decode(gettext
(
82 q{Persistence wizard - Persistent volume configuration}
84 $self->subtitle->set_text($self->encoding->decode(gettext
(
85 q{Specify the files that will be saved in the persistent volume}
87 $self->description->set_markup($self->encoding->decode(sprintf(
88 # TRANSLATORS: partition, size, device vendor, device model
89 gettext
(q{The selected files will be stored in the encrypted partition %s (%s), on the <b>%s %s</b> device.}),
90 $self->persistence_partition_device_file,
91 format_bytes($self->persistence_partition_size, mode => "iec"),
95 $self->go_button->set_label($self->encoding->decode(gettext(q{Save})));
96 $self->go_button->set_sensitive(TRUE
);
101 my $box = Gtk3
::VBox
->new();
102 $box->set_spacing(6);
103 $box->pack_start($self->title, FALSE
, FALSE
, 0);
104 $box->pack_start($self->subtitle, FALSE
, FALSE
, 0);
105 $box->pack_start($self->description, FALSE
, FALSE
, 0);
107 my $viewport = Gtk3
::Viewport
->new;
108 $viewport->set_shadow_type('GTK_SHADOW_NONE');
109 $viewport->add($self->list_box);
110 my $scrolled_win = Gtk3
::ScrolledWindow
->new;
111 $scrolled_win->set_policy('automatic', 'automatic');
112 $scrolled_win->add($viewport);
113 $box->pack_start($scrolled_win, TRUE
, TRUE
, 0);
115 $box->pack_start($self->status_area, FALSE
, FALSE
, 0);
117 my $button_alignment = Gtk3
::Alignment
->new(1.0, 0, 0.2, 1.0);
118 $button_alignment->set_padding(0, 0, 10, 10);
119 $button_alignment->add($self->go_button);
120 $box->pack_start($button_alignment, FALSE
, FALSE
, 0);
129 Tails
::Persistence
::Configuration
::Button
->new(atom
=> $_)
130 } $self->configuration->all_atoms
134 sub _build_list_box
{
136 my $box = Gtk3
::VBox
->new();
137 $box->set_spacing(6);
138 $box->pack_start($_->main_widget, FALSE
, FALSE
, 0) foreach $self->all_buttons;
139 $self->refresh_buttons;
149 sub operation_finished
{
155 $self->subtitle->set_text($self->encoding->decode(gettext
(q{Failed})));
156 $self->description->set_text($error);
161 $self->success_callback->();
165 sub go_button_pressed
{
167 $self->list_box->hide;
169 $self->subtitle->set_text(
170 $self->encoding->decode(gettext
(q{Saving...})),
172 $self->description->set_text(
173 $self->encoding->decode(gettext
(q{Saving persistence configuration...})),
178 $self->go_callback->();
182 $self->operation_finished($error);
185 sub refresh_buttons
{
187 $_->refresh_display foreach $self->all_buttons;
190 with
'Tails::Persistence::Role::StatusArea';
191 with
'Tails::Persistence::Role::SetupStep';