From 3c40185bc26542fec07c3815301875e0f8eae449 Mon Sep 17 00:00:00 2001
From: Bruce Cowan <bruce@bcowan.me.uk>
Date: Sat, 23 Sep 2023 13:19:24 +0100
Subject: [PATCH] Embed item template within main UI file

---
 data/gtk/score-item.ui                | 23 -----------------------
 data/gtk/window.blp                   |  7 ++++++-
 data/uk.me.bcowan.Rugby.gresource.xml |  3 +--
 3 files changed, 7 insertions(+), 26 deletions(-)
 delete mode 100644 data/gtk/score-item.ui

diff --git a/data/gtk/score-item.ui b/data/gtk/score-item.ui
deleted file mode 100644
index 219a0f5..0000000
--- a/data/gtk/score-item.ui
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  SPDX-FileCopyrightText: 2021 Bruce Cowan <bruce@bcowan.me.uk>
-
-  SPDX-License-Identifier: GPL-3.0-or-later
--->
-<interface>
-  <requires lib="gtk" version="4.0"/>
-  <template class="GtkListItem">
-    <property name="child">
-      <object class="RugbyPossibilityWidget">
-        <binding name="possibility">
-          <lookup name="item">GtkListItem</lookup>
-        </binding>
-        <binding name="tooltip-text">
-          <closure type="gchararray" function="item_tooltip_cb">
-            <lookup name="item">GtkListItem</lookup>
-          </closure>
-        </binding>
-      </object>
-    </property>
-  </template>
-</interface>
diff --git a/data/gtk/window.blp b/data/gtk/window.blp
index 73f1871..d713fb2 100644
--- a/data/gtk/window.blp
+++ b/data/gtk/window.blp
@@ -82,7 +82,12 @@ template $RugbyAppWindow : Adw.ApplicationWindow {
                 styles ["rich-list", "card"]
 
                 factory: BuilderListItemFactory {
-                  resource: "/uk/me/bcowan/Rugby/gtk/score-item.ui";
+                  template ListItem {
+                    child: $RugbyPossibilityWidget {
+                      possibility: bind template.item;
+                      tooltip-text: bind $item_tooltip_cb(template.item) as <string>;
+                    };
+                  }
                 };
                 model: NoSelection {
                   model: FilterListModel {
diff --git a/data/uk.me.bcowan.Rugby.gresource.xml b/data/uk.me.bcowan.Rugby.gresource.xml
index f0b3926..d3d5bf8 100644
--- a/data/uk.me.bcowan.Rugby.gresource.xml
+++ b/data/uk.me.bcowan.Rugby.gresource.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
-  SPDX-FileCopyrightText: 2012-2022 Bruce Cowan <bruce@bcowan.me.uk>
+  SPDX-FileCopyrightText: 2012-2023 Bruce Cowan <bruce@bcowan.me.uk>
 
   SPDX-License-Identifier: GPL-3.0-or-later
 -->
@@ -8,7 +8,6 @@
   <gresource prefix="/uk/me/bcowan/Rugby">
     <file compressed="true" preprocess="xml-stripblanks">gtk/help-overlay.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">gtk/prefs.ui</file>
-    <file compressed="true" preprocess="xml-stripblanks">gtk/score-item.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">gtk/window.ui</file>
   </gresource>
   <gresource prefix="/uk/me/bcowan/Rugby/icons/scalable/actions/">
-- 
GitLab