summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Lundblad <ml@dfupdate.se>2023-01-24 22:53:40 +0100
committerMarcus Lundblad <ml@dfupdate.se>2023-05-17 22:54:45 +0200
commit6dc3719cae99e4c9d668c2763951f8cd7503b76b (patch)
treeef9a2b7128e76710ebf5f1cf4ba0b41a6e1b84a0
parent27e8a7468494d76a5df27d8f152325ea81913c30 (diff)
downloadgnome-maps-6dc3719cae99e4c9d668c2763951f8cd7503b76b.tar.gz
WIP: Add list box row for POI categories
-rw-r--r--data/org.gnome.Maps.data.gresource.xml.in1
-rw-r--r--data/ui/poi-category-row.ui36
-rw-r--r--src/org.gnome.Maps.src.gresource.xml.in1
-rw-r--r--src/poiCategoryRow.js38
4 files changed, 76 insertions, 0 deletions
diff --git a/data/org.gnome.Maps.data.gresource.xml.in b/data/org.gnome.Maps.data.gresource.xml.in
index 5c4a307a..2fda768f 100644
--- a/data/org.gnome.Maps.data.gresource.xml.in
+++ b/data/org.gnome.Maps.data.gresource.xml.in
@@ -26,6 +26,7 @@
<file preprocess="xml-stripblanks">ui/place-list-row.ui</file>
<file preprocess="xml-stripblanks">ui/place-popover.ui</file>
<file preprocess="xml-stripblanks">ui/place-view.ui</file>
+ <file preprocess="xml-stripblanks">ui/poi-category-row.ui</file>
<file preprocess="xml-stripblanks">ui/route-entry.ui</file>
<file preprocess="xml-stripblanks">ui/send-to-dialog.ui</file>
<file preprocess="xml-stripblanks">ui/sidebar.ui</file>
diff --git a/data/ui/poi-category-row.ui b/data/ui/poi-category-row.ui
new file mode 100644
index 00000000..566f4cf9
--- /dev/null
+++ b/data/ui/poi-category-row.ui
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <requires lib="gtk" version="4.0"/>
+ <template class="Gjs_PoiCategoryRow" parent="GtkListBoxRow">
+ <accessibility>
+ <relation name="labelled-by">label</relation>
+ </accessibility>
+ <property name="margin-top">6</property>
+ <property name="margin-start">6</property>
+ <property name="margin-end">6</property>
+ <property name="child">
+ <object class="GtkBox">
+ <child>
+ <object class="GtkImage" id="icon">
+ <property name="valign">center</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label">
+ <property name="ellipsize">end</property>
+ <property name="lines">0</property>
+ <property name="xalign">0</property>
+ </object>
+ </child>"
+ <child>
+ <object class="GtkImage">
+ <property name="icon-name">go-next</property>
+ <property name="halign">end</property>
+ <property name="valign">center</property>
+ <property name="hexpand">True</property>
+ </object>
+ </child>
+ </object>
+ </property>
+ </template>
+</interface>
diff --git a/src/org.gnome.Maps.src.gresource.xml.in b/src/org.gnome.Maps.src.gresource.xml.in
index 15e9a8f6..bcdd795e 100644
--- a/src/org.gnome.Maps.src.gresource.xml.in
+++ b/src/org.gnome.Maps.src.gresource.xml.in
@@ -64,6 +64,7 @@
<file>placeViewImage.js</file>
<file>placeZoom.js</file>
<file>poiCategories.js</file>
+ <file>poiCategoryRow.js</file>
<file>printLayout.js</file>
<file>printOperation.js</file>
<file>route.js</file>
diff --git a/src/poiCategoryRow.js b/src/poiCategoryRow.js
new file mode 100644
index 00000000..ec83d09c
--- /dev/null
+++ b/src/poiCategoryRow.js
@@ -0,0 +1,38 @@
+/* -*- Mode: JS2; indent-tabs-mode: nil; js2-basic-offset: 4 -*- */
+/* vim: set et ts=4 sw=4: */
+/*
+ * Copyright (c) 2023 Marcus Lundblad.
+ *
+ * GNOME Maps is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * GNOME Maps is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with GNOME Maps; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Marcus Lundblad <ml@dfupdate.se>
+ */
+
+import GObject from 'gi://GObject';
+import Gtk from 'gi://Gtk';
+
+export class PoiCategoryRow extends Gtk.ListBoxRow {
+ constructor({ iconName, label, ...params }) {
+ super(params);
+
+ this._icon.icon_name = iconName;
+ this._label.label = label;
+ }
+};
+
+GObject.registerClass({
+ Template: 'resource:///org/gnome/Maps/ui/poi-category-row.ui',
+ InternalChildren: [ 'icon',
+ 'label' ],
+}, PoiCategoryRow);