[meld] meldapp: Add helper to get the current MeldWindow and use



commit 8e60c7ee7b7c770cc56f27be85a91ac6114a9cb8
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sat Mar 15 10:57:12 2014 +1000

    meldapp: Add helper to get the current MeldWindow and use

 meld/meldapp.py |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/meld/meldapp.py b/meld/meldapp.py
index adb0b8f..3bbe990 100644
--- a/meld/meldapp.py
+++ b/meld/meldapp.py
@@ -129,10 +129,13 @@ class MeldApp(Gtk.Application):
         window.widget.meldwindow = window
         return window
 
+    def get_meld_window(self):
+        return self.get_active_window().meldwindow
+
     def open_paths(self, paths, **kwargs):
         new_tab = kwargs.pop('new_tab')
         if new_tab:
-            window = self.get_active_window().meldwindow
+            window = self.get_meld_window()
         else:
             window = self.new_window()
         return window.open_paths(paths, **kwargs)
@@ -255,7 +258,7 @@ class MeldApp(Gtk.Application):
             comparison_file_path = os.path.expanduser(path)
             gio_file = Gio.File.new_for_path(comparison_file_path)
             try:
-                tab = self.window.append_recent(gio_file.get_uri())
+                tab = self.get_meld_window().append_recent(gio_file.get_uri())
             except (IOError, ValueError):
                 parser.error(_("Error reading saved comparison file"))
             return tab
@@ -279,7 +282,7 @@ class MeldApp(Gtk.Application):
                 tab.set_merge_output_file(options.outfile)
 
         if error:
-            if not self.window.has_pages():
+            if not self.get_meld_window().has_pages():
                 parser.error(error)
             else:
                 print(error)


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