Actually show the dialog
authorEnrico Zini <enrico@enricozini.org>
Sun, 16 Aug 2009 11:25:45 +0000 (12:25 +0100)
committerEnrico Zini <enrico@enricozini.org>
Sun, 16 Aug 2009 11:25:45 +0000 (12:25 +0100)
src/app_power.vala

index 5146087853995465e3e3ae84650c9e83112868ba..1edd502bc88baf79f4d40027b8e22eb8e163d52e 100644 (file)
@@ -282,11 +282,13 @@ public class PowerMenu : zavai.Resource, Gtk.Window
        protected ShutdownButton act_shutdown;
        protected RebootButton act_reboot;
        protected ServiceRequestLink act_backlight_on;
+       protected bool shown;
 
        public PowerMenu()
        {
                type = Gtk.WindowType.POPUP;
                title = "Power Menu";
+               shown = false;
 
                vbox = new Gtk.VBox(true, 0);
                add(vbox);
@@ -318,10 +320,16 @@ public class PowerMenu : zavai.Resource, Gtk.Window
 
        public void toggle()
        {
-               // TODO: do more in case it is visible but has no visibility (is covered by others)
-               visible = !visible;
-               if (visible)
-                       present();
+               if (!shown)
+               {
+                       show_all();
+                       shown = true;
+               } else {
+                       // TODO: do more in case it is visible but has no visibility (is covered by others)
+                       visible = !visible;
+                       if (visible)
+                               present();
+               }                               
        }
 
        public void hide()