More debugging
[gregoa/zavai.git] / src / app.vala
index 05e81667bcfa250b6a7ee5da9e33d30a017712ea..66f432bd3cd41c528b3c81e6863deb0d1125fef8 100644 (file)
@@ -24,6 +24,9 @@ namespace zavai {
 
 public class Zavai : Gtk.Window, zavai.Resource
 {
+       public bool visibility = true;
+       public signal void visibility_changed(bool visible);
+
        zavai.Applet current;
        string current_name;
 
@@ -33,6 +36,34 @@ public class Zavai : Gtk.Window, zavai.Resource
                current = null;
                current_name = null;
                destroy += Gtk.main_quit;
+               set_events(get_events() | Gdk.EventMask.VISIBILITY_NOTIFY_MASK);
+               visibility_notify_event += on_visibility;
+               set_skip_pager_hint(true);
+               set_skip_taskbar_hint(true);
+
+       }
+
+       private bool on_visibility(Gdk.Event event)
+       {
+               visibility = (event.visibility.state == Gdk.VisibilityState.UNOBSCURED);
+               visibility_changed(visibility);
+               return true;
+       }
+
+       public void toggle_visibility()
+       {
+               if (visibility)
+               {
+                       visible = false;
+                       visibility = false;
+                       visibility_changed(visibility);
+                       //zavai.app.iconify();
+               } else {
+                       visible = true;
+                       present();
+                       set_skip_pager_hint(true);
+                       set_skip_taskbar_hint(true);
+               }
        }
 
        public void show_applet(string name)