[meld] Use gio trashing in dirdiff as well



commit 6e7b7055ba803c46fc3f328bc3ef69a1fc5b6431
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sat Aug 17 15:10:35 2013 +1000

    Use gio trashing in dirdiff as well

 meld/dirdiff.py |   18 ++++++------------
 1 files changed, 6 insertions(+), 12 deletions(-)
---
diff --git a/meld/dirdiff.py b/meld/dirdiff.py
index 7d6139e..6f60329 100644
--- a/meld/dirdiff.py
+++ b/meld/dirdiff.py
@@ -27,6 +27,7 @@ import stat
 import sys
 import time
 
+import gio
 import gobject
 import gtk
 import gtk.keysyms
@@ -863,18 +864,11 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
                 it = self.model.get_iter(path)
                 name = self.model.value_path(it, pane)
                 try:
-                    if os.path.isfile(name):
-                        os.remove(name)
-                        self.file_deleted( path, pane)
-                    elif os.path.isdir(name):
-                        if misc.run_dialog(_("'%s' is a directory.\nRemove recursively?") % 
os.path.basename(name),
-                                parent = self,
-                                buttonstype=gtk.BUTTONS_OK_CANCEL) == gtk.RESPONSE_OK:
-                            shutil.rmtree(name)
-                            self.recursively_update(path)
-                            self.file_deleted(path, pane)
-                except OSError as e:
-                    misc.run_dialog(_("Error removing %s\n\n%s.") % (name,e), parent = self)
+                    gfile = gio.File(name)
+                    gfile.trash()
+                    self.file_deleted(path, pane)
+                except gio.Error as e:
+                    misc.error_dialog(_("Error deleting %s") % name, str(e))
 
     def on_treemodel_row_deleted(self, model, path):
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]