[meld] Use gio trashing directly, and get rid of the confirmation dialog
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] Use gio trashing directly, and get rid of the confirmation dialog
- Date: Fri, 27 Sep 2013 22:04:36 +0000 (UTC)
commit 77e0b7bc8e162dc5e6dde3133719ce337684d93f
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sat Aug 17 12:27:44 2013 +1000
Use gio trashing directly, and get rid of the confirmation dialog
meld/vcview.py | 12 ++++--------
1 files changed, 4 insertions(+), 8 deletions(-)
---
diff --git a/meld/vcview.py b/meld/vcview.py
index c4f50d8..7ee0db9 100644
--- a/meld/vcview.py
+++ b/meld/vcview.py
@@ -26,6 +26,7 @@ import stat
import sys
from gettext import gettext as _
+import gio
import gtk
import pango
@@ -739,14 +740,9 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
files = self._get_selected_files()
for name in files:
try:
- if os.path.isfile(name):
- os.remove(name)
- 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)
- except OSError as e:
+ gfile = gio.File(name)
+ gfile.trash()
+ except gio.Error as e:
misc.run_dialog(_("Error removing %s\n\n%s.") % (name, e),
parent=self)
workdir = _commonprefix(files)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]