Skip to content

Conversation

@the78mole
Copy link

@the78mole the78mole commented Aug 3, 2025

  • 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

I also validated it by compiling, installing and testing the Extension on my local Linux Mint installation.

2025-08-03_15-59 - Encrypt 2025-08-03_16-01 - Decrypt

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

* 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]>
@the78mole the78mole changed the title Fix decrypt context menu not appearing for .gpg files in Nemo (#2) Fix decrypt context menu not appearing for .gpg files in Nemo Aug 3, 2025
Comment on lines +163 to +173
/* 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);
Copy link
Member

@mtwebster mtwebster Oct 30, 2025

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)))
Copy link
Member

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()

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.

2 participants