From b33e9806c7b6d2fba2713c68239fadaca943d033 Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Thu, 28 Jul 2022 01:55:44 +0200 Subject: [PATCH] WIP: gtk4 template --- gemgraph/main.py | 11 ++++++++--- gemgraph/window.py | 1 + ui/gemgraph.ui | 1 + 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/gemgraph/main.py b/gemgraph/main.py index 81e3aa3..86591de 100644 --- a/gemgraph/main.py +++ b/gemgraph/main.py @@ -39,6 +39,7 @@ class GemGraphApplication(Adw.Application): self.create_action('editmode', self.on_editmode_action, ['e']) self.create_action('runmode', self.on_runmode_action, ['r']) self.create_action('presentmode', self.on_presentmode_action, ['p']) + self.create_action('togglesidebar', self.on_togglesidebar_action) def do_activate(self): """Called when the application is activated. @@ -62,17 +63,21 @@ class GemGraphApplication(Adw.Application): print('app.preferences action activated') def on_editmode_action(self, widget, _): - """Callback for the app.preferences action.""" + """Callback for the app.editmode action.""" print('app.editmode action activated') def on_runmode_action(self, widget, _): - """Callback for the app.preferences action.""" + """Callback for the app.runmode action.""" print('app.runmode action activated') def on_presentmode_action(self, widget, _): - """Callback for the app.preferences action.""" + """Callback for the app.presentmode action.""" print('app.presentmode action activated') + def on_togglesidebar_action(self, widget, _): + """Callback for the app.togglesidebar action.""" + print('app.togglesidebar action activated') + def create_action(self, name, callback, shortcuts=None): """Add an application action. diff --git a/gemgraph/window.py b/gemgraph/window.py index 1abd0c8..e3a00a0 100644 --- a/gemgraph/window.py +++ b/gemgraph/window.py @@ -41,3 +41,4 @@ class AboutDialog(Gtk.AboutDialog): self.props.logo_icon_name = 'application-x-executable' self.props.modal = True self.set_transient_for(parent) + diff --git a/ui/gemgraph.ui b/ui/gemgraph.ui index dc80303..d29256d 100644 --- a/ui/gemgraph.ui +++ b/ui/gemgraph.ui @@ -30,6 +30,7 @@ sidebar-show-symbolic Display/hide sidebar + app.togglesidebar