Merge pull request 'clan-app: set title and icon' (#3658) from clan-app-title into main

Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/3658
This commit is contained in:
Mic92
2025-05-15 10:42:06 +00:00
5 changed files with 28 additions and 62 deletions

View File

@@ -38,6 +38,9 @@ def app_run(app_opts: ClanAppOptions) -> int:
content_uri = f"file://{site_index}"
webview = Webview(debug=app_opts.debug)
webview.title = "Clan App"
# This seems to call the gtk api correctly but and gtk also seems to our icon, but somehow the icon is not loaded.
webview.icon = "clan-white"
def cancel_task(
task_id: str, *, op_key: str

View File

@@ -88,6 +88,9 @@ class _WebviewLibrary:
self.webview_set_title = self.lib.webview_set_title
self.webview_set_title.argtypes = [c_void_p, c_char_p]
self.webview_set_icon = self.lib.webview_set_icon
self.webview_set_icon.argtypes = [c_void_p, c_char_p]
self.webview_set_size = self.lib.webview_set_size
self.webview_set_size.argtypes = [c_void_p, c_int, c_int, c_int]

View File

@@ -149,6 +149,15 @@ class Webview:
_webview_lib.webview_set_title(self._handle, _encode_c_string(value))
self._title = value
@property
def icon(self) -> str:
return self._icon
@icon.setter
def icon(self, value: str) -> None:
_webview_lib.webview_set_icon(self._handle, _encode_c_string(value))
self._icon = value
def destroy(self) -> None:
for name in list(self._callbacks.keys()):
self.unbind(name)