prefs.js importing Main complains about not finding Meta
- From: Amy C <mathematical coffee gmail com>
- To: gnome-shell-list gnome org
- Subject: prefs.js importing Main complains about not finding Meta
- Date: Wed, 8 Aug 2012 23:07:51 +1000
Hi all,
In my prefs.js I'm trying to import imports.ui.Main.
However this causes the following error on selecting the extension in
gnome-shell:
JS ERROR: !!! Exception was: Error: Requiring Meta, version
none: Typelib file for namespace 'Meta' (any version) not found
I guess Main imports Meta which is not included in the import path for
gnome-shell-extension-prefs.
The workaround is not to import Main in prefs.js and leave that until
the settings.connect('changed::...') listener in extension.js.
However I'm only importing Main because I want to query
`Main.panel._leftBox.get_children().length` and depending on the
result I'll do a this._settings.set_int(...). I'm incorporating a
wrap-around effect: if the number increases past the
get_children().length I'll set it back to 0 instead.
If I defer this processing to the listener in extension.js, it's going
to look like this:
settings.connect('changed::my_key', function () {
let value = settings.get_int('my_key');
if (value >= Main.panel._leftBox.get_children().length) {
value = 0;
settings.set_int(value);
return;
}
/* ... more stuff to do with value */
}
It just seems awkward because this will fire the 'changed::my_key'
signal twice, once with the first value and the proper adjusted value
of 0.
So, is there any way to import Main into prefs.js?
cheers
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]