collections: Properly handle markup

This commit is contained in:
Jamie Gravendeel
2025-12-23 13:23:57 +01:00
parent 94db6acf37
commit 9fe7b252d7
2 changed files with 9 additions and 3 deletions

View File

@@ -4,7 +4,7 @@
from collections.abc import Iterable from collections.abc import Iterable
from typing import Any, cast, override from typing import Any, cast, override
from gi.repository import Adw, GObject, Gtk from gi.repository import Adw, GLib, GObject, Gtk
from cartridges import collections from cartridges import collections
from cartridges.collections import Collection from cartridges.collections import Collection
@@ -52,7 +52,13 @@ class CollectionSidebarItem(Adw.SidebarItem): # pyright: ignore[reportAttribute
def __init__(self, **kwargs: Any): def __init__(self, **kwargs: Any):
super().__init__(**kwargs) super().__init__(**kwargs)
self.bind_property("title", self, "tooltip", GObject.BindingFlags.SYNC_CREATE) self.bind_property(
"title",
self,
"tooltip",
GObject.BindingFlags.SYNC_CREATE,
lambda _, name: GLib.markup_escape_text(name),
)
class CollectionButton(Gtk.ToggleButton): class CollectionButton(Gtk.ToggleButton):

View File

@@ -153,7 +153,7 @@ class Window(Adw.ApplicationWindow):
Optionally display a button allowing the user to `undo` an operation. Optionally display a button allowing the user to `undo` an operation.
""" """
toast = Adw.Toast.new(title) toast = Adw.Toast(title=title, use_markup=False)
if undo: if undo:
toast.props.button_label = _("Undo") toast.props.button_label = _("Undo")
toast.props.priority = Adw.ToastPriority.HIGH toast.props.priority = Adw.ToastPriority.HIGH