mirror of
https://gitlab.gnome.org/june/top-bar-organizer.git
synced 2026-01-12 01:03:51 +01:00
Refactor: Let PrefsBoxOrderItemRow handle item association
Let `PrefsBoxOrderItemRow` handle the association of itself with an item itself. Doing so makes the code cleaner, since the association isn't done externally anymore.
This commit is contained in:
parent
bd69f816eb
commit
309e2c07b9
2 changed files with 19 additions and 15 deletions
14
src/prefs.js
14
src/prefs.js
|
|
@ -99,19 +99,7 @@ var PrefsWidget = GObject.registerClass({
|
|||
// Add the items of the given configured box order as
|
||||
// GtkListBoxRows.
|
||||
for (const item of boxOrder) {
|
||||
const listBoxRow = new PrefsBoxOrderItemRow.PrefsBoxOrderItemRow({}, this._scrollManager);
|
||||
|
||||
listBoxRow.item = item;
|
||||
if (item.startsWith("appindicator-kstatusnotifieritem-")) {
|
||||
// Set `item_name_display_label` of the `listBoxRow` to
|
||||
// something nicer, if the associated item is an
|
||||
// AppIndicator/KStatusNotifierItem item.
|
||||
listBoxRow.item_name_display_label.set_label(item.replace("appindicator-kstatusnotifieritem-", ""));
|
||||
} else {
|
||||
// Otherwise just set the `item_name_display_label` of the
|
||||
// `listBoxRow` to `item`.
|
||||
listBoxRow.item_name_display_label.set_label(item);
|
||||
}
|
||||
const listBoxRow = new PrefsBoxOrderItemRow.PrefsBoxOrderItemRow({}, this._scrollManager, item);
|
||||
gtkListBox.append(listBoxRow);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue