Skip to content

Commit

Permalink
add gtk4 preferences templates
Browse files Browse the repository at this point in the history
  • Loading branch information
jonian committed Mar 22, 2021
1 parent 1bb7ad9 commit 0a1dc4c
Show file tree
Hide file tree
Showing 3 changed files with 628 additions and 3 deletions.
14 changes: 11 additions & 3 deletions unite@hardpixel.eu/prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const Gtk = imports.gi.Gtk
const Unite = imports.misc.extensionUtils.getCurrentExtension()
const Convenience = Unite.imports.convenience
const VERSION = Unite.imports.constants.VERSION
const TEMPLATE = VERSION < 40 ? 'settings-gtk3.ui' : 'settings-gtk4.ui'

var PrefsWidget = GObject.registerClass(
class UnitePrefsWidget extends Gtk.Box {
Expand All @@ -11,10 +12,15 @@ var PrefsWidget = GObject.registerClass(
super._init(params)

this._buildable = new Gtk.Builder()
this._buildable.add_from_file(`${Unite.path}/settings.ui`)
this._buildable.add_from_file(`${Unite.path}/${TEMPLATE}`)

this._container = this._getWidget('prefs_widget')
this.add(this._container)

if (VERSION < 40) {
this.add(this._container)
} else {
this.append(this._container)
}

this._bindStrings()
this._bindSelects()
Expand All @@ -24,7 +30,9 @@ var PrefsWidget = GObject.registerClass(
}

startup() {
this.show_all()
if (VERSION < 40) {
this.show_all()
}

if (VERSION >= 36) {
this._hideSetting('use-system-fonts')
Expand Down
File renamed without changes.
Loading

0 comments on commit 0a1dc4c

Please # to comment.