From 8bb6ce04ef00dc85722823a388e8c7d0b922bd5c Mon Sep 17 00:00:00 2001 From: Rafostar <40623528+Rafostar@users.noreply.github.com> Date: Mon, 9 Nov 2020 17:56:38 +0100 Subject: [PATCH] Get initial dimensions only once --- clapper_src/app.js | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/clapper_src/app.js b/clapper_src/app.js index 1d26a150..a664df08 100644 --- a/clapper_src/app.js +++ b/clapper_src/app.js @@ -6,7 +6,6 @@ const Menu = imports.clapper_src.menu; const Misc = imports.clapper_src.misc; let { debug } = Debug; -let { settings } = Misc; var App = GObject.registerClass( class ClapperApp extends Gtk.Application @@ -45,18 +44,9 @@ class ClapperApp extends Gtk.Application let clapperWidget = new Widget(); window.set_child(clapperWidget); - let size = settings.get_string('window-size'); - try { - size = JSON.parse(size); - } - catch(err) { - debug(err); - size = null; - } - if(size) { - window.set_default_size(size[0], size[1]); - debug(`restored window size: ${size[0]}x${size[1]}`); - } + let size = clapperWidget.windowSize; + window.set_default_size(size[0], size[1]); + debug(`restored window size: ${size[0]}x${size[1]}`); let clapperPath = Misc.getClapperPath(); let uiBuilder = Gtk.Builder.new_from_file(