Commit 4e890a75 authored by Nico Alt's avatar Nico Alt

Add actions for application

parent 3d61f99b
# Copyright (c) 2014-2020 Cedric Bellegarde <cedric.bellegarde@adishatz.org>
# Copyright (c) 2020 Nico Alt
# SPDX-License-Identifier: AGPL-3.0-only
# License-Filename: LICENSE.md
#
# Initial version based on GNOME Lollypop
# https://gitlab.gnome.org/World/lollypop/blob/1.2.20/lollypop/application_actions.py
from gi.repository import Gio
# pylint: disable=too-few-public-methods
class ApplicationActions:
def __init__(self):
self._setup_actions()
# pylint: disable=no-member
def _setup_actions(self):
quit_action = Gio.SimpleAction.new("quit", None)
quit_action.connect("activate", self._quit)
self.set_accels_for_action("app.quit", ["<Ctrl>q"])
self.add_action(quit_action)
# pylint: disable=unused-argument
def _quit(self, action, parameter):
self.quit()
......@@ -13,16 +13,18 @@ from gi.repository import Gdk, Gio, GLib, Gtk
from briar_wrapper.api import Api
from briar_gtk.actions.application import ApplicationActions
from briar_gtk.define import APPLICATION_ID, APPLICATION_NAME
from briar_gtk.define import APPLICATION_STYLING_PATH, BRIAR_HEADLESS_JAR
from briar_gtk.window import Window
class Application(Gtk.Application):
class Application(Gtk.Application, ApplicationActions):
def __init__(self):
Application._set_application_name(APPLICATION_NAME)
super().__init__(application_id=APPLICATION_ID)
ApplicationActions.__init__(self)
# pylint: disable=arguments-differ
def do_startup(self):
......
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