Commit 32ef01e1 authored by Bilal Elmoussaoui's avatar Bilal Elmoussaoui

fix headerbar, app not running on unity

parent 9abc08db
......@@ -28,6 +28,7 @@ from .utils import is_gnome
class Application(Gtk.Application):
"""Authenticator application object."""
instance = None
def __init__(self):
Gtk.Application.__init__(self,
......@@ -38,6 +39,12 @@ class Application(Gtk.Application):
self.alive = True
self.menu = Gio.Menu()
@staticmethod
def get_default():
if Application.instance is None:
Application.instance = Application()
return Application.instance
def setup_css(self):
"""Setup the CSS and load it."""
if Gtk.get_major_version() >= 3 and Gtk.get_minor_version() >= 20:
......
......@@ -146,9 +146,11 @@ class HeaderBar(Gtk.HeaderBar):
self.pack_end(right_box)
def generate_popover(self, box):
from ..application import Application
menu = Application.get_default().menu
self.settings_btn.connect("clicked", self.toggle_popover)
self.popover = Gtk.Popover.new_from_model(self.settings_btn,
self.app.menu)
menu)
self.popover.props.width_request = 200
box.add(self.settings_btn)
......
[![Translation status](https://hosted.weblate.org/widgets/authenticator/-/svg-badge.svg)](https://hosted.weblate.org/engage/authenticator/?utm_source=widget) ![Status](https://img.shields.io/badge/status-stable-green.svg) [![Version](https://img.shields.io/badge/version-0.1.1-green.svg)](https://github.com/bilelmoussaoui/Authenticator/releases) ![Python
version](https://img.shields.io/badge/python-3.3%2B-blue.svg)
[![Translation status](https://hosted.weblate.org/widgets/authenticator/-/svg-badge.svg)](https://hosted.weblate.org/engage/authenticator/?utm_source=widget) [![Version](https://img.shields.io/badge/version-0.2.1-green.svg)](https://github.com/bilelmoussaoui/Authenticator/releases)
# Authenticator
<img src="https://raw.githubusercontent.com/bilelmoussaoui/Authenticator/master/data/icons/hicolor/256x256/apps/com.github.bilelmoussaoui.Authenticator.png" width="128" height="128" />
......@@ -18,7 +17,7 @@ version](https://img.shields.io/badge/python-3.3%2B-blue.svg)
## Installation
### Flatpak
You can install the flatpak package of the application from flathub using
You can install the flatpak package of the application from flathub using
```
flatpak install flathub com.github.bilelmoussaoui.Authenticator
```
......
......@@ -60,7 +60,7 @@ if __name__ == "__main__":
sys.exit("Version : " + str(VERSION))
else:
try:
app = Application()
app = Application.get_default()
exit_status = app.run(None)
sys.exit(exit_status)
except KeyboardInterrupt:
......
project('com.github.bilelmoussaoui.Authenticator',
version: '0.2',
version: '0.2.1',
meson_version: '>= 0.40',
license: 'GPL+-3.0',
default_options: ['prefix=/usr']
......
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