[meld/meld-3-12] bin/meld: Hook SIGINT using GLib instead of Python for instant quitting



commit 253516b185c32e22cb6670052c7f507abb42b083
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sat Nov 22 08:07:16 2014 +1000

    bin/meld: Hook SIGINT using GLib instead of Python for instant quitting
    
    The previous solution worked, but waited until the window got focus,
    repainted or we otherwise ran the event loop, which was weird. This
    just works straight away.

 bin/meld |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/bin/meld b/bin/meld
index 1e53d59..3d73b1b 100755
--- a/bin/meld
+++ b/bin/meld
@@ -130,7 +130,7 @@ def check_requirements():
 
     pyver = (2, 7)
     gtk_requirement = (3, 6)
-    glib_requirement = (2, 34, 0)
+    glib_requirement = (2, 36, 0)
     gtksourceview_requirement = (3, 6, 0)
 
     def missing_reqs(mod, ver, exception=None):
@@ -252,6 +252,9 @@ if __name__ == '__main__':
     setup_resources()
 
     import meld.meldapp
-    signal.signal(signal.SIGINT, lambda *args: meld.meldapp.app.quit())
+    if sys.platform != 'win32':
+        from gi.repository import GLib
+        GLib.unix_signal_add(GLib.PRIORITY_DEFAULT, signal.SIGINT,
+                             lambda *args: meld.meldapp.app.quit(), None)
     status = meld.meldapp.app.run(sys.argv)
     sys.exit(status)


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