Skip to content

Commit

Permalink
prefs: optimize settings startup
Browse files Browse the repository at this point in the history
  • Loading branch information
jonian committed Mar 22, 2021
1 parent 8e1365a commit d7d33d6
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions unite@hardpixel.eu/prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,31 @@ var PrefsWidget = GObject.registerClass(
this._container = this._getWidget('prefs_widget')
this.add(this._container)

if (VERSION >= 36) {
const fonts = this._getWidget('use_system_fonts_section')

fonts.set_no_show_all(true)
fonts.set_visible(false)
fonts.set_sensitive(false)
}

this._bindStrings()
this._bindSelects()
this._bindBooleans()
this._bindEnumerations()
this._bindIntegers()
}

startup() {
this.show_all()

if (VERSION >= 36) {
this._hideSetting('use-system-fonts')
}
}

_getWidget(name) {
let widgetName = name.replace(/-/g, '_')
return this._buildable.get_object(widgetName)
}

_hideSetting(name) {
const widget = this._getWidget(`${name}_section`)
widget.hide()
}

_bindInput(setting, prop) {
let widget = this._getWidget(setting)
this._settings.bind(setting, widget, prop, this._settings.DEFAULT_BINDING)
Expand Down Expand Up @@ -83,7 +88,7 @@ function init() {

function buildPrefsWidget() {
let widget = new PrefsWidget()
widget.show_all()
widget.startup()

return widget
}

0 comments on commit d7d33d6

Please # to comment.