aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEugeni Dodonov <eugeni@mandriva.org>2009-01-21 16:21:19 +0000
committerEugeni Dodonov <eugeni@mandriva.org>2009-01-21 16:21:19 +0000
commite585ac57841e3bbf8cdec1cd08c2fefd32175e82 (patch)
tree5cdc0ad5f82c588f3851d3231e2fd8ecf1915fc7 /src
parentcd8e53cbd0cd88b9999f9f17c6ba676420b697ca (diff)
downloadmsec-e585ac57841e3bbf8cdec1cd08c2fefd32175e82.tar
msec-e585ac57841e3bbf8cdec1cd08c2fefd32175e82.tar.gz
msec-e585ac57841e3bbf8cdec1cd08c2fefd32175e82.tar.bz2
msec-e585ac57841e3bbf8cdec1cd08c2fefd32175e82.tar.xz
msec-e585ac57841e3bbf8cdec1cd08c2fefd32175e82.zip
Now handling close events when closing from MCC.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/msec/msecgui.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/msec/msecgui.py b/src/msec/msecgui.py
index 22ae610..568d53e 100755
--- a/src/msec/msecgui.py
+++ b/src/msec/msecgui.py
@@ -7,6 +7,8 @@ import os
import sys
import string
import getopt
+import signal
+import Queue
# PyGTK
import warnings
@@ -202,8 +204,20 @@ class MsecGui:
# are we enabled?
self.toggle_level(self.base_level)
+ # pending signals
+ self.signals = Queue.Queue()
+ gobject.timeout_add(500, self.check_signals)
+
self.window.show_all()
+ def check_signals(self):
+ """Checks for received signals"""
+ if not self.signals.empty():
+ s = self.signals.get()
+ if s == signal.SIGTERM:
+ self.quit(self.window)
+ gobject.timeout_add(500, self.check_signals)
+
def check_for_changes(self, curconfig, curperms):
"""Checks for changes in configuration. Returns number of configuration
changes, the description of changes, and results of msec dry run"""
@@ -1133,8 +1147,12 @@ class MsecGui:
model.set(iter, self.COLUMN_DESCR, doc)
model.set(iter, self.COLUMN_CUSTOM, custom)
+ def signal_quit(self, s):
+ """Quits via a signal"""
+ self.signals.put(s)
+ return True
- def quit(self, widget, event):
+ def quit(self, widget, event=None):
"""Quits the application"""
# were there changes in configuration?
@@ -1224,5 +1242,6 @@ if __name__ == "__main__":
log.info("Starting gui..")
gui = MsecGui(log, msec, perms, msec_config, perm_conf, embed=PlugWindowID)
+ signal.signal(signal.SIGTERM, lambda s, f: gui.signal_quit(s))
gtk.main()