[Tails-dev] Persistence: display nicer paths

Borrar esta mensaxe

Responder a esta mensaxe
Autor: Andres Gomez Ramirez
Data:  
Para: tails-dev@boum.org
Asunto: [Tails-dev] Persistence: display nicer paths
Hello,

>Thanks a lot!
>
>If you feel it's ready for QA, please email the tails-dev ML about it
>(that's the preferred way to submit patches and discuss them, as not
>everybody is tracking Redmine that closely). Thanks in advance :)


Ok no problem, attached is the patch for "Persistence: display nicer paths" feature -> https://labs.riseup.net/code/issues/5311.

Cheers

Andres
From 4152d1fa8838e8e5d25df82e8213f8d433d19011 Mon Sep 17 00:00:00 2001
From: kurono <andres.gomez@???>
Date: Wed, 20 Nov 2013 22:52:34 +0100
Subject: [PATCH] persistence: display nicer paths

---
 lib/Tails/Persistence/Setup.pm          |   15 +++++++++++++++
 lib/Tails/Persistence/Step/Configure.pm |    3 ++-
 lib/Tails/Persistence/Step/Delete.pm    |    4 ++--
 3 files changed, 19 insertions(+), 3 deletions(-)


diff --git a/lib/Tails/Persistence/Setup.pm b/lib/Tails/Persistence/Setup.pm
index 6cd3997..1106646 100644
--- a/lib/Tails/Persistence/Setup.pm
+++ b/lib/Tails/Persistence/Setup.pm
@@ -97,6 +97,10 @@ has 'system_partition' =>
     lazy_build rw Str,
     documentation => q{The UDI of the partition where Tails is installed, e.g. /org/freedesktop/UDisks/devices/sdb1.};


+has 'partition_file' =>
+    lazy_build rw Str,
+    documentation => q{The persistent partition file, e.g. /dev/sdb1.};
+
 has 'main_window' =>
     lazy_build ro 'Gtk2::Window',
     metaclass  => 'NoGetopt';
@@ -271,6 +275,15 @@ sub _build_system_partition {
     );
 }


+sub _build_partition_file {
+    my $self = shift;
+    
+    my $device_file = $self->get_device_property($self->device, 'DeviceFile');
+    my $partition_number = $self->get_device_property($self->persistence_partition, 'PartitionNumber');
+
+    $device_file.$partition_number;
+}
+
 sub _build_main_window {
     my $self = shift;
     my $win = Gtk2::Window->new('toplevel');
@@ -910,6 +923,7 @@ sub step_object_from_name {
             },
             persistence_partition      => $self->persistence_partition,
             persistence_partition_size => $self->persistence_partition_size,
+            partition_file             => $self->partition_file,
         );
     }
     elsif ($name eq 'configure') {
@@ -920,6 +934,7 @@ sub step_object_from_name {
             configuration              => $self->configuration,
             persistence_partition      => $self->persistence_partition,
             persistence_partition_size => $self->persistence_partition_size,
+            partition_file             => $self->partition_file,
         );
     }


diff --git a/lib/Tails/Persistence/Step/Configure.pm b/lib/Tails/Persistence/Step/Configure.pm
index 5d3603a..a5e0efe 100644
--- a/lib/Tails/Persistence/Step/Configure.pm
+++ b/lib/Tails/Persistence/Step/Configure.pm
@@ -32,6 +32,7 @@ has 'configuration' => required ro 'Tails::Persistence::Configuration';

 has 'persistence_partition'      => required ro Str;
 has 'persistence_partition_size' => required ro Int;
+has 'partition_file'             => required ro Str;


has 'list_box' => ro 'Gtk2::VBox', builder '_build_list_box';

@@ -60,7 +61,7 @@ sub BUILD {
     $self->description->set_markup($self->encoding->decode(sprintf(
         # TRANSLATORS: partition, size, device vendor, device model
         gettext(q{The selected files will be stored in the encrypted partition %s (%s), on the <b>%s %s</b> device.}),
-        $self->persistence_partition,
+        $self->partition_file,
         format_bytes($self->persistence_partition_size, mode => "iec"),
         $self->device_vendor,
         $self->device_model
diff --git a/lib/Tails/Persistence/Step/Delete.pm b/lib/Tails/Persistence/Step/Delete.pm
index 40c72cf..81989e3 100644
--- a/lib/Tails/Persistence/Step/Delete.pm
+++ b/lib/Tails/Persistence/Step/Delete.pm
@@ -27,7 +27,7 @@ textdomain("tails-persistence-setup");


 has 'persistence_partition'      => required ro Str;
 has 'persistence_partition_size' => required ro Int;
-
+has 'partition_file'             => required ro Str;


=head1 CONSTRUCTORS

@@ -45,7 +45,7 @@ sub BUILD {
     # TRANSLATORS: partition, size, device vendor, device model
     $self->description->set_markup($self->encoding->decode(sprintf(
         gettext(q{The persistent volume %s (%s), on the <b>%s %s</b> device, will be deleted.}),
-        $self->persistence_partition,
+        $self->partition_file,
         format_bytes($self->persistence_partition_size, mode => "iec"),
         $self->device_vendor,
         $self->device_model
-- 
1.7.9.5