From 7f039398d0934c5d85c60622f086425c862fb62a Mon Sep 17 00:00:00 2001 From: abakkk Date: Mon, 22 Jun 2020 12:16:17 +0200 Subject: [PATCH] Idlize savePersistent --- draw.js | 24 +++++++++++++----------- prefs.js | 2 +- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/draw.js b/draw.js index ae32951..e6f737d 100644 --- a/draw.js +++ b/draw.js @@ -1029,13 +1029,15 @@ var DrawingArea = new Lang.Class({ if (name == Me.metadata['persistent-file-name'] && contents == oldContents) return; - GLib.file_set_contents(path, contents); - if (notify) - this.emit('show-osd', 'document-save-symbolic', name, "", -1); - if (name != Me.metadata['persistent-file-name']) { - this.jsonName = name; - this.lastJsonContents = contents; - } + GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => { + GLib.file_set_contents(path, contents); + if (notify) + this.emit('show-osd', 'document-save-symbolic', name, "", -1); + if (name != Me.metadata['persistent-file-name']) { + this.jsonName = name; + this.lastJsonContents = contents; + } + }); }, saveAsJsonWithName: function(name) { @@ -2151,7 +2153,7 @@ const DrawingMenu = new Lang.Class({ item.menu.close(); }; - GLib.idle_add(GLib.PRIORITY_DEFAULT, () => { + GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => { for (let i in obj) { let text; if (targetProperty == 'currentFontFamilyId') @@ -2193,7 +2195,7 @@ const DrawingMenu = new Lang.Class({ item.menu.close(); }; - GLib.idle_add(GLib.PRIORITY_DEFAULT, () => { + GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => { for (let i = 1; i < this.area.colors.length; i++) { let text = this.area.colors[i].to_string(); let iCaptured = i; @@ -2236,7 +2238,7 @@ const DrawingMenu = new Lang.Class({ item.menu.close(); }; - GLib.idle_add(GLib.PRIORITY_DEFAULT, () => { + GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => { this._populateOpenDrawingSubMenu(); // small trick to prevent the menu from "jumping" on first opening item.menu.open(); @@ -2289,7 +2291,7 @@ const DrawingMenu = new Lang.Class({ item.menu.close(); }; - GLib.idle_add(GLib.PRIORITY_DEFAULT, () => { + GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => { this._populateSaveDrawingSubMenu(); // small trick to prevent the menu from "jumping" on first opening item.menu.open(); diff --git a/prefs.js b/prefs.js index b08a7aa..d092db8 100644 --- a/prefs.js +++ b/prefs.js @@ -122,7 +122,7 @@ function init() { function buildPrefsWidget() { let topStack = new TopStack(); let switcher = new Gtk.StackSwitcher({halign: Gtk.Align.CENTER, visible: true, stack: topStack}); - GLib.idle_add(GLib.PRIORITY_DEFAULT, () => { + GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => { let window = topStack.get_toplevel(); window.resize(720,500); let headerBar = window.get_titlebar();