Skip to content
This repository has been archived by the owner on May 23, 2019. It is now read-only.

Commit

Permalink
fix headerbar, app not running on unity
Browse files Browse the repository at this point in the history
  • Loading branch information
Bilal Elmoussaoui committed Mar 22, 2018
1 parent 9abc08d commit 32ef01e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
7 changes: 7 additions & 0 deletions Authenticator/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

class Application(Gtk.Application):
"""Authenticator application object."""
instance = None

def __init__(self):
Gtk.Application.__init__(self,
Expand All @@ -38,6 +39,12 @@ def __init__(self):
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:
Expand Down
4 changes: 3 additions & 1 deletion Authenticator/widgets/headerbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,11 @@ def _build_widgets(self):
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)

Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[![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" />
Expand All @@ -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
```
Expand Down
2 changes: 1 addition & 1 deletion authenticator.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
project('com.github.bilelmoussaoui.Authenticator',
version: '0.2',
version: '0.2.1',
meson_version: '>= 0.40',
license: 'GPL+-3.0',
default_options: ['prefix=/usr']
Expand Down

0 comments on commit 32ef01e

Please sign in to comment.