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



commit 7cee0bdc98b241f3144ef0617d801ecd1979c348
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 409191c..96dfe34 100644
--- a/src/js/ui/fallbackRenderer.js
+++ b/src/js/ui/fallbackRenderer.js
@@ -143,7 +143,7 @@ var 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 3f555ed..2e6436e 100644
--- a/src/js/ui/mainWindow.js
+++ b/src/js/ui/mainWindow.js
@@ -92,8 +92,6 @@ var 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);
@@ -113,13 +111,6 @@ var 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];
 
@@ -158,7 +149,7 @@ var MainWindow = new Lang.Class({
     /**************************************************************************
      *********************** texture allocation *******************************
      **************************************************************************/
-    _resizeWindow : function() {
+    resizeWindow : function() {
         if (this._isFullScreen)
             return;
 
@@ -227,7 +218,7 @@ var 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]