WIP: icônes

This commit is contained in:
Adrien Bourmault 2022-06-30 23:52:12 +02:00
parent ddc7a362be
commit e06b241d01
No known key found for this signature in database
GPG Key ID: 6EB408FE0ACEC664
2 changed files with 25 additions and 4 deletions

View File

@ -36,6 +36,9 @@ class GemGraphApplication(Adw.Application):
self.create_action('quit', self.quit, ['<primary>q'])
self.create_action('about', self.on_about_action)
self.create_action('preferences', self.on_preferences_action)
self.create_action('editmode', self.on_editmode_action, ['<primary>e'])
self.create_action('runmode', self.on_runmode_action, ['<primary>r'])
self.create_action('presentmode', self.on_presentmode_action, ['<primary>p'])
def do_activate(self):
"""Called when the application is activated.
@ -58,6 +61,18 @@ class GemGraphApplication(Adw.Application):
"""Callback for the app.preferences action."""
print('app.preferences action activated')
def on_editmode_action(self, widget, _):
"""Callback for the app.preferences action."""
print('app.editmode action activated')
def on_runmode_action(self, widget, _):
"""Callback for the app.preferences action."""
print('app.runmode action activated')
def on_presentmode_action(self, widget, _):
"""Callback for the app.preferences action."""
print('app.presentmode action activated')
def create_action(self, name, callback, shortcuts=None):
"""Add an application action.

View File

@ -80,16 +80,22 @@
<attribute name="label" translatable="yes">Switch session mode</attribute>
<item>
<attribute name="icon">document-edit-symbolic</attribute>
<attribute name="label" translatable="yes">_Edit</attribute>
<attribute name="action">app.switch_to_edit</attribute>
<attribute name="action">app.editmode</attribute>
<attribute name="use-icon">True</attribute>
</item>
<item>
<attribute name="icon">run-start-symbolic</attribute>
<attribute name="label" translatable="yes">_Run</attribute>
<attribute name="action">app.switch_to_run</attribute>
<attribute name="action">app.runmode</attribute>
<attribute name="use-icon">True</attribute>
</item>
<item>
<attribute name="icon">run-start-symbolic</attribute>
<attribute name="label" translatable="yes">_Presentation</attribute>
<attribute name="action">app.switch_to_presentation</attribute>
<attribute name="action">app.presentmode</attribute>
<attribute name="use-icon">True</attribute>
</item>
</section>
</menu>