Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flatten single-item submenus #132

Merged
merged 2 commits into from
Jan 20, 2024
Merged

Conversation

ferdnyc
Copy link
Contributor

@ferdnyc ferdnyc commented Jan 11, 2024

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 the nautilus_dropbox_parse_menu() function, a necessary adjustment because toret (which was unused in the function anyway) will no longer be defined until after nautilus_dropbox_parse_menu() is called.

Then, the second commit makes the adjustments so that nautilus_dropbox_get_file_items() calls nautilus_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

image

image

With this patch

image

Nautilus 43+ uses Gtk4 context menus, where submenus have to be
clicked on and entered instead of opening on hover. This makes
accessing submenus containing only a single item needlessly tedious.

So, we detect when the Dropbox submenu will only contain a single
selection, and promote it up to the top level instead of burying
it within an unnecessary submenu layer.
@CLAassistant
Copy link

CLAassistant commented Jan 11, 2024

CLA assistant check
All committers have signed the CLA.

@ferdnyc
Copy link
Contributor Author

ferdnyc commented Jan 11, 2024

CLA just signed.

Well, maybe not. I did the old, Google Forms-based one. Trying to sign the new CLAassistant-managed version, I'm getting stuck at a second screen. I submitted the first page that came up, and now I'm faced with this:

image

There's nowhere to click "Submit" or the like, and no actual agreement in there anywhere.

(Edit: It loaded, after about 45 seconds.)

@jewelpit
Copy link
Member

I can merge this once #133 updates the build scripts to use the right distro versions 👍

@jewelpit
Copy link
Member

The canary jobs failed, but from looking at the logs it's because they're still running against the older commit before I fixed them today. Rather than asking you to push a new commit to update the PR, I'll just go ahead and land because I was able to run them all successfully locally on my testing VMs. Thanks for getting this!

@jewelpit jewelpit merged commit 1e37564 into dropbox:master Jan 20, 2024
1 of 4 checks passed
@ferdnyc ferdnyc deleted the flatten-submenu branch January 21, 2024 02:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants