[yast-commit] r66314 - in /branches/SuSE-Code-11-SP2-Branch/snapper: VERSION package/yast2-snapper.changes src/Snapper.ycp src/dialogs.ycp
![](https://seccdn.libravatar.org/avatar/60813f3f932f58dedcb16c313b400a2e.jpg?s=120&d=mm&r=g)
Author: jsuchome Date: Fri Oct 7 11:00:26 2011 New Revision: 66314 URL: http://svn.opensuse.org/viewcvs/yast?rev=66314&view=rev Log: - show path to current subvolume above filesystem tree (bnc#719482) - close the feedback window correctly (bnc#722477) - 2.17.6 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/snappe... ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/snapper/VERSION (original) +++ branches/SuSE-Code-11-SP2-Branch/snapper/VERSION Fri Oct 7 11:00:26 2011 @@ -1 +1 @@ -2.17.5 +2.17.6 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/snappe... ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/snapper/package/yast2-snapper.changes (original) +++ branches/SuSE-Code-11-SP2-Branch/snapper/package/yast2-snapper.changes Fri Oct 7 11:00:26 2011 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Fri Oct 7 09:07:43 CEST 2011 - jsuchome@suse.cz + +- show path to current subvolume above filesystem tree (bnc#719482) +- close the feedback window correctly (bnc#722477) +- 2.17.6 + +------------------------------------------------------------------- Wed Sep 21 16:07:48 CEST 2011 - jsuchome@suse.cz - support more snapper configurations (bnc#719482) Modified: branches/SuSE-Code-11-SP2-Branch/snapper/src/Snapper.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/snappe... ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/snapper/src/Snapper.ycp (original) +++ branches/SuSE-Code-11-SP2-Branch/snapper/src/Snapper.ycp Fri Oct 7 11:00:26 2011 @@ -87,6 +87,16 @@ } /** + * Return the full path to the given file from currently selected configuration (subvolume) + * @param file path, relatively to current config + * GetFileFullPath ("/testfile.txt") -> /abc/testfile.txt for /abc subvolume + */ +global string GetFileFullPath (string file) { + + return snapshots[selected_snapshot_index,"files_index",file,"full_path"]:file; +} + +/** * Describe what was done with given file between given snapshots * - when new is 0, meaning is 'current system' */ @@ -97,7 +107,7 @@ string file2 = sformat ("%1%2", GetSnapshotPath (new), file); if (new == 0) { - file2 = snapshots[selected_snapshot_index,"files_index",file,"full_path"]:file; + file2 = GetFileFullPath (file); } y2milestone ("comparing '%1' and '%2'", file1, file2); @@ -304,7 +314,7 @@ UI::ChangeWidget (`id (`progress ), `Value, progress); string orig = GetSnapshotPath (snapshot_num) + file; - string full_path= snapshots[selected_snapshot_index,"files_index",file,"full_path"]:file; + string full_path= GetFileFullPath (file); string dir = substring (full_path, 0, findlastof (full_path, "/")); if (!FileUtils::Exists (orig)) Modified: branches/SuSE-Code-11-SP2-Branch/snapper/src/dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/snappe... ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/snapper/src/dialogs.ycp (original) +++ branches/SuSE-Code-11-SP2-Branch/snapper/src/dialogs.ycp Fri Oct 7 11:00:26 2011 @@ -253,7 +253,6 @@ if (!haskey (snapshot, "tree_map")) { snapshot["tree_map"] = Snapper::ReadModifiedFilesMap (from, to); - Popup::ClearFeedback (); tree_map = snapshot["tree_map"]:$[]; } // full paths of files marked as modified, mapping to changes string @@ -263,6 +262,7 @@ snapshot["files_index"] = Snapper::ReadModifiedFilesIndex (from, to); Snapper::snapshots[Snapper::selected_snapshot_index] = snapshot; } + Popup::ClearFeedback (); files_index = snapshot["files_index"]:$[]; // update the global snapshots list @@ -279,7 +279,6 @@ boolean file_was_removed (string file) { return (substring (files_index[file,"status"]:"", 0, 1) == "-"); } - // go through the map defining filesystem tree and create the widget items list<term> generate_tree_items (string current_path, map<string,map> current_branch) { @@ -471,6 +470,10 @@ } string tree_label = sformat ("%1 - %2", previous_num, snapshot_num); + // find out the path to current subvolume + string subtree_path = Snapper::GetSnapshotPath (snapshot_num); + subtree_path = substring (subtree_path, 0, find (subtree_path, ".snapshots/")); + term date_widget = `VBox ( `HBox ( // label, date string will follow at the end of line @@ -497,9 +500,10 @@ `HWeight (1, `HBox (`VSpacing (20), `VBox (`HSpacing(70), `HBox ( `HSpacing (), - `ReplacePoint (`id (`reptree), + `ReplacePoint (`id (`reptree), `VBox ( + `Left (`Label (subtree_path)), `Tree (`id(`tree), tree_label, []) - ), + )), `HSpacing () ), `HBox ( @@ -537,9 +541,10 @@ if (size (tree_items) > 0) { - UI::ReplaceWidget (`id (`reptree), + UI::ReplaceWidget (`id (`reptree), `VBox ( + `Left (`Label (subtree_path)), `Tree (`id(`tree), `opt (`notify, `immediate, `multiSelection, `recursiveSelection), tree_label, tree_items) - ); + )); // no item is selected UI::ChangeWidget (`tree, `CurrentItem, nil); } @@ -607,7 +612,7 @@ %1 -from snapshot '%2' to current system?", current_file, previous_num))) +from snapshot '%2' to current system?", Snapper::GetFileFullPath (current_file), previous_num))) { Snapper::RestoreFiles (previous_num, [current_file]); } @@ -619,7 +624,7 @@ %1 -from snapshot '%2' to current system?", current_file, snapshot_num))) +from snapshot '%2' to current system?", Snapper::GetFileFullPath (current_file), snapshot_num))) { Snapper::RestoreFiles (snapshot_num, [current_file]); } @@ -627,22 +632,30 @@ } else if (ret == `next) { list<string> files = (list<string>) UI::QueryWidget (`id (`tree), `SelectedItems); + list<string> to_restore = []; files = filter (string file, files, { - return haskey (files_index, file); + if (haskey (files_index, file)) + { + to_restore = add (to_restore, Snapper::GetFileFullPath (file)); + return true; + } + else + { + return false; + } }); - if (files == []) + if (to_restore == []) { // popup message Popup::Message (_("No file was selected for restoring")); continue; } - // FIXME restore from PRE or POST? (PRE by default) // 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?"), - previous_num, mergestring (files, "<br>")), + previous_num, mergestring (to_restore, "<br>")), 60, 20, Label::YesButton (), Label::NoButton (), `focus_no)) { Snapper::RestoreFiles (previous_num, files); -- 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