window: Implement search on action
This commit is contained in:
@@ -368,6 +368,58 @@ template $Window: Adw.ApplicationWindow {
|
||||
"circular",
|
||||
]
|
||||
}
|
||||
|
||||
MenuButton {
|
||||
icon-name: "edit-find-symbolic";
|
||||
tooltip-text: _("Search On");
|
||||
valign: center;
|
||||
|
||||
menu-model: menu {
|
||||
section {
|
||||
label: _("Search On");
|
||||
|
||||
item {
|
||||
label: _("HowLongToBeat");
|
||||
action: "win.search-on";
|
||||
target: "https://howlongtobeat.com/?q={}";
|
||||
}
|
||||
|
||||
item {
|
||||
label: _("IGDB");
|
||||
action: "win.search-on";
|
||||
target: "https://www.igdb.com/search?type=1&q={}";
|
||||
}
|
||||
|
||||
item {
|
||||
label: _("Lutris");
|
||||
action: "win.search-on";
|
||||
target: "https://lutris.net/games?q={}";
|
||||
}
|
||||
|
||||
item {
|
||||
label: _("PCGamingWiki");
|
||||
action: "win.search-on";
|
||||
target: "https://www.pcgamingwiki.com/w/index.php?search={}";
|
||||
}
|
||||
|
||||
item {
|
||||
label: _("ProtonDB");
|
||||
action: "win.search-on";
|
||||
target: "https://www.protondb.com/search?q={}";
|
||||
}
|
||||
|
||||
item {
|
||||
label: _("SteamGridDB");
|
||||
action: "win.search-on";
|
||||
target: "https://www.steamgriddb.com/search/grids?term={}";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
styles [
|
||||
"circular",
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ from collections.abc import Generator
|
||||
from datetime import UTC, datetime
|
||||
from gettext import gettext as _
|
||||
from typing import Any, TypeVar
|
||||
from urllib.parse import quote
|
||||
|
||||
from gi.repository import Adw, Gdk, Gio, GLib, GObject, Gtk
|
||||
|
||||
@@ -83,6 +84,13 @@ class Window(Adw.ApplicationWindow):
|
||||
"s",
|
||||
state_settings.get_value("sort-mode").print_(False),
|
||||
),
|
||||
(
|
||||
"search-on",
|
||||
lambda _action, param, *_: Gio.AppInfo.launch_default_for_uri(
|
||||
param.get_string().format(quote(self.active_game.name))
|
||||
),
|
||||
"s",
|
||||
),
|
||||
))
|
||||
|
||||
@Gtk.Template.Callback()
|
||||
|
||||
Reference in New Issue
Block a user