Skip to content

Commit

Permalink
Add the ability to support 'unar' over .zip archives
Browse files Browse the repository at this point in the history
Closes #210
  • Loading branch information
sc0w committed Aug 22, 2018
1 parent 10e665f commit c587ae1
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 5 deletions.
5 changes: 5 additions & 0 deletions data/org.mate.engrampa.gschema.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@
<summary>Encrypt the archive header</summary>
<description>Whether to encrypt the archive header. If the header is encrypted the password will be required to list the archive content as well.</description>
</key>
<key name="unar-open-zip" type="b">
<default>false</default>
<summary>Adds 'unar' support over .zip archives.</summary>
<description>It enables the ability to support 'unar' over .zip archives.</description>
</key>
</schema>
<schema gettext-domain="@GETTEXT_PACKAGE@" id="org.mate.engrampa.dialogs" path="/org/mate/engrampa/dialogs/">
<child name="extract" schema="org.mate.engrampa.dialogs.extract"/>
Expand Down
15 changes: 13 additions & 2 deletions src/fr-command-7z.c
Original file line number Diff line number Diff line change
Expand Up @@ -588,13 +588,24 @@ const char *sevenz_mime_types[] = { "application/x-7z-compressed",
"application/x-ms-dos-executable",
"application/x-ms-wim",
"application/x-rar",
"application/zip",
NULL };
"application/zip", /* zip always at the end and the number of */
NULL }; /* place in fr_command_7z_get_mime_types */


static const char **
fr_command_7z_get_mime_types (FrCommand *comm)
{
GSettings *settings;
settings = g_settings_new ("org.mate.engrampa.general");

if (g_settings_get_boolean (settings, "unar-open-zip") &&
is_program_in_path ("unar") && is_program_in_path ("lsar"))
sevenz_mime_types [8] = NULL;
else
g_settings_set_boolean (settings, "unar-open-zip", FALSE);

g_object_unref (settings);

return sevenz_mime_types;
}

Expand Down
3 changes: 2 additions & 1 deletion src/fr-command-unarchiver.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,8 @@ fr_command_unarchiver_handle_error (FrCommand *comm,
}


const char *unarchiver_mime_type[] = { "application/x-cbr",
const char *unarchiver_mime_type[] = { "application/zip",
"application/x-cbr",
"application/x-rar",
NULL };

Expand Down
15 changes: 13 additions & 2 deletions src/fr-command-zip.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,13 +392,24 @@ const char *zip_mime_type[] = {
"application/x-ear",
"application/x-ms-dos-executable",
"application/x-war",
"application/zip",
NULL };
"application/zip", /* zip always at the end and the number of */
NULL }; /* place in fr_command_zip_get_mime_types */


static const char **
fr_command_zip_get_mime_types (FrCommand *comm)
{
GSettings *settings;
settings = g_settings_new ("org.mate.engrampa.general");

if (g_settings_get_boolean (settings, "unar-open-zip") &&
is_program_in_path ("unar") && is_program_in_path ("lsar"))
zip_mime_type [10] = NULL;
else
g_settings_set_boolean (settings, "unar-open-zip", FALSE);

g_object_unref (settings);

return zip_mime_type;
}

Expand Down

0 comments on commit c587ae1

Please sign in to comment.