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.
Nautilus since v43 uses Gtk4 for its file views, and the context menus are implemented as popovers instead of "real" traditional context menus. One functionality difference is, submenus don't open on hover, they have to be clicked to enter.
That makes single-item submenus particularly tedious to deal with. When right-clicking on a file/directory that's not in the Dropbox folder, the only item displayed is "Move to Dropbox", and having it hidden in a submenu is an unnecessary complication.
These patches detect when the Dropbox submenu contains only a single item, and promotes it to the top level, removing the extra indirection to reach it.
Dropbox submenus containing two or more items are unaffected.
A preparatory commit removes the
toret
argument from thenautilus_dropbox_parse_menu()
function, a necessary adjustment becausetoret
(which was unused in the function anyway) will no longer be defined until afternautilus_dropbox_parse_menu()
is called.Then, the second commit makes the adjustments so that
nautilus_dropbox_get_file_items()
callsnautilus_dropbox_parse_menu()
before setting up its outer menu wrapper. Then, based on whether the list of menu items returned contains 1 or more than one items, it will either return the single item as its menu option, or create a "Dropbox" wrapper and place the list of multiple items into it as a submenu, as before.Without this patch
With this patch