From 3cbe0925d35538a01fcb82504b8117ff82fbb3c1 Mon Sep 17 00:00:00 2001 From: Alberto Milone Date: Thu, 15 Apr 2010 16:19:01 +0200 Subject: [PATCH] * lib/plymouth/themes/lubuntu-logo/lubuntu-logo.script: - Add the support for receiving a localised progress string (LP: #553954). * Release version 0.7. --- debian/changelog | 7 ++-- .../themes/lubuntu-logo/lubuntu-logo.script | 37 +++++++++++++++---- 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/debian/changelog b/debian/changelog index 09386b1..fc4fb8f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,9 @@ -lubuntu-artwork (0.7) UNRELEASED; urgency=low +lubuntu-artwork (0.7) lucid; urgency=low - * + * lib/plymouth/themes/lubuntu-logo/lubuntu-logo.script: + - Add the support for receiving a localised progress string (LP: #553954). - -- Julien Lavergne Mon, 05 Apr 2010 15:46:20 +0200 + -- Alberto Milone Tue, 13 Apr 2010 18:36:32 +0200 lubuntu-artwork (0.6) lucid; urgency=low diff --git a/lib/plymouth/themes/lubuntu-logo/lubuntu-logo.script b/lib/plymouth/themes/lubuntu-logo/lubuntu-logo.script index 550b66d..d3a51f8 100644 --- a/lib/plymouth/themes/lubuntu-logo/lubuntu-logo.script +++ b/lib/plymouth/themes/lubuntu-logo/lubuntu-logo.script @@ -133,6 +133,18 @@ fun StringCopy (source, beginning, end) { return local.destination; } +fun StringReplace (source, pattern, replacement) { + local.found = StringString(source, pattern); + if (local.found == NULL) + return source; + + local.new_string = StringCopy (source, 0, local.found - 1) + + replacement + + StringCopy (source, local.found + StringLength(pattern), NULL); + + return local.new_string; +} + # it makes sense to use it only for # numbers up to 100 fun StringToInteger (str) { @@ -640,11 +652,12 @@ fun set_progress_label_opacity (opacity) { # label, the associated # device and the image size of the sprite. -fun init_progress_label (device) { +fun init_progress_label (device, status_string) { # Make the slot unavailable global.progress_label.is_available = 0; progress_label.progress = 0; progress_label.device = device; + progress_label.status_string = status_string; } # See if the progress label is keeping track of the fsck @@ -677,7 +690,12 @@ fun update_progress_label (progress) { } } # Update progress label here - label = "Checking disk " + global.counter.current + " of " + global.counter.total + " (" + progress_label.progress + "% complete)"; + # + # FIXME: the queue logic from this theme should really be moved into mountall + # instead of using string replacement to deal with localised strings. + label = StringReplace (progress_label.status_string[0], "%1$d", global.counter.current); + label = StringReplace (label, "%2$d", global.counter.total); + label = StringReplace (label, "%3$d", progress_label.progress); progress_label = get_fsck_label (label, 0); #progress_label.progress = progress; @@ -824,7 +842,7 @@ fun update_progress_in_queue (index, device, progress) { # # NOTE: no more than "progress_bar.max_number" bars are allowed # -fun fsck_check (device, progress) { +fun fsck_check (device, progress, status_string) { # The 1st time this will take place if (!global.progress_label) { @@ -832,7 +850,7 @@ fun fsck_check (device, progress) { increase_fsck_count (); # Set up a new label for the check - init_progress_label (device); + init_progress_label (device, status_string); update_progress_label (progress); return; @@ -868,7 +886,7 @@ fun fsck_check (device, progress) { #Debug("setting new label for device " + device + " progress " + progress); # Set up a new label for the check - init_progress_label (device); + init_progress_label (device, status_string); update_progress_label (progress); } @@ -936,12 +954,15 @@ fun update_status_callback (status) { # my_string = update_strings[0] + " " + update_strings[1] + " " + update_strings[2]; # Debug(my_string); # Let's assume that we're dealing with these strings fsck:sda1:40 - if ((string_it == 2) && (update_strings[0] == "fsck")) { + if ((string_it >= 2) && (update_strings[0] == "fsck")) { device = update_strings[1]; progress = update_strings[2]; + status_string[0] = update_strings[3]; # "Checking disk %1$d of %2$d (%3$d %% complete)" - if ((device != "") && (progress != "")) { + if ((device != "") && + (progress != "") && + (status_string[0] != "")) { progress = StringToInteger (progress); # Make sure that the fsck_queue is initialised @@ -956,7 +977,7 @@ fun update_status_callback (status) { # create_extra_fsck_label (); # Keep track of the fsck check - fsck_check (device, progress); + fsck_check (device, progress, status_string); } }