mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
Bar editor: removing the last ControlCenter triggers a toast warning.
This commit is contained in:
@@ -771,7 +771,7 @@
|
||||
},
|
||||
"section-editor": {
|
||||
"placeholder": "Select a widget to add...",
|
||||
"search-placeholder": "Search widgets..."
|
||||
"search-placeholder": "Search widget..."
|
||||
},
|
||||
"active-window": {
|
||||
"auto-hide": "Hide automatically",
|
||||
@@ -1233,8 +1233,12 @@
|
||||
"unmuted": "Unmuted"
|
||||
},
|
||||
"battery": {
|
||||
"low": "Low Battery",
|
||||
"low": "Low battery",
|
||||
"low-desc": "Battery is at {percent}%. Please connect the charger."
|
||||
},
|
||||
"missing-control-center": {
|
||||
"label": "Last Control Center widget removed",
|
||||
"description": "The Control Center widget has been removed from the bar. To access it from the bar again, you will need to re-add the widget."
|
||||
}
|
||||
},
|
||||
"weather": {
|
||||
|
||||
@@ -314,8 +314,13 @@ ColumnLayout {
|
||||
function _removeWidgetFromSection(section, index) {
|
||||
if (index >= 0 && index < Settings.data.bar.widgets[section].length) {
|
||||
var newArray = Settings.data.bar.widgets[section].slice()
|
||||
newArray.splice(index, 1)
|
||||
var removedWidgets = newArray.splice(index, 1)
|
||||
Settings.data.bar.widgets[section] = newArray
|
||||
|
||||
// Check that we still have a control center
|
||||
if (removedWidgets[0].id === "ControlCenter" && BarService.lookupWidget("ControlCenter") === undefined) {
|
||||
ToastService.showWarning(I18n.tr("toast.missing-control-center.label"), I18n.tr("toast.missing-control-center.description"), 12000)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user