Merge branch 'focus_if_open' of https://github.com/pypingou/guake into pypingou-focus_if_open

Conflicts:
	src/guake

Signed-off-by: Gaetan Semet <gaetan@xeberon.net>
This commit is contained in:
Gaetan Semet 2014-02-12 11:18:54 +01:00
commit ebe6f77bff
2 changed files with 19 additions and 1 deletions

View File

@ -649,5 +649,19 @@
<long>Set it as false to enjoy guake's fullscreen.</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/guake/general/focus_if_open</key>
<applyto>/apps/guake/general/focus_if_open</applyto>
<owner>guake</owner>
<type>bool</type>
<default>true</default>
<locale name="C">
<short>Give focus to guake if tab is opened.</short>
<long>If the guake window is out of focus but open,
enabling this will give it back the focus instead of closing the window.</long>
</locale>
</schema>
</schemalist>
</gconfschemafile>

View File

@ -874,8 +874,12 @@ class Guake(SimpleGladeApp):
if not self.window.get_property('visible'):
self.show()
self.set_terminal_focus()
else:
elif not self.client.get_bool(KEY('general/focus_if_open')) and \
self.window.window.get_state() == gtk.gdk.WINDOW_STATE_ABOVE:
self.hide()
else:
self.show()
self.set_terminal_focus()
def show(self):
"""Shows the main window and grabs the focus on it.