Implement equivalent functionality as previous iterations wrt handling the availability of the hide_window keybinding

This commit is contained in:
Chris Jones 2009-08-09 23:25:53 +01:00
parent 3df46d1d85
commit 598eededd2
1 changed files with 10 additions and 6 deletions

View File

@ -26,6 +26,7 @@ class Window(Container, gtk.Window):
title = None title = None
isfullscreen = None isfullscreen = None
hidebound = None hidebound = None
hidefunc = None
def __init__(self, configobject): def __init__(self, configobject):
"""Class initialiser""" """Class initialiser"""
@ -45,13 +46,16 @@ class Window(Container, gtk.Window):
self.connect('destroy', self.on_destroy_event) self.connect('destroy', self.on_destroy_event)
self.connect('window-state-event', self.on_window_state_changed) self.connect('window-state-event', self.on_window_state_changed)
self.hidebound = False # Attempt to grab a global hotkey for hiding the window.
try: # If we fail, we'll never hide the window, iconifying instead.
self.couldbind = bindkey.tomboy_keybinder_bind( self.hidebound = bindkey.tomboy_keybinder_bind(
self.config['keybindings']['hide_window'], self.config['keybindings']['hide_window'],
self.on_hide_window) self.on_hide_window)
except KeyError: if not self.hidebound:
dbg('Unable to bind hide_window key, another instance has it.') dbg('Unable to bind hide_window key, another instance has it.')
self.hidefunc = self.iconify
else:
self.hidefunc = self.hide
def apply_config(self): def apply_config(self):
"""Apply various configuration options""" """Apply various configuration options"""