[meld] Add a confirmation dialog for removing VC folders, and support in Git
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] Add a confirmation dialog for removing VC folders, and support in Git
- Date: Sat, 22 Jun 2013 22:32:34 +0000 (UTC)
commit baf82bd4d73a9245a336895b95ddb4022037e9c3
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sun Jun 23 08:30:36 2013 +1000
Add a confirmation dialog for removing VC folders, and support in Git
meld/vc/git.py | 7 ++++---
meld/vcview.py | 19 +++++++++++++++++++
2 files changed, 23 insertions(+), 3 deletions(-)
---
diff --git a/meld/vc/git.py b/meld/vc/git.py
index a1e4d6c..90e05b5 100644
--- a/meld/vc/git.py
+++ b/meld/vc/git.py
@@ -81,9 +81,6 @@ class Vc(_vc.CachedVc):
def add_command(self):
return [self.CMD, "add"]
- def remove_command(self, force=0):
- return [self.CMD, "rm"]
-
# Prototyping VC interface version 2
def update_actions_for_paths(self, path_states, actions):
@@ -184,6 +181,10 @@ class Vc(_vc.CachedVc):
command = [self.CMD, 'push']
runner(command, [], refresh=True, working_dir=self.root)
+ def remove(self, runner, files):
+ command = [self.CMD, 'rm', '-r']
+ runner(command, files, refresh=True, working_dir=self.root)
+
def revert(self, runner, files):
exists = [f for f in files if os.path.exists(f)]
missing = [f for f in files if not os.path.exists(f)]
diff --git a/meld/vcview.py b/meld/vcview.py
index 1d27080..c5f6db1 100644
--- a/meld/vcview.py
+++ b/meld/vcview.py
@@ -672,6 +672,25 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
self._command_on_selected(self.vc.add_command())
def on_button_remove_clicked(self, obj):
+ selected = self._get_selected_files()
+ if any(os.path.isdir(p) for p in selected):
+ # TODO: Improve and reuse this dialog for the non-VC delete action
+ dialog = gtk.MessageDialog(
+ parent=self.widget.get_toplevel(),
+ flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
+ type=gtk.MESSAGE_WARNING,
+ message_format=_("Remove folder and all its files?"))
+ dialog.format_secondary_text(
+ _("This will remove all selected files and folders, and all "
+ "files within any selected folders, from version control."))
+
+ dialog.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)
+ dialog.add_button(_("_Remove"), gtk.RESPONSE_OK)
+ response = dialog.run()
+ dialog.destroy()
+ if response != gtk.RESPONSE_OK:
+ return
+
try:
self.vc.remove(self._command, self._get_selected_files())
except NotImplementedError:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]