From 67d2a5f526d95fd954fe65e93375c64c8ade0800 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Sat, 17 Aug 2019 16:52:46 +0800 Subject: [PATCH] Add app name and icon. --- src/gtk/toga_gtk/app.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/gtk/toga_gtk/app.py b/src/gtk/toga_gtk/app.py index c6f016a08e..0a3677f71f 100644 --- a/src/gtk/toga_gtk/app.py +++ b/src/gtk/toga_gtk/app.py @@ -20,6 +20,18 @@ class MainWindow(Window): _IMPL_CLASS = Gtk.ApplicationWindow + def create(self): + super().create() + self.native.set_role("MainWindow") + self.native.set_icon(Icon.app_icon._impl.native_72.get_pixbuf()) + + def set_app(self, app): + super().set_app(app) + # The GTK docs list set_wmclass() as deprecated (and "pointless") + # but it's the only way I've found that actually sets the + # Application name to something other than '__main__.py'. + self.native.set_wmclass(app.interface.name, app.interface.name) + def on_close(self, widget, data): pass @@ -42,6 +54,8 @@ def __init__(self, interface): def create(self): Icon.app_icon = Icon.load(self.interface.icon, default=Icon.TIBERIUS_ICON) + Icon.app_icon.bind(self.interface.factory) + # Stimulate the build of the app self.native = Gtk.Application(application_id=self.interface.app_id, flags=Gio.ApplicationFlags.FLAGS_NONE)