Skip to content

Commit 32ef01e

Browse files
author
Bilal Elmoussaoui
committed
fix headerbar, app not running on unity
1 parent 9abc08d commit 32ef01e

File tree

5 files changed

+14
-6
lines changed

5 files changed

+14
-6
lines changed

Authenticator/application.py

+7
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
class Application(Gtk.Application):
3030
"""Authenticator application object."""
31+
instance = None
3132

3233
def __init__(self):
3334
Gtk.Application.__init__(self,
@@ -38,6 +39,12 @@ def __init__(self):
3839
self.alive = True
3940
self.menu = Gio.Menu()
4041

42+
@staticmethod
43+
def get_default():
44+
if Application.instance is None:
45+
Application.instance = Application()
46+
return Application.instance
47+
4148
def setup_css(self):
4249
"""Setup the CSS and load it."""
4350
if Gtk.get_major_version() >= 3 and Gtk.get_minor_version() >= 20:

Authenticator/widgets/headerbar.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,11 @@ def _build_widgets(self):
146146
self.pack_end(right_box)
147147

148148
def generate_popover(self, box):
149+
from ..application import Application
150+
menu = Application.get_default().menu
149151
self.settings_btn.connect("clicked", self.toggle_popover)
150152
self.popover = Gtk.Popover.new_from_model(self.settings_btn,
151-
self.app.menu)
153+
menu)
152154
self.popover.props.width_request = 200
153155
box.add(self.settings_btn)
154156

README.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
[![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
2-
version](https://img.shields.io/badge/python-3.3%2B-blue.svg)
1+
[![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)
32

43
# Authenticator
54
<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)
1817
## Installation
1918

2019
### Flatpak
21-
You can install the flatpak package of the application from flathub using
20+
You can install the flatpak package of the application from flathub using
2221
```
2322
flatpak install flathub com.github.bilelmoussaoui.Authenticator
2423
```

authenticator.py.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ if __name__ == "__main__":
6060
sys.exit("Version : " + str(VERSION))
6161
else:
6262
try:
63-
app = Application()
63+
app = Application.get_default()
6464
exit_status = app.run(None)
6565
sys.exit(exit_status)
6666
except KeyboardInterrupt:

meson.build

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
project('com.github.bilelmoussaoui.Authenticator',
2-
version: '0.2',
2+
version: '0.2.1',
33
meson_version: '>= 0.40',
44
license: 'GPL+-3.0',
55
default_options: ['prefix=/usr']

0 commit comments

Comments
 (0)