[meld] meldapp: Add 'support' for launching non-uniquely, which is our default



commit 86b8edd6aa467ae7eb7f7eb62f2c1b8f0ca70f34
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Fri Feb 14 06:11:37 2014 +1000

    meldapp: Add 'support' for launching non-uniquely, which is our default

 bin/meld        |   10 ++++++++--
 meld/meldapp.py |   15 ++++++++-------
 2 files changed, 16 insertions(+), 9 deletions(-)
---
diff --git a/bin/meld b/bin/meld
index 29f2754..e2f398e 100755
--- a/bin/meld
+++ b/bin/meld
@@ -200,6 +200,12 @@ if __name__ == '__main__':
     setup_settings()
     setup_resources()
 
-    import meld.meldapp
-    status = meld.meldapp.app.run(sys.argv)
+    from gi.repository import Gio
+    from meld.meldapp import app
+
+    if not ("-n" in sys.argv or "--newtab" in sys.argv):
+        app.set_flags(Gio.ApplicationFlags.HANDLES_COMMAND_LINE |
+                      Gio.ApplicationFlags.NON_UNIQUE)
+
+    status = app.run(sys.argv)
     sys.exit(status)
diff --git a/meld/meldapp.py b/meld/meldapp.py
index 81090f5..a9977a5 100644
--- a/meld/meldapp.py
+++ b/meld/meldapp.py
@@ -77,10 +77,12 @@ class MeldApp(Gtk.Application):
             self.window.append_new_comparison()
         return 0
 
+    # We can't override do_local_command_line because it has no introspection
+    # annotations: https://bugzilla.gnome.org/show_bug.cgi?id=687912
+    # Uniqueness handling is instead hackily done in the launcher script.
+
     # def do_local_command_line(self, command_line):
-    #     response = Gtk.Application.do_local_command_line(self, command_line)
-    #     print(response)
-    #     return response
+    #     return False
 
     def preferences_callback(self, action, parameter):
         meld.preferences.PreferencesDialog(self.get_active_window())
@@ -135,12 +137,12 @@ class MeldApp(Gtk.Application):
     def parse_args(self, rawargs):
         usages = [
             ("", _("Start with an empty window")),
-            ("<%s|%s>" % (_("file"), _("dir")),
+            ("<%s|%s>" % (_("file"), _("folder")),
              _("Start a version control comparison")),
             ("<%s> <%s> [<%s>]" % ((_("file"),) * 3),
              _("Start a 2- or 3-way file comparison")),
-            ("<%s> <%s> [<%s>]" % ((_("dir"),) * 3),
-             _("Start a 2- or 3-way directory comparison")),
+            ("<%s> <%s> [<%s>]" % ((_("folder"),) * 3),
+             _("Start a 2- or 3-way folder comparison")),
         ]
         pad_args_fmt = "%-" + str(max([len(s[0]) for s in usages])) + "s %s"
         usage_lines = ["  %prog " + pad_args_fmt % u for u in usages]
@@ -213,7 +215,6 @@ class MeldApp(Gtk.Application):
                 print(error)
 
 
-
 app = MeldApp()
 
 from . import filediff


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