|
|
8d85c1 |
From a5e3f2407589a232edd6bcf498d13529cedcd599 Mon Sep 17 00:00:00 2001
|
|
|
8d85c1 |
From: Carlos Soriano <csoriano@redhat.com>
|
|
|
8d85c1 |
Date: Wed, 29 Aug 2018 16:20:14 +0200
|
|
|
8d85c1 |
Subject: [PATCH] Revert "nautilus-fileroller: remove compress support"
|
|
|
8d85c1 |
|
|
|
8d85c1 |
This reverts commit fad2372ccbbfd40013b4225002f4a737d67928bc.
|
|
|
8d85c1 |
---
|
|
|
8d85c1 |
nautilus/nautilus-fileroller.c | 66 ++++++++++++++++++++++++++++++++++
|
|
|
8d85c1 |
1 file changed, 66 insertions(+)
|
|
|
8d85c1 |
|
|
|
8d85c1 |
diff --git a/nautilus/nautilus-fileroller.c b/nautilus/nautilus-fileroller.c
|
|
|
8d85c1 |
index 441356bf..196f0282 100644
|
|
|
8d85c1 |
--- a/nautilus/nautilus-fileroller.c
|
|
|
8d85c1 |
+++ b/nautilus/nautilus-fileroller.c
|
|
|
8d85c1 |
@@ -105,6 +105,44 @@ extract_here_callback (NautilusMenuItem *item,
|
|
|
8d85c1 |
g_string_free (cmd, TRUE);
|
|
|
8d85c1 |
}
|
|
|
8d85c1 |
|
|
|
8d85c1 |
+
|
|
|
8d85c1 |
+static void
|
|
|
8d85c1 |
+add_callback (NautilusMenuItem *item,
|
|
|
8d85c1 |
+ gpointer user_data)
|
|
|
8d85c1 |
+{
|
|
|
8d85c1 |
+ GList *files, *scan;
|
|
|
8d85c1 |
+ NautilusFileInfo *file;
|
|
|
8d85c1 |
+ char *uri, *dir;
|
|
|
8d85c1 |
+ GString *cmd;
|
|
|
8d85c1 |
+
|
|
|
8d85c1 |
+ files = g_object_get_data (G_OBJECT (item), "files");
|
|
|
8d85c1 |
+ file = files->data;
|
|
|
8d85c1 |
+
|
|
|
8d85c1 |
+ uri = nautilus_file_info_get_uri (file);
|
|
|
8d85c1 |
+ dir = g_path_get_dirname (uri);
|
|
|
8d85c1 |
+
|
|
|
8d85c1 |
+ cmd = g_string_new ("file-roller");
|
|
|
8d85c1 |
+ g_string_append (cmd, " --notify");
|
|
|
8d85c1 |
+ g_string_append_printf (cmd," --default-dir=%s", g_shell_quote (dir));
|
|
|
8d85c1 |
+ g_string_append (cmd," --add");
|
|
|
8d85c1 |
+
|
|
|
8d85c1 |
+ g_free (dir);
|
|
|
8d85c1 |
+ g_free (uri);
|
|
|
8d85c1 |
+
|
|
|
8d85c1 |
+ for (scan = files; scan; scan = scan->next) {
|
|
|
8d85c1 |
+ NautilusFileInfo *file = scan->data;
|
|
|
8d85c1 |
+
|
|
|
8d85c1 |
+ uri = nautilus_file_info_get_uri (file);
|
|
|
8d85c1 |
+ g_string_append_printf (cmd, " %s", g_shell_quote (uri));
|
|
|
8d85c1 |
+ g_free (uri);
|
|
|
8d85c1 |
+ }
|
|
|
8d85c1 |
+
|
|
|
8d85c1 |
+ g_spawn_command_line_async (cmd->str, NULL);
|
|
|
8d85c1 |
+
|
|
|
8d85c1 |
+ g_string_free (cmd, TRUE);
|
|
|
8d85c1 |
+}
|
|
|
8d85c1 |
+
|
|
|
8d85c1 |
+
|
|
|
8d85c1 |
static struct {
|
|
|
8d85c1 |
char *mime_type;
|
|
|
8d85c1 |
gboolean is_compressed;
|
|
|
8d85c1 |
@@ -218,6 +256,10 @@ nautilus_fr_get_file_items (NautilusMenuProvider *provider,
|
|
|
8d85c1 |
GList *items = NULL;
|
|
|
8d85c1 |
GList *scan;
|
|
|
8d85c1 |
gboolean can_write = TRUE;
|
|
|
8d85c1 |
+ gboolean one_item;
|
|
|
8d85c1 |
+ gboolean one_archive = FALSE;
|
|
|
8d85c1 |
+ gboolean one_derived_archive = FALSE;
|
|
|
8d85c1 |
+ gboolean one_compressed_archive = FALSE;
|
|
|
8d85c1 |
gboolean all_archives = TRUE;
|
|
|
8d85c1 |
gboolean all_archives_derived = TRUE;
|
|
|
8d85c1 |
gboolean all_archives_compressed = TRUE;
|
|
|
8d85c1 |
@@ -254,6 +296,11 @@ nautilus_fr_get_file_items (NautilusMenuProvider *provider,
|
|
|
8d85c1 |
|
|
|
8d85c1 |
/**/
|
|
|
8d85c1 |
|
|
|
8d85c1 |
+ one_item = (files != NULL) && (files->next == NULL);
|
|
|
8d85c1 |
+ one_archive = one_item && all_archives;
|
|
|
8d85c1 |
+ one_derived_archive = one_archive && all_archives_derived;
|
|
|
8d85c1 |
+ one_compressed_archive = one_archive && all_archives_compressed;
|
|
|
8d85c1 |
+
|
|
|
8d85c1 |
if (all_archives && can_write) {
|
|
|
8d85c1 |
NautilusMenuItem *item;
|
|
|
8d85c1 |
|
|
|
8d85c1 |
@@ -293,6 +340,25 @@ nautilus_fr_get_file_items (NautilusMenuProvider *provider,
|
|
|
8d85c1 |
|
|
|
8d85c1 |
}
|
|
|
8d85c1 |
|
|
|
8d85c1 |
+ if (! one_compressed_archive || one_derived_archive) {
|
|
|
8d85c1 |
+ NautilusMenuItem *item;
|
|
|
8d85c1 |
+
|
|
|
8d85c1 |
+ item = nautilus_menu_item_new ("NautilusFr::add",
|
|
|
8d85c1 |
+ g_dgettext ("file-roller", "Compress..."),
|
|
|
8d85c1 |
+ g_dgettext ("file-roller", "Create a compressed archive with the selected objects"),
|
|
|
8d85c1 |
+ "gnome-mime-application-x-archive");
|
|
|
8d85c1 |
+ g_signal_connect (item,
|
|
|
8d85c1 |
+ "activate",
|
|
|
8d85c1 |
+ G_CALLBACK (add_callback),
|
|
|
8d85c1 |
+ provider);
|
|
|
8d85c1 |
+ g_object_set_data_full (G_OBJECT (item),
|
|
|
8d85c1 |
+ "files",
|
|
|
8d85c1 |
+ nautilus_file_info_list_copy (files),
|
|
|
8d85c1 |
+ (GDestroyNotify) nautilus_file_info_list_free);
|
|
|
8d85c1 |
+
|
|
|
8d85c1 |
+ items = g_list_append (items, item);
|
|
|
8d85c1 |
+ }
|
|
|
8d85c1 |
+
|
|
|
8d85c1 |
return items;
|
|
|
8d85c1 |
}
|
|
|
8d85c1 |
|
|
|
8d85c1 |
--
|
|
|
8d85c1 |
2.17.1
|
|
|
8d85c1 |
|