diff --git a/src/Library/EntryRow.blp b/src/Library/EntryRow.blp index 84e37b83e..35c9488ce 100644 --- a/src/Library/EntryRow.blp +++ b/src/Library/EntryRow.blp @@ -1,20 +1,20 @@ using Gtk 4.0; using Adw 1; -template $EntryRow: Adw.PreferencesRow { +template $EntryRow: Adw.ActionRow { + activatable: true; + accessibility { labelled-by: title_label; described-by: description_label; } - title: bind title_label.label; - + [prefix] Box contents { orientation: horizontal; Box labels_box { margin-top: 6; - margin-start: 12; margin-bottom: 6; spacing: 3; orientation: vertical; @@ -43,13 +43,13 @@ template $EntryRow: Adw.PreferencesRow { margin-top: 3; } } + } - Image { - icon-name: "go-next-symbolic"; - margin-end: 12; - margin-start: 6; - hexpand: true; - halign: end; - } + [suffix] + Image { + icon-name: "go-next-symbolic"; + margin-start: 6; + hexpand: true; + halign: end; } } diff --git a/src/Library/EntryRow.js b/src/Library/EntryRow.js index 9eb9d9827..e40e6963a 100644 --- a/src/Library/EntryRow.js +++ b/src/Library/EntryRow.js @@ -6,7 +6,7 @@ import GObject from "gi://GObject"; import { getLanguage } from "../util.js"; import Template from "./EntryRow.blp" with { type: "uri" }; -class EntryRow extends Adw.PreferencesRow { +class EntryRow extends Adw.ActionRow { constructor({ demo, ...params } = {}) { super(params); @@ -22,7 +22,7 @@ class EntryRow extends Adw.PreferencesRow { }); activate_action.connect("activate", () => { - this.emit("activated", null); + this.emit("triggered", null); }); action_group.add_action(activate_action); @@ -47,7 +47,7 @@ class EntryRow extends Adw.PreferencesRow { }); button.connect("clicked", () => { - this.emit("activated", language); + this.emit("triggered", language); }); return button; @@ -68,7 +68,7 @@ export default GObject.registerClass( ), }, Signals: { - activated: { + triggered: { param_types: [GObject.TYPE_JSOBJECT], }, }, diff --git a/src/Library/Library.js b/src/Library/Library.js index ea0f75117..106cc593e 100644 --- a/src/Library/Library.js +++ b/src/Library/Library.js @@ -27,7 +27,7 @@ export default function Library({ application }) { window.add_css_class("devel"); } - let last_selected; + let last_triggered; window.connect("close-request", quitOnLastWindowClose); @@ -35,11 +35,11 @@ export default function Library({ application }) { const widgets_map = new Map(); const category_map = new Map(); demos.forEach((demo) => { - const widget = new EntryRow({ demo: demo }); - if (demo.name === "Welcome") last_selected = widget; + const entry_row = new EntryRow({ demo: demo }); + if (demo.name === "Welcome") last_triggered = entry_row; - widget.connect("activated", (_self, language) => { - last_selected = widget; + entry_row.connect("triggered", (_self, language) => { + last_triggered = entry_row; openDemo({ application, @@ -50,8 +50,8 @@ export default function Library({ application }) { if (!category_map.has(demo.category)) { category_map.set(demo.category, objects[`library_${demo.category}`]); } - objects[`library_${demo.category}`].add(widget); - widgets_map.set(demo.name, { widget, category: demo.category }); + objects[`library_${demo.category}`].add(entry_row); + widgets_map.set(demo.name, { entry_row, category: demo.category }); }); search_entry.connect("search-changed", () => { @@ -74,7 +74,7 @@ export default function Library({ application }) { }); action_library.connect("activate", () => { window.present(); - last_selected?.grab_focus(); + last_triggered?.grab_focus(); }); application.add_action(action_library); application.set_accels_for_action("app.library", ["O"]);