aboutsummaryrefslogtreecommitdiff
path: root/src/prepaid-manager-applet.py
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2020-03-31 17:37:27 +0200
committerGuido Günther <agx@sigxcpu.org>2020-03-31 18:16:28 +0200
commitd481e04a2e3713d563037889b1dc5b1417e63ecd (patch)
tree95d635a712e8e5524ca7f04a8f717233eacaa957 /src/prepaid-manager-applet.py
parentfabc5e3c268019f07fb12def1d0f09e37bd15389 (diff)
Use gresource for ui files
This will make referencing them simpler
Diffstat (limited to 'src/prepaid-manager-applet.py')
-rwxr-xr-xsrc/prepaid-manager-applet.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/prepaid-manager-applet.py b/src/prepaid-manager-applet.py
index 59cef7a..9f6278c 100755
--- a/src/prepaid-manager-applet.py
+++ b/src/prepaid-manager-applet.py
@@ -32,6 +32,7 @@ from ppm.accountdb import AccountDB
import gettext
import gi
+from gi.repository import Gio
from gi.repository import GObject
from gi.repository import GLib
gi.require_version('Gtk', '3.0')
@@ -41,6 +42,10 @@ from gi.repository import Gdk # noqa: E402
_ = None
+# Needs to happen early so we can use it to create classes based on templates
+resource = Gio.Resource.load(os.path.join(ppm.data_dir, "ppm.gresource"))
+resource._register()
+
# The controller receives input and initiates a response by making calls on model
# objects. A controller accepts input from the user and instructs the model and
@@ -319,7 +324,7 @@ class PPMObject(object):
"""Load the user interfade description"""
self.builder = Gtk.Builder()
self.builder.set_translation_domain(ppm.gettext_app)
- self.builder.add_from_file(os.path.join(ppm.ui_dir, '%s.ui' % ui))
+ self.builder.add_from_resource('/org/gnome/PrepaidManager/ui/%s.ui' % ui)
self.builder.connect_signals(self)
def _add_elem(self, name):