WIP: gtk4 template

This commit is contained in:
Adrien Bourmault 2022-07-28 01:55:44 +02:00
parent e06b241d01
commit b33e9806c7
No known key found for this signature in database
GPG Key ID: 6EB408FE0ACEC664
3 changed files with 10 additions and 3 deletions

View File

@ -39,6 +39,7 @@ class GemGraphApplication(Adw.Application):
self.create_action('editmode', self.on_editmode_action, ['<primary>e']) self.create_action('editmode', self.on_editmode_action, ['<primary>e'])
self.create_action('runmode', self.on_runmode_action, ['<primary>r']) self.create_action('runmode', self.on_runmode_action, ['<primary>r'])
self.create_action('presentmode', self.on_presentmode_action, ['<primary>p']) self.create_action('presentmode', self.on_presentmode_action, ['<primary>p'])
self.create_action('togglesidebar', self.on_togglesidebar_action)
def do_activate(self): def do_activate(self):
"""Called when the application is activated. """Called when the application is activated.
@ -62,17 +63,21 @@ class GemGraphApplication(Adw.Application):
print('app.preferences action activated') print('app.preferences action activated')
def on_editmode_action(self, widget, _): def on_editmode_action(self, widget, _):
"""Callback for the app.preferences action.""" """Callback for the app.editmode action."""
print('app.editmode action activated') print('app.editmode action activated')
def on_runmode_action(self, widget, _): def on_runmode_action(self, widget, _):
"""Callback for the app.preferences action.""" """Callback for the app.runmode action."""
print('app.runmode action activated') print('app.runmode action activated')
def on_presentmode_action(self, widget, _): def on_presentmode_action(self, widget, _):
"""Callback for the app.preferences action.""" """Callback for the app.presentmode action."""
print('app.presentmode action activated') 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): def create_action(self, name, callback, shortcuts=None):
"""Add an application action. """Add an application action.

View File

@ -41,3 +41,4 @@ class AboutDialog(Gtk.AboutDialog):
self.props.logo_icon_name = 'application-x-executable' self.props.logo_icon_name = 'application-x-executable'
self.props.modal = True self.props.modal = True
self.set_transient_for(parent) self.set_transient_for(parent)

View File

@ -30,6 +30,7 @@
<object class="GtkToggleButton" id="main_button_sidebar"> <object class="GtkToggleButton" id="main_button_sidebar">
<property name="icon-name">sidebar-show-symbolic</property> <property name="icon-name">sidebar-show-symbolic</property>
<property name="tooltip-text" translatable="yes">Display/hide sidebar</property> <property name="tooltip-text" translatable="yes">Display/hide sidebar</property>
<property name="action-name">app.togglesidebar</property>
</object> </object>
<!-- <object class="GtkLabel" id="is_modified"> --> <!-- <object class="GtkLabel" id="is_modified"> -->
<!-- <property name="halign">end</property> --> <!-- <property name="halign">end</property> -->