Lift setting() onto the Panel base too
Matches the BarWidget extraction in the previous commit. The weather panel was the only panel reimplementing the helper inline; future panels with inline settings get it for free.
This commit is contained in:
@@ -21,6 +21,13 @@ Item {
|
||||
function close() { panelController.hide() }
|
||||
function toggle() { opened ? close() : open() }
|
||||
|
||||
// Read a single value from this panel's inline shell.json entry, with a
|
||||
// fallback for missing/null values. Matches BarWidget.setting().
|
||||
function setting(name, fallback) {
|
||||
var value = settings ? settings[name] : undefined
|
||||
return value === undefined || value === null ? fallback : value
|
||||
}
|
||||
|
||||
PanelController {
|
||||
id: panelController
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user