tps-14594-asp-gui.diff 93.6 KB
Newer Older
1
diff --git a/usr/share/perl5/Tails/Persistence.pm b/usr/share/perl5/Tails/Persistence.pm
2
index 8d1e412..0f1ec7c 100644
3
4
5
6
7
8
9
10
--- a/usr/share/perl5/Tails/Persistence.pm
+++ b/usr/share/perl5/Tails/Persistence.pm
@@ -4,10 +4,7 @@ Tails::Persistence - main placeholder module
 
 =cut
 
-use strict;
-use warnings FATAL => 'all';
11
-use 5.10.0;
12
13
-
-
14
15
16
+use 5.10.1;
+use strictures 2;
 
17
 1;
18
diff --git a/usr/share/perl5/Tails/Persistence/Configuration.pm b/usr/share/perl5/Tails/Persistence/Configuration.pm
19
index 9719481..d8edc60 100644
20
21
--- a/usr/share/perl5/Tails/Persistence/Configuration.pm
+++ b/usr/share/perl5/Tails/Persistence/Configuration.pm
22
@@ -5,81 +5,112 @@ Tails::Persistence::Configuration - manage live-persistence.conf and presets
23
24
25
26
27
28
29
30
31
32
33
34
35
36
 =cut
 
 package Tails::Persistence::Configuration;
-use Moose;
-use MooseX::Method::Signatures;
-use MooseX::Types::Moose qw( :all );
-use MooseX::Types::Path::Class;
-use MooseX::Has::Sugar::Saccharin;
-
-
+use Moo;
+use MooX::late;
+use MooX::HandlesVia;
 
37
+use 5.10.1;
38
+use strictures 2;
39
 use autodie qw(:all);
40
-use warnings FATAL => 'all';
41
 use Carp;
42
+use Carp::Assert::More;
43
 
44
+use Function::Parameters;
45
46
47
48
49
50
 use Tails::Persistence::Configuration::Atom;
-use Tails::Persistence::Configuration::File;
+use Tails::Persistence::Configuration::ConfigFile;
 use Tails::Persistence::Configuration::Presets;
+use Types::Path::Tiny qw{AbsPath};
 
51
+use List::MoreUtils qw{none};
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
 use Locale::gettext;
 use POSIX;
 setlocale(LC_MESSAGES, "");
 textdomain("tails-persistence-setup");
 
+use namespace::clean;
+
 
 =head1 ATTRIBUTES
 
 =cut
 
-has 'config_file_path' => lazy_build rw 'Path::Class::File';
-has 'file' =>
-    lazy_build rw 'Tails::Persistence::Configuration::File';
-has 'presets' =>
-    lazy_build rw 'Tails::Persistence::Configuration::Presets';
-has 'atoms' =>
-    lazy_build rw 'ArrayRef[Tails::Persistence::Configuration::Atom]',
-    traits  => [ 'Array' ],
-    handles => {
+has 'config_file_path' => (
74
75
76
77
+    required  => 1,
+    isa       => AbsPath,
+    is        => 'rw',
+    coerce    => AbsPath->coercion,
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
+);
+
+has 'file' => (
+    lazy_build => 1,
+    is         => 'rw',
+    isa        => 'Tails::Persistence::Configuration::ConfigFile',
+);
+has 'presets' => (
+    lazy_build => 1,
+    is         => 'rw',
+    isa        => 'Tails::Persistence::Configuration::Presets',
+);
+has 'force_enable_presets' => (
+    is      => 'ro',
+    isa     => 'ArrayRef[Str]',
+    default => sub { [] },
+);
+has 'atoms' => (
+    lazy_build => 1,
+    is            => 'rw',
+    isa           => 'ArrayRef[Tails::Persistence::Configuration::Atom]',
+    handles_via   => 'Array',
+    handles       => {
         all_atoms => 'elements',
-        push_atom  => 'push',
-    };
+        push_atom => 'push',
+    },
+);
 
 
 =head1 CONSTRUCTORS
 
 =cut
 
-method _build_file {
-    Tails::Persistence::Configuration::File->new(
-        path => $self->config_file_path
116
+method _build_file () {
117
118
119
120
121
122
123
+    my $file = Tails::Persistence::Configuration::ConfigFile->new(
+        config_file_path => $self->config_file_path
     );
+    return $file;
 }
 
-method _build_presets {
124
+method _build_presets () {
125
126
127
128
     Tails::Persistence::Configuration::Presets->new();
 }
 
-method _build_atoms {
129
-    return $self->merge_file_with_presets($self->file, $self->presets);
130
+method _build_atoms () {
131
+    return $self->merge_file_with_presets();
132
133
 }
 
134
 =head1 METHODS
135
136
137
138
 
 =cut
 
-method lines_not_in_presets {
139
+method lines_not_in_presets () {
140
141
     grep {
         my $line = $_;
142
143
-        ! grep { $_->equals_line($line) } $self->presets->all
+        ! grep { $_->equals_line($line) } $self->presets->atoms
144
145
146
147
     } $self->file->all_lines;
 }
 
-method merge_file_with_presets {
148
-    # Modifying and returning clones of the presets atoms would be a bit cleaner.
149
+method atoms_not_in_presets () {
150
151
152
153
154
155
+    grep {
+        my $atom = $_;
+        none { $atom->equals_atom($_) } $self->presets->atoms
+    } $self->all_atoms;
+}
+
156
+method merge_file_with_presets () {
157
158
159
160
     $self->presets->set_state_from_lines($self->file->all_lines);
+    $self->presets->set_state_from_overrides($self->force_enable_presets);
 
     [
161
162
163
164
165
-        $self->presets->all,
+        $self->presets->atoms,
         map {
             Tails::Persistence::Configuration::Atom->new_from_line(
                 $_,
166
@@ -89,11 +120,11 @@ method merge_file_with_presets {
167
168
169
170
     ];
 }
 
-method all_enabled_atoms {
171
+method all_enabled_atoms () {
172
173
174
175
     grep { $_->enabled } $self->all_atoms;
 }
 
-method all_enabled_lines {
176
+method all_enabled_lines () {
177
178
179
     map {
         Tails::Persistence::Configuration::Line->new(
             destination => $_->destination,
180
@@ -102,10 +133,10 @@ method all_enabled_lines {
181
182
183
184
     } $self->all_enabled_atoms;
 }
 
-method save {
185
+method save () {
186
187
188
189
190
191
192
193
     $self->file->lines([ $self->all_enabled_lines ]);
     $self->file->save;
 }
 
-no Moose;
+no Moo;
 1;
diff --git a/usr/share/perl5/Tails/Persistence/Configuration/Atom.pm b/usr/share/perl5/Tails/Persistence/Configuration/Atom.pm
194
index 768b2c5..3433f70 100644
195
196
--- a/usr/share/perl5/Tails/Persistence/Configuration/Atom.pm
+++ b/usr/share/perl5/Tails/Persistence/Configuration/Atom.pm
197
@@ -5,46 +5,49 @@ Tails::Persistence::Configuration::Atom - a GUI-friendly configuration line
198
199
200
201
202
203
204
205
206
 =cut
 
 package Tails::Persistence::Configuration::Atom;
-use Moose;
-use MooseX::Method::Signatures;
-use MooseX::Types::Moose qw( :all );
-use MooseX::Has::Sugar::Saccharin;
-
-
207
+use 5.10.1;
208
+use strictures 2;
209
210
211
212
+use Moo;
+use MooX::late;
 
 with 'Tails::Persistence::Role::ConfigurationLine';
213
214
215
216
217
-with 'Tails::Role::HasEncoding';
 
 use autodie qw(:all);
 use warnings FATAL => 'all';
 
218
+use Function::Parameters;
219
 use List::MoreUtils qw{all pairwise};
220
+use Types::Standard qw(ClassName InstanceOf);
221
 
222
223
224
225
-use Locale::gettext;
-use POSIX;
-setlocale(LC_MESSAGES, "");
-textdomain("tails-persistence-setup");
226
+use namespace::clean;
227
 
228
229
230
 
 =head1 ATTRIBUTES
 
231
232
 =cut
 
233
234
235
236
237
238
239
240
241
242
-has 'enabled'     => required rw Bool;
-has 'name'        => lazy_build rw Str;
-has 'description' => lazy_build rw Str;
-has 'icon_name'     => lazy_build rw Str;
+has 'enabled' => (
+    required => 1,
+    is       => 'rw',
+    isa      => 'Bool',
+);
+
243
244
245
246
247
+has 'id' => (
+    lazy_build => 1,
+    is         => 'rw',
+    isa        => 'Str',
+);
248
249
250
 
 
 =head1 CONSTRUCTORS
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
 
 =cut
 
-sub new_from_line {
-    my $class = shift;
-    my $line  = shift;
-    my %args  = @_;
-
+method new_from_line (
+    ClassName $class:
+    (InstanceOf['Tails::Persistence::Configuration::Line']) $line,
+    %args
+) {
     Tails::Persistence::Configuration::Atom->new(
         destination => $line->destination,
         options     => $line->options,
@@ -52,30 +55,33 @@ sub new_from_line {
268
269
270
     );
 }
 
271
-method _build_name { $self->encoding->decode(gettext('Custom')); }
272
273
274
-
-method _build_description {
-    $self->encoding->decode($self->destination);
275
+method _build_id () {
276
277
278
279
+    'Custom';
 }
 
-method _build_icon_name { 'dialog-question' }
280
-
281
282
 
 =head1 METHODS
283
 
284
285
 =cut
 
286
287
288
+method equals_atom (
+    (InstanceOf['Tails::Persistence::Configuration::Atom']) $other_atom
+) {
289
290
291
292
+    $self->destination eq $other_atom->destination
+        and
+    $self->options_are(@{$other_atom->options});
+}
293
294
 
-method equals_line ($line) {
295
296
297
+method equals_line (
+    (InstanceOf['Tails::Persistence::Configuration::Line']) $line
+) {
298
299
300
     $self->destination eq $line->destination
         and
     $self->options_are($line->all_options);
301
302
303
304
305
306
307
308
309
310
311
 }
 
-sub options_are {
-    my $self = shift;
-
-    my @expected = sort(@_);
+method options_are (@expected_options) {
+    my @expected = sort(@expected_options);
     my @options  = sort($self->all_options);
 
     return unless @expected == @options;
312
@@ -85,5 +91,5 @@ sub options_are {
313
314
315
316
317
318
319
     } @expected, @options;
 }
 
-no Moose;
+no Moo;
 1;
diff --git a/usr/share/perl5/Tails/Persistence/Configuration/Button.pm b/usr/share/perl5/Tails/Persistence/Configuration/Button.pm
320
321
deleted file mode 100644
index 3540544..0000000
322
--- a/usr/share/perl5/Tails/Persistence/Configuration/Button.pm
323
324
325
326
327
328
329
330
331
+++ /dev/null
@@ -1,163 +0,0 @@
-=head1 NAME
-
-Tails::Persistence::Configuration::Button - a configuration button in the GUI
-
-=cut
-
-package Tails::Persistence::Configuration::Button;
332
333
334
335
336
337
-use Moose;
-use MooseX::Method::Signatures;
-use MooseX::Types::Moose qw( :all );
-use MooseX::Has::Sugar::Saccharin;
-
-
338
339
-
-use autodie qw(:all);
340
-use warnings FATAL => 'all';
341
342
343
344
345
346
347
348
-use Glib qw{TRUE FALSE};
-use Pango;
-
-
-=head1 ATTRIBUTES
-
-=cut
-
349
350
-has 'atom'         => lazy_build ro 'Tails::Persistence::Configuration::Atom',
-    handles => [
351
-        qw{source destination all_options enabled name description icon_name}
352
353
354
355
356
-    ];
-has 'icon'         => lazy_build ro 'Gtk3::Image';
-has 'checked_img'  => lazy_build ro 'Gtk3::Image';
-has 'main_widget'  => lazy_build ro 'Gtk3::ToggleButton',
-    handles => {
357
358
-        is_active  => 'get_active',
-        set_active => 'set_active',
359
360
361
362
-    };
-has 'icon_theme' => ro 'Gtk3::IconTheme', builder '_build_icon_theme';
-has 'title_label'  => lazy_build ro 'Gtk3::Label';
-has 'description_label' => lazy_build ro 'Gtk3::Label';
363
364
365
366
367
368
-
-
-=head1 CONSTRUCTORS
-
-=cut
-
369
-method _build_icon {
370
371
372
373
374
-    Gtk3::Image->new_from_pixbuf($self->icon_theme->load_icon(
-        $self->icon_name, 48, 'use-builtin'
-    ));
-}
-
375
-method _build_checked_img {
376
377
378
379
380
-    # FIXME: we want the GTK_ICON_SIZE_SMALL_TOOLBAR
-    # member of the GtkIconSize enum, not a magic "16" number here.
-    Gtk3::Image->new_from_stock('gtk-apply', 16);
-}
-
381
-method _build_main_widget {
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
-    my $line = shift;
-
-    my $vbox = Gtk3::VBox->new();
-    $vbox->set_border_width(5);
-    $vbox->pack_start($self->title_label, FALSE, FALSE, 0);
-    $vbox->pack_start($self->description_label, FALSE, FALSE, 0);
-
-    my $hbox = Gtk3::HBox->new();
-    $hbox->pack_start($self->icon, FALSE, FALSE, 0);
-    $hbox->pack_start($vbox, TRUE, TRUE, 0);
-    $hbox->pack_start($self->checked_img, FALSE, FALSE, 0);
-
-    my $button = Gtk3::ToggleButton->new();
-    $button->add($hbox);
-    $button->set_active($self->enabled);
-    $button->signal_connect('toggled' => sub { $self->toggled_cb });
-
-    $button->signal_connect('show' => sub { $self->refresh_display });
-
-    return $button;
-}
-
404
-method _build_icon_theme {
405
406
407
408
409
410
411
412
413
414
-    my $theme = Gtk3::IconTheme::get_default();
-
-    $theme->append_search_path('/usr/share/pixmaps/cryptui/48x48');
-    $theme->append_search_path('/usr/share/pixmaps/seahorse/48x48');
-    $theme->append_search_path('/usr/share/icons/gnome-colors-common/32x32/apps/');
-    $theme->append_search_path('/usr/share/app-install/icons/');
-
-    return $theme;
- }
-
415
-method _build_title_label {
416
417
418
419
420
421
422
423
424
425
-    my $title = Gtk3::Label->new($self->name);
-    $title->set_alignment(0.0, 0.5);
-    my $title_attrlist  = Pango::AttrList->new;
-    $title_attrlist->insert($_)
-        foreach ( Pango::AttrScale->new(1.1),Pango::AttrWeight->new('bold') );
-    $title->set_attributes($title_attrlist);
-
-    return $title;
-}
-
426
-method _build_description_label {
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
-    my $description = Gtk3::Label->new($self->description);
-    $description->set_alignment(0.0, 0.5);
-    my $description_attrlist = Pango::AttrList->new;
-    $description_attrlist->insert(
-        Pango::AttrForeground->new(30000, 30000, 30000)
-      );
-    $description->set_attributes($description_attrlist);
-    $description->set_line_wrap(TRUE);
-    $description->set_line_wrap_mode('word');
-    $description->set_single_line_mode(FALSE);
-
-    return $description;
-}
-
-
-=head1 METHODS
-
-=cut
-
446
-method toggled_cb {
447
-    $self->atom->enabled($self->is_active);
448
449
450
-    $self->refresh_display;
-}
-
451
-method refresh_display {
452
453
454
455
-    $self->refresh_checked_img;
-    $self->refresh_text_color;
-}
-
456
-method refresh_checked_img {
457
458
459
460
461
462
463
464
-    if ($self->enabled) {
-        $self->checked_img->show;
-    }
-    else {
-        $self->checked_img->hide;
-    }
-}
-
465
-method refresh_text_color {
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
-    my %color = $self->enabled ?
-        (
-            title       => 0,
-            description => 30000,
-    ) : (
-            title       => 30000,
-            description => 40000,
-    );
-    my $attrlist = $self->title_label->get_attributes;
-    $attrlist->change(
-        Pango::AttrForeground->new($color{title}, $color{title}, $color{title})
-    );
-    $self->title_label->set_attributes($attrlist);
-    $attrlist = $self->description_label->get_attributes;
-    $attrlist->change(
-        Pango::AttrForeground->new($color{description}, $color{description}, $color{description})
-    );
-    $self->description_label->set_attributes($attrlist);
-}
-
486
-no Moose;
487
-1;
488
489
diff --git a/usr/share/perl5/Tails/Persistence/Configuration/ConfigFile.pm b/usr/share/perl5/Tails/Persistence/Configuration/ConfigFile.pm
new file mode 100644
490
index 0000000..d5ac42d
491
492
--- /dev/null
+++ b/usr/share/perl5/Tails/Persistence/Configuration/ConfigFile.pm
493
@@ -0,0 +1,96 @@
494
495
496
+=head1 NAME
+
+Tails::Persistence::Configuration::ConfigFile - read, parse and write live-persistence.conf
497
+
498
499
500
+=cut
+
+package Tails::Persistence::Configuration::ConfigFile;
501
+use 5.10.1;
502
+use strictures 2;
503
504
505
506
507
508
509
+use Moo;
+use MooX::late;
+use MooX::HandlesVia;
+
+use autodie qw(:all);
+use warnings FATAL => 'all';
+use Carp;
510
+use Function::Parameters;
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
+use Tails::Persistence::Configuration::Line;
+use Types::Path::Tiny qw{AbsPath};
+
+use namespace::clean;
+
+
+=head1 ATTRIBUTES
+
+=cut
+
+has 'config_file_path' => (
+    isa      => AbsPath,
+    is       => 'ro',
+    coerce   => AbsPath->coercion,
+    required => 1,
+);
+
+has 'lines' => (
+    lazy_build    => 1,
+    is            => 'rw',
+    isa           => 'ArrayRef[Tails::Persistence::Configuration::Line]',
+    handles_via   => [ 'Array' ],
+    handles       => {
+        all_lines => 'elements',
+    },
+);
+
+
+=head1 CONSTRUCTORS
+
+=cut
+
543
+method BUILD (@args) {
544
545
546
+    $self->config_file_path->touch;
+}
+
547
+method _build_lines () {
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
+    return [
+        grep { defined $_ } map {
+            Tails::Persistence::Configuration::Line->new_from_string($_)
+        } $self->config_file_path->lines({chomp => 1})
+    ];
+}
+
+
+=head1 METHODS
+
+=cut
+
+=head2 output
+
+Returns the in-memory configuration, as a string in the live-persistence.conf format.
+
+=cut
565
+method output () {
566
567
568
569
570
571
572
573
574
575
576
577
578
+    my $out = "";
+    foreach ($self->all_lines) {
+        $out .= $_->stringify . "\n";
+    }
+    return $out;
+}
+
+=head2 save
+
+Save the in-memory configuration to disk.
+Throw exception on error.
+
+=cut
579
+method save () {
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
+    my $output = $self->output;
+    my $fh = $self->config_file_path->openw();
+    print $fh $output;
+    $fh->sync;
+    close $fh;
+    $self->config_file_path->chmod(0600);
+}
+
+no Moo;
+1;
diff --git a/usr/share/perl5/Tails/Persistence/Configuration/File.pm b/usr/share/perl5/Tails/Persistence/Configuration/File.pm
deleted file mode 100644
index aa76c16..0000000
--- a/usr/share/perl5/Tails/Persistence/Configuration/File.pm
+++ /dev/null
@@ -1,94 +0,0 @@
-=head1 NAME
-
-Tails::Persistence::Configuration::File - read, parse and write live-persistence.conf
-
-=cut
-
-package Tails::Persistence::Configuration::File;
-use Moose;
-use MooseX::Method::Signatures;
-use MooseX::Types::Moose qw( :all );
-use MooseX::Types::Path::Class;
-use MooseX::Has::Sugar::Saccharin;
-
-
-
-use autodie qw(:all);
-use warnings FATAL => 'all';
-use Carp;
-use Path::Class;
-use Tails::Persistence::Configuration::Line;
-
-
-=head1 ATTRIBUTES
-
-=cut
-
-has 'path' => (
-    isa        => 'Path::Class::File',
-    is         => 'ro',
-    coerce     => 1,
-    required   => 1,
-);
-
-has 'lines' =>
-    lazy_build rw 'ArrayRef[Tails::Persistence::Configuration::Line]',
-    traits  => [ 'Array' ],
-    handles => {
-        all_lines => 'elements',
-    };
-
-
-=head1 CONSTRUCTORS
-
-=cut
-
-sub BUILD {
-    my $self = shift;
-
-    $self->path->touch;
-}
-
-method _build_lines {
-    return [
-        grep { defined $_ } map {
-            Tails::Persistence::Configuration::Line->new_from_string($_)
-        } $self->path->slurp(chomp => 1)
-    ];
-}
-
-
-=head1 METHODS
-
-=cut
-
-=head2 output
-
-Returns the in-memory configuration, as a string in the live-persistence.conf format.
-
-=cut
-method output {
-    my $out = "";
-    foreach ($self->all_lines) {
-        $out .= $_->stringify . "\n";
-    }
-    return $out;
-}
-
-=head2 save
-
-Save the in-memory configuration to disk.
-Throw exception on error.
-
-=cut
-method save {
-    my $output = $self->output;
-    my $fh = $self->path->openw();
-    print $fh $output;
-    $fh->sync;
-    close $fh;
-    chmod 0600, $self->path;
-}
-
-no Moose;
-1;
diff --git a/usr/share/perl5/Tails/Persistence/Configuration/Line.pm b/usr/share/perl5/Tails/Persistence/Configuration/Line.pm
691
index f3fd304..a21e9f8 100644
692
693
--- a/usr/share/perl5/Tails/Persistence/Configuration/Line.pm
+++ b/usr/share/perl5/Tails/Persistence/Configuration/Line.pm
694
@@ -5,11 +5,12 @@ Tails::Persistence::Configuration::Line - read, parse and write live-persistence
695
 =cut
696
 
697
 package Tails::Persistence::Configuration::Line;
698
-
699
-use Moose;
700
+use 5.10.1;
701
+use strictures 2;
702
703
704
705
706
707
708
709
710
711
+use Moo;
 with 'Tails::Persistence::Role::ConfigurationLine';
 
+use namespace::clean;
 
-
-no Moose;
+no Moo;
 1;
diff --git a/usr/share/perl5/Tails/Persistence/Configuration/Presets.pm b/usr/share/perl5/Tails/Persistence/Configuration/Presets.pm
712
index 1a01326..befc2f0 100644
713
714
--- a/usr/share/perl5/Tails/Persistence/Configuration/Presets.pm
+++ b/usr/share/perl5/Tails/Persistence/Configuration/Presets.pm
715
@@ -5,180 +5,248 @@ Tails::Persistence::Configuration::Presets - available configuration snippets
716
717
718
719
720
721
722
723
 =cut
 
 package Tails::Persistence::Configuration::Presets;
-use Moose;
-use MooseX::Method::Signatures;
-use MooseX::Types::Moose qw( :all );
-use MooseX::Has::Sugar::Saccharin;
-
724
-
725
+use 5.10.1;
726
+use strictures 2;
727
728
729
730
731
732
+use Moo;
+use MooX::HandlesVia;
+use MooX::late;
 
 with 'Tails::Role::HasEncoding';
 
733
734
735
 use autodie qw(:all);
 use warnings FATAL => 'all';
 use Carp;
736
+use Function::Parameters;
737
738
+use List::MoreUtils qw{all};
 use Tails::Persistence::Configuration::Atom;
739
+use Types::Standard qw(ArrayRef Str);
740
741
 
 use Locale::gettext;
742
 use POSIX;
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
 setlocale(LC_MESSAGES, "");
 textdomain("tails-persistence-setup");
 
+use namespace::clean;
+
 
 =head1 ATTRIBUTES
 
 =cut
 
-has '_presets' =>
-    lazy_build ro 'ArrayRef[Tails::Persistence::Configuration::Atom]',
-    traits  => [ 'Array' ],
-    handles => {
-        count => 'count',
-        all   => 'elements',
-    };
+has '_presets' => (
761
+    lazy_build  => 1,
762
+    is          => 'rw',
763
+    isa         => 'ArrayRef',
764
765
766
767
768
769
770
771
772
773
774
775
776
+    handles_via => 'Array',
+    handles     => {
+        count   => 'count',
+        all     => 'elements',
+    },
+);
 
 
 =head1 CONSTRUCTORS
 
 =cut
 
-method _build__presets {
777
+method _build__presets () {
778
779
     my @presets = (
         {
780
+            id          => 'PersonalData',
781
782
783
             name        => $self->encoding->decode(gettext(q{Personal Data})),
             description => $self->encoding->decode(gettext(
                 q{Keep files stored in the `Persistent' directory}
784
785
786
787
             )),
-            destination => '/home/amnesia/Persistent',
-            enabled     => 1,
-            options     => [ 'source=Persistent' ],
788
             icon_name   => 'stock_folder',
789
790
791
792
793
794
795
+            enabled     => 1,
+            atoms_args  => [
+                {
+                    destination => '/home/amnesia/Persistent',
+                    options     => [ 'source=Persistent' ],
+                },
+            ]
796
797
798
799
800
801
802
803
804
805
806
807
808
         },
         {
-            name        => $self->encoding->decode(gettext(q{GnuPG})),
-            description => $self->encoding->decode(gettext(
-                q{GnuPG keyrings and configuration}
-            )),
-            destination => '/home/amnesia/.gnupg',
-            options     => [ 'source=gnupg' ],
-            enabled     => 0,
-            icon_name   => 'seahorse-key',
-        },
-        {
-            name        => $self->encoding->decode(gettext(q{SSH Client})),
809
-            description => $self->encoding->decode(gettext(
810
-                q{SSH keys, configuration and known hosts}
811
-            )),
812
813
-            destination => '/home/amnesia/.ssh',
-            options     => [ 'source=openssh-client'],
814
-            enabled     => 0,
815
-            icon_name   => 'seahorse-key-ssh',
816
817
-        },
-        {
818
-            name        => $self->encoding->decode(gettext(q{Pidgin})),
819
+            id          => 'BrowserBookmarks',
820
+            name        => $self->encoding->decode(gettext(q{Browser Bookmarks})),
821
822
             description => $self->encoding->decode(gettext(
-                q{Pidgin profiles and OTR keyring}
823
+                q{Bookmarks saved in the Tor Browser}
824
825
826
             )),
-            destination => '/home/amnesia/.purple',
-            options     => [ 'source=pidgin' ],
827
+            icon_name   => 'user-bookmarks',
828
829
             enabled     => 0,
-            icon_name   => 'pidgin',
830
831
832
833
834
835
+            atoms_args  => [
+                {
+                    destination => '/home/amnesia/.mozilla/firefox/bookmarks',
+                    options     => [ 'source=bookmarks' ],
+                },
+            ],
836
837
838
         },
         {
-            name        => $self->encoding->decode(gettext(q{Thunderbird})),
839
+            id          => 'NetworkConnections',
840
+            name        => $self->encoding->decode(gettext(q{Network Connections})),
841
             description => $self->encoding->decode(gettext(
842
-                q{Thunderbird profiles and locally stored email}
843
+                q{Configuration of network devices and connections}
844
845
846
             )),
-            destination => '/home/amnesia/.thunderbird',
-            options     => [ 'source=thunderbird' ],
847
+            icon_name   => 'network-wired',
848
849
             enabled     => 0,
-            icon_name   => 'thunderbird',
850
851
852
853
854
855
+            atoms_args  => [
+                {
+                    destination => '/etc/NetworkManager/system-connections',
+                    options     => [ 'source=nm-system-connections' ],
+                },
+            ],
856
857
858
         },
         {
-            name        => $self->encoding->decode(gettext(q{GNOME Keyring})),
859
-            description => $self->encoding->decode(gettext(
860
-                q{Secrets stored by GNOME Keyring}
861
862
863
+            id                  => 'AdditionalSoftware',
+            name                => $self->encoding->decode(gettext(q{Additional Software})),
+            description         => $self->encoding->decode(gettext(
864
+                q{Software installed when starting Tails}
865
866
867
             )),
-            destination => '/home/amnesia/.gnome2/keyrings',
-            options     => [ 'source=gnome-keyrings' ],
868
-            enabled     => 0,
869
-            icon_name   => 'seahorse-key-personal',
870
871
+            icon_name           => 'package-x-generic',
+            enabled             => 0,
872
+            configuration_app_desktop_id => 'org.boum.tails.additional-software-config.desktop',
873
+            atoms_args          => [
874
875
876
877
878
879
880
881
882
+                {
+                    destination => '/var/cache/apt/archives',
+                    options     => [ 'source=apt/cache' ],
+                },
+                {
+                    destination => '/var/lib/apt/lists',
+                    options     => [ 'source=apt/lists' ],
+                },
+            ],
883
884
885
886
887
888
889
890
891
892
893
         },
         {
-            name        => $self->encoding->decode(gettext(q{Network Connections})),
+            id          => 'Printers',
+            name        => $self->encoding->decode(gettext(q{Printers})),
             description => $self->encoding->decode(gettext(
-                q{Configuration of network devices and connections}
+                q{Printers configuration}
             )),
-            destination => '/etc/NetworkManager/system-connections',
-            options     => [ 'source=nm-system-connections' ],
894
+            icon_name   => 'printer',
895
896
             enabled     => 0,
-            icon_name   => 'network-wired',
897
898
899
900
901
902
+            atoms_args  => [
+                {
+                    destination => '/etc/cups',
+                    options     => [ 'source=cups-configuration' ],
+                },
+            ],
903
904
905
906
907
908
909
         },
         {
-            name        => $self->encoding->decode(gettext(q{Browser bookmarks})),
+            id          => 'Thunderbird',
+            name        => $self->encoding->decode(gettext(q{Thunderbird})),
             description => $self->encoding->decode(gettext(
-                q{Bookmarks saved in the Tor Browser}
910
+                q{Thunderbird emails, feeds, and settings}
911
912
913
             )),
-            destination => '/home/amnesia/.mozilla/firefox/bookmarks',
-            options     => [ 'source=bookmarks' ],
914
+            icon_name   => 'thunderbird',
915
916
             enabled     => 0,
-            icon_name   => 'user-bookmarks',
917
918
919
920
921
922
+            atoms_args  => [
+                {
+                    destination => '/home/amnesia/.thunderbird',
+                    options     => [ 'source=thunderbird' ],
+                },
+            ],
923
924
925
926
927
928
929
930
931
932
933
         },
         {
-            name        => $self->encoding->decode(gettext(q{Printers})),
+            id          => 'GnuPG',
+            name        => $self->encoding->decode(gettext(q{GnuPG})),
             description => $self->encoding->decode(gettext(
-                q{Printers configuration}
+                q{GnuPG keyrings and configuration}
             )),
-            destination => '/etc/cups',
-            options     => [ 'source=cups-configuration' ],
934
+            icon_name   => 'seahorse-key',
935
936
             enabled     => 0,
-            icon_name   => 'printer',
937
938
939
940
941
942
+            atoms_args  => [
+                {
+                    destination => '/home/amnesia/.gnupg',
+                    options     => [ 'source=gnupg' ],
+                },
+            ],
943
944
         },
         {
945
-            name        => $self->encoding->decode(gettext(q{Bitcoin client})),
946
+            id          => 'BitcoinClient',
947
+            name        => $self->encoding->decode(gettext(q{Bitcoin Client})),
948
949
             description => $self->encoding->decode(gettext(
                 q{Electrum's bitcoin wallet and configuration}
950
951
952
953
             )),
-            destination => '/home/amnesia/.electrum',
-            options     => [ 'source=electrum' ],
-            enabled     => 0,
954
             icon_name   => 'electrum',
955
956
957
958
959
960
961
+            enabled     => 0,
+            atoms_args  => [
+                {
+                    destination => '/home/amnesia/.electrum',
+                    options     => [ 'source=electrum' ],
+                },
+            ],
962
963
964
965
966
967
968
969
970
971
972
         },
         {
-            name        => $self->encoding->decode(gettext(q{APT Packages})),
+            id          => 'Pidgin',
+            name        => $self->encoding->decode(gettext(q{Pidgin})),
             description => $self->encoding->decode(gettext(
-                q{Packages downloaded by APT}
+                q{Pidgin profiles and OTR keyring}
             )),
-            destination => '/var/cache/apt/archives',
-            options     => [ 'source=apt/cache' ],
973
+            icon_name   => 'pidgin',
974
975
             enabled     => 0,
-            icon_name   => 'package-x-generic',
976
977
978
979
980
981
+            atoms_args  => [
+                {
+                    destination => '/home/amnesia/.purple',
+                    options     => [ 'source=pidgin' ],
+                },
+            ],
982
983
984
         },
         {
-            name        => $self->encoding->decode(gettext(q{APT Lists})),
985
+            id          => 'SSHClient',
986
987
988
989
990
991
992
+            name        => $self->encoding->decode(gettext(q{SSH Client})),
             description => $self->encoding->decode(gettext(
-                q{Lists downloaded by APT}
+                q{SSH keys, configuration and known hosts}
             )),
-            destination => '/var/lib/apt/lists',
-            options     => [ 'source=apt/lists' ],
993
+            icon_name   => 'seahorse-key-ssh',
994
995
             enabled     => 0,
-            icon_name   => 'package-x-generic',
996
997
998
999
1000
+            atoms_args  => [
+                {
+                    destination => '/home/amnesia/.ssh',
+                    options     => [ 'source=openssh-client'],
+                },
For faster browsing, not all history is shown. View entire blame