fix: use row title to make settings window not break for long item names

Use the title of the PrefsBoxOrderItemRow (AdwActionRow) for the item
name instead of a label in the prefix. Aside from generally being more
correct, item names now wrap correctly, avoiding the settings window
breaking (being cut off by default to the right with even the close
button not showing, until resizing) with long item names.
This commit is contained in:
June 2025-06-09 19:53:12 +02:00
parent a58ddc6146
commit 185a48c857
No known key found for this signature in database
2 changed files with 4 additions and 13 deletions

View File

@ -1,12 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="PrefsBoxOrderItemRow" parent="AdwActionRow">
<child type="prefix">
<object class="GtkLabel" id="item-name-display-label">
<property name="halign">start</property>
<property name="hexpand">True</property>
</object>
</child>
<child type="prefix">
<object class="GtkImage">
<property name="icon-name">list-drag-handle-symbolic</property>

View File

@ -11,9 +11,6 @@ export default class PrefsBoxOrderItemRow extends Adw.ActionRow {
GObject.registerClass({
GTypeName: "PrefsBoxOrderItemRow",
Template: GLib.uri_resolve_relative(import.meta.url, "../ui/prefs-box-order-item-row.ui", GLib.UriFlags.NONE),
InternalChildren: [
"item-name-display-label",
],
Signals: {
"move": {
param_types: [GObject.TYPE_STRING],
@ -47,12 +44,12 @@ export default class PrefsBoxOrderItemRow extends Adw.ActionRow {
this.item = item;
if (item.startsWith("appindicator-kstatusnotifieritem-")) {
// Set `this._item_name_display_label` to something nicer, if the
// associated item is an AppIndicator/KStatusNotifierItem item.
this._item_name_display_label.set_label(item.replace("appindicator-kstatusnotifieritem-", ""));
// Set the title to something nicer, if the associated item is an
// AppIndicator/KStatusNotifierItem item.
this.set_title(item.replace("appindicator-kstatusnotifieritem-", ""));
} else {
// Otherwise just set it to `item`.
this._item_name_display_label.set_label(item);
this.set_title(item);
}
}