mirror of
https://github.com/linuxmint/timeshift.git
synced 2024-09-11 17:07:43 +03:00
Commandline: Paginate snapshot list displayed for restore
This commit is contained in:
parent
0ab90bb05c
commit
759257bd0a
@ -38,7 +38,7 @@ using TeeJee.System;
|
||||
using TeeJee.Misc;
|
||||
|
||||
public Main App;
|
||||
public const string AppName = "TimeShift";
|
||||
public const string AppName = "Timeshift RSYNC";
|
||||
public const string AppShortName = "timeshift";
|
||||
public const string AppVersion = "1.6.2";
|
||||
public const string AppAuthor = "Tony George";
|
||||
@ -126,6 +126,7 @@ public class Main : GLib.Object{
|
||||
public string prompt_type = "";
|
||||
public bool prompt_user = false;
|
||||
public bool prompt_break = false;
|
||||
public int snapshot_list_start_index = 0;
|
||||
|
||||
//initialization
|
||||
|
||||
@ -358,7 +359,7 @@ public class Main : GLib.Object{
|
||||
LOG_TIMESTAMP = false;
|
||||
if (snapshot_list.size > 0){
|
||||
log_msg(_("Snapshots") + ":");
|
||||
list_snapshots();
|
||||
list_snapshots(false);
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
@ -810,6 +811,25 @@ public class Main : GLib.Object{
|
||||
exit_app();
|
||||
exit(0);
|
||||
}
|
||||
else if (line.down() == "p"){
|
||||
snapshot_list_start_index -= 10;
|
||||
if (snapshot_list_start_index < 0){
|
||||
snapshot_list_start_index = 0;
|
||||
}
|
||||
log_msg("");
|
||||
list_snapshots(true);
|
||||
log_msg("");
|
||||
prompt_break = true;
|
||||
}
|
||||
else if (line.down() == "n"){
|
||||
if ((snapshot_list_start_index + 10) < snapshot_list.size){
|
||||
snapshot_list_start_index += 10;
|
||||
}
|
||||
log_msg("");
|
||||
list_snapshots(true);
|
||||
log_msg("");
|
||||
prompt_break = true;
|
||||
}
|
||||
else if (line.contains("_")||line.contains("-")){
|
||||
//TODO
|
||||
log_error("Invalid input");
|
||||
@ -1010,35 +1030,16 @@ public class Main : GLib.Object{
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
if (){
|
||||
Source.remove (shutdownTimerID);
|
||||
WaitingForShutdown = false;
|
||||
return;
|
||||
}
|
||||
else if ((ch == 'q')||(ch == 'Q')){
|
||||
if (Status == AppStatus.RUNNING){
|
||||
stop_batch();
|
||||
}
|
||||
}
|
||||
else if ((ch == 'p')||(ch == 'P')){
|
||||
if (Status == AppStatus.RUNNING){
|
||||
pause();
|
||||
}
|
||||
}
|
||||
else if ((ch == 'r')||(ch == 'R')){
|
||||
if (Status == AppStatus.PAUSED){
|
||||
resume();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
public void list_snapshots(){
|
||||
public void list_snapshots(bool paginate){
|
||||
LOG_TIMESTAMP = false;
|
||||
int index = -1;
|
||||
foreach (TimeShiftBackup bak in snapshot_list){
|
||||
log_msg("%4d > %s%s%s".printf(++index, bak.name, " ~ " + bak.taglist_short, (bak.description.length > 0) ? " ~ " + bak.description : ""));
|
||||
index++;
|
||||
if (!paginate || ((index >= snapshot_list_start_index) && (index < snapshot_list_start_index + 10))){
|
||||
log_msg("%4d > %s%s%s".printf(index, bak.name, " ~ " + bak.taglist_short, (bak.description.length > 0) ? " ~ " + bak.description : ""));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1969,7 +1970,7 @@ public class Main : GLib.Object{
|
||||
|
||||
log_msg("");
|
||||
log_msg(TERM_COLOR_YELLOW + _("Select snapshot to restore") + ":\n" + TERM_COLOR_RESET);
|
||||
list_snapshots();
|
||||
list_snapshots(true);
|
||||
log_msg("");
|
||||
|
||||
prompt_type = "snapshot-restore";
|
||||
@ -1977,7 +1978,7 @@ public class Main : GLib.Object{
|
||||
prompt_break = false;
|
||||
|
||||
while (prompt_user){
|
||||
stdout.printf(TERM_COLOR_YELLOW + _("Enter snapshot number (a=Abort)") + ": " + TERM_COLOR_RESET);
|
||||
stdout.printf(TERM_COLOR_YELLOW + _("Enter snapshot number (a=Abort, p=Previous, n=Next)") + ": " + TERM_COLOR_RESET);
|
||||
stdout.flush();
|
||||
while (snapshot_to_restore == null){
|
||||
Thread.usleep((ulong) GLib.TimeSpan.MILLISECOND * 100);
|
||||
|
@ -1,5 +1,5 @@
|
||||
[Desktop Entry]
|
||||
Name=TimeShift
|
||||
Name=Timeshift
|
||||
MimeType=
|
||||
Exec=timeshift-launcher
|
||||
Type=Application
|
||||
@ -9,4 +9,4 @@ Icon=timeshift
|
||||
Caption=System Restore Utility
|
||||
X-KDE-StartupNotify=false
|
||||
Categories=System;
|
||||
Name[en_IN]=TimeShift
|
||||
Name[en_IN]=Timeshift
|
||||
|
@ -17,8 +17,8 @@ long_line_behaviour=1
|
||||
long_line_column=80
|
||||
|
||||
[files]
|
||||
current_page=11
|
||||
FILE_NAME_0=58628;Vala;0;EUTF-8;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Ftimeshift%2Fsrc%2FMain.vala;0;4
|
||||
current_page=0
|
||||
FILE_NAME_0=1346;Vala;0;EUTF-8;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Ftimeshift%2Fsrc%2FMain.vala;0;4
|
||||
FILE_NAME_1=904;Vala;0;EUTF-8;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Ftimeshift%2Fsrc%2FMainWindow.vala;0;4
|
||||
FILE_NAME_2=22134;Vala;0;EUTF-8;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Ftimeshift%2Fsrc%2FRestoreWindow.vala;0;4
|
||||
FILE_NAME_3=913;Vala;0;EUTF-8;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Ftimeshift%2Fsrc%2FSettingsWindow.vala;0;4
|
||||
|
336
timeshift.pot
336
timeshift.pot
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user