general.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import Adw from 'gi://Adw';
  2. import GLib from 'gi://GLib';
  3. import GObject from 'gi://GObject';
  4. import Gio from 'gi://Gio';
  5. import { CustomizeRow } from './customize_row.js';
  6. export const General = GObject.registerClass({
  7. GTypeName: 'General',
  8. Template: GLib.uri_resolve_relative(import.meta.url, '../ui/general.ui', GLib.UriFlags.NONE),
  9. InternalChildren: [
  10. 'sigma',
  11. 'brightness',
  12. 'color',
  13. 'color_row',
  14. 'noise_amount',
  15. 'noise_amount_row',
  16. 'noise_lightness',
  17. 'noise_lightness_row',
  18. 'color_and_noise',
  19. 'hack_level',
  20. 'debug',
  21. 'reset'
  22. ],
  23. }, class General extends Adw.PreferencesPage {
  24. constructor(preferences) {
  25. super({});
  26. this.preferences = preferences;
  27. CustomizeRow.prototype.connect_to.call(this, preferences, preferences);
  28. this.preferences.settings.bind(
  29. 'color-and-noise', this._color_and_noise, 'active',
  30. Gio.SettingsBindFlags.DEFAULT
  31. );
  32. this.preferences.settings.bind(
  33. 'hacks-level', this._hack_level, 'selected',
  34. Gio.SettingsBindFlags.DEFAULT
  35. );
  36. this.preferences.settings.bind(
  37. 'debug', this._debug, 'active',
  38. Gio.SettingsBindFlags.DEFAULT
  39. );
  40. this._reset.connect('clicked', _ => this.preferences.reset());
  41. }
  42. });