From 23361d95002ee15694c22de2a9a32ac14f0bcb58 Mon Sep 17 00:00:00 2001
From: elimat <>
Date: Apr 25 2023 14:54:39 +0000
Subject: Update tilix to version 1.9.5 / rev 27 via SR 1082707


https://build.opensuse.org/request/show/1082707
by user elimat + dimstar_suse

---

diff --git a/.files b/.files
index e59e768..eb473cb 100644
Binary files a/.files and b/.files differ
diff --git a/.rev b/.rev
index 310535c..6ea36f9 100644
--- a/.rev
+++ b/.rev
@@ -274,4 +274,12 @@
     <comment></comment>
     <requestid>1005723</requestid>
   </revision>
+  <revision rev="27" vrev="3">
+    <srcmd5>65be577c84c529664b0141c1bcbaed02</srcmd5>
+    <version>1.9.5</version>
+    <time>1682433770</time>
+    <user>dimstar_suse</user>
+    <comment></comment>
+    <requestid>1082707</requestid>
+  </revision>
 </revisionlist>
diff --git a/b027797.patch b/b027797.patch
new file mode 100644
index 0000000..f429bb5
--- /dev/null
+++ b/b027797.patch
@@ -0,0 +1,117 @@
+From b02779737997a02b98b690e6f8478d28d5e931a5 Mon Sep 17 00:00:00 2001
+From: Matthias Klumpp <matthias@tenstral.net>
+Date: Thu, 20 Apr 2023 02:09:36 +0200
+Subject: [PATCH] Replace std.xml with GMarkup-based parser
+
+This is quite ugly, but using GMarkup avoids us introducing another
+hard-to-maintain dependency for a tiny task.
+
+(It would either be a better D XML parsing library or undeaD to
+resurrect the removed standard-library module, both options are pretty
+unattractive. GMarkup will not go away anytime soon)
+
+Resolves: #2151
+---
+ source/gx/tilix/prefeditor/prefdialog.d | 73 +++++++++++++++++++------
+ 1 file changed, 55 insertions(+), 18 deletions(-)
+
+diff --git a/source/gx/tilix/prefeditor/prefdialog.d b/source/gx/tilix/prefeditor/prefdialog.d
+index a5c3ce37..505096ec 100644
+--- a/source/gx/tilix/prefeditor/prefdialog.d
++++ b/source/gx/tilix/prefeditor/prefdialog.d
+@@ -947,9 +947,10 @@ private:
+      * pre GTK 3.20
+      */
+     void loadLocalizedShortcutLabels() {
+-        //Clear associative arrays since clear method isn't compatible with LDC
+-        labels = null;
+-        prefixes = null;
++        import glib.SimpleXML : SimpleXML;
++        import glib.c.types : GMarkupParser, GMarkupParseContext, GMarkupParseFlags;
++        import std.string : fromStringz;
++        import std.array : empty;
+ 
+         string ui = getResource(SHORTCUT_UI_RESOURCE);
+         if (ui.length == 0) {
+@@ -957,22 +958,58 @@ private:
+             return;
+         }
+ 
+-        import std.xml: DocumentParser, ElementParser, Element, XMLException;
++        struct ParseHelper {
++            string currentId = "";
++            bool addNextText = false;
++            string[string] labels;
++        }
+ 
+-        try {
+-            DocumentParser parser = new DocumentParser(ui);
+-            parser.onStartTag["object"] = (ElementParser xml) {
+-                if (xml.tag.attr["class"] == "GtkShortcutsShortcut") {
+-                    string id = xml.tag.attr["id"];
+-                    xml.onEndTag["property"] = (in Element e) {
+-                        if (e.tag.attr["name"] == "title") {
+-                            labels[id] = C_(SHORTCUT_LOCALIZATION_CONTEXT, e.text);
+-                        }
+-                    };
+-                    xml.parse();
++        GMarkupParser parseConfig;
++        parseConfig.startElement = function void(GMarkupParseContext* context,
++                                             const(char)* elementNameC,
++                                             char** attributeNames,
++                                             char** attributeValues,
++                                             void* userData,
++                                             GError** err) {
++            auto helper = cast(ParseHelper*)userData;
++            const elementName = elementNameC.fromStringz;
++            if (elementName == "object") {
++                string[string] attrs;
++                for (uint i = 0; attributeNames[i] != null; i++)
++                    attrs[attributeNames[i].fromStringz.to!string] = attributeValues[i].fromStringz.to!string;
++
++                if (attrs.get("class", "") == "GtkShortcutsShortcut")
++                    helper.currentId = attrs["id"];
++
++            } else if (elementName == "property" && !helper.currentId.empty) {
++                for (uint i = 0; attributeNames[i] != null; i++) {
++                    if (attributeNames[i].fromStringz == "name" && attributeValues[i].fromStringz == "title") {
++                        helper.addNextText = true;
++                        break;
++                    }
+                 }
+-            };
+-            parser.parse();
++            }
++        };
++        parseConfig.text = function void(GMarkupParseContext* context,
++                                         const(char)* text,
++                                         size_t textLen,
++                                         void* userData,
++                                         GError** err) {
++            auto helper = cast(ParseHelper*)userData;
++            if (!helper.addNextText)
++                return;
++
++            helper.labels[helper.currentId] = C_(SHORTCUT_LOCALIZATION_CONTEXT, text.fromStringz.to!string);
++            helper.currentId = null;
++            helper.addNextText = false;
++        };
++
++        try {
++            ParseHelper helper;
++            auto parser = new SimpleXML(&parseConfig, GMarkupParseFlags.PREFIX_ERROR_POSITION, &helper, null);
++            parser.parse(ui, ui.length);
++            labels = helper.labels;
++
+             // While you could use sections to get prefixes, not all sections are there
+             // and it's not inutituve from a localization perspective. Just add them manually
+             prefixes[ACTION_PREFIX_WIN] = C_(SHORTCUT_LOCALIZATION_CONTEXT, "Window");
+@@ -980,7 +1017,7 @@ private:
+             prefixes[ACTION_PREFIX_TERMINAL] = C_(SHORTCUT_LOCALIZATION_CONTEXT, "Terminal");
+             prefixes[ACTION_PREFIX_SESSION] = C_(SHORTCUT_LOCALIZATION_CONTEXT, "Session");
+             prefixes[ACTION_PREFIX_NAUTILUS] = C_(SHORTCUT_LOCALIZATION_CONTEXT, "Nautilus");
+-        } catch (XMLException e) {
++        } catch (Exception e) {
+             error("Failed to parse shortcuts.ui", e);
+         }
+     }
diff --git a/tilix.changes b/tilix.changes
index 0e4368c..48d92a6 100644
--- a/tilix.changes
+++ b/tilix.changes
@@ -1,4 +1,10 @@
 -------------------------------------------------------------------
+Tue Apr 25 07:35:16 UTC 2023 - Bjørn Lie <bjorn.lie@gmail.com>
+
+- Add b027797.patch: Replace std.xml with GMarkup-based parser.
+- Build nautilus-extension-tilix as noarch.
+
+-------------------------------------------------------------------
 Thu Sep 22 21:28:44 UTC 2022 - Atri Bhattacharya <badshah400@gmail.com>
 
 - Add tilix-nautilus-43-compat.patch: nautilus: Add compatibility
diff --git a/tilix.spec b/tilix.spec
index 24009e7..a4d651b 100644
--- a/tilix.spec
+++ b/tilix.spec
@@ -1,7 +1,7 @@
 #
 # spec file for package tilix
 #
-# Copyright (c) 2022 SUSE LLC
+# Copyright (c) 2023 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -24,7 +24,7 @@ Release:        0
 Summary:        A tiling terminal emulator based on GTK+ 3
 License:        LGPL-3.0-only AND MPL-2.0
 URL:            https://github.com/gnunn1/tilix
-Source0:        https://github.com/gnunn1/tilix/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
+Source0:        %{url}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
 %if 0%{?sle_version} < 150400 && 0%{?is_opensuse}
 Source1:        com.gexperts.Tilix.appdata.xml
 %endif
@@ -36,6 +36,8 @@ Patch1:         0001-Don-t-generate-appstream-meta-data-on-older-versions.patch
 %endif
 # PATCH-FIX-UPSTREAM tilix-nautilus-43-compat.patch  gh#gnunn1/tilix#2115 badshah400@gmail.com -- nautilus: Add compatibility with Nautilus 43
 Patch2:         tilix-nautilus-43-compat.patch
+# PATCH-FIX-UPSTREAM b027797.patch -- Replace std.xml with GMarkup-based parser
+Patch3:         %{url}/commit/b027797.patch
 BuildRequires:  AppStream
 BuildRequires:  appstream-glib
 BuildRequires:  desktop-file-utils
@@ -73,6 +75,7 @@ A tiling terminal emulator for Linux using GTK+ 3
 
 %package -n nautilus-extension-tilix
 Summary:        Nautilus Extension to Open Tilix in Folders
+BuildArch:      noarch
 Requires:       python3-nautilus
 Supplements:    (nautilus and %{name})