[yast-commit] r67205 - in /branches/SuSE-Code-11-SP2-Branch/snapper: VERSION package/yast2-snapper.changes src/Snapper.ycp src/dialogs.ycp
Author: jsuchome Date: Mon Jan 16 16:09:44 2012 New Revision: 67205 URL: http://svn.opensuse.org/viewcvs/yast?rev=67205&view=rev Log: - when reverting changes to selected snapshot, delete files as well (bnc#741214) - 2.17.13 Modified: branches/SuSE-Code-11-SP2-Branch/snapper/VERSION branches/SuSE-Code-11-SP2-Branch/snapper/package/yast2-snapper.changes branches/SuSE-Code-11-SP2-Branch/snapper/src/Snapper.ycp branches/SuSE-Code-11-SP2-Branch/snapper/src/dialogs.ycp Modified: branches/SuSE-Code-11-SP2-Branch/snapper/VERSION URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/snapper/VERSION?rev=67205&r1=67204&r2=67205&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/snapper/VERSION (original) +++ branches/SuSE-Code-11-SP2-Branch/snapper/VERSION Mon Jan 16 16:09:44 2012 @@ -1 +1 @@ -2.17.12 +2.17.13 Modified: branches/SuSE-Code-11-SP2-Branch/snapper/package/yast2-snapper.changes URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/snapper/package/yast2-snapper.changes?rev=67205&r1=67204&r2=67205&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/snapper/package/yast2-snapper.changes (original) +++ branches/SuSE-Code-11-SP2-Branch/snapper/package/yast2-snapper.changes Mon Jan 16 16:09:44 2012 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Mon Jan 16 10:45:11 CET 2012 - jsuchome@suse.cz + +- when reverting changes to selected snapshot, delete files as well + (bnc#741214) +- 2.17.13 + +------------------------------------------------------------------- Thu Nov 24 11:52:29 CET 2011 - jsuchome@suse.cz - removed fixed sizes in UI, to prevent breaking Gtk (bnc#731363) Modified: branches/SuSE-Code-11-SP2-Branch/snapper/src/Snapper.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/snapper/src/Snapper.ycp?rev=67205&r1=67204&r2=67205&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/snapper/src/Snapper.ycp (original) +++ branches/SuSE-Code-11-SP2-Branch/snapper/src/Snapper.ycp Mon Jan 16 16:09:44 2012 @@ -328,8 +328,10 @@ if (!FileUtils::Exists (orig)) { + SCR::Execute (.target.bash, sformat ("/bin/rm -rf -- '%1'", String::Quote (full_path))); + y2milestone ("removing '%1' from system", full_path); // log entry (%1 is file name) - UI::ChangeWidget (`id (`log), `LastLine, sformat (_("%1 does not exist in snapshot %2\n"), file, snapshot_num)); + UI::ChangeWidget (`id (`log), `LastLine, sformat (_("Deleted %1\n"), full_path)); } else if (FileUtils::CheckAndCreatePath (dir)) { Modified: branches/SuSE-Code-11-SP2-Branch/snapper/src/dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/snapper/src/dialogs.ycp?rev=67205&r1=67204&r2=67205&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/snapper/src/dialogs.ycp (original) +++ branches/SuSE-Code-11-SP2-Branch/snapper/src/dialogs.ycp Mon Jan 16 16:09:44 2012 @@ -405,30 +405,27 @@ content = add (content, `VStretch ()); } + // button label + string restore_label = _("R&estore From First"); + // button label + string restore_label_single = _("Restore"); + + if (file_was_created (file)) + { + restore_label = Label::RemoveButton (); + restore_label_single= Label::RemoveButton (); + } + UI::ReplaceWidget (`id (`diff_content), `HBox (`HSpacing (0.5), `VBox ( content, `VSquash (`HBox ( `HStretch (), - // button label - type == `SINGLE ? `Empty () : `PushButton (`id (`restore_pre), _("R&estore From First")), - // button label - `PushButton (`id (`restore), type == `SINGLE ? _("Restore") : _("Res&tore From Second")) + type == `SINGLE ? `Empty () : `PushButton (`id (`restore_pre), restore_label), + `PushButton (`id (`restore), type == `SINGLE ? restore_label_single : _("Res&tore From Second")) )) ), `HSpacing (0.5)) ); - if (file_was_created (file)) - { - // file created after taking first snapshot cannot be restored from that snapshot - if (type == `SINGLE) - { - UI::ChangeWidget (`id (`restore), `Enabled, false); - } - else - { - UI::ChangeWidget (`id (`restore_pre), `Enabled, false); - } - } - else if (type != `SINGLE && file_was_removed (file)) + if (type != `SINGLE && file_was_removed (file)) { // file removed in 2nd snapshot cannot be restored from that snapshot UI::ChangeWidget (`id (`restore), `Enabled, false); @@ -629,13 +626,27 @@ else if (ret == `abort || ret == `cancel || ret == `back) { break; } + else if ((ret == `restore_pre || (ret == `restore && type == `SINGLE)) + && file_was_created (current_file)) + { + // yes/no question, %1 is file name, %2 is number + if (Popup::YesNo (sformat (_("Do you want to delete the file + +%1 + +from current system?"), Snapper::GetFileFullPath (current_file)))) + { + Snapper::RestoreFiles (ret == `restore_pre ? previous_num : snapshot_num, [current_file]); + } + continue; + } else if (ret == `restore_pre) { // yes/no question, %1 is file name, %2 is number - if (Popup::YesNo (sformat ("Do you want to copy the file + if (Popup::YesNo (sformat (_("Do you want to copy the file %1 -from snapshot '%2' to current system?", Snapper::GetFileFullPath (current_file), previous_num))) +from snapshot '%2' to current system?"), Snapper::GetFileFullPath (current_file), previous_num))) { Snapper::RestoreFiles (previous_num, [current_file]); } @@ -643,11 +654,11 @@ } else if (ret == `restore) { // yes/no question, %1 is file name, %2 is number - if (Popup::YesNo (sformat ("Do you want to copy the file + if (Popup::YesNo (sformat (_("Do you want to copy the file %1 -from snapshot '%2' to current system?", Snapper::GetFileFullPath (current_file), snapshot_num))) +from snapshot '%2' to current system?"), Snapper::GetFileFullPath (current_file), snapshot_num))) { Snapper::RestoreFiles (snapshot_num, [current_file]); } @@ -677,7 +688,12 @@ // popup headline if (Popup::AnyQuestionRichText (_("Restoring files"), // popup message, %1 is snapshot number, %2 list of files - sformat (_("These files will be copied from snapshot '%1' to current system: <p>%2</p>Are you sure?"), + sformat (_("<p>These files will be restored from snapshot '%1':</p> +<p> +%2 +</p> +<p>Files existing in original snapshot will be copied to current system.</p> +<p>Files that did not exist in the snapshot will be deleted.</p>Are you sure?"), previous_num, mergestring (to_restore, "<br>")), 60, 20, Label::YesButton (), Label::NoButton (), `focus_no)) { -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
jsuchome@svn2.opensuse.org