[meld] Remove use of RESULT_ constants in favour of Booleans
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] Remove use of RESULT_ constants in favour of Booleans
- Date: Tue, 29 Nov 2011 07:26:37 +0000 (UTC)
commit 65e882ead155cd60c63d16ca54fc2716f78ad75c
Author: Kai Willadsen <kai willadsen gmail com>
Date: Mon Nov 28 07:49:01 2011 +1000
Remove use of RESULT_ constants in favour of Booleans
meld/filediff.py | 10 +++++-----
meld/melddoc.py | 2 --
2 files changed, 5 insertions(+), 7 deletions(-)
---
diff --git a/meld/filediff.py b/meld/filediff.py
index 9cd9968..cc7087b 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -831,7 +831,7 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
if response==gtk.RESPONSE_OK:
for i in range(self.num_panes):
if try_save[i]:
- if self.save_file(i) != melddoc.RESULT_OK:
+ if not self.save_file(i):
return gtk.RESPONSE_CANCEL
elif response == gtk.RESPONSE_DELETE_EVENT:
response = gtk.RESPONSE_CANCEL
@@ -1379,7 +1379,7 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
self.fileentry[pane].set_filename( bufdata.filename)
self.fileentry[pane].prepend_history(bufdata.filename)
else:
- return melddoc.RESULT_ERROR
+ return False
start, end = buf.get_bounds()
text = unicode(buf.get_text(start, end, False), 'utf8')
if bufdata.newlines:
@@ -1406,15 +1406,15 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
if misc.run_dialog(
_("'%s' contains characters not encodable with '%s'\nWould you like to save as UTF-8?") % (bufdata.label, bufdata.encoding),
self, gtk.MESSAGE_ERROR, gtk.BUTTONS_YES_NO) != gtk.RESPONSE_YES:
- return melddoc.RESULT_ERROR
+ return False
save_to = bufdata.savefile or bufdata.filename
if self._save_text_to_filename(save_to, text):
self.emit("file-changed", save_to)
self.undosequence.checkpoint(buf)
- return melddoc.RESULT_OK
+ return True
else:
- return melddoc.RESULT_ERROR
+ return False
def make_patch(self, *extra):
dialog = patchdialog.PatchDialog(self)
diff --git a/meld/melddoc.py b/meld/melddoc.py
index 0267997..13ba263 100644
--- a/meld/melddoc.py
+++ b/meld/melddoc.py
@@ -25,8 +25,6 @@ import gtk
import os
from gettext import gettext as _
-# Use these to ensure consistent return values.
-RESULT_OK, RESULT_ERROR = (0,1)
class MeldDoc(gobject.GObject):
"""Base class for documents in the meld application.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]