[meld] filediff: Break out conflict resolution to helper function
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] filediff: Break out conflict resolution to helper function
- Date: Mon, 31 Dec 2018 23:58:35 +0000 (UTC)
commit 9376d7a0a64174e29a3004d278dcea5bd06fd2fd
Author: Kai Willadsen <kai willadsen gmail com>
Date: Tue Jan 1 07:49:15 2019 +1000
filediff: Break out conflict resolution to helper function
meld/filediff.py | 47 +++++++++++++++++++++++++----------------------
1 file changed, 25 insertions(+), 22 deletions(-)
---
diff --git a/meld/filediff.py b/meld/filediff.py
index 87b11e56..154df5de 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -887,33 +887,36 @@ class FileDiff(MeldDoc, Component):
response = Gtk.ResponseType.OK
if response == Gtk.ResponseType.OK and self.meta:
- parent = self.meta.get('parent', None)
- saved = self.meta.get('middle_saved', False)
- prompt_resolve = self.meta.get('prompt_resolve', False)
- if prompt_resolve and saved and parent.has_command('resolve'):
- primary = _("Mark conflict as resolved?")
- secondary = _(
- "If the conflict was resolved successfully, you may mark "
- "it as resolved now.")
- buttons = ((_("Cancel"), Gtk.ResponseType.CANCEL),
- (_("Mark _Resolved"), Gtk.ResponseType.OK))
- resolve_response = misc.modal_dialog(
- primary, secondary, buttons, parent=self.widget,
- messagetype=Gtk.MessageType.QUESTION)
-
- if resolve_response == Gtk.ResponseType.OK:
- bufdata = self.textbuffer[1].data
- conflict_gfile = bufdata.savefile or bufdata.gfile
- # It's possible that here we're in a quit callback,
- # so we can't schedule the resolve action to an
- # idle loop; it might never happen.
- parent.command(
- 'resolve', [conflict_gfile.get_path()], sync=True)
+ self.prompt_resolve_conflict()
elif response == Gtk.ResponseType.CANCEL:
self.state = ComparisonState.Normal
return response
+ def prompt_resolve_conflict(self):
+ parent = self.meta.get('parent', None)
+ saved = self.meta.get('middle_saved', False)
+ prompt_resolve = self.meta.get('prompt_resolve', False)
+ if prompt_resolve and saved and parent.has_command('resolve'):
+ primary = _("Mark conflict as resolved?")
+ secondary = _(
+ "If the conflict was resolved successfully, you may mark "
+ "it as resolved now.")
+ buttons = ((_("Cancel"), Gtk.ResponseType.CANCEL),
+ (_("Mark _Resolved"), Gtk.ResponseType.OK))
+ resolve_response = misc.modal_dialog(
+ primary, secondary, buttons, parent=self.widget,
+ messagetype=Gtk.MessageType.QUESTION)
+
+ if resolve_response == Gtk.ResponseType.OK:
+ bufdata = self.textbuffer[1].data
+ conflict_gfile = bufdata.savefile or bufdata.gfile
+ # It's possible that here we're in a quit callback,
+ # so we can't schedule the resolve action to an
+ # idle loop; it might never happen.
+ parent.command(
+ 'resolve', [conflict_gfile.get_path()], sync=True)
+
def on_delete_event(self):
self.state = ComparisonState.Closing
response = self.check_save_modified()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]