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



commit 74e15dda8536b1b381e91496527ead06c3182c35
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 062221c..0be179d 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, 10, 0)
 
     def missing_reqs(mod, ver, exception=None):
@@ -260,6 +260,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]