--- /dev/null
+#!/usr/bin/env python
+# coding=UTF-8
+#
+# Copyright (C) 2010 Stefanos Harhalakis
+#
+# This file is part of wifieye.
+#
+# wifieye is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# wifieye is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with wifieye. If not, see <http://www.gnu.org/licenses/>.
+#
+# $Id: 0.py 2265 2010-02-21 19:16:26Z v13 $
+
+__version__ = "$Id: 0.py 2265 2010-02-21 19:16:26Z v13 $"
+
+import gtk
+
+class Disconnector(object):
+ def __init__(self):
+ self.chandles=[]
+ if isinstance(self, gtk.Widget):
+ self.c(self, 'delete-event', self.slotDiscDeleteEvent)
+
+ def c(self, obj, signal, slot, *args):
+ h=obj.connect(signal, slot, *args)
+ self.chandles.append((obj, h))
+
+ return(h)
+
+ def slotDiscDeleteEvent(self, sender, event):
+# print "sig-delete-event"
+ self.dis_finish()
+ return(False)
+
+ def dis_finish(self, obj=None):
+ """ Disconnect all signals. If obj is specified the only disconnect
+ signals from that object """
+ for i in self.chandles:
+ if obj!=None and i[0]!=obj:
+ continue
+ #print i[0], i[1]
+ i[0].disconnect(i[1])
+
+ if obj==None:
+ self.chandles=[]
+ else:
+ self.chandles=[a for a in self.chandles if a[0]!=obj]
+
+# vim: set ts=8 sts=4 sw=4 noet formatoptions=r ai nocindent:
+