+ def run(self):
+ '''UzblTabbed main function that calls the gtk loop.'''
+
+ if not len(self.tabs):
+ self.new_tab()
+
+ # Update tablist timer
+ #timer = "update-tablist"
+ #timerid = timeout_add(500, self.update_tablist,timer)
+ #self._timers[timer] = timerid
+
+ # Probe clients every second for window titles and location
+ timer = "probe-clients"
+ timerid = timeout_add(1000, self.probe_clients, timer)
+ self._timers[timer] = timerid
+
+ # Make SIGTERM act orderly.
+ signal(SIGTERM, lambda signum, stack_frame: self.terminate(SIGTERM))
+
+ # Catch keyboard interrupts
+ signal(SIGINT, lambda signum, stack_frame: self.terminate(SIGINT))
+
+ try:
+ gtk.main()
+
+ except:
+ error("encounted error %r" % sys.exc_info()[1])
+
+ # Unlink fifo socket
+ self.unlink_fifo_socket()
+
+ # Attempt to close all uzbl instances nicely.
+ self.quitrequest()
+
+ # Allow time for all the uzbl instances to quit.
+ time.sleep(1)
+
+ raise
+
+
+ def terminate(self, termsig=None):
+ '''Handle termination signals and exit safely and cleanly.'''
+
+ # Not required but at least it lets the user know what killed his
+ # browsing session.
+ if termsig == SIGTERM:
+ error("caught SIGTERM signal")
+
+ elif termsig == SIGINT:
+ error("caught keyboard interrupt")
+
+ else:
+ error("caught unknown signal")
+
+ error("commencing infanticide!")
+
+ # Sends the exit signal to all uzbl instances.
+ self.quitrequest()
+
+
+ def init_fifo_socket(self):