[nautilus/wip/muktupavels/delete: 2/3] dbus-manager: add and implement FileOperations2 interface
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/muktupavels/delete: 2/3] dbus-manager: add and implement FileOperations2 interface
- Date: Tue, 4 Feb 2020 09:40:46 +0000 (UTC)
commit f873afd456d9604b0a4f90cee0c8c8e98b744244
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Thu Jan 30 23:55:15 2020 +0200
dbus-manager: add and implement FileOperations2 interface
Add new version of FileOperations interface. This versions adds
PlatformData argument to all methods. Currently supported arguments
are parent-handle and timestamp.
This change is necessary for proper focus handling.
https://gitlab.gnome.org/GNOME/nautilus/merge_requests/504
data/dbus-interfaces2.xml | 72 ++++++
src/meson.build | 10 +
src/nautilus-dbus-manager.c | 314 ++++++++++++++++++++++---
src/nautilus-file-operations-dbus-data.c | 75 ++++++
src/nautilus-file-operations-dbus-data.h | 34 +++
src/nautilus-file-operations.c | 348 +++++++++++++++++++---------
src/nautilus-file-operations.h | 115 ++++-----
src/nautilus-file-undo-manager.c | 16 +-
src/nautilus-file-undo-manager.h | 6 +-
src/nautilus-file-undo-operations.c | 226 +++++++++++-------
src/nautilus-file-undo-operations.h | 23 +-
src/nautilus-files-view.c | 9 +-
src/nautilus-mime-actions.c | 1 +
src/nautilus-trash-bar.c | 2 +-
src/nautilus-window.c | 10 +-
test/automated/displayless/test-utilities.c | 6 +-
test/interactive/test-copy.c | 1 +
17 files changed, 962 insertions(+), 306 deletions(-)
---
diff --git a/data/dbus-interfaces2.xml b/data/dbus-interfaces2.xml
new file mode 100644
index 000000000..0e62e5725
--- /dev/null
+++ b/data/dbus-interfaces2.xml
@@ -0,0 +1,72 @@
+<!DOCTYPE node PUBLIC
+"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+
+<!--
+ Copyright (C) 2011 Red Hat, Inc.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General
+ Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
+ Author: Alexander Larsson <alexl redhat com>
+-->
+
+<node xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd">
+ <interface name='org.gnome.Nautilus.FileOperations2'>
+
+ <!--
+ All methods takes PlatformData argument that can be used to
+ pass extra data. Currently supported arguments are:
+ - parent-handle (s): the parent window identifier, used to set
+ parent window for dialogs; must be in
+ x11:XID or wayland:HANDLE form
+ - timestamp (u): the timestamp of the user interaction
+ -->
+
+ <method name='CopyURIs'>
+ <arg type='as' name='SourceFilesURIList' direction='in'/>
+ <arg type='s' name='DestinationDirectoryURI' direction='in'/>
+ <arg type='a{sv}' name='PlatformData' direction='in'/>
+ </method>
+ <method name='MoveURIs'>
+ <arg type='as' name='SourceFilesURIList' direction='in'/>
+ <arg type='s' name='DestinationDirectoryURI' direction='in'/>
+ <arg type='a{sv}' name='PlatformData' direction='in'/>
+ </method>
+ <method name='EmptyTrash'>
+ <arg type='a{sv}' name='PlatformData' direction='in'/>
+ </method>
+ <method name='TrashFiles'>
+ <arg type='as' name='URIs' direction='in'/>
+ <arg type='a{sv}' name='PlatformData' direction='in'/>
+ </method>
+ <method name='CreateFolder'>
+ <arg type='s' name='URI' direction='in'/>
+ <arg type='a{sv}' name='PlatformData' direction='in'/>
+ </method>
+ <method name='RenameFile'>
+ <arg type='s' name='URI' direction='in'/>
+ <arg type='s' name='NewName' direction='in'/>
+ <arg type='a{sv}' name='PlatformData' direction='in'/>
+ </method>
+ <method name='Undo'>
+ <arg type='a{sv}' name='PlatformData' direction='in'/>
+ </method>
+ <method name='Redo'>
+ <arg type='a{sv}' name='PlatformData' direction='in'/>
+ </method>
+
+ <property name="UndoStatus" type="i" access="read"/>
+
+ </interface>
+</node>
diff --git a/src/meson.build b/src/meson.build
index 86d062161..274a26dba 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -37,6 +37,14 @@ libnautilus_sources = [
interface_prefix: 'org.gnome.Nautilus',
namespace: 'NautilusDBus'
),
+ gnome.gdbus_codegen(
+ 'nautilus-generated2',
+ join_paths(
+ meson.source_root(), 'data', 'dbus-interfaces2.xml'
+ ),
+ interface_prefix: 'org.gnome.Nautilus',
+ namespace: 'NautilusDBus'
+ ),
gnome.gdbus_codegen(
'nautilus-shell-search-provider-generated',
join_paths(
@@ -180,6 +188,8 @@ libnautilus_sources = [
'nautilus-operations-ui-manager.h',
'nautilus-file-operations.c',
'nautilus-file-operations.h',
+ 'nautilus-file-operations-dbus-data.c',
+ 'nautilus-file-operations-dbus-data.h',
'nautilus-file-private.h',
'nautilus-file-queue.c',
'nautilus-file-queue.h',
diff --git a/src/nautilus-dbus-manager.c b/src/nautilus-dbus-manager.c
index 43f27e10a..1623745bd 100644
--- a/src/nautilus-dbus-manager.c
+++ b/src/nautilus-dbus-manager.c
@@ -24,6 +24,7 @@
#include "nautilus-dbus-manager.h"
#include "nautilus-generated.h"
+#include "nautilus-generated2.h"
#include "nautilus-file-operations.h"
#include "nautilus-file-undo-manager.h"
@@ -37,6 +38,7 @@ struct _NautilusDBusManager
GObject parent;
NautilusDBusFileOperations *file_operations;
+ NautilusDBusFileOperations2 *file_operations2;
};
G_DEFINE_TYPE (NautilusDBusManager, nautilus_dbus_manager, G_TYPE_OBJECT);
@@ -52,6 +54,12 @@ nautilus_dbus_manager_dispose (GObject *object)
self->file_operations = NULL;
}
+ if (self->file_operations2)
+ {
+ g_object_unref (self->file_operations2);
+ self->file_operations2 = NULL;
+ }
+
G_OBJECT_CLASS (nautilus_dbus_manager_parent_class)->dispose (object);
}
@@ -67,9 +75,8 @@ undo_redo_on_finished (gpointer user_data)
g_free (handler_id);
}
-static gboolean
-handle_redo (NautilusDBusFileOperations *object,
- GDBusMethodInvocation *invocation)
+static void
+handle_redo_internal (NautilusFileOperationsDBusData *dbus_data)
{
NautilusFileUndoManager *undo_manager = NULL;
gint *handler_id = g_new0(int, 1);
@@ -80,15 +87,36 @@ handle_redo (NautilusDBusFileOperations *object,
*handler_id = g_signal_connect_swapped (undo_manager, "undo-changed",
G_CALLBACK (undo_redo_on_finished),
handler_id);
- nautilus_file_undo_manager_redo (NULL);
+ nautilus_file_undo_manager_redo (NULL, dbus_data);
+}
+
+static gboolean
+handle_redo (NautilusDBusFileOperations *object,
+ GDBusMethodInvocation *invocation)
+{
+ handle_redo_internal (NULL);
nautilus_dbus_file_operations_complete_redo (object, invocation);
return TRUE; /* invocation was handled */
}
static gboolean
-handle_undo (NautilusDBusFileOperations *object,
- GDBusMethodInvocation *invocation)
+handle_redo2 (NautilusDBusFileOperations2 *object,
+ GDBusMethodInvocation *invocation,
+ GVariant *platform_data)
+{
+ g_autoptr (NautilusFileOperationsDBusData) dbus_data = NULL;
+
+ dbus_data = nautilus_file_operations_dbus_data_new (platform_data);
+
+ handle_redo_internal (dbus_data);
+
+ nautilus_dbus_file_operations2_complete_redo (object, invocation);
+ return TRUE; /* invocation was handled */
+}
+
+static void
+handle_undo_internal (NautilusFileOperationsDBusData *dbus_data)
{
NautilusFileUndoManager *undo_manager = NULL;
gint *handler_id = g_new0(int, 1);
@@ -99,12 +127,34 @@ handle_undo (NautilusDBusFileOperations *object,
*handler_id = g_signal_connect_swapped (undo_manager, "undo-changed",
G_CALLBACK (undo_redo_on_finished),
handler_id);
- nautilus_file_undo_manager_undo (NULL);
+ nautilus_file_undo_manager_undo (NULL, dbus_data);
+}
+
+static gboolean
+handle_undo (NautilusDBusFileOperations *object,
+ GDBusMethodInvocation *invocation)
+{
+ handle_undo_internal (NULL);
nautilus_dbus_file_operations_complete_undo (object, invocation);
return TRUE; /* invocation was handled */
}
+static gboolean
+handle_undo2 (NautilusDBusFileOperations2 *object,
+ GDBusMethodInvocation *invocation,
+ GVariant *platform_data)
+{
+ g_autoptr (NautilusFileOperationsDBusData) dbus_data = NULL;
+
+ dbus_data = nautilus_file_operations_dbus_data_new (platform_data);
+
+ handle_undo_internal (dbus_data);
+
+ nautilus_dbus_file_operations2_complete_undo (object, invocation);
+ return TRUE; /* invocation was handled */
+}
+
static void
create_folder_on_finished (GFile *new_file,
gboolean success,
@@ -113,10 +163,9 @@ create_folder_on_finished (GFile *new_file,
g_application_release (g_application_get_default ());
}
-static gboolean
-handle_create_folder (NautilusDBusFileOperations *object,
- GDBusMethodInvocation *invocation,
- const gchar *uri)
+static void
+handle_create_folder_internal (const char *uri,
+ NautilusFileOperationsDBusData *dbus_data)
{
g_autoptr (GFile) file = NULL;
g_autoptr (GFile) parent_file = NULL;
@@ -129,13 +178,38 @@ handle_create_folder (NautilusDBusFileOperations *object,
parent_file_uri = g_file_get_uri (parent_file);
g_application_hold (g_application_get_default ());
- nautilus_file_operations_new_folder (NULL, parent_file_uri, basename,
+ nautilus_file_operations_new_folder (NULL, dbus_data,
+ parent_file_uri, basename,
create_folder_on_finished, NULL);
+}
+
+static gboolean
+handle_create_folder (NautilusDBusFileOperations *object,
+ GDBusMethodInvocation *invocation,
+ const gchar *uri)
+{
+ handle_create_folder_internal (uri, NULL);
nautilus_dbus_file_operations_complete_create_folder (object, invocation);
return TRUE; /* invocation was handled */
}
+static gboolean
+handle_create_folder2 (NautilusDBusFileOperations2 *object,
+ GDBusMethodInvocation *invocation,
+ const gchar *uri,
+ GVariant *platform_data)
+{
+ g_autoptr (NautilusFileOperationsDBusData) dbus_data = NULL;
+
+ dbus_data = nautilus_file_operations_dbus_data_new (platform_data);
+
+ handle_create_folder_internal (uri, dbus_data);
+
+ nautilus_dbus_file_operations2_complete_create_folder (object, invocation);
+ return TRUE; /* invocation was handled */
+}
+
static void
copy_move_on_finished (GHashTable *debutting_uris,
gboolean success,
@@ -144,11 +218,10 @@ copy_move_on_finished (GHashTable *debutting_uris,
g_application_release (g_application_get_default ());
}
-static gboolean
-handle_copy_uris (NautilusDBusFileOperations *object,
- GDBusMethodInvocation *invocation,
- const gchar **sources,
- const gchar *destination)
+static void
+handle_copy_uris_internal (const char **sources,
+ const char *destination,
+ NautilusFileOperationsDBusData *dbus_data)
{
GList *source_files = NULL;
gint idx;
@@ -160,18 +233,45 @@ handle_copy_uris (NautilusDBusFileOperations *object,
g_application_hold (g_application_get_default ());
nautilus_file_operations_copy_move (source_files, destination,
- GDK_ACTION_COPY, NULL, copy_move_on_finished, NULL);
+ GDK_ACTION_COPY, NULL, dbus_data,
+ copy_move_on_finished, NULL);
g_list_free_full (source_files, g_free);
- nautilus_dbus_file_operations_complete_copy_uris (object, invocation);
- return TRUE; /* invocation was handled */
}
static gboolean
-handle_move_uris (NautilusDBusFileOperations *object,
+handle_copy_uris (NautilusDBusFileOperations *object,
GDBusMethodInvocation *invocation,
const gchar **sources,
const gchar *destination)
+{
+ handle_copy_uris_internal (sources, destination, NULL);
+
+ nautilus_dbus_file_operations_complete_copy_uris (object, invocation);
+ return TRUE; /* invocation was handled */
+}
+
+static gboolean
+handle_copy_uris2 (NautilusDBusFileOperations2 *object,
+ GDBusMethodInvocation *invocation,
+ const gchar **sources,
+ const gchar *destination,
+ GVariant *platform_data)
+{
+ g_autoptr (NautilusFileOperationsDBusData) dbus_data = NULL;
+
+ dbus_data = nautilus_file_operations_dbus_data_new (platform_data);
+
+ handle_copy_uris_internal (sources, destination, dbus_data);
+
+ nautilus_dbus_file_operations2_complete_copy_uris (object, invocation);
+ return TRUE; /* invocation was handled */
+}
+
+static void
+handle_move_uris_internal (const char **sources,
+ const char *destination,
+ NautilusFileOperationsDBusData *dbus_data)
{
GList *source_files = NULL;
gint idx;
@@ -183,24 +283,73 @@ handle_move_uris (NautilusDBusFileOperations *object,
g_application_hold (g_application_get_default ());
nautilus_file_operations_copy_move (source_files, destination,
- GDK_ACTION_MOVE, NULL, copy_move_on_finished, NULL);
+ GDK_ACTION_MOVE, NULL, dbus_data,
+ copy_move_on_finished, NULL);
g_list_free_full (source_files, g_free);
+}
+
+static gboolean
+handle_move_uris (NautilusDBusFileOperations *object,
+ GDBusMethodInvocation *invocation,
+ const gchar **sources,
+ const gchar *destination)
+{
+ handle_move_uris_internal (sources, destination, NULL);
+
nautilus_dbus_file_operations_complete_copy_uris (object, invocation);
return TRUE; /* invocation was handled */
}
+static gboolean
+handle_move_uris2 (NautilusDBusFileOperations2 *object,
+ GDBusMethodInvocation *invocation,
+ const gchar **sources,
+ const gchar *destination,
+ GVariant *platform_data)
+{
+ g_autoptr (NautilusFileOperationsDBusData) dbus_data = NULL;
+
+ dbus_data = nautilus_file_operations_dbus_data_new (platform_data);
+
+ handle_move_uris_internal (sources, destination, dbus_data);
+
+ nautilus_dbus_file_operations2_complete_copy_uris (object, invocation);
+ return TRUE; /* invocation was handled */
+}
+
/* FIXME: Needs a callback for maintaining alive the application */
+static void
+handle_empty_trash_internal (NautilusFileOperationsDBusData *dbus_data)
+{
+ nautilus_file_operations_empty_trash (NULL, dbus_data);
+}
+
static gboolean
handle_empty_trash (NautilusDBusFileOperations *object,
GDBusMethodInvocation *invocation)
{
- nautilus_file_operations_empty_trash (NULL);
+ handle_empty_trash_internal (NULL);
nautilus_dbus_file_operations_complete_empty_trash (object, invocation);
return TRUE; /* invocation was handled */
}
+static gboolean
+handle_empty_trash2 (NautilusDBusFileOperations2 *object,
+ GDBusMethodInvocation *invocation,
+ GVariant *platform_data)
+{
+ g_autoptr (NautilusFileOperationsDBusData) dbus_data = NULL;
+
+ dbus_data = nautilus_file_operations_dbus_data_new (platform_data);
+
+ handle_empty_trash_internal (dbus_data);
+
+ nautilus_dbus_file_operations2_complete_empty_trash (object, invocation);
+ return TRUE; /* invocation was handled */
+}
+
static void
trash_on_finished (GHashTable *debutting_uris,
gboolean user_cancel,
@@ -209,10 +358,9 @@ trash_on_finished (GHashTable *debutting_uris,
g_application_release (g_application_get_default ());
}
-static gboolean
-handle_trash_files (NautilusDBusFileOperations *object,
- GDBusMethodInvocation *invocation,
- const gchar **sources)
+static void
+handle_trash_files_internal (const char **sources,
+ NautilusFileOperationsDBusData *dbus_data)
{
g_autolist (GFile) source_files = NULL;
gint idx;
@@ -225,12 +373,37 @@ handle_trash_files (NautilusDBusFileOperations *object,
g_application_hold (g_application_get_default ());
nautilus_file_operations_trash_or_delete_async (source_files, NULL,
+ dbus_data,
trash_on_finished, NULL);
+}
+
+static gboolean
+handle_trash_files (NautilusDBusFileOperations *object,
+ GDBusMethodInvocation *invocation,
+ const gchar **sources)
+{
+ handle_trash_files_internal (sources, NULL);
nautilus_dbus_file_operations_complete_trash_files (object, invocation);
return TRUE; /* invocation was handled */
}
+static gboolean
+handle_trash_files2 (NautilusDBusFileOperations2 *object,
+ GDBusMethodInvocation *invocation,
+ const gchar **sources,
+ GVariant *platform_data)
+{
+ g_autoptr (NautilusFileOperationsDBusData) dbus_data = NULL;
+
+ dbus_data = nautilus_file_operations_dbus_data_new (platform_data);
+
+ handle_trash_files_internal (sources, dbus_data);
+
+ nautilus_dbus_file_operations2_complete_trash_files (object, invocation);
+ return TRUE; /* invocation was handled */
+}
+
static void
rename_file_on_finished (NautilusFile *file,
GFile *result_location,
@@ -240,11 +413,10 @@ rename_file_on_finished (NautilusFile *file,
g_application_release (g_application_get_default ());
}
-static gboolean
-handle_rename_file (NautilusDBusFileOperations *object,
- GDBusMethodInvocation *invocation,
- const gchar *uri,
- const gchar *new_name)
+static void
+handle_rename_file_internal (const gchar *uri,
+ const gchar *new_name,
+ NautilusFileOperationsDBusData *dbus_data)
{
NautilusFile *file = NULL;
@@ -253,12 +425,38 @@ handle_rename_file (NautilusDBusFileOperations *object,
g_application_hold (g_application_get_default ());
nautilus_file_rename (file, new_name,
rename_file_on_finished, NULL);
+}
+
+static gboolean
+handle_rename_file (NautilusDBusFileOperations *object,
+ GDBusMethodInvocation *invocation,
+ const gchar *uri,
+ const gchar *new_name)
+{
+ handle_rename_file_internal (uri, new_name, NULL);
nautilus_dbus_file_operations_complete_rename_file (object, invocation);
return TRUE; /* invocation was handled */
}
+static gboolean
+handle_rename_file2 (NautilusDBusFileOperations2 *object,
+ GDBusMethodInvocation *invocation,
+ const gchar *uri,
+ const gchar *new_name,
+ GVariant *platform_data)
+{
+ g_autoptr (NautilusFileOperationsDBusData) dbus_data = NULL;
+
+ dbus_data = nautilus_file_operations_dbus_data_new (platform_data);
+
+ handle_rename_file_internal (uri, new_name, dbus_data);
+
+ nautilus_dbus_file_operations2_complete_rename_file (object, invocation);
+
+ return TRUE; /* invocation was handled */
+}
static void
undo_manager_changed (NautilusDBusManager *self)
@@ -268,45 +466,80 @@ undo_manager_changed (NautilusDBusManager *self)
undo_state = nautilus_file_undo_manager_get_state ();
nautilus_dbus_file_operations_set_undo_status (self->file_operations,
undo_state);
+ nautilus_dbus_file_operations2_set_undo_status (self->file_operations2,
+ undo_state);
}
static void
nautilus_dbus_manager_init (NautilusDBusManager *self)
{
self->file_operations = nautilus_dbus_file_operations_skeleton_new ();
+ self->file_operations2 = nautilus_dbus_file_operations2_skeleton_new ();
g_signal_connect (self->file_operations,
"handle-copy-uris",
G_CALLBACK (handle_copy_uris),
self);
+ g_signal_connect (self->file_operations2,
+ "handle-copy-uris",
+ G_CALLBACK (handle_copy_uris2),
+ self);
g_signal_connect (self->file_operations,
"handle-move-uris",
G_CALLBACK (handle_move_uris),
self);
+ g_signal_connect (self->file_operations2,
+ "handle-move-uris",
+ G_CALLBACK (handle_move_uris2),
+ self);
g_signal_connect (self->file_operations,
"handle-empty-trash",
G_CALLBACK (handle_empty_trash),
self);
+ g_signal_connect (self->file_operations2,
+ "handle-empty-trash",
+ G_CALLBACK (handle_empty_trash2),
+ self);
g_signal_connect (self->file_operations,
"handle-trash-files",
G_CALLBACK (handle_trash_files),
self);
+ g_signal_connect (self->file_operations2,
+ "handle-trash-files",
+ G_CALLBACK (handle_trash_files2),
+ self);
g_signal_connect (self->file_operations,
"handle-create-folder",
G_CALLBACK (handle_create_folder),
self);
+ g_signal_connect (self->file_operations2,
+ "handle-create-folder",
+ G_CALLBACK (handle_create_folder2),
+ self);
g_signal_connect (self->file_operations,
"handle-rename-file",
G_CALLBACK (handle_rename_file),
self);
+ g_signal_connect (self->file_operations2,
+ "handle-rename-file",
+ G_CALLBACK (handle_rename_file2),
+ self);
g_signal_connect (self->file_operations,
"handle-undo",
G_CALLBACK (handle_undo),
self);
+ g_signal_connect (self->file_operations2,
+ "handle-undo",
+ G_CALLBACK (handle_undo2),
+ self);
g_signal_connect (self->file_operations,
"handle-redo",
G_CALLBACK (handle_redo),
self);
+ g_signal_connect (self->file_operations2,
+ "handle-redo",
+ G_CALLBACK (handle_redo2),
+ self);
}
static void
@@ -328,10 +561,22 @@ nautilus_dbus_manager_register (NautilusDBusManager *self,
GDBusConnection *connection,
GError **error)
{
+ gboolean success1;
+ gboolean success2;
gboolean succes;
- succes = g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (self->file_operations),
- connection, "/org/gnome/Nautilus" PROFILE, error);
+ success1 = g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (self->file_operations),
+ connection,
+ "/org/gnome/Nautilus" PROFILE,
+ error);
+
+ success2 = g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (self->file_operations2),
+ connection,
+ "/org/gnome/Nautilus" PROFILE "/FileOperations2",
+ error);
+
+ succes = success1 && success2;
+
if (succes)
{
g_signal_connect_object (nautilus_file_undo_manager_get (),
@@ -350,6 +595,7 @@ void
nautilus_dbus_manager_unregister (NautilusDBusManager *self)
{
g_dbus_interface_skeleton_unexport (G_DBUS_INTERFACE_SKELETON (self->file_operations));
+ g_dbus_interface_skeleton_unexport (G_DBUS_INTERFACE_SKELETON (self->file_operations2));
g_signal_handlers_disconnect_by_data (nautilus_file_undo_manager_get (), self);
}
diff --git a/src/nautilus-file-operations-dbus-data.c b/src/nautilus-file-operations-dbus-data.c
new file mode 100644
index 000000000..37bf0e330
--- /dev/null
+++ b/src/nautilus-file-operations-dbus-data.c
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2020 Alberts Muktupāvels
+ *
+ * Nautilus is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * Nautilus is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+#include "nautilus-file-operations-dbus-data.h"
+
+struct _NautilusFileOperationsDBusData
+{
+ gatomicrefcount ref_count;
+
+ char *parent_handle;
+
+ guint32 timestamp;
+};
+
+NautilusFileOperationsDBusData *
+nautilus_file_operations_dbus_data_new (GVariant *platform_data)
+{
+ NautilusFileOperationsDBusData *self;
+ GVariantDict dict;
+
+ self = g_new0 (NautilusFileOperationsDBusData, 1);
+ g_atomic_ref_count_init (&self->ref_count);
+
+ g_variant_dict_init (&dict, platform_data);
+
+ g_variant_dict_lookup (&dict, "parent-handle", "s", &self->parent_handle);
+ g_variant_dict_lookup (&dict, "timestamp", "u", &self->timestamp);
+
+ return self;
+}
+
+NautilusFileOperationsDBusData *
+nautilus_file_operations_dbus_data_ref (NautilusFileOperationsDBusData *self)
+{
+ g_atomic_ref_count_inc (&self->ref_count);
+
+ return self;
+}
+
+void
+nautilus_file_operations_dbus_data_unref (NautilusFileOperationsDBusData *self)
+{
+ if (g_atomic_ref_count_dec (&self->ref_count))
+ {
+ g_free (self->parent_handle);
+ g_free (self);
+ }
+}
+
+const char *
+nautilus_file_operations_dbus_data_get_parent_handle (NautilusFileOperationsDBusData *self)
+{
+ return self->parent_handle;
+}
+
+guint32
+nautilus_file_operations_dbus_data_get_timestamp (NautilusFileOperationsDBusData *self)
+{
+ return self->timestamp;
+}
diff --git a/src/nautilus-file-operations-dbus-data.h b/src/nautilus-file-operations-dbus-data.h
new file mode 100644
index 000000000..d15226ff4
--- /dev/null
+++ b/src/nautilus-file-operations-dbus-data.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2020 Alberts Muktupāvels
+ *
+ * Nautilus is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * Nautilus is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#include <glib.h>
+
+typedef struct _NautilusFileOperationsDBusData NautilusFileOperationsDBusData;
+
+NautilusFileOperationsDBusData *nautilus_file_operations_dbus_data_new (GVariant
*platform_data);
+
+NautilusFileOperationsDBusData *nautilus_file_operations_dbus_data_ref
(NautilusFileOperationsDBusData *self);
+
+void nautilus_file_operations_dbus_data_unref
(NautilusFileOperationsDBusData *self);
+
+const char *nautilus_file_operations_dbus_data_get_parent_handle
(NautilusFileOperationsDBusData *self);
+
+guint32 nautilus_file_operations_dbus_data_get_timestamp
(NautilusFileOperationsDBusData *self);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(NautilusFileOperationsDBusData, nautilus_file_operations_dbus_data_unref)
diff --git a/src/nautilus-file-operations.c b/src/nautilus-file-operations.c
index e288a9afe..2f577ce99 100644
--- a/src/nautilus-file-operations.c
+++ b/src/nautilus-file-operations.c
@@ -61,12 +61,21 @@
#include "nautilus-file-undo-manager.h"
#include "nautilus-ui-utilities.h"
+#ifdef GDK_WINDOWING_X11
+#include <gdk/gdkx.h>
+#endif
+
+#ifdef GDK_WINDOWING_WAYLAND
+#include <gdk/gdkwayland.h>
+#endif
+
/* TODO: TESTING!!! */
typedef struct
{
GTimer *time;
GtkWindow *parent_window;
+ NautilusFileOperationsDBusData *dbus_data;
guint inhibit_cookie;
NautilusProgressInfo *progress;
GCancellable *cancellable;
@@ -256,11 +265,6 @@ static void empty_trash_task_done (GObject *source_object,
static char *query_fs_type (GFile *file,
GCancellable *cancellable);
-static CopyMoveJob *copy_job_setup (GList *files,
- GFile *target_dir,
- GtkWindow *parent_window,
- NautilusCopyCallback done_callback,
- gpointer done_callback_data);
static void nautilus_file_operations_copy (GTask *task,
gpointer source_object,
@@ -1027,11 +1031,12 @@ get_truncated_parse_name (GFile *file)
return eel_str_middle_truncate (parse_name, MAXIMUM_DISPLAYED_FILE_NAME_LENGTH);
}
-#define op_job_new(__type, parent_window) ((__type *) (init_common (sizeof (__type), parent_window)))
+#define op_job_new(__type, parent_window, dbus_data) ((__type *) (init_common (sizeof (__type),
parent_window, dbus_data)))
static gpointer
-init_common (gsize job_size,
- GtkWindow *parent_window)
+init_common (gsize job_size,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data)
{
CommonJob *common;
@@ -1043,6 +1048,12 @@ init_common (gsize job_size,
g_object_add_weak_pointer (G_OBJECT (common->parent_window),
(gpointer *) &common->parent_window);
}
+
+ if (dbus_data)
+ {
+ common->dbus_data = nautilus_file_operations_dbus_data_ref (dbus_data);
+ }
+
common->progress = nautilus_progress_info_new ();
common->cancellable = nautilus_progress_info_get_cancellable (common->progress);
common->time = g_timer_new ();
@@ -1071,6 +1082,11 @@ finalize_common (CommonJob *common)
(gpointer *) &common->parent_window);
}
+ if (common->dbus_data)
+ {
+ nautilus_file_operations_dbus_data_unref (common->dbus_data);
+ }
+
if (common->skip_files)
{
g_hash_table_destroy (common->skip_files);
@@ -1176,6 +1192,7 @@ can_delete_files_without_confirm (GList *files)
typedef struct
{
GtkWindow **parent_window;
+ NautilusFileOperationsDBusData *dbus_data;
gboolean ignore_close_box;
GtkMessageType message_type;
const char *primary_text;
@@ -1192,6 +1209,65 @@ typedef struct
GCond cond;
} RunSimpleDialogData;
+static void
+set_transient_for (GdkWindow *child_window,
+ const char *parent_handle)
+{
+ GdkDisplay *display;
+ const char *prefix;
+
+ display = gdk_window_get_display (child_window);
+
+#ifdef GDK_WINDOWING_X11
+ if (GDK_IS_X11_DISPLAY (display))
+ {
+ prefix = "x11:";
+
+ if (g_str_has_prefix (parent_handle, prefix))
+ {
+ const char *handle;
+ GdkWindow *window;
+
+ handle = parent_handle + strlen (prefix);
+ window = gdk_x11_window_foreign_new_for_display (display, strtol (handle, NULL, 16));
+
+ if (window != NULL)
+ {
+ gdk_window_set_transient_for (child_window, window);
+ g_object_unref (window);
+ }
+ }
+ }
+#endif
+
+#ifdef GDK_WINDOWING_WAYLAND
+ if (GDK_IS_WAYLAND_DISPLAY (display))
+ {
+ prefix = "wayland:";
+
+ if (g_str_has_prefix (parent_handle, prefix))
+ {
+ const char *handle;
+
+ handle = parent_handle + strlen (prefix);
+
+ gdk_wayland_window_set_transient_for_exported (child_window, (char *) handle);
+ }
+ }
+#endif
+}
+
+static void
+dialog_realize_cb (GtkWidget *widget,
+ gpointer user_data)
+{
+ NautilusFileOperationsDBusData *dbus_data = user_data;
+ const char *parent_handle;
+
+ parent_handle = nautilus_file_operations_dbus_data_get_parent_handle (dbus_data);
+ set_transient_for (gtk_widget_get_window (widget), parent_handle);
+}
+
static gboolean
do_run_simple_dialog (gpointer _data)
{
@@ -1259,6 +1335,30 @@ do_run_simple_dialog (gpointer _data)
gtk_widget_show (label);
}
+ if (data->dbus_data != NULL)
+ {
+ guint32 timestamp;
+
+ timestamp = nautilus_file_operations_dbus_data_get_timestamp (data->dbus_data);
+
+ /* Assuming this is used for desktop implementations, we want the
+ * dialog to be centered on the screen rather than the parent window,
+ * which could extend to all monitors. This is the case for
+ * gnome-flashback.
+ */
+ gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
+
+ if (nautilus_file_operations_dbus_data_get_parent_handle (data->dbus_data) != NULL)
+ {
+ g_signal_connect (dialog, "realize", G_CALLBACK (dialog_realize_cb), data->dbus_data);
+ }
+
+ if (timestamp != 0)
+ {
+ gtk_window_present_with_time (GTK_WINDOW (dialog), timestamp);
+ }
+ }
+
/* Run it. */
result = gtk_dialog_run (GTK_DIALOG (dialog));
@@ -1300,6 +1400,7 @@ run_simple_dialog_va (CommonJob *job,
data = g_new0 (RunSimpleDialogData, 1);
data->parent_window = &job->parent_window;
+ data->dbus_data = job->dbus_data;
data->ignore_close_box = ignore_close_box;
data->message_type = message_type;
data->primary_text = primary_text;
@@ -2492,16 +2593,17 @@ trash_or_delete_internal (GTask *task,
}
static DeleteJob *
-setup_delete_job (GList *files,
- GtkWindow *parent_window,
- gboolean try_trash,
- NautilusDeleteCallback done_callback,
- gpointer done_callback_data)
+setup_delete_job (GList *files,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data,
+ gboolean try_trash,
+ NautilusDeleteCallback done_callback,
+ gpointer done_callback_data)
{
DeleteJob *job;
/* TODO: special case desktop icon link files ... */
- job = op_job_new (DeleteJob, parent_window);
+ job = op_job_new (DeleteJob, parent_window, dbus_data);
job->files = g_list_copy_deep (files, (GCopyFunc) g_object_ref, NULL);
job->try_trash = try_trash;
job->user_cancel = FALSE;
@@ -2529,15 +2631,17 @@ setup_delete_job (GList *files,
}
static void
-trash_or_delete_internal_sync (GList *files,
- GtkWindow *parent_window,
- gboolean try_trash)
+trash_or_delete_internal_sync (GList *files,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data,
+ gboolean try_trash)
{
GTask *task;
DeleteJob *job;
job = setup_delete_job (files,
parent_window,
+ dbus_data,
try_trash,
NULL,
NULL);
@@ -2553,17 +2657,19 @@ trash_or_delete_internal_sync (GList *files,
}
static void
-trash_or_delete_internal_async (GList *files,
- GtkWindow *parent_window,
- gboolean try_trash,
- NautilusDeleteCallback done_callback,
- gpointer done_callback_data)
+trash_or_delete_internal_async (GList *files,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data,
+ gboolean try_trash,
+ NautilusDeleteCallback done_callback,
+ gpointer done_callback_data)
{
GTask *task;
DeleteJob *job;
job = setup_delete_job (files,
parent_window,
+ dbus_data,
try_trash,
done_callback,
done_callback_data);
@@ -2577,33 +2683,37 @@ trash_or_delete_internal_async (GList *files,
void
nautilus_file_operations_trash_or_delete_sync (GList *files)
{
- trash_or_delete_internal_sync (files, NULL, TRUE);
+ trash_or_delete_internal_sync (files, NULL, NULL, TRUE);
}
void
nautilus_file_operations_delete_sync (GList *files)
{
- trash_or_delete_internal_sync (files, NULL, FALSE);
+ trash_or_delete_internal_sync (files, NULL, NULL, FALSE);
}
void
-nautilus_file_operations_trash_or_delete_async (GList *files,
- GtkWindow *parent_window,
- NautilusDeleteCallback done_callback,
- gpointer done_callback_data)
+nautilus_file_operations_trash_or_delete_async (GList *files,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data,
+ NautilusDeleteCallback done_callback,
+ gpointer done_callback_data)
{
trash_or_delete_internal_async (files, parent_window,
+ dbus_data,
TRUE,
done_callback, done_callback_data);
}
void
-nautilus_file_operations_delete_async (GList *files,
- GtkWindow *parent_window,
- NautilusDeleteCallback done_callback,
- gpointer done_callback_data)
+nautilus_file_operations_delete_async (GList *files,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data,
+ NautilusDeleteCallback done_callback,
+ gpointer done_callback_data)
{
trash_or_delete_internal_async (files, parent_window,
+ dbus_data,
FALSE,
done_callback, done_callback_data);
}
@@ -2928,7 +3038,7 @@ nautilus_file_operations_unmount_mount_full (GtkWindow *parent_win
GTask *task;
EmptyTrashJob *job;
- job = op_job_new (EmptyTrashJob, parent_window);
+ job = op_job_new (EmptyTrashJob, parent_window, NULL);
job->should_confirm = FALSE;
job->trash_dirs = get_trash_dirs_for_mount (mount);
job->done_callback = empty_trash_for_unmount_done;
@@ -5674,15 +5784,16 @@ copy_task_done (GObject *source_object,
}
static CopyMoveJob *
-copy_job_setup (GList *files,
- GFile *target_dir,
- GtkWindow *parent_window,
- NautilusCopyCallback done_callback,
- gpointer done_callback_data)
+copy_job_setup (GList *files,
+ GFile *target_dir,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data,
+ NautilusCopyCallback done_callback,
+ gpointer done_callback_data)
{
CopyMoveJob *job;
- job = op_job_new (CopyMoveJob, parent_window);
+ job = op_job_new (CopyMoveJob, parent_window, dbus_data);
job->done_callback = done_callback;
job->done_callback_data = done_callback_data;
job->files = g_list_copy_deep (files, (GCopyFunc) g_object_ref, NULL);
@@ -5781,10 +5892,11 @@ nautilus_file_operations_copy_sync (GList *files,
CopyMoveJob *job;
job = copy_job_setup (files,
- target_dir,
- NULL,
- NULL,
- NULL);
+ target_dir,
+ NULL,
+ NULL,
+ NULL,
+ NULL);
task = g_task_new (NULL, job->common.cancellable, NULL, job);
g_task_set_task_data (task, job, NULL);
@@ -5797,20 +5909,22 @@ nautilus_file_operations_copy_sync (GList *files,
}
void
-nautilus_file_operations_copy_async (GList *files,
- GFile *target_dir,
- GtkWindow *parent_window,
- NautilusCopyCallback done_callback,
- gpointer done_callback_data)
+nautilus_file_operations_copy_async (GList *files,
+ GFile *target_dir,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data,
+ NautilusCopyCallback done_callback,
+ gpointer done_callback_data)
{
GTask *task;
CopyMoveJob *job;
job = copy_job_setup (files,
- target_dir,
- parent_window,
- done_callback,
- done_callback_data);
+ target_dir,
+ parent_window,
+ dbus_data,
+ done_callback,
+ done_callback_data);
task = g_task_new (NULL, job->common.cancellable, copy_task_done, job);
g_task_set_task_data (task, job, NULL);
@@ -6274,15 +6388,16 @@ move_task_done (GObject *source_object,
}
static CopyMoveJob *
-move_job_setup (GList *files,
- GFile *target_dir,
- GtkWindow *parent_window,
- NautilusCopyCallback done_callback,
- gpointer done_callback_data)
+move_job_setup (GList *files,
+ GFile *target_dir,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data,
+ NautilusCopyCallback done_callback,
+ gpointer done_callback_data)
{
CopyMoveJob *job;
- job = op_job_new (CopyMoveJob, parent_window);
+ job = op_job_new (CopyMoveJob, parent_window, dbus_data);
job->is_move = TRUE;
job->done_callback = done_callback;
job->done_callback_data = done_callback_data;
@@ -6304,7 +6419,7 @@ nautilus_file_operations_move_sync (GList *files,
GTask *task;
CopyMoveJob *job;
- job = move_job_setup (files, target_dir, NULL, NULL, NULL);
+ job = move_job_setup (files, target_dir, NULL, NULL, NULL, NULL);
task = g_task_new (NULL, job->common.cancellable, NULL, job);
g_task_set_task_data (task, job, NULL);
g_task_run_in_thread_sync (task, nautilus_file_operations_move);
@@ -6316,16 +6431,23 @@ nautilus_file_operations_move_sync (GList *files,
}
void
-nautilus_file_operations_move_async (GList *files,
- GFile *target_dir,
- GtkWindow *parent_window,
- NautilusCopyCallback done_callback,
- gpointer done_callback_data)
+nautilus_file_operations_move_async (GList *files,
+ GFile *target_dir,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data,
+ NautilusCopyCallback done_callback,
+ gpointer done_callback_data)
{
GTask *task;
CopyMoveJob *job;
- job = move_job_setup (files, target_dir, parent_window, done_callback, done_callback_data);
+ job = move_job_setup (files,
+ target_dir,
+ parent_window,
+ dbus_data,
+ done_callback,
+ done_callback_data);
+
task = g_task_new (NULL, job->common.cancellable, move_task_done, job);
g_task_set_task_data (task, job, NULL);
g_task_run_in_thread (task, nautilus_file_operations_move);
@@ -6727,16 +6849,17 @@ link_task_thread_func (GTask *task,
}
void
-nautilus_file_operations_link (GList *files,
- GFile *target_dir,
- GtkWindow *parent_window,
- NautilusCopyCallback done_callback,
- gpointer done_callback_data)
+nautilus_file_operations_link (GList *files,
+ GFile *target_dir,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data,
+ NautilusCopyCallback done_callback,
+ gpointer done_callback_data)
{
g_autoptr (GTask) task = NULL;
CopyMoveJob *job;
- job = op_job_new (CopyMoveJob, parent_window);
+ job = op_job_new (CopyMoveJob, parent_window, dbus_data);
job->done_callback = done_callback;
job->done_callback_data = done_callback_data;
job->files = g_list_copy_deep (files, (GCopyFunc) g_object_ref, NULL);
@@ -6763,16 +6886,17 @@ nautilus_file_operations_link (GList *files,
void
-nautilus_file_operations_duplicate (GList *files,
- GtkWindow *parent_window,
- NautilusCopyCallback done_callback,
- gpointer done_callback_data)
+nautilus_file_operations_duplicate (GList *files,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data,
+ NautilusCopyCallback done_callback,
+ gpointer done_callback_data)
{
g_autoptr (GTask) task = NULL;
CopyMoveJob *job;
g_autoptr (GFile) parent = NULL;
- job = op_job_new (CopyMoveJob, parent_window);
+ job = op_job_new (CopyMoveJob, parent_window, dbus_data);
job->done_callback = done_callback;
job->done_callback_data = done_callback_data;
job->files = g_list_copy_deep (files, (GCopyFunc) g_object_ref, NULL);
@@ -6965,7 +7089,7 @@ nautilus_file_set_permissions_recursive (const char *directory,
g_autoptr (GTask) task = NULL;
SetPermissionsJob *job;
- job = op_job_new (SetPermissionsJob, NULL);
+ job = op_job_new (SetPermissionsJob, NULL, NULL);
job->file = g_file_new_for_uri (directory);
job->file_permissions = file_permissions;
job->file_mask = file_mask;
@@ -7023,12 +7147,13 @@ callback_for_move_to_trash (GHashTable *debuting_uris,
}
void
-nautilus_file_operations_copy_move (const GList *item_uris,
- const char *target_dir,
- GdkDragAction copy_action,
- GtkWidget *parent_view,
- NautilusCopyCallback done_callback,
- gpointer done_callback_data)
+nautilus_file_operations_copy_move (const GList *item_uris,
+ const char *target_dir,
+ GdkDragAction copy_action,
+ GtkWidget *parent_view,
+ NautilusFileOperationsDBusData *dbus_data,
+ NautilusCopyCallback done_callback,
+ gpointer done_callback_data)
{
GList *locations;
GList *p;
@@ -7083,6 +7208,7 @@ nautilus_file_operations_copy_move (const GList *item_uris,
{
nautilus_file_operations_duplicate (locations,
parent_window,
+ dbus_data,
done_callback, done_callback_data);
}
else
@@ -7090,6 +7216,7 @@ nautilus_file_operations_copy_move (const GList *item_uris,
nautilus_file_operations_copy_async (locations,
dest,
parent_window,
+ dbus_data,
done_callback, done_callback_data);
}
if (src_dir)
@@ -7109,6 +7236,7 @@ nautilus_file_operations_copy_move (const GList *item_uris,
nautilus_file_operations_trash_or_delete_async (locations,
parent_window,
+ dbus_data,
(NautilusDeleteCallback)
callback_for_move_to_trash,
cb_data);
}
@@ -7117,6 +7245,7 @@ nautilus_file_operations_copy_move (const GList *item_uris,
nautilus_file_operations_move_async (locations,
dest,
parent_window,
+ dbus_data,
done_callback, done_callback_data);
}
}
@@ -7125,6 +7254,7 @@ nautilus_file_operations_copy_move (const GList *item_uris,
nautilus_file_operations_link (locations,
dest,
parent_window,
+ dbus_data,
done_callback, done_callback_data);
}
@@ -7557,11 +7687,12 @@ retry:
}
void
-nautilus_file_operations_new_folder (GtkWidget *parent_view,
- const char *parent_dir,
- const char *folder_name,
- NautilusCreateCallback done_callback,
- gpointer done_callback_data)
+nautilus_file_operations_new_folder (GtkWidget *parent_view,
+ NautilusFileOperationsDBusData *dbus_data,
+ const char *parent_dir,
+ const char *folder_name,
+ NautilusCreateCallback done_callback,
+ gpointer done_callback_data)
{
g_autoptr (GTask) task = NULL;
CreateJob *job;
@@ -7573,7 +7704,7 @@ nautilus_file_operations_new_folder (GtkWidget *parent_view,
parent_window = (GtkWindow *) gtk_widget_get_ancestor (parent_view, GTK_TYPE_WINDOW);
}
- job = op_job_new (CreateJob, parent_window);
+ job = op_job_new (CreateJob, parent_window, dbus_data);
job->done_callback = done_callback;
job->done_callback_data = done_callback_data;
job->dest_dir = g_file_new_for_uri (parent_dir);
@@ -7608,7 +7739,7 @@ nautilus_file_operations_new_file_from_template (GtkWidget *parent_
parent_window = (GtkWindow *) gtk_widget_get_ancestor (parent_view, GTK_TYPE_WINDOW);
}
- job = op_job_new (CreateJob, parent_window);
+ job = op_job_new (CreateJob, parent_window, NULL);
job->done_callback = done_callback;
job->done_callback_data = done_callback_data;
job->dest_dir = g_file_new_for_uri (parent_dir);
@@ -7648,7 +7779,7 @@ nautilus_file_operations_new_file (GtkWidget *parent_view,
parent_window = (GtkWindow *) gtk_widget_get_ancestor (parent_view, GTK_TYPE_WINDOW);
}
- job = op_job_new (CreateJob, parent_window);
+ job = op_job_new (CreateJob, parent_window, NULL);
job->done_callback = done_callback;
job->done_callback_data = done_callback_data;
job->dest_dir = g_file_new_for_uri (parent_dir);
@@ -7769,7 +7900,8 @@ empty_trash_thread_func (GTask *task,
}
void
-nautilus_file_operations_empty_trash (GtkWidget *parent_view)
+nautilus_file_operations_empty_trash (GtkWidget *parent_view,
+ NautilusFileOperationsDBusData *dbus_data)
{
g_autoptr (GTask) task = NULL;
EmptyTrashJob *job;
@@ -7781,7 +7913,7 @@ nautilus_file_operations_empty_trash (GtkWidget *parent_view)
parent_window = (GtkWindow *) gtk_widget_get_ancestor (parent_view, GTK_TYPE_WINDOW);
}
- job = op_job_new (EmptyTrashJob, parent_window);
+ job = op_job_new (EmptyTrashJob, parent_window, dbus_data);
job->trash_dirs = g_list_prepend (job->trash_dirs,
g_file_new_for_uri ("trash:"));
job->should_confirm = TRUE;
@@ -8222,16 +8354,17 @@ extract_task_thread_func (GTask *task,
}
void
-nautilus_file_operations_extract_files (GList *files,
- GFile *destination_directory,
- GtkWindow *parent_window,
- NautilusExtractCallback done_callback,
- gpointer done_callback_data)
+nautilus_file_operations_extract_files (GList *files,
+ GFile *destination_directory,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data,
+ NautilusExtractCallback done_callback,
+ gpointer done_callback_data)
{
ExtractJob *extract_job;
g_autoptr (GTask) task = NULL;
- extract_job = op_job_new (ExtractJob, parent_window);
+ extract_job = op_job_new (ExtractJob, parent_window, dbus_data);
extract_job->source_files = g_list_copy_deep (files,
(GCopyFunc) g_object_ref,
NULL);
@@ -8569,18 +8702,19 @@ compress_task_thread_func (GTask *task,
}
void
-nautilus_file_operations_compress (GList *files,
- GFile *output,
- AutoarFormat format,
- AutoarFilter filter,
- GtkWindow *parent_window,
- NautilusCreateCallback done_callback,
- gpointer done_callback_data)
+nautilus_file_operations_compress (GList *files,
+ GFile *output,
+ AutoarFormat format,
+ AutoarFilter filter,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data,
+ NautilusCreateCallback done_callback,
+ gpointer done_callback_data)
{
g_autoptr (GTask) task = NULL;
CompressJob *compress_job;
- compress_job = op_job_new (CompressJob, parent_window);
+ compress_job = op_job_new (CompressJob, parent_window, dbus_data);
compress_job->source_files = g_list_copy_deep (files,
(GCopyFunc) g_object_ref,
NULL);
diff --git a/src/nautilus-file-operations.h b/src/nautilus-file-operations.h
index c9f0ae79a..4d3ef321a 100644
--- a/src/nautilus-file-operations.h
+++ b/src/nautilus-file-operations.h
@@ -27,6 +27,7 @@
#include <gio/gio.h>
#include <gnome-autoar/gnome-autoar.h>
+#include "nautilus-file-operations-dbus-data.h"
#define SECONDS_NEEDED_FOR_APROXIMATE_TRANSFER_RATE 1
@@ -50,18 +51,21 @@ typedef void (* NautilusExtractCallback) (GList *outputs,
/* FIXME: int copy_action should be an enum */
-void nautilus_file_operations_copy_move (const GList *item_uris,
- const char *target_dir_uri,
- GdkDragAction copy_action,
- GtkWidget *parent_view,
- NautilusCopyCallback done_callback,
- gpointer done_callback_data);
-void nautilus_file_operations_empty_trash (GtkWidget *parent_view);
-void nautilus_file_operations_new_folder (GtkWidget *parent_view,
- const char *parent_dir_uri,
- const char *folder_name,
- NautilusCreateCallback done_callback,
- gpointer done_callback_data);
+void nautilus_file_operations_copy_move (const GList *item_uris,
+ const char *target_dir_uri,
+ GdkDragAction copy_action,
+ GtkWidget *parent_view,
+ NautilusFileOperationsDBusData *dbus_data,
+ NautilusCopyCallback done_callback,
+ gpointer done_callback_data);
+void nautilus_file_operations_empty_trash (GtkWidget *parent_view,
+ NautilusFileOperationsDBusData *dbus_data);
+void nautilus_file_operations_new_folder (GtkWidget *parent_view,
+ NautilusFileOperationsDBusData *dbus_data,
+ const char *parent_dir_uri,
+ const char *folder_name,
+ NautilusCreateCallback done_callback,
+ gpointer done_callback_data);
void nautilus_file_operations_new_file (GtkWidget *parent_view,
const char *parent_dir,
const char *target_filename,
@@ -78,15 +82,16 @@ void nautilus_file_operations_new_file_from_template (GtkWidget *p
void nautilus_file_operations_trash_or_delete_sync (GList *files);
void nautilus_file_operations_delete_sync (GList *files);
-void nautilus_file_operations_trash_or_delete_async (GList *files,
- GtkWindow *parent_window,
- NautilusDeleteCallback done_callback,
- gpointer done_callback_data);
-void nautilus_file_operations_delete_async (GList *files,
- GtkWindow *parent_window,
- NautilusDeleteCallback done_callback,
- gpointer done_callback_data);
-
+void nautilus_file_operations_trash_or_delete_async (GList *files,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data,
+ NautilusDeleteCallback done_callback,
+ gpointer done_callback_data);
+void nautilus_file_operations_delete_async (GList *files,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data,
+ NautilusDeleteCallback done_callback,
+ gpointer done_callback_data);
void nautilus_file_set_permissions_recursive (const char *directory,
guint32 file_permissions,
@@ -114,40 +119,46 @@ void nautilus_file_operations_mount_volume_full (GtkWindow
NautilusMountCallback mount_callback,
GObject *mount_callback_data_object);
-void nautilus_file_operations_copy_async (GList *files,
- GFile *target_dir,
- GtkWindow *parent_window,
- NautilusCopyCallback done_callback,
- gpointer done_callback_data);
+void nautilus_file_operations_copy_async (GList *files,
+ GFile *target_dir,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data,
+ NautilusCopyCallback done_callback,
+ gpointer done_callback_data);
void nautilus_file_operations_copy_sync (GList *files,
GFile *target_dir);
-void nautilus_file_operations_move_async (GList *files,
- GFile *target_dir,
- GtkWindow *parent_window,
- NautilusCopyCallback done_callback,
- gpointer done_callback_data);
+void nautilus_file_operations_move_async (GList *files,
+ GFile *target_dir,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data,
+ NautilusCopyCallback done_callback,
+ gpointer done_callback_data);
void nautilus_file_operations_move_sync (GList *files,
GFile *target_dir);
-void nautilus_file_operations_duplicate (GList *files,
- GtkWindow *parent_window,
- NautilusCopyCallback done_callback,
- gpointer done_callback_data);
-void nautilus_file_operations_link (GList *files,
- GFile *target_dir,
- GtkWindow *parent_window,
- NautilusCopyCallback done_callback,
- gpointer done_callback_data);
-void nautilus_file_operations_extract_files (GList *files,
- GFile *destination_directory,
- GtkWindow *parent_window,
- NautilusExtractCallback done_callback,
- gpointer done_callback_data);
-void nautilus_file_operations_compress (GList *files,
- GFile *output,
- AutoarFormat format,
- AutoarFilter filter,
- GtkWindow *parent_window,
- NautilusCreateCallback done_callback,
- gpointer done_callback_data);
+void nautilus_file_operations_duplicate (GList *files,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data,
+ NautilusCopyCallback done_callback,
+ gpointer done_callback_data);
+void nautilus_file_operations_link (GList *files,
+ GFile *target_dir,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data,
+ NautilusCopyCallback done_callback,
+ gpointer done_callback_data);
+void nautilus_file_operations_extract_files (GList *files,
+ GFile *destination_directory,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data,
+ NautilusExtractCallback done_callback,
+ gpointer done_callback_data);
+void nautilus_file_operations_compress (GList *files,
+ GFile *output,
+ AutoarFormat format,
+ AutoarFilter filter,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data,
+ NautilusCreateCallback done_callback,
+ gpointer done_callback_data);
diff --git a/src/nautilus-file-undo-manager.c b/src/nautilus-file-undo-manager.c
index 4dc26c64a..0207c55ec 100644
--- a/src/nautilus-file-undo-manager.c
+++ b/src/nautilus-file-undo-manager.c
@@ -186,8 +186,9 @@ undo_info_apply_ready (GObject *source,
}
static void
-do_undo_redo (NautilusFileUndoManager *self,
- GtkWindow *parent_window)
+do_undo_redo (NautilusFileUndoManager *self,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data)
{
gboolean undo = self->state == NAUTILUS_FILE_UNDO_MANAGER_STATE_UNDO;
@@ -195,6 +196,7 @@ do_undo_redo (NautilusFileUndoManager *self,
self->is_operating = TRUE;
nautilus_file_undo_info_apply_async (self->info, undo, parent_window,
+ dbus_data,
undo_info_apply_ready, self);
/* clear actions while undoing */
@@ -203,7 +205,8 @@ do_undo_redo (NautilusFileUndoManager *self,
}
void
-nautilus_file_undo_manager_redo (GtkWindow *parent_window)
+nautilus_file_undo_manager_redo (GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data)
{
if (undo_singleton->state != NAUTILUS_FILE_UNDO_MANAGER_STATE_REDO)
{
@@ -212,11 +215,12 @@ nautilus_file_undo_manager_redo (GtkWindow *parent_window)
return;
}
- do_undo_redo (undo_singleton, parent_window);
+ do_undo_redo (undo_singleton, parent_window, dbus_data);
}
void
-nautilus_file_undo_manager_undo (GtkWindow *parent_window)
+nautilus_file_undo_manager_undo (GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data)
{
if (undo_singleton->state != NAUTILUS_FILE_UNDO_MANAGER_STATE_UNDO)
{
@@ -225,7 +229,7 @@ nautilus_file_undo_manager_undo (GtkWindow *parent_window)
return;
}
- do_undo_redo (undo_singleton, parent_window);
+ do_undo_redo (undo_singleton, parent_window, dbus_data);
}
void
diff --git a/src/nautilus-file-undo-manager.h b/src/nautilus-file-undo-manager.h
index fc857ac6f..7bf0309aa 100644
--- a/src/nautilus-file-undo-manager.h
+++ b/src/nautilus-file-undo-manager.h
@@ -47,7 +47,9 @@ NautilusFileUndoInfo *nautilus_file_undo_manager_get_action (void);
NautilusFileUndoManagerState nautilus_file_undo_manager_get_state (void);
-void nautilus_file_undo_manager_undo (GtkWindow *parent_window);
-void nautilus_file_undo_manager_redo (GtkWindow *parent_window);
+void nautilus_file_undo_manager_undo (GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data);
+void nautilus_file_undo_manager_redo (GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data);
gboolean nautilus_file_undo_manager_is_operating (void);
diff --git a/src/nautilus-file-undo-operations.c b/src/nautilus-file-undo-operations.c
index 1b5998344..8581b9674 100644
--- a/src/nautilus-file-undo-operations.c
+++ b/src/nautilus-file-undo-operations.c
@@ -147,16 +147,18 @@ nautilus_file_undo_info_set_property (GObject *object,
}
static void
-nautilus_file_redo_info_warn_redo (NautilusFileUndoInfo *self,
- GtkWindow *parent_window)
+nautilus_file_redo_info_warn_redo (NautilusFileUndoInfo *self,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data)
{
g_critical ("Object %p of type %s does not implement redo_func!!",
self, G_OBJECT_TYPE_NAME (self));
}
static void
-nautilus_file_undo_info_warn_undo (NautilusFileUndoInfo *self,
- GtkWindow *parent_window)
+nautilus_file_undo_info_warn_undo (NautilusFileUndoInfo *self,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data)
{
g_critical ("Object %p of type %s does not implement undo_func!!",
self, G_OBJECT_TYPE_NAME (self));
@@ -256,11 +258,12 @@ nautilus_file_undo_info_get_item_count (NautilusFileUndoInfo *self)
}
void
-nautilus_file_undo_info_apply_async (NautilusFileUndoInfo *self,
- gboolean undo,
- GtkWindow *parent_window,
- GAsyncReadyCallback callback,
- gpointer user_data)
+nautilus_file_undo_info_apply_async (NautilusFileUndoInfo *self,
+ gboolean undo,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
NautilusFileUndoInfoPrivate *priv;
@@ -277,11 +280,15 @@ nautilus_file_undo_info_apply_async (NautilusFileUndoInfo *self,
if (undo)
{
- NAUTILUS_FILE_UNDO_INFO_CLASS (G_OBJECT_GET_CLASS (self))->undo_func (self, parent_window);
+ NAUTILUS_FILE_UNDO_INFO_CLASS (G_OBJECT_GET_CLASS (self))->undo_func (self,
+ parent_window,
+ dbus_data);
}
else
{
- NAUTILUS_FILE_UNDO_INFO_CLASS (G_OBJECT_GET_CLASS (self))->redo_func (self, parent_window);
+ NAUTILUS_FILE_UNDO_INFO_CLASS (G_OBJECT_GET_CLASS (self))->redo_func (self,
+ parent_window,
+ dbus_data);
}
}
@@ -571,51 +578,60 @@ ext_strings_func (NautilusFileUndoInfo *info,
}
static void
-ext_create_link_redo_func (NautilusFileUndoInfoExt *self,
- GtkWindow *parent_window)
+ext_create_link_redo_func (NautilusFileUndoInfoExt *self,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data)
{
nautilus_file_operations_link (g_queue_peek_head_link (self->sources),
self->dest_dir,
parent_window,
+ dbus_data,
file_undo_info_transfer_callback,
self);
}
static void
-ext_duplicate_redo_func (NautilusFileUndoInfoExt *self,
- GtkWindow *parent_window)
+ext_duplicate_redo_func (NautilusFileUndoInfoExt *self,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data)
{
nautilus_file_operations_duplicate (g_queue_peek_head_link (self->sources),
parent_window,
+ dbus_data,
file_undo_info_transfer_callback,
self);
}
static void
-ext_copy_redo_func (NautilusFileUndoInfoExt *self,
- GtkWindow *parent_window)
+ext_copy_redo_func (NautilusFileUndoInfoExt *self,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data)
{
nautilus_file_operations_copy_async (g_queue_peek_head_link (self->sources),
self->dest_dir,
parent_window,
+ dbus_data,
file_undo_info_transfer_callback,
self);
}
static void
-ext_move_restore_redo_func (NautilusFileUndoInfoExt *self,
- GtkWindow *parent_window)
+ext_move_restore_redo_func (NautilusFileUndoInfoExt *self,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data)
{
nautilus_file_operations_move_async (g_queue_peek_head_link (self->sources),
self->dest_dir,
parent_window,
+ dbus_data,
file_undo_info_transfer_callback,
self);
}
static void
-ext_redo_func (NautilusFileUndoInfo *info,
- GtkWindow *parent_window)
+ext_redo_func (NautilusFileUndoInfo *info,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data)
{
NautilusFileUndoInfoExt *self = NAUTILUS_FILE_UNDO_INFO_EXT (info);
NautilusFileUndoOp op_type = nautilus_file_undo_info_get_op_type (info);
@@ -623,19 +639,19 @@ ext_redo_func (NautilusFileUndoInfo *info,
if (op_type == NAUTILUS_FILE_UNDO_OP_MOVE ||
op_type == NAUTILUS_FILE_UNDO_OP_RESTORE_FROM_TRASH)
{
- ext_move_restore_redo_func (self, parent_window);
+ ext_move_restore_redo_func (self, parent_window, dbus_data);
}
else if (op_type == NAUTILUS_FILE_UNDO_OP_COPY)
{
- ext_copy_redo_func (self, parent_window);
+ ext_copy_redo_func (self, parent_window, dbus_data);
}
else if (op_type == NAUTILUS_FILE_UNDO_OP_DUPLICATE)
{
- ext_duplicate_redo_func (self, parent_window);
+ ext_duplicate_redo_func (self, parent_window, dbus_data);
}
else if (op_type == NAUTILUS_FILE_UNDO_OP_CREATE_LINK)
{
- ext_create_link_redo_func (self, parent_window);
+ ext_create_link_redo_func (self, parent_window, dbus_data);
}
else
{
@@ -644,30 +660,35 @@ ext_redo_func (NautilusFileUndoInfo *info,
}
static void
-ext_restore_undo_func (NautilusFileUndoInfoExt *self,
- GtkWindow *parent_window)
+ext_restore_undo_func (NautilusFileUndoInfoExt *self,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data)
{
nautilus_file_operations_trash_or_delete_async (g_queue_peek_head_link (self->destinations),
parent_window,
+ dbus_data,
file_undo_info_delete_callback,
self);
}
static void
-ext_move_undo_func (NautilusFileUndoInfoExt *self,
- GtkWindow *parent_window)
+ext_move_undo_func (NautilusFileUndoInfoExt *self,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data)
{
nautilus_file_operations_move_async (g_queue_peek_head_link (self->destinations),
self->src_dir,
parent_window,
+ dbus_data,
file_undo_info_transfer_callback,
self);
}
static void
-ext_copy_duplicate_undo_func (NautilusFileUndoInfoExt *self,
- GtkWindow *parent_window)
+ext_copy_duplicate_undo_func (NautilusFileUndoInfoExt *self,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data)
{
GList *files;
@@ -675,14 +696,16 @@ ext_copy_duplicate_undo_func (NautilusFileUndoInfoExt *self,
files = g_list_reverse (files); /* Deleting must be done in reverse */
nautilus_file_operations_delete_async (files, parent_window,
+ dbus_data,
file_undo_info_delete_callback, self);
g_list_free (files);
}
static void
-ext_undo_func (NautilusFileUndoInfo *info,
- GtkWindow *parent_window)
+ext_undo_func (NautilusFileUndoInfo *info,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data)
{
NautilusFileUndoInfoExt *self = NAUTILUS_FILE_UNDO_INFO_EXT (info);
NautilusFileUndoOp op_type = nautilus_file_undo_info_get_op_type (info);
@@ -691,15 +714,15 @@ ext_undo_func (NautilusFileUndoInfo *info,
op_type == NAUTILUS_FILE_UNDO_OP_DUPLICATE ||
op_type == NAUTILUS_FILE_UNDO_OP_CREATE_LINK)
{
- ext_copy_duplicate_undo_func (self, parent_window);
+ ext_copy_duplicate_undo_func (self, parent_window, dbus_data);
}
else if (op_type == NAUTILUS_FILE_UNDO_OP_MOVE)
{
- ext_move_undo_func (self, parent_window);
+ ext_move_undo_func (self, parent_window, dbus_data);
}
else if (op_type == NAUTILUS_FILE_UNDO_OP_RESTORE_FROM_TRASH)
{
- ext_restore_undo_func (self, parent_window);
+ ext_restore_undo_func (self, parent_window, dbus_data);
}
else
{
@@ -840,8 +863,9 @@ create_callback (GFile *new_file,
}
static void
-create_from_template_redo_func (NautilusFileUndoInfoCreate *self,
- GtkWindow *parent_window)
+create_from_template_redo_func (NautilusFileUndoInfoCreate *self,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data)
{
GFile *parent;
gchar *parent_uri, *new_name;
@@ -860,8 +884,9 @@ create_from_template_redo_func (NautilusFileUndoInfoCreate *self,
}
static void
-create_folder_redo_func (NautilusFileUndoInfoCreate *self,
- GtkWindow *parent_window)
+create_folder_redo_func (NautilusFileUndoInfoCreate *self,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data)
{
GFile *parent;
gchar *parent_uri;
@@ -870,7 +895,9 @@ create_folder_redo_func (NautilusFileUndoInfoCreate *self,
name = g_file_get_basename (self->target_file);
parent = g_file_get_parent (self->target_file);
parent_uri = g_file_get_uri (parent);
- nautilus_file_operations_new_folder (NULL, parent_uri, name,
+ nautilus_file_operations_new_folder (NULL,
+ dbus_data,
+ parent_uri, name,
create_callback, self);
g_free (name);
@@ -879,8 +906,9 @@ create_folder_redo_func (NautilusFileUndoInfoCreate *self,
}
static void
-create_empty_redo_func (NautilusFileUndoInfoCreate *self,
- GtkWindow *parent_window)
+create_empty_redo_func (NautilusFileUndoInfoCreate *self,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data)
{
GFile *parent;
gchar *parent_uri;
@@ -901,23 +929,24 @@ create_empty_redo_func (NautilusFileUndoInfoCreate *self,
}
static void
-create_redo_func (NautilusFileUndoInfo *info,
- GtkWindow *parent_window)
+create_redo_func (NautilusFileUndoInfo *info,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data)
{
NautilusFileUndoInfoCreate *self = NAUTILUS_FILE_UNDO_INFO_CREATE (info);
NautilusFileUndoOp op_type = nautilus_file_undo_info_get_op_type (info);
if (op_type == NAUTILUS_FILE_UNDO_OP_CREATE_EMPTY_FILE)
{
- create_empty_redo_func (self, parent_window);
+ create_empty_redo_func (self, parent_window, dbus_data);
}
else if (op_type == NAUTILUS_FILE_UNDO_OP_CREATE_FOLDER)
{
- create_folder_redo_func (self, parent_window);
+ create_folder_redo_func (self, parent_window, dbus_data);
}
else if (op_type == NAUTILUS_FILE_UNDO_OP_CREATE_FILE_FROM_TEMPLATE)
{
- create_from_template_redo_func (self, parent_window);
+ create_from_template_redo_func (self, parent_window, dbus_data);
}
else
{
@@ -926,14 +955,16 @@ create_redo_func (NautilusFileUndoInfo *info,
}
static void
-create_undo_func (NautilusFileUndoInfo *info,
- GtkWindow *parent_window)
+create_undo_func (NautilusFileUndoInfo *info,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data)
{
NautilusFileUndoInfoCreate *self = NAUTILUS_FILE_UNDO_INFO_CREATE (info);
GList *files = NULL;
files = g_list_append (files, g_object_ref (self->target_file));
nautilus_file_operations_delete_async (files, parent_window,
+ dbus_data,
file_undo_info_delete_callback, self);
g_list_free_full (files, g_object_unref);
@@ -1024,8 +1055,9 @@ rename_strings_func (NautilusFileUndoInfo *info,
}
static void
-rename_redo_func (NautilusFileUndoInfo *info,
- GtkWindow *parent_window)
+rename_redo_func (NautilusFileUndoInfo *info,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data)
{
NautilusFileUndoInfoRename *self = NAUTILUS_FILE_UNDO_INFO_RENAME (info);
NautilusFile *file;
@@ -1038,8 +1070,9 @@ rename_redo_func (NautilusFileUndoInfo *info,
}
static void
-rename_undo_func (NautilusFileUndoInfo *info,
- GtkWindow *parent_window)
+rename_undo_func (NautilusFileUndoInfo *info,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data)
{
NautilusFileUndoInfoRename *self = NAUTILUS_FILE_UNDO_INFO_RENAME (info);
NautilusFile *file;
@@ -1144,8 +1177,9 @@ batch_rename_strings_func (NautilusFileUndoInfo *info,
}
static void
-batch_rename_redo_func (NautilusFileUndoInfo *info,
- GtkWindow *parent_window)
+batch_rename_redo_func (NautilusFileUndoInfo *info,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data)
{
NautilusFileUndoInfoBatchRename *self = NAUTILUS_FILE_UNDO_INFO_BATCH_RENAME (info);
@@ -1176,8 +1210,9 @@ batch_rename_redo_func (NautilusFileUndoInfo *info,
}
static void
-batch_rename_undo_func (NautilusFileUndoInfo *info,
- GtkWindow *parent_window)
+batch_rename_undo_func (NautilusFileUndoInfo *info,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data)
{
NautilusFileUndoInfoBatchRename *self = NAUTILUS_FILE_UNDO_INFO_BATCH_RENAME (info);
@@ -1397,8 +1432,9 @@ on_undo_starred_tags_updated (GObject *object,
}
static void
-starred_redo_func (NautilusFileUndoInfo *info,
- GtkWindow *parent_window)
+starred_redo_func (NautilusFileUndoInfo *info,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data)
{
NautilusFileUndoInfoStarred *self = NAUTILUS_FILE_UNDO_INFO_STARRED (info);
NautilusTagManager *tag_manager;
@@ -1424,8 +1460,9 @@ starred_redo_func (NautilusFileUndoInfo *info,
}
static void
-starred_undo_func (NautilusFileUndoInfo *info,
- GtkWindow *parent_window)
+starred_undo_func (NautilusFileUndoInfo *info,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data)
{
NautilusFileUndoInfoStarred *self = NAUTILUS_FILE_UNDO_INFO_STARRED (info);
NautilusTagManager *tag_manager;
@@ -1647,8 +1684,9 @@ trash_redo_func_callback (GHashTable *debuting_uris,
}
static void
-trash_redo_func (NautilusFileUndoInfo *info,
- GtkWindow *parent_window)
+trash_redo_func (NautilusFileUndoInfo *info,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data)
{
NautilusFileUndoInfoTrash *self = NAUTILUS_FILE_UNDO_INFO_TRASH (info);
@@ -1658,6 +1696,7 @@ trash_redo_func (NautilusFileUndoInfo *info,
locations = g_hash_table_get_keys (self->trashed);
nautilus_file_operations_trash_or_delete_async (locations, parent_window,
+ dbus_data,
trash_redo_func_callback, self);
g_list_free (locations);
@@ -1804,8 +1843,9 @@ trash_retrieve_files_ready (GObject *source,
}
static void
-trash_undo_func (NautilusFileUndoInfo *info,
- GtkWindow *parent_window)
+trash_undo_func (NautilusFileUndoInfo *info,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data)
{
NautilusFileUndoInfoTrash *self = NAUTILUS_FILE_UNDO_INFO_TRASH (info);
@@ -1913,8 +1953,9 @@ rec_permissions_callback (gboolean success,
}
static void
-rec_permissions_redo_func (NautilusFileUndoInfo *info,
- GtkWindow *parent_window)
+rec_permissions_redo_func (NautilusFileUndoInfo *info,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data)
{
NautilusFileUndoInfoRecPermissions *self = NAUTILUS_FILE_UNDO_INFO_REC_PERMISSIONS (info);
gchar *parent_uri;
@@ -1930,8 +1971,9 @@ rec_permissions_redo_func (NautilusFileUndoInfo *info,
}
static void
-rec_permissions_undo_func (NautilusFileUndoInfo *info,
- GtkWindow *parent_window)
+rec_permissions_undo_func (NautilusFileUndoInfo *info,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data)
{
NautilusFileUndoInfoRecPermissions *self = NAUTILUS_FILE_UNDO_INFO_REC_PERMISSIONS (info);
@@ -2070,16 +2112,18 @@ permissions_real_func (NautilusFileUndoInfoPermissions *self,
}
static void
-permissions_redo_func (NautilusFileUndoInfo *info,
- GtkWindow *parent_window)
+permissions_redo_func (NautilusFileUndoInfo *info,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data)
{
NautilusFileUndoInfoPermissions *self = NAUTILUS_FILE_UNDO_INFO_PERMISSIONS (info);
permissions_real_func (self, self->new_permissions);
}
static void
-permissions_undo_func (NautilusFileUndoInfo *info,
- GtkWindow *parent_window)
+permissions_undo_func (NautilusFileUndoInfo *info,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data)
{
NautilusFileUndoInfoPermissions *self = NAUTILUS_FILE_UNDO_INFO_PERMISSIONS (info);
permissions_real_func (self, self->current_permissions);
@@ -2206,16 +2250,18 @@ ownership_real_func (NautilusFileUndoInfoOwnership *self,
}
static void
-ownership_redo_func (NautilusFileUndoInfo *info,
- GtkWindow *parent_window)
+ownership_redo_func (NautilusFileUndoInfo *info,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data)
{
NautilusFileUndoInfoOwnership *self = NAUTILUS_FILE_UNDO_INFO_OWNERSHIP (info);
ownership_real_func (self, self->new_ownership);
}
static void
-ownership_undo_func (NautilusFileUndoInfo *info,
- GtkWindow *parent_window)
+ownership_undo_func (NautilusFileUndoInfo *info,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data)
{
NautilusFileUndoInfoOwnership *self = NAUTILUS_FILE_UNDO_INFO_OWNERSHIP (info);
ownership_real_func (self, self->original_ownership);
@@ -2352,25 +2398,29 @@ extract_strings_func (NautilusFileUndoInfo *info,
}
static void
-extract_redo_func (NautilusFileUndoInfo *info,
- GtkWindow *parent_window)
+extract_redo_func (NautilusFileUndoInfo *info,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data)
{
NautilusFileUndoInfoExtract *self = NAUTILUS_FILE_UNDO_INFO_EXTRACT (info);
nautilus_file_operations_extract_files (self->sources,
self->destination_directory,
parent_window,
+ dbus_data,
extract_callback,
self);
}
static void
-extract_undo_func (NautilusFileUndoInfo *info,
- GtkWindow *parent_window)
+extract_undo_func (NautilusFileUndoInfo *info,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data)
{
NautilusFileUndoInfoExtract *self = NAUTILUS_FILE_UNDO_INFO_EXTRACT (info);
nautilus_file_operations_delete_async (self->outputs, parent_window,
+ dbus_data,
file_undo_info_delete_callback, self);
}
@@ -2506,8 +2556,9 @@ compress_strings_func (NautilusFileUndoInfo *info,
}
static void
-compress_redo_func (NautilusFileUndoInfo *info,
- GtkWindow *parent_window)
+compress_redo_func (NautilusFileUndoInfo *info,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data)
{
NautilusFileUndoInfoCompress *self = NAUTILUS_FILE_UNDO_INFO_COMPRESS (info);
@@ -2516,13 +2567,15 @@ compress_redo_func (NautilusFileUndoInfo *info,
self->format,
self->filter,
parent_window,
+ dbus_data,
compress_callback,
self);
}
static void
-compress_undo_func (NautilusFileUndoInfo *info,
- GtkWindow *parent_window)
+compress_undo_func (NautilusFileUndoInfo *info,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data)
{
NautilusFileUndoInfoCompress *self = NAUTILUS_FILE_UNDO_INFO_COMPRESS (info);
GList *files = NULL;
@@ -2530,6 +2583,7 @@ compress_undo_func (NautilusFileUndoInfo *info,
files = g_list_prepend (files, self->output);
nautilus_file_operations_delete_async (files, parent_window,
+ dbus_data,
file_undo_info_delete_callback, self);
g_list_free (files);
diff --git a/src/nautilus-file-undo-operations.h b/src/nautilus-file-undo-operations.h
index 74f57c1f1..f96f2fe69 100644
--- a/src/nautilus-file-undo-operations.h
+++ b/src/nautilus-file-undo-operations.h
@@ -28,6 +28,8 @@
#include <gtk/gtk.h>
#include <gnome-autoar/gnome-autoar.h>
+#include "nautilus-file-operations-dbus-data.h"
+
typedef enum
{
NAUTILUS_FILE_UNDO_OP_INVALID,
@@ -61,10 +63,12 @@ struct _NautilusFileUndoInfoClass
{
GObjectClass parent_class;
- void (* undo_func) (NautilusFileUndoInfo *self,
- GtkWindow *parent_window);
- void (* redo_func) (NautilusFileUndoInfo *self,
- GtkWindow *parent_window);
+ void (* undo_func) (NautilusFileUndoInfo *self,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data);
+ void (* redo_func) (NautilusFileUndoInfo *self,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data);
void (* strings_func) (NautilusFileUndoInfo *self,
gchar **undo_label,
@@ -73,11 +77,12 @@ struct _NautilusFileUndoInfoClass
gchar **redo_description);
};
-void nautilus_file_undo_info_apply_async (NautilusFileUndoInfo *self,
- gboolean undo,
- GtkWindow *parent_window,
- GAsyncReadyCallback callback,
- gpointer user_data);
+void nautilus_file_undo_info_apply_async (NautilusFileUndoInfo *self,
+ gboolean undo,
+ GtkWindow *parent_window,
+ NautilusFileOperationsDBusData *dbus_data,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
gboolean nautilus_file_undo_info_apply_finish (NautilusFileUndoInfo *self,
GAsyncResult *res,
gboolean *user_cancel,
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 18b714a71..57d9975a8 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -1602,7 +1602,7 @@ delete_selected_files (NautilusFilesView *view)
}
locations = g_list_reverse (locations);
- nautilus_file_operations_delete_async (locations, nautilus_files_view_get_containing_window (view),
NULL, NULL);
+ nautilus_file_operations_delete_async (locations, nautilus_files_view_get_containing_window (view),
NULL, NULL, NULL);
g_list_free_full (locations, g_object_unref);
nautilus_file_list_free (selection);
@@ -2084,6 +2084,7 @@ new_folder_dialog_controller_on_name_accepted (NautilusFileNameWidgetController
parent_uri = nautilus_files_view_get_backing_uri (view);
parent = nautilus_file_get_by_uri (parent_uri);
nautilus_file_operations_new_folder (GTK_WIDGET (view),
+ NULL,
parent_uri, name,
new_folder_done, data);
@@ -2301,6 +2302,7 @@ compress_dialog_controller_on_name_accepted (NautilusFileNameWidgetController *c
format,
filter,
nautilus_files_view_get_containing_window (view),
+ NULL,
compress_done,
data);
@@ -4848,6 +4850,7 @@ trash_or_delete_files (GtkWindow *parent_window,
nautilus_file_operations_trash_or_delete_async (locations,
parent_window,
+ NULL,
(NautilusDeleteCallback) trash_or_delete_done_cb,
view);
g_list_free_full (locations, g_object_unref);
@@ -6417,6 +6420,7 @@ extract_files (NautilusFilesView *view,
nautilus_file_operations_extract_files (locations,
destination_directory,
nautilus_files_view_get_containing_window (view),
+ NULL,
extract_done,
data);
}
@@ -6426,6 +6430,7 @@ extract_files (NautilusFilesView *view,
destination_directory,
nautilus_files_view_get_containing_window (view),
NULL,
+ NULL,
NULL);
}
@@ -6677,6 +6682,7 @@ action_set_as_wallpaper (GSimpleAction *action,
target_uri,
GDK_ACTION_COPY,
GTK_WIDGET (user_data),
+ NULL,
wallpaper_copy_done_callback,
NULL);
g_free (target_uri);
@@ -8906,6 +8912,7 @@ nautilus_files_view_move_copy_items (NautilusFilesView *view,
nautilus_file_operations_copy_move
(item_uris,
target_uri, copy_action, GTK_WIDGET (view),
+ NULL,
copy_move_done_callback, pre_copy_move (view));
}
diff --git a/src/nautilus-mime-actions.c b/src/nautilus-mime-actions.c
index 316066d4c..b757791d4 100644
--- a/src/nautilus-mime-actions.c
+++ b/src/nautilus-mime-actions.c
@@ -517,6 +517,7 @@ trash_or_delete_files (GtkWindow *parent_window,
nautilus_file_operations_trash_or_delete_async (locations,
parent_window,
+ NULL,
NULL, NULL);
g_list_free_full (locations, g_object_unref);
}
diff --git a/src/nautilus-trash-bar.c b/src/nautilus-trash-bar.c
index 1256963a4..6748c0024 100644
--- a/src/nautilus-trash-bar.c
+++ b/src/nautilus-trash-bar.c
@@ -168,7 +168,7 @@ trash_bar_response_cb (GtkInfoBar *infobar,
{
case TRASH_BAR_RESPONSE_EMPTY:
{
- nautilus_file_operations_empty_trash (window);
+ nautilus_file_operations_empty_trash (window, NULL);
}
break;
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 056c75c7a..0eedddf9f 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -424,7 +424,7 @@ action_redo (GSimpleAction *action,
{
NautilusWindow *window = user_data;
- nautilus_file_undo_manager_redo (GTK_WINDOW (window));
+ nautilus_file_undo_manager_redo (GTK_WINDOW (window), NULL);
}
static void
@@ -434,7 +434,7 @@ action_undo (GSimpleAction *action,
{
NautilusWindow *window = user_data;
- nautilus_file_undo_manager_undo (GTK_WINDOW (window));
+ nautilus_file_undo_manager_undo (GTK_WINDOW (window), NULL);
}
static void
@@ -1146,7 +1146,7 @@ places_sidebar_drag_perform_drop_cb (GtkPlacesSidebar *sidebar,
dest_uri = g_file_get_uri (dest_file);
source_uri_list = build_uri_list_from_gfile_list (source_file_list);
- nautilus_file_operations_copy_move (source_uri_list, dest_uri, action, GTK_WIDGET (sidebar), NULL, NULL);
+ nautilus_file_operations_copy_move (source_uri_list, dest_uri, action, GTK_WIDGET (sidebar), NULL, NULL,
NULL);
g_free (dest_uri);
g_list_free_full (source_uri_list, g_free);
@@ -1160,7 +1160,7 @@ action_empty_trash (GSimpleAction *action,
{
NautilusWindow *window = NAUTILUS_WINDOW (user_data);
- nautilus_file_operations_empty_trash (GTK_WIDGET (window));
+ nautilus_file_operations_empty_trash (GTK_WIDGET (window), NULL);
}
/* Callback used for the "properties" menu item from the places sidebar */
@@ -1591,7 +1591,7 @@ on_in_app_notification_undo_undo_button_clicked (GtkWidget *notification,
{
hide_in_app_notification_undo (window);
- nautilus_file_undo_manager_undo (GTK_WINDOW (window));
+ nautilus_file_undo_manager_undo (GTK_WINDOW (window), NULL);
}
static void
diff --git a/test/automated/displayless/test-utilities.c b/test/automated/displayless/test-utilities.c
index 7b38c6849..4bb2b3e47 100644
--- a/test/automated/displayless/test-utilities.c
+++ b/test/automated/displayless/test-utilities.c
@@ -162,7 +162,7 @@ test_operation_undo (void)
G_CALLBACK (quit_loop_callback),
loop);
- nautilus_file_undo_manager_undo (NULL);
+ nautilus_file_undo_manager_undo (NULL, NULL);
g_main_loop_run (loop);
@@ -191,7 +191,7 @@ test_operation_undo_redo (void)
G_CALLBACK (quit_loop_callback),
loop);
- nautilus_file_undo_manager_redo (NULL);
+ nautilus_file_undo_manager_redo (NULL, NULL);
g_main_loop_run (loop);
@@ -552,4 +552,4 @@ create_multiple_full_directories (gchar *prefix, gint number_of_directories)
g_file_make_directory (file, NULL, NULL);
}
-}
\ No newline at end of file
+}
diff --git a/test/interactive/test-copy.c b/test/interactive/test-copy.c
index 39fe609f1..194eda444 100644
--- a/test/interactive/test-copy.c
+++ b/test/interactive/test-copy.c
@@ -77,6 +77,7 @@ main (int argc,
nautilus_file_operations_copy_async (sources,
dest,
GTK_WINDOW (window),
+ NULL,
copy_done, NULL);
infos = nautilus_progress_info_manager_get_all_infos (manager);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]