[meld] meldwindow: Fix regression with tab close handling (bgo#760977)
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] meldwindow: Fix regression with tab close handling (bgo#760977)
- Date: Fri, 22 Jan 2016 23:04:39 +0000 (UTC)
commit 352836389b6a992b1eeabea71142a8f0de62dbf1
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sat Jan 23 09:00:48 2016 +1000
meldwindow: Fix regression with tab close handling (bgo#760977)
Somewhere in the window signal handling rework for async save/load, we
stopped correctly handling removal of the currently focussed page. This
was introduced in 82c4bf, but given the notebook API it's a little
unclear what on earth I was thinking at the time.
meld/meldwindow.py | 22 ++++++++++++++--------
1 files changed, 14 insertions(+), 8 deletions(-)
---
diff --git a/meld/meldwindow.py b/meld/meldwindow.py
index 70d2885..49b77cb 100644
--- a/meld/meldwindow.py
+++ b/meld/meldwindow.py
@@ -348,18 +348,21 @@ class MeldWindow(gnomeglade.Component):
"Replace"):
self.actiongroup.get_action(action).set_sensitive(is_filediff)
+ def handle_current_doc_switch(self, page):
+ if self.diff_handler is not None:
+ page.disconnect(self.diff_handler)
+ page.on_container_switch_out_event(self.ui)
+ if self.undo_handlers:
+ undoseq = page.undosequence
+ for handler in self.undo_handlers:
+ undoseq.disconnect(handler)
+ self.undo_handlers = tuple()
+
def on_switch_page(self, notebook, page, which):
oldidx = notebook.get_current_page()
if oldidx >= 0:
olddoc = notebook.get_nth_page(oldidx).pyobject
- if self.diff_handler is not None:
- olddoc.disconnect(self.diff_handler)
- olddoc.on_container_switch_out_event(self.ui)
- if self.undo_handlers:
- undoseq = olddoc.undosequence
- for handler in self.undo_handlers:
- undoseq.disconnect(handler)
- self.undo_handlers = tuple()
+ self.handle_current_doc_switch(olddoc)
newdoc = notebook.get_nth_page(which).pyobject if which >= 0 else None
try:
@@ -599,6 +602,9 @@ class MeldWindow(gnomeglade.Component):
page_num = self.notebook.page_num(page.widget)
+ if self.notebook.get_current_page() == page_num:
+ self.handle_current_doc_switch(page)
+
self.notebook.remove_page(page_num)
# Normal switch-page handlers don't get run for removing the
# last page from a notebook.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]