[meld] Fix interactions between new diff tab and chain-switching handling
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] Fix interactions between new diff tab and chain-switching handling
- Date: Wed, 9 Jan 2013 20:04:39 +0000 (UTC)
commit 219c30b5011bdbbfaf9dfd8ad5925499b3f3ebcc
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sat Dec 8 05:25:01 2012 +1000
Fix interactions between new diff tab and chain-switching handling
meld/meldwindow.py | 23 +++++++++++++++--------
meld/new_diff_dialog.py | 10 ++++++----
2 files changed, 21 insertions(+), 12 deletions(-)
---
diff --git a/meld/meldwindow.py b/meld/meldwindow.py
index 85449f3..dbb2b60 100644
--- a/meld/meldwindow.py
+++ b/meld/meldwindow.py
@@ -570,14 +570,16 @@ class MeldWindow(gnomeglade.Component):
page.on_file_changed(filename)
def _append_page(self, page, icon):
- nbl = notebooklabel.NotebookLabel(icon, "", lambda b: self.try_remove_page(page))
- self.notebook.append_page( page.widget, nbl)
+ nbl = notebooklabel.NotebookLabel(icon, "",
+ lambda b: self.try_remove_page(page))
+ self.notebook.append_page(page.widget, nbl)
# Change focus to the newly created page only if the user is on a
- # DirDiff or VcView page. This prevents cycling through X pages
- # when X diffs are initiated.
+ # DirDiff or VcView page, or if it's a new tab page. This prevents
+ # cycling through X pages when X diffs are initiated.
if isinstance(self.current_doc(), dirdiff.DirDiff) or \
- isinstance(self.current_doc(), vcview.VcView):
+ isinstance(self.current_doc(), vcview.VcView) or \
+ isinstance(page, new_diff_dialog.NewDiffTab):
self.notebook.set_current_page(self.notebook.page_num(page.widget))
if hasattr(page, 'scheduler'):
@@ -589,14 +591,19 @@ class MeldWindow(gnomeglade.Component):
page.connect("status-changed",
lambda obj, arg: self.statusbar.set_doc_status(arg))
- # Allow reordering of tabs
- self.notebook.set_tab_reorderable(page.widget, True);
+ self.notebook.set_tab_reorderable(page.widget, True)
def append_new_comparison(self):
doc = new_diff_dialog.NewDiffTab(self)
self._append_page(doc, "document-new")
self.on_notebook_label_changed(doc, _("New comparison"), None)
- doc.connect("diff-created", lambda x: self.try_remove_page(doc))
+
+ def diff_created_cb(doc, newdoc):
+ self.try_remove_page(doc)
+ idx = self.notebook.page_num(newdoc.widget)
+ self.notebook.set_current_page(idx)
+
+ doc.connect("diff-created", diff_created_cb)
return doc
def append_dirdiff(self, dirs, auto_compare=False):
diff --git a/meld/new_diff_dialog.py b/meld/new_diff_dialog.py
index ab2bd21..4b208be 100644
--- a/meld/new_diff_dialog.py
+++ b/meld/new_diff_dialog.py
@@ -28,7 +28,8 @@ class NewDiffTab(gobject.GObject, gnomeglade.Component):
__gtype_name__ = "NewDiffTab"
__gsignals__ = {
- 'diff-created': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ()),
+ 'diff-created': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
+ (object,)),
}
def __init__(self, parentapp):
@@ -93,15 +94,16 @@ class NewDiffTab(gobject.GObject, gnomeglade.Component):
path = gfile.get_path() if gfile else ""
compare_paths.append(path)
- self.diff_methods[self.diff_type](compare_paths)
- self.emit('diff-created')
+ tab = self.diff_methods[self.diff_type](compare_paths)
+ self.emit('diff-created', tab)
def on_button_new_blank_clicked(self, *args):
# TODO: This doesn't work the way I'd like for DirDiff and VCView.
# It should do something similar to FileDiff; give a tab with empty
# file entries and no comparison done.
compare_paths = [""] * self._get_num_paths()
- self.diff_methods[self.diff_type](compare_paths)
+ tab = self.diff_methods[self.diff_type](compare_paths)
+ self.emit('diff-created', tab)
def on_container_switch_in_event(self, *args):
pass
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]