Commit 581dd1d1 authored by Bilal Elmoussaoui's avatar Bilal Elmoussaoui

Merge branch 'shortcuts-popover' into 'master'

Added shortcuts menu entry

See merge request !102
parents 8baa4517 385a3622
Pipeline #33567 passed with stage
in 2 minutes
......@@ -114,12 +114,14 @@ class Application(Gtk.Application):
# Night mode action
main_content.append_item(Gio.MenuItem.new(_("Settings"), "app.settings"))
main_content.append_item(Gio.MenuItem.new(_("About"), "app.about"))
main_content.append_item(Gio.MenuItem.new(_("Keyboard Shortcuts"), "app.shortcuts"))
main_content.append_item(Gio.MenuItem.new(_("Quit"), "app.quit"))
help_section = Gio.MenuItem.new_section(None, main_content)
self._menu.append_item(help_section)
def __setup_actions(self):
self.__add_action("about", self.__on_about)
self.__add_action("shortcuts", self.__on_shortcuts)
self.__add_action("quit", self.__on_quit)
self.__add_action("settings", self.__on_settings, "is_locked")
self.__add_action("import_json", self.__on_import_json, "is_locked")
......@@ -162,6 +164,13 @@ class Application(Gtk.Application):
dialog.run()
dialog.destroy()
def __on_shortcuts(self, *_):
builder = Gtk.Builder()
builder.add_from_resource("/com/github/bilelmoussaoui/Authenticator/Shortcuts.ui")
dialog = builder.get_object("shortcuts")
dialog.set_transient_for(Window.get_default())
dialog.show()
@staticmethod
def __on_import_json(*_):
from .models import BackupJSON
......@@ -215,3 +224,4 @@ class Application(Gtk.Application):
Clipboard.clear()
Window.get_default().close()
self.quit()
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/com/github/bilelmoussaoui/Authenticator">
<file alias="style.css">style.css</file>
......@@ -8,6 +8,9 @@
<!-- Accounts logo fallback -->
<file alias="authenticator-fallback">icons/hicolor/48x48/apps/com.github.bilelmoussaoui.Authenticator.png</file>
<!-- UI Files -->
<file compressed="true" preprocess="xml-stripblanks" alias="Shortcuts.ui">ui/Shortcuts.ui</file>
<!-- Default pre-shipped icons -->
<file alias="amazon.svg">icons/hicolor/48x48/apps/amazon.svg</file>
<file alias="discord.svg">icons/hicolor/48x48/apps/discord.svg</file>
......
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkShortcutsWindow" id="shortcuts">
<property name="modal">True</property>
<child>
<object class="GtkShortcutsSection">
<property name="visible">True</property>
<property name="section-name">shortcuts</property>
<property name="max-height">10</property>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">True</property>
<property name="title" translatable="yes" context="shortcut window">General</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">True</property>
<property name="title" translatable="yes" context="shortcut window">Add</property>
<property name="accelerator">&lt;Primary&gt;A</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">True</property>
<property name="title" translatable="yes" context="shortcut window">Select</property>
<property name="accelerator">&lt;Primary&gt;S</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">True</property>
<property name="title" translatable="yes" context="shortcut window">Search</property>
<property name="accelerator">&lt;Primary&gt;F</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</interface>
......@@ -15,4 +15,5 @@ Authenticator/widgets/window.py
data/com.github.bilelmoussaoui.Authenticator.appdata.xml.in
data/com.github.bilelmoussaoui.Authenticator.desktop.in
data/com.github.bilelmoussaoui.Authenticator.gschema.xml
data/ui/Shortcuts.ui
authenticator.py.in
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment