[meld] Focus new tabs when created from the New dialog



commit d11f77ac7edd1e399032a964ce9af0459f6b03e6
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sun May 6 07:12:25 2012 +1000

    Focus new tabs when created from the New dialog
    
    The recent change to tab handling to avoid switching pages when
    opening multiple tabs at once broke the New dialog, as in its case the
    parent tab could be anything. This change adds manual tab focus logic
    to the dialog.
    
    Based on a patch from Peter Tyser.

 meld/meldwindow.py |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/meld/meldwindow.py b/meld/meldwindow.py
index 31a7814..f393655 100644
--- a/meld/meldwindow.py
+++ b/meld/meldwindow.py
@@ -53,6 +53,7 @@ class NewDocDialog(gnomeglade.Component):
         self.diff_methods = (parentapp.append_filediff,
                              parentapp.append_dirdiff,
                              parentapp.append_vcview)
+        self.parentapp = parentapp
         self.widget.show_all()
 
     def on_entry_activate(self, entry):
@@ -78,9 +79,14 @@ class NewDocDialog(gnomeglade.Component):
             for path in paths:
                 self.entrylists[page][0].prepend_history(path)
             if page == 2:
-                self.diff_methods[page](paths[0])
+                new_tab = self.diff_methods[page](paths[0])
             else:
-                self.diff_methods[page](paths)
+                new_tab = self.diff_methods[page](paths)
+
+            # We just opened a new comparison, transfer focus to it
+            new_tab_idx = self.parentapp.notebook.page_num(new_tab.widget)
+            self.parentapp.notebook.set_current_page(new_tab_idx)
+
         self.widget.destroy()
 
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]