[nautilus/dbus-trash: 11/15] dbus-manager: Implement undo/redo
- From: Carlos Soriano <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/dbus-trash: 11/15] dbus-manager: Implement undo/redo
- Date: Tue, 7 Aug 2018 19:16:08 +0000 (UTC)
commit 36b011a9e0bdbb365c56c2c09c542435e1e0d7ef
Author: Carlos Soriano <csoriano redhat com>
Date: Mon Aug 6 20:12:00 2018 +0200
dbus-manager: Implement undo/redo
For the integration with the desktop icons extension.
data/dbus-interfaces.xml | 4 ++++
src/nautilus-dbus-manager.c | 35 +++++++++++++++++++++++++++++++++++
2 files changed, 39 insertions(+)
---
diff --git a/data/dbus-interfaces.xml b/data/dbus-interfaces.xml
index 4e67f1393..2133bb99c 100644
--- a/data/dbus-interfaces.xml
+++ b/data/dbus-interfaces.xml
@@ -41,5 +41,9 @@
<method name='CreateFolder'>
<arg type='s' name='URI' direction='in'/>
</method>
+ <method name='Undo'>
+ </method>
+ <method name='Redo'>
+ </method>
</interface>
</node>
diff --git a/src/nautilus-dbus-manager.c b/src/nautilus-dbus-manager.c
index 5ba39e73f..cc1cd75c0 100644
--- a/src/nautilus-dbus-manager.c
+++ b/src/nautilus-dbus-manager.c
@@ -26,6 +26,7 @@
#include "nautilus-generated.h"
#include "nautilus-file-operations.h"
+#include "nautilus-file-undo-manager.h"
#define DEBUG_FLAG NAUTILUS_DEBUG_DBUS
#include "nautilus-debug.h"
@@ -87,6 +88,32 @@ handle_copy_file (NautilusDBusFileOperations *object,
return TRUE; /* invocation was handled */
}
+static gboolean
+handle_redo (NautilusDBusFileOperations *object,
+ GDBusMethodInvocation *invocation)
+{
+ g_autoptr (NautilusFileUndoManager) undo_manager = NULL;
+
+ undo_manager = nautilus_file_undo_manager_get ();
+ nautilus_file_undo_manager_redo (NULL);
+
+ nautilus_dbus_file_operations_complete_redo (object, invocation);
+ return TRUE; /* invocation was handled */
+}
+
+static gboolean
+handle_undo (NautilusDBusFileOperations *object,
+ GDBusMethodInvocation *invocation)
+{
+ g_autoptr (NautilusFileUndoManager) undo_manager = NULL;
+
+ undo_manager = nautilus_file_undo_manager_get ();
+ nautilus_file_undo_manager_undo (NULL);
+
+ nautilus_dbus_file_operations_complete_undo (object, invocation);
+ return TRUE; /* invocation was handled */
+}
+
static gboolean
handle_create_folder (NautilusDBusFileOperations *object,
GDBusMethodInvocation *invocation,
@@ -191,6 +218,14 @@ nautilus_dbus_manager_init (NautilusDBusManager *self)
"handle-create-folder",
G_CALLBACK (handle_create_folder),
self);
+ g_signal_connect (self->file_operations,
+ "handle-undo",
+ G_CALLBACK (handle_undo),
+ self);
+ g_signal_connect (self->file_operations,
+ "handle-redo",
+ G_CALLBACK (handle_redo),
+ self);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]