Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello, this PR fixes some issues (see bottom) related to cutting/pasting/deleting items in the
cinnamon-menu-editor.Sorry for the very long description, but it took me a long time to (sort of) understand this application, so I think I should provide a detailed description so that more people can easier understand/review these changes.
Changelog and explanation
Commit 4b0f5cb:
This commit fixes bad UX when copying items. Whenever user clicks on the "Copy" button no visual changes occur, despite the fact that the application places the item into a buffer. This might lead the user to think that copying "doesn't work". Pasting will only activate when user selects a category from the left menu.
To fix this I've added one line to the
on_edit_copy_activate()function. This line simulates user reopening the category that is currently open -> the one where copying occured. This will cause the currently selected items to deselect and will activate the "Paste" button, which will provide necessary UI feedback to the user. This issue was mention in the #9293 (comment)Commit dbc7fe6
This commit fixes two cutting/pasting bugs. First of all the current "cut" functionality is not really a cut. It just copies an item and immediately removes it, which is not how cutting should work. Items shouldn't be deleted until they're pasted somewhere. This commit fixes this through the introduction of a new variable
self.item_to_cut, which indicates that cutting is (not) in progress.This commit also fixed issues with duplicate cutting, by that I mean the incorrect behavior that occurs whenever cutting non-user-made items, which causes the same item to appear where its supposed to be pasted (correct), but also in its original category (incorrect duplicate). This is only worsened by fact that deleting either of these duplicated causes both to be deleted. This is caused by the fact that the pasted item is XML
<Include>ed into the target category, but it is also displayed in the original one, because of theCategories.desktopproperty.My fix dbc7fe6#diff-c98f55b82ed859a581afcbd203640e9e8dd29811a0cfd3db9d133c99f1becbdcR257 to this works by altering how items are pasted. Instead of just pasting the item I think it's also required to alter its
Categoriesattribute in the.desktopfile. My code basically just overrides the defaultCategories(which cause the duplication), with the category name of where the item was pasted into.For example, the calculator app is by default in
Categories=GNOME;GTK;Utility;Calculator;, after the paste into "Graphics" my code would transform.desktopof the pasted item toCategories=Graphics;.Unfortunately recent changes from a692d52#diff-04e819d30a3cd74ec4ed5faf25823f7121c8043dc21dbe9ecfa9231b2e7e19e7R54 are unexpectedly causing more issues here, because this also makes the editor add an additional (unneeded) localized property for ex.
Categories[en_US]=Graphics;. While this is incorrect behavior I don't think it would cause any issues for now. I figured I should leave this alone and let maintainers make a decision, because I'm sure you know better than me.Issues which this PR is based on
In my opinion this PR closes