Let the tray icon really be useful (showing and hiding)

This commit is contained in:
Pierre Pronchery 2012-05-21 23:38:08 +00:00
parent 12b63cf046
commit f90aa0a790
3 changed files with 14 additions and 2 deletions

View File

@ -123,6 +123,9 @@ void on_view_hide(gpointer data)
void on_systray_activate(gpointer data)
{
Keyboard * keyboard = data;
gboolean visible;
keyboard_show(keyboard, TRUE);
/* toggle visibility */
visible = keyboard_is_visible(keyboard);
keyboard_show(keyboard, visible ? FALSE : TRUE);
}

View File

@ -537,6 +537,13 @@ void keyboard_delete(Keyboard * keyboard)
/* accessors */
/* keyboard_is_visible */
gboolean keyboard_is_visible(Keyboard * keyboard)
{
return gtk_widget_get_visible(keyboard->window);
}
/* keyboard_set_layout */
void keyboard_set_layout(Keyboard * keyboard, unsigned int which)
{

View File

@ -1,5 +1,5 @@
/* $Id$ */
/* Copyright (c) 2010 Pierre Pronchery <khorben@defora.org> */
/* Copyright (c) 2010-2012 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Desktop Keyboard */
/* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -48,6 +48,8 @@ Keyboard * keyboard_new(KeyboardPrefs * prefs);
void keyboard_delete(Keyboard * keyboard);
/* accessors */
gboolean keyboard_is_visible(Keyboard * keyboard);
/* XXX be more explicit */
void keyboard_set_layout(Keyboard * keyboard, unsigned int which);
void keyboard_set_page(Keyboard * keyboard, KeyboardPage page);