mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-03 20:32:07 -04:00
fix: Save user prefs in topbar spacing
This commit is contained in:
@@ -119,6 +119,8 @@ Singleton {
|
|||||||
signal widgetDataChanged
|
signal widgetDataChanged
|
||||||
signal workspaceIconsUpdated
|
signal workspaceIconsUpdated
|
||||||
|
|
||||||
|
property bool _loading: false
|
||||||
|
|
||||||
function getEffectiveTimeFormat() {
|
function getEffectiveTimeFormat() {
|
||||||
if (use24HourClock) {
|
if (use24HourClock) {
|
||||||
return Locale.ShortFormat
|
return Locale.ShortFormat
|
||||||
@@ -155,10 +157,13 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function loadSettings() {
|
function loadSettings() {
|
||||||
|
_loading = true
|
||||||
parseSettings(settingsFile.text())
|
parseSettings(settingsFile.text())
|
||||||
|
_loading = false
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseSettings(content) {
|
function parseSettings(content) {
|
||||||
|
_loading = true
|
||||||
try {
|
try {
|
||||||
if (content && content.trim()) {
|
if (content && content.trim()) {
|
||||||
var settings = JSON.parse(content)
|
var settings = JSON.parse(content)
|
||||||
@@ -287,10 +292,14 @@ Singleton {
|
|||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
applyStoredTheme()
|
applyStoredTheme()
|
||||||
|
} finally {
|
||||||
|
_loading = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveSettings() {
|
function saveSettings() {
|
||||||
|
if (_loading)
|
||||||
|
return
|
||||||
settingsFile.setText(JSON.stringify({
|
settingsFile.setText(JSON.stringify({
|
||||||
"currentThemeName": currentThemeName,
|
"currentThemeName": currentThemeName,
|
||||||
"customThemeFile": customThemeFile,
|
"customThemeFile": customThemeFile,
|
||||||
@@ -1026,6 +1035,7 @@ Singleton {
|
|||||||
path: StandardPaths.writableLocation(StandardPaths.ConfigLocation) + "/DankMaterialShell/settings.json"
|
path: StandardPaths.writableLocation(StandardPaths.ConfigLocation) + "/DankMaterialShell/settings.json"
|
||||||
blockLoading: true
|
blockLoading: true
|
||||||
blockWrites: true
|
blockWrites: true
|
||||||
|
atomicWrites: true
|
||||||
watchChanges: true
|
watchChanges: true
|
||||||
onLoaded: {
|
onLoaded: {
|
||||||
parseSettings(settingsFile.text())
|
parseSettings(settingsFile.text())
|
||||||
|
|||||||
Reference in New Issue
Block a user