[the-board] [ui] Show/hide MainWindow when clicking on status icon



commit 646f815e308fa4e67e1628d8c9445c6cfc29f699
Author: Lucas Rocha <lucasr gnome org>
Date:   Sat Nov 13 23:44:28 2010 +0000

    [ui] Show/hide MainWindow when clicking on status icon
    
    This is just a temporary UI to have a more convenient way of dogfooding
    the app.

 src/js/ui/mainWindow.js |   23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 deletions(-)
---
diff --git a/src/js/ui/mainWindow.js b/src/js/ui/mainWindow.js
index ea19525..771991e 100644
--- a/src/js/ui/mainWindow.js
+++ b/src/js/ui/mainWindow.js
@@ -57,6 +57,7 @@ MainWindow.prototype = {
 
         this._createGtkWindow();
         this._createClutterEmbed();
+        this._createStatusIcon();
         this._createPageManager();
 
         this._connectStageSignals();
@@ -83,8 +84,8 @@ MainWindow.prototype = {
                              hasResizeGrip: false,
                              decorated: false,
                              deletable: false,
-                             skipTaskbarHint: true,
-                             skipPagerHint: true });
+                             skipTaskbarHint: false,
+                             skipPagerHint: false });
 
         this._application.add_window(this._gtkWindow);
 
@@ -106,6 +107,16 @@ MainWindow.prototype = {
         this._stage = this._clutterEmbed.get_stage();
     },
 
+    _createStatusIcon : function() {
+        this._statusIcon =
+            Gtk.StatusIcon.new_from_icon_name("the-board");
+
+        this._statusIcon.set_tooltip_text("The Board");
+
+        this._statusIcon.connect("button-press-event",
+                                 Lang.bind(this, this._onStatusIconButtonPressEvent));
+    },
+
     _createPageManager : function() {
         this._pageManager = new PageManager.PageManager();
 
@@ -592,6 +603,14 @@ MainWindow.prototype = {
         clipboard.request_text(onTextReceived, null);
     },
 
+    _onStatusIconButtonPressEvent : function() {
+        if (this._gtkWindow.visible) {
+            this._gtkWindow.hide();
+        } else {
+            this.present();
+        }
+    },
+
     _onToolbarActiveChanged : function() {
         if (this._currentPage && this._activeToolbar.active) {
             this._currentPage.setActiveThing(null);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]