Use set-markup property for toasts

This commit is contained in:
kramo
2023-07-04 19:11:17 +02:00
parent 536e6792e7
commit df461421c3
3 changed files with 4 additions and 9 deletions

View File

@@ -2,7 +2,6 @@ using Gtk 4.0;
using Adw 1;
template $PreferencesWindow : Adw.PreferencesWindow {
default-height: 500;
Adw.PreferencesPage general_page {
name: "general";

View File

@@ -24,7 +24,7 @@ import subprocess
from pathlib import Path
from time import time
from gi.repository import Adw, GLib, GObject, Gtk
from gi.repository import Adw, GObject, Gtk
from src import shared
@@ -97,6 +97,7 @@ class Game(Gtk.Box):
def create_toast(self, title, action=None):
toast = Adw.Toast.new(title.format(self.name))
toast.set_priority(Adw.ToastPriority.HIGH)
toast.set_use_markup(False)
if action:
toast.set_button_label(_("Undo"))
@@ -149,9 +150,7 @@ class Game(Gtk.Box):
if toast:
self.create_toast(
# The variable is the title of the game
(_("{} hidden") if self.hidden else _("{} unhidden")).format(
GLib.markup_escape_text(self.name)
),
(_("{} hidden") if self.hidden else _("{} unhidden")).format(self.name),
"hide",
)
@@ -165,9 +164,7 @@ class Game(Gtk.Box):
self.win.navigation_view.pop()
# The variable is the title of the game
self.create_toast(
_("{} removed").format(GLib.markup_escape_text(self.name)), "remove"
)
self.create_toast(_("{} removed").format(self.name), "remove")
def set_loading(self, state):
self.loading += state

View File

@@ -127,7 +127,6 @@ class PreferencesWindow(Adw.PreferencesWindow):
if shared.PROFILE == "development":
self.reset_action_row.set_visible(True)
self.reset_button.connect("clicked", self.reset_app)
self.set_default_size(-1, 560)
# Sources settings
for source_class in (