[sushi/wip/cosimoc/no-clutter: 59/67] mainWindow: move to explicit model for resizeWindow()



commit d92646ba58377446867da11dd5e3a72eae87ab84
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Sun Apr 9 11:29:32 2017 -0700

    mainWindow: move to explicit model for resizeWindow()
    
    Instead of calling it every allocation, make it an explicit method.

 src/js/ui/fallbackRenderer.js |    2 +-
 src/js/ui/mainWindow.js       |   13 ++-----------
 src/js/viewers/gst.js         |    2 +-
 3 files changed, 4 insertions(+), 13 deletions(-)
---
diff --git a/src/js/ui/fallbackRenderer.js b/src/js/ui/fallbackRenderer.js
index 2e209d4..7e0359e 100644
--- a/src/js/ui/fallbackRenderer.js
+++ b/src/js/ui/fallbackRenderer.js
@@ -143,7 +143,7 @@ const FallbackRenderer = new Lang.Class({
             this._image.set_from_pixbuf(this._fileLoader.icon);
 
         this._applyLabels();
-        this._mainWindow.queue_allocate();
+        this._mainWindow.resizeWindow();
     },
 
     clear : function() {
diff --git a/src/js/ui/mainWindow.js b/src/js/ui/mainWindow.js
index fb25efe..5ebd791 100644
--- a/src/js/ui/mainWindow.js
+++ b/src/js/ui/mainWindow.js
@@ -101,8 +101,6 @@ const MainWindow = new Lang.Class({
                      Lang.bind(this, this._onMotionNotifyEvent));
         this.connect('realize',
                      Lang.bind(this, this._onRealize));
-        this.connect('size-allocate',
-                     Lang.bind(this, this._onSizeAllocate));
 
         this._embed = new Embed();
         this.add(this._embed);
@@ -122,13 +120,6 @@ const MainWindow = new Lang.Class({
                                         Gdk.WMFunction.CLOSE);
     },
 
-    _onSizeAllocate: function() {
-        if (!this._renderer)
-            return;
-
-        this._resizeWindow();
-    },
-
     _onKeyPressEvent : function(widget, event) {
         let key = event.get_keyval()[1];
 
@@ -167,7 +158,7 @@ const MainWindow = new Lang.Class({
     /**************************************************************************
      *********************** texture allocation *******************************
      **************************************************************************/
-    _resizeWindow : function() {
+    resizeWindow : function() {
         if (this._isFullScreen)
             return;
 
@@ -236,7 +227,7 @@ const MainWindow = new Lang.Class({
         this._view.show();
 
         this._embed.add(this._view);
-        this._resizeWindow();
+        this.resizeWindow();
     },
 
     /**************************************************************************
diff --git a/src/js/viewers/gst.js b/src/js/viewers/gst.js
index 5e12de1..15865f8 100644
--- a/src/js/viewers/gst.js
+++ b/src/js/viewers/gst.js
@@ -44,7 +44,7 @@ const GstRenderer = new Lang.Class({
         this._player = new Sushi.MediaBin({ uri: file.get_uri() });
         this._player.play();
         this._player.connect('size-change', function() {
-            mainWindow.queue_allocate();
+            mainWindow.resizeWindow();
         });
         callback();
     },


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