prefs.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * This file is part of the Forge GNOME extension
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. *
  17. */
  18. // Gnome imports
  19. import Gdk from "gi://Gdk";
  20. import Gtk from "gi://Gtk";
  21. import { ExtensionPreferences } from "resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js";
  22. import { KeyboardPage } from "./lib/prefs/keyboard.js";
  23. import { AppearancePage } from "./lib/prefs/appearance.js";
  24. import { WorkspacePage } from "./lib/prefs/workspace.js";
  25. import { SettingsPage } from "./lib/prefs/settings.js";
  26. export default class ForgeExtensionPreferences extends ExtensionPreferences {
  27. settings = this.getSettings();
  28. kbdSettings = this.getSettings("org.gnome.shell.extensions.forge.keybindings");
  29. constructor(...args) {
  30. super(...args);
  31. const iconPath = this.dir.get_child("resources").get_child("icons").get_path();
  32. const iconTheme = Gtk.IconTheme.get_for_display(Gdk.Display.get_default());
  33. iconTheme.add_search_path(iconPath);
  34. }
  35. fillPreferencesWindow(window) {
  36. this.window = window;
  37. window._settings = this.settings;
  38. window._kbdSettings = this.kbdSettings;
  39. window.add(new SettingsPage(this));
  40. window.add(new AppearancePage(this));
  41. window.add(new WorkspacePage(this));
  42. window.add(new KeyboardPage(this));
  43. window.search_enabled = true;
  44. window.can_navigate_back = true;
  45. }
  46. }