/* * app_wm - zavai window management functions * * Copyright (C) 2009 Enrico Zini * * 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 * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ using GLib; namespace zavai { namespace ui { namespace wm { /* static void print_window_state(Gtk.Window w) { Gdk.WindowState state = w.window.get_state(); int istate = (int) state; bool is_icon = (state & Gdk.WindowState.ICONIFIED) != 0; bool is_visible = w.visible; bool is_focus = w.is_focus; bool has_focus = ((Gtk.Widget)w).has_focus; bool is_active = w.is_active; bool is_toplevel = w.is_toplevel(); bool is_tfocus = w.has_toplevel_focus; stderr.printf("istate: %d; is_icon: %s; is_visible: %s; is_focus: %s; has_focus: %s, is_active: %s; is_toplevel: %s; is_tfocus: %s\n", istate, is_icon ? "true" : "false", is_visible ? "true" : "false", is_focus ? "true" : "false", has_focus ? "true" : "false", is_active ? "true" : "false", is_toplevel ? "true" : "false", is_tfocus ? "true" : "false" ); } */ public class RaiseIcon : Gtk.StatusIcon { public RaiseIcon() { activate += on_activate; zavai.app.visibility_changed += on_visibility_changed; update_icon(); } private void on_visibility_changed(bool visible) { update_icon(); } private void on_activate() { zavai.app.toggle_visibility(); update_icon(); } protected void update_icon() { string name = zavai.config.icondir + "/"; if (!zavai.app.visibility) name += "zavai_on.png"; else name += "zavai_off.png"; set_from_file(name); } } RaiseIcon raise_icon; public void init() { raise_icon = new RaiseIcon(); raise_icon.set_visible(true); } } } }