diff options
author | Marcus Lundblad <ml@dfupdate.se> | 2023-01-24 22:53:40 +0100 |
---|---|---|
committer | Marcus Lundblad <ml@dfupdate.se> | 2023-04-25 22:17:29 +0200 |
commit | aeba532161bad73e8ea9ded9788ea7eb37f13c2e (patch) | |
tree | 0481dcc3666c3cb75d611650e36cbf86132c72a2 | |
parent | e1d534ea308c07366b5a7d9801c0f44b46512a47 (diff) | |
download | gnome-maps-aeba532161bad73e8ea9ded9788ea7eb37f13c2e.tar.gz |
WIP: Add list box row for POI categories
-rw-r--r-- | data/org.gnome.Maps.data.gresource.xml.in | 1 | ||||
-rw-r--r-- | data/ui/poi-category-row.ui | 36 | ||||
-rw-r--r-- | src/org.gnome.Maps.src.gresource.xml.in | 1 | ||||
-rw-r--r-- | src/poiCategoryRow.js | 38 |
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 4782ac07..c2eb266a 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 a4e36019..cbd5efcb 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); |