-
Notifications
You must be signed in to change notification settings - Fork 166
[WIP] Fix decrypt context menu not appearing for .gpg files in Nemo #554
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
base: master
Are you sure you want to change the base?
Conversation
* Add decrypt menu for GPG encrypted files - Added decrypt_callback function to handle decryption requests - Added is_encrypted_file function to detect encrypted files by extension (.gpg, .asc, .sig) and MIME type - Modified logic to show Decrypt menu for encrypted files instead of no menu - Extension now properly detects .gpg files and provides decrypt context menu --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: the78mole <[email protected]>
| /* Check file extension for .gpg and .asc files */ | ||
| name = nemo_file_info_get_name (file); | ||
| if (name != NULL) { | ||
| int len = strlen (name); | ||
| if ((len > 4 && g_ascii_strcasecmp (name + len - 4, ".gpg") == 0) || | ||
| (len > 4 && g_ascii_strcasecmp (name + len - 4, ".asc") == 0) || | ||
| (len > 4 && g_ascii_strcasecmp (name + len - 4, ".sig") == 0)) { | ||
| result = TRUE; | ||
| } | ||
| } | ||
| g_free (name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is useful - those extensions are used by many files that are not encrypted also, and the function that nemo_file_info_is_mime_type() eventually resolves to - g_content_type_is_a() - already does this sort of thing for us. We should just trust it.
| is_all_encrypted_files (GList *files) | ||
| { | ||
| while (files) { | ||
| if (!is_encrypted_file ((NemoFileInfo*)(files->data))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could just call is_mime_types() here instead, and get rid of is_encrypted_file()
I also validated it by compiling, installing and testing the Extension on my local Linux Mint installation.
Disclaimer: I used Github Copilot to "solve" the issue, but reviewed and tested the functionality manually.
You can find the PR in my fork here: the78mole#2