[sushi] utils: change icon to view-restore-symbolic when fullscreen



commit 873a27030223fc4f4c94d885525445ec561cdec7
Author: Cosimo Cecchi <cosimo endlessm com>
Date:   Wed Oct 19 16:45:13 2016 -0700

    utils: change icon to view-restore-symbolic when fullscreen
    
    https://bugzilla.gnome.org/show_bug.cgi?id=772988

 src/js/ui/mainWindow.js |    4 +++-
 src/js/ui/utils.js      |   10 ++++++++--
 2 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/src/js/ui/mainWindow.js b/src/js/ui/mainWindow.js
index 651cb32..a2271d2 100644
--- a/src/js/ui/mainWindow.js
+++ b/src/js/ui/mainWindow.js
@@ -568,13 +568,15 @@ const MainWindow = new Lang.Class({
 
     toggleFullScreen : function() {
         if (!this._renderer.canFullScreen)
-            return;
+            return false;
 
         if (this._isFullScreen) {
             this._exitFullScreen();
         } else {
             this._enterFullScreen();
         }
+
+        return this._isFullScreen;
     },
 
     close : function() {
diff --git a/src/js/ui/utils.js b/src/js/ui/utils.js
index 02f655f..c63facb 100644
--- a/src/js/ui/utils.js
+++ b/src/js/ui/utils.js
@@ -105,9 +105,15 @@ function createToolButton(iconName, callback) {
 }
 
 function createFullScreenButton(mainWindow) {
-    return createToolButton('view-fullscreen-symbolic', function() {
-        mainWindow.toggleFullScreen();
+    let button = createToolButton('view-fullscreen-symbolic', function() {
+        let fullscreen = mainWindow.toggleFullScreen();
+        if (fullscreen)
+            button.icon_name = 'view-restore-symbolic';
+        else
+            button.icon_name = 'view-fullscreen-symbolic';
     });
+
+    return button;
 }
 
 function createOpenButton(file, mainWindow) {


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