Re: Extension/Preferences shared variables



Hi Vadim,

Could you just use gsettings (i.e. the same thing that you use with `prefs.js` to store extension settings) for this?

In the `prefs.js` your widget does a:

    let settings = Convenience.getSettings();
    settings.set_int('my-setting-name', 1);

and in the extension you connect to the change:

    // in your init() say
    let settings = Convenience.getSettings();
    // in your enable() say
    settings.connect('changed::my-setting-name', callback)

So `callback` is called whenever a user changes the setting in the prefs widget.

(Here Convenience.getSettings is the one from the official gnome shell extensions - https://git.gnome.org/browse/gnome-shell-extensions/tree/lib/convenience.js)


On 11 April 2013 08:38, Vadim <vadim dbfin com> wrote:
Hi everyone,

I was wondering if there is a common way to share a variable between an
extension and the preferences dialog.

Let say, I want to set some "global".variable within the preferences
dialog (temporary until it is closed), and the running extension should
react on this, i.e. it should see that the variable was set.

Thanks in advance,
Vadim

_______________________________________________
gnome-shell-list mailing list
gnome-shell-list gnome org
https://mail.gnome.org/mailman/listinfo/gnome-shell-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]