If a file isn't writable, don't allow a user to edit it in meld. Allowing a user to edit a non-writable file doesn't add much benefit, and it can be frustrating to a user who makes changes, only to find that they can't save the changes, or they were accidentally modifying the "wrong" file (eg a temporary version control file) and their changes disappear after closing meld (and the temporary version control files are automatically deleted).
Signed-off-by: Peter Tyser <[email protected]> --- meld/filediff.py | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/meld/filediff.py b/meld/filediff.py index 0e6a207..b0c2ffb 100644 --- a/meld/filediff.py +++ b/meld/filediff.py @@ -232,8 +232,6 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component): buf.disconnect(h) def _connect_buffer_handlers(self): - for textview in self.textview: - textview.set_editable(1) for buf in self.textbuffer: id0 = buf.connect("insert-text", self.on_text_insert_text) id1 = buf.connect("delete-range", self.on_text_delete_range) @@ -1054,6 +1052,12 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component): return melddoc.RESULT_ERROR if self._save_text_to_filename(bufdata.filename, text): self.emit("file-changed", bufdata.filename) + + # We may be saving a non-writable buffer to a new file, so make sure the + # new file is writable and the label/icon are up to date. + self.set_buffer_writable(buf, True) + self.recompute_label() + self.undosequence.checkpoint(buf) return melddoc.RESULT_OK else: @@ -1093,6 +1097,10 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component): def set_buffer_writable(self, buf, yesno): pane = self.textbuffer.index(buf) self.bufferdata[pane].writable = yesno + + # If a buffer is writable it should also be editable, and vice-versa + self.textview[pane].set_editable(yesno) + self.recompute_label() def set_buffer_modified(self, buf, yesno): -- 1.7.1.13.gcfb88 _______________________________________________ meld-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/meld-list
