[sushi/wip/cosimoc/no-clutter: 19/50] fallbackRenderer: move function into only caller
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sushi/wip/cosimoc/no-clutter: 19/50] fallbackRenderer: move function into only caller
- Date: Mon, 17 Jun 2019 18:34:12 +0000 (UTC)
commit c62bf1ad8593de7b75b351a421fcbd798a66fcc6
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Mon Apr 3 12:40:58 2017 -0700
fallbackRenderer: move function into only caller
src/js/ui/fallbackRenderer.js | 29 +++++++++++++++++++++++++----
src/js/ui/utils.js | 28 ----------------------------
2 files changed, 25 insertions(+), 32 deletions(-)
---
diff --git a/src/js/ui/fallbackRenderer.js b/src/js/ui/fallbackRenderer.js
index 9e9bfbe..c00a34c 100644
--- a/src/js/ui/fallbackRenderer.js
+++ b/src/js/ui/fallbackRenderer.js
@@ -33,7 +33,6 @@ const _ = Gettext.gettext;
const Lang = imports.lang;
const Constants = imports.util.constants;
-const Utils = imports.ui.utils;
var FallbackRenderer = new Lang.Class({
Name: 'FallbackRenderer',
@@ -48,8 +47,8 @@ var FallbackRenderer = new Lang.Class({
prepare : function(file, mainWindow, callback) {
this._mainWindow = mainWindow;
- this.lastWidth = 0;
- this.lastHeight = 0;
+ this._lastWidth = 0;
+ this._lastHeight = 0;
this._fileLoader = new Sushi.FileLoader();
this._fileLoader.file = file;
@@ -159,6 +158,28 @@ var FallbackRenderer = new Lang.Class({
},
getSizeForAllocation : function(allocation) {
- return Utils.getStaticSize(this, this._box);
+ let width = this._box.get_preferred_width()[1];
+ let height = this._box.get_preferred_height()[1];
+
+ if (width < Constants.VIEW_MIN &&
+ height < Constants.VIEW_MIN) {
+ width = Constants.VIEW_MIN;
+ }
+
+ /* never make it shrink; this could happen when the
+ * spinner hides.
+ */
+ if (width < this._lastWidth)
+ width = this._lastWidth;
+ else
+ this._lastWidth = width;
+
+ if (height < this._lastHeight)
+ height = this._lastHeight;
+ else
+ this._lastHeight = height;
+
+ /* return the natural */
+ return [width, height];
}
});
diff --git a/src/js/ui/utils.js b/src/js/ui/utils.js
index 0e5efdf..c4b37c6 100644
--- a/src/js/ui/utils.js
+++ b/src/js/ui/utils.js
@@ -28,8 +28,6 @@ const Gtk = imports.gi.Gtk;
const Lang = imports.lang;
-const Constants = imports.util.constants;
-
var slowDownFactor = 0;
function setSlowDownFactor(factor) {
@@ -69,32 +67,6 @@ function getScaledSize(baseSize, allocSize, upscale) {
return [ Math.floor(width), Math.floor(height) ];
}
-function getStaticSize(renderer, widget) {
- let width = widget.get_preferred_width()[1];
- let height = widget.get_preferred_height()[1];
-
- if (width < Constants.VIEW_MIN &&
- height < Constants.VIEW_MIN) {
- width = Constants.VIEW_MIN;
- }
-
- /* never make it shrink; this could happen when the
- * spinner hides.
- */
- if (width < renderer.lastWidth)
- width = renderer.lastWidth;
- else
- renderer.lastWidth = width;
-
- if (height < renderer.lastHeight)
- height = renderer.lastHeight;
- else
- renderer.lastHeight = height;
-
- /* return the natural */
- return [ width, height ];
-}
-
function createToolButton(iconName, callback) {
let button = new Gtk.ToolButton({ expand: false,
icon_name: iconName });
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]