mirror of
https://github.com/linuxmint/timeshift.git
synced 2024-08-17 04:20:34 +03:00
Prompt user before taking the pre-restore snapshot
This commit is contained in:
parent
2d3ce218cc
commit
74868e7921
@ -924,7 +924,7 @@ class MainWindow : Gtk.Window{
|
||||
App.restore_target = App.root_device;
|
||||
|
||||
//show restore window -----------------
|
||||
|
||||
|
||||
var dialog = new RestoreWindow();
|
||||
dialog.set_transient_for (this);
|
||||
dialog.show_all();
|
||||
@ -937,7 +937,7 @@ class MainWindow : Gtk.Window{
|
||||
else{
|
||||
return; //cancel
|
||||
}
|
||||
|
||||
|
||||
//update UI ----------------
|
||||
|
||||
update_ui(false);
|
||||
@ -945,19 +945,32 @@ class MainWindow : Gtk.Window{
|
||||
//take a snapshot if current system is being restored -----------------
|
||||
|
||||
if (!App.is_live_system() && (App.restore_target.device == App.root_device.device) && (App.restore_target.uuid == App.root_device.uuid)){
|
||||
statusbar_message(_("Taking snapshot..."));
|
||||
|
||||
update_progress_start();
|
||||
|
||||
string msg = _("Do you want to take a snapshot of the current system before restoring the selected snapshot?");
|
||||
|
||||
bool is_success = App.take_snapshot(true);
|
||||
var dialog2 = new Gtk.MessageDialog.with_markup(null, Gtk.DialogFlags.MODAL, Gtk.MessageType.QUESTION, Gtk.ButtonsType.YES_NO, msg);
|
||||
dialog2.set_title(_("Take Snapshot"));
|
||||
dialog2.set_default_size (200, -1);
|
||||
dialog2.set_transient_for(this);
|
||||
dialog2.set_modal(true);
|
||||
response = dialog2.run();
|
||||
dialog2.destroy();
|
||||
|
||||
if (response == Gtk.ResponseType.YES){
|
||||
statusbar_message(_("Taking snapshot..."));
|
||||
|
||||
update_progress_stop();
|
||||
|
||||
if (is_success){
|
||||
App.update_snapshot_list();
|
||||
var latest = App.get_latest_snapshot("ondemand");
|
||||
latest.description = _("Before restoring") + " '%s'".printf(App.snapshot_to_restore.name);
|
||||
latest.update_control_file();
|
||||
update_progress_start();
|
||||
|
||||
bool is_success = App.take_snapshot(true);
|
||||
|
||||
update_progress_stop();
|
||||
|
||||
if (is_success){
|
||||
App.update_snapshot_list();
|
||||
var latest = App.get_latest_snapshot("ondemand");
|
||||
latest.description = _("Before restoring") + " '%s'".printf(App.snapshot_to_restore.name);
|
||||
latest.update_control_file();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,12 +17,12 @@ long_line_behaviour=1
|
||||
long_line_column=80
|
||||
|
||||
[files]
|
||||
current_page=4
|
||||
FILE_NAME_0=2176;Vala;0;16;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Ftimeshift%2Fsrc%2FMain.vala;0;4
|
||||
FILE_NAME_1=3715;Vala;0;16;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Ftimeshift%2Fsrc%2FMainWindow.vala;0;4
|
||||
FILE_NAME_2=18296;Vala;0;16;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Ftimeshift%2Fsrc%2FSettingsWindow.vala;0;4
|
||||
FILE_NAME_3=13804;Vala;0;16;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Ftimeshift%2Fsrc%2FRestoreWindow.vala;0;4
|
||||
FILE_NAME_4=12635;Vala;0;16;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Ftimeshift%2Fsrc%2FUtility.vala;0;4
|
||||
current_page=2
|
||||
FILE_NAME_0=2482;Vala;0;16;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Ftimeshift%2Fsrc%2FMain.vala;0;4
|
||||
FILE_NAME_1=2651;Vala;0;16;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Ftimeshift%2Fsrc%2FMainWindow.vala;0;4
|
||||
FILE_NAME_2=17072;Vala;0;16;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Ftimeshift%2Fsrc%2FSettingsWindow.vala;0;4
|
||||
FILE_NAME_3=6114;Vala;0;16;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Ftimeshift%2Fsrc%2FRestoreWindow.vala;0;4
|
||||
FILE_NAME_4=9134;Vala;0;16;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Ftimeshift%2Fsrc%2FUtility.vala;0;4
|
||||
FILE_NAME_5=1138;Make;0;16;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Ftimeshift%2Fsrc%2Fmakefile;0;4
|
||||
FILE_NAME_6=410;Conf;0;16;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Ftimeshift%2Fdebian%2Fcontrol;0;4
|
||||
FILE_NAME_7=232;None;0;16;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Ftimeshift%2Fdebian%2Fchangelog;0;4
|
||||
|
Loading…
Reference in New Issue
Block a user