Blame SOURCES/0003-dbus-manager-Implement-undo-redo.patch

af40a0
From 42ea37f93c134d55cd622e3e346726babaf56139 Mon Sep 17 00:00:00 2001
af40a0
From: Carlos Soriano <csoriano@redhat.com>
af40a0
Date: Mon, 6 Aug 2018 20:12:00 +0200
af40a0
Subject: [PATCH 03/11] dbus-manager: Implement undo/redo
af40a0
af40a0
For the integration with the desktop icons extension.
af40a0
---
af40a0
 data/dbus-interfaces.xml    |  4 ++++
af40a0
 src/nautilus-dbus-manager.c | 35 +++++++++++++++++++++++++++++++++++
af40a0
 2 files changed, 39 insertions(+)
af40a0
af40a0
diff --git a/data/dbus-interfaces.xml b/data/dbus-interfaces.xml
af40a0
index 4e67f1393..2133bb99c 100644
af40a0
--- a/data/dbus-interfaces.xml
af40a0
+++ b/data/dbus-interfaces.xml
af40a0
@@ -41,5 +41,9 @@
af40a0
     <method name='CreateFolder'>
af40a0
       <arg type='s' name='URI' direction='in'/>
af40a0
     </method>
af40a0
+    <method name='Undo'>
af40a0
+    </method>
af40a0
+    <method name='Redo'>
af40a0
+    </method>
af40a0
   </interface>
af40a0
 </node>
af40a0
diff --git a/src/nautilus-dbus-manager.c b/src/nautilus-dbus-manager.c
af40a0
index 337a73262..bce6b5c4d 100644
af40a0
--- a/src/nautilus-dbus-manager.c
af40a0
+++ b/src/nautilus-dbus-manager.c
af40a0
@@ -26,6 +26,7 @@
af40a0
 #include "nautilus-generated.h"
af40a0
 
af40a0
 #include "nautilus-file-operations.h"
af40a0
+#include "nautilus-file-undo-manager.h"
af40a0
 
af40a0
 #define DEBUG_FLAG NAUTILUS_DEBUG_DBUS
af40a0
 #include "nautilus-debug.h"
af40a0
@@ -94,6 +95,32 @@ handle_copy_file (NautilusDBusFileOperations *object,
af40a0
     return TRUE; /* invocation was handled */
af40a0
 }
af40a0
 
af40a0
+static gboolean
af40a0
+handle_redo (NautilusDBusFileOperations *object,
af40a0
+             GDBusMethodInvocation      *invocation)
af40a0
+{
af40a0
+    g_autoptr (NautilusFileUndoManager) undo_manager = NULL;
af40a0
+
af40a0
+    undo_manager = nautilus_file_undo_manager_get ();
af40a0
+    nautilus_file_undo_manager_redo (NULL);
af40a0
+
af40a0
+    nautilus_dbus_file_operations_complete_redo (object, invocation);
af40a0
+    return TRUE; /* invocation was handled */
af40a0
+}
af40a0
+
af40a0
+static gboolean
af40a0
+handle_undo (NautilusDBusFileOperations *object,
af40a0
+             GDBusMethodInvocation      *invocation)
af40a0
+{
af40a0
+    g_autoptr (NautilusFileUndoManager) undo_manager = NULL;
af40a0
+
af40a0
+    undo_manager = nautilus_file_undo_manager_get ();
af40a0
+    nautilus_file_undo_manager_undo (NULL);
af40a0
+
af40a0
+    nautilus_dbus_file_operations_complete_undo (object, invocation);
af40a0
+    return TRUE; /* invocation was handled */
af40a0
+}
af40a0
+
af40a0
 static gboolean
af40a0
 handle_create_folder (NautilusDBusFileOperations *object,
af40a0
                       GDBusMethodInvocation      *invocation,
af40a0
@@ -198,6 +225,14 @@ nautilus_dbus_manager_init (NautilusDBusManager *self)
af40a0
                       "handle-create-folder",
af40a0
                       G_CALLBACK (handle_create_folder),
af40a0
                       self);
af40a0
+    g_signal_connect (self->file_operations,
af40a0
+                      "handle-undo",
af40a0
+                      G_CALLBACK (handle_undo),
af40a0
+                      self);
af40a0
+    g_signal_connect (self->file_operations,
af40a0
+                      "handle-redo",
af40a0
+                      G_CALLBACK (handle_redo),
af40a0
+                      self);
af40a0
 }
af40a0
 
af40a0
 static void
af40a0
-- 
af40a0
2.17.1
af40a0