fixes after test on GS 3.24

* use var to export extensionJs.manager
* remove duplicated (old) buildPrefsWidget
* set OsdWindow.HIDE_TIMEOUT in a try/catch because HIDE_TIMEOUT is not exported with 'var'
* capture i in callbacks in for(){} (i is changing)
* add 3.24 version as supported
This commit is contained in:
abakkk 2019-11-29 18:43:42 +01:00
parent fbd6ad709c
commit 6dd552ae7e
4 changed files with 11 additions and 13 deletions

View File

@ -1230,9 +1230,10 @@ var DrawingMenu = new Lang.Class({
else
text = _(obj[i]);
let iCaptured = i;
let subItem = item.menu.addAction(text, () => {
item.label.set_text(_(obj[i]));
target[targetProperty] = i;
item.label.set_text(_(obj[iCaptured]));
target[targetProperty] = iCaptured;
if (callback)
callback();
});
@ -1256,8 +1257,9 @@ var DrawingMenu = new Lang.Class({
Mainloop.timeout_add(0, () => {
for (let i = 1; i < this.area.colors.length; i++) {
let text = `<span foreground="${this.area.colors[i].to_string()}">${this.area.colors[i].to_string()}</span>`;
let iCaptured = i;
let colorItem = item.menu.addAction(text, () => {
this.area.currentColor = this.area.colors[i];
this.area.currentColor = this.area.colors[iCaptured];
item.icon.set_style(`color:${this.area.currentColor.to_string().slice(0, 7)};`);
});
colorItem.label.get_clutter_text().set_use_markup(true);

View File

@ -43,7 +43,7 @@ var DRAWING_ACTION_MODE = Math.pow(2,14);
// use 'login-dialog-message-warning' class in order to get GS theme warning color (default: #f57900)
var WARNING_COLOR_STYLE_CLASS_NAME = 'login-dialog-message-warning';
let manager;
var manager;
function init() {
Convenience.initTranslations();
@ -193,11 +193,12 @@ var AreaManager = new Lang.Class({
}
for (let i = 1; i < 10; i++) {
let iCaptured = i;
Main.wm.addKeybinding('select-color' + i,
this.settings,
Meta.KeyBindingFlags.NONE,
DRAWING_ACTION_MODE,
() => this.activeArea.selectColor(i));
() => this.activeArea.selectColor(iCaptured));
}
},
@ -303,9 +304,9 @@ var AreaManager = new Lang.Class({
if (!this.osdDisabled) {
// increase OSD display time
let hideTimeoutSave = OsdWindow.HIDE_TIMEOUT;
OsdWindow.HIDE_TIMEOUT = 2000;
try { OsdWindow.HIDE_TIMEOUT = 2000; } catch(e) { /* HIDE_TIMEOUT is not exported with 'var' */ }
Main.osdWindowManager.show(currentIndex, this.enterGicon, _("Press Ctrl + F1 for help") + "\n\n" + _("Entering drawing mode"), null);
OsdWindow.HIDE_TIMEOUT = hideTimeoutSave;
try { OsdWindow.HIDE_TIMEOUT = hideTimeoutSave; } catch(e) {}
}
}

View File

@ -7,6 +7,7 @@
"settings-schema": "org.gnome.shell.extensions.draw-on-your-screen",
"gettext-domain": "draw-on-your-screen",
"shell-version": [
"3.24",
"3.26",
"3.28",
"3.30",

View File

@ -88,12 +88,6 @@ function init() {
Convenience.initTranslations();
}
function buildPrefsWidget() {
let prefsPage = new PrefsPage();
prefsPage.show_all();
return prefsPage;
}
function buildPrefsWidget() {
let topStack = new TopStack();
let switcher = new Gtk.StackSwitcher({halign: Gtk.Align.CENTER, visible: true, stack: topStack});