Skip to content

Commit

Permalink
Add app name and icon.
Browse files Browse the repository at this point in the history
  • Loading branch information
freakboy3742 committed Aug 17, 2019
1 parent 510ec81 commit 67d2a5f
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/gtk/toga_gtk/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)

Expand Down

0 comments on commit 67d2a5f

Please sign in to comment.