Working prefs

This commit is contained in:
Benjamin Drieu 2021-11-17 15:10:47 +01:00
parent 57e67ef312
commit ff5280f729
2 changed files with 7 additions and 2 deletions

View File

@ -79,11 +79,13 @@ class Indicator extends PanelMenu.Button {
serverBox.add_child(name_box);
let warning_box = new St.BoxLayout({ style_class: 'monito-warning-box monito-box' });
warning_box.set_style ( 'background-color: ' + _account_settings.get_string ( 'warning-color' ) );
this.warningBoxes [ _server ] = new St.Label({ text: String(_status['WARNING']) })
warning_box.add_child ( this.warningBoxes [ _server ] );
serverBox.add_child(warning_box);
let critical_box = new St.BoxLayout({ style_class: 'monito-critical-box monito-box' });
critical_box.set_style ( 'background-color: ' + _account_settings.get_string ( 'critical-color' ) );
this.criticalBoxes [ _server ] = new St.Label({ text: String(_status['CRITICAL']) })
critical_box.add_child ( this.criticalBoxes [ _server ] );
serverBox.add_child(critical_box);

View File

@ -59,6 +59,8 @@ const prefs = [ { type: Gtk.Entry, label: _('Name'), key: 'name' },
function init() {
log('initializing ${Me.metadata.name} Preferences');
this.settings = ExtensionUtils.getSettings(SETTINGS_SCHEMA);
log ( Me );
log ( Me._indicator );
}
@ -270,7 +272,7 @@ function activateAccountRow ( ) {
_color.parse (_account_settings.get_string(prefEntry.key) );
this.prefWidgets[prefEntry.key].set_use_alpha ( false );
this.prefWidgets[prefEntry.key].set_rgba ( _color );
this.prefWidgets[prefEntry.key].connect('color-set', Lang.bind ( { key: prefEntry.key }, setColor ) );
this.prefWidgets[prefEntry.key].connect('color-set', Lang.bind ( { key: prefEntry.key, settings: _account_settings }, setColor ) );
}
else if ( prefEntry.type == Gtk.ComboBoxText )
{
@ -344,5 +346,6 @@ function setColor ( color )
255 * color.get_rgba().red,
255 * color.get_rgba().green,
255 * color.get_rgba().blue );
_account_settings.set_string('' + this.key, _output);
this.settings.set_string('' + this.key, _output);
}