From 2ef22ec1b494c9d41b8533ede3d1be6e37154805 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sun, 11 Oct 2015 18:42:24 +0530 Subject: [PATCH] Require library version for GObject introspection Specify the version of a library before importing it using GObject introspection. Mainly to avoid warnings with recent version of pygobject. Closes #247. --- plinth/modules/networks/forms.py | 2 ++ plinth/network.py | 3 +++ plinth/package.py | 3 +++ 3 files changed, 8 insertions(+) diff --git a/plinth/modules/networks/forms.py b/plinth/modules/networks/forms.py index 908426b98..bb22a9821 100644 --- a/plinth/modules/networks/forms.py +++ b/plinth/modules/networks/forms.py @@ -20,6 +20,8 @@ from django.core import validators from gettext import gettext as _ from plinth import network +import gi +gi.require_version('NM', '1.0') from gi.repository import NM as nm diff --git a/plinth/network.py b/plinth/network.py index e75192592..614e80c73 100644 --- a/plinth/network.py +++ b/plinth/network.py @@ -20,7 +20,10 @@ Helper functions for working with network manager. """ import collections +import gi +gi.require_version('GLib', '2.0') from gi.repository import GLib as glib +gi.require_version('NM', '1.0') from gi.repository import NM as nm import logging import socket diff --git a/plinth/package.py b/plinth/package.py index 2c7b6d91a..bb65a2de4 100644 --- a/plinth/package.py +++ b/plinth/package.py @@ -22,7 +22,10 @@ Framework for installing and updating distribution packages from django.contrib import messages import functools from gettext import gettext as _ +import gi +gi.require_version('GLib', '2.0') from gi.repository import GLib as glib +gi.require_version('PackageKitGlib', '1.0') from gi.repository import PackageKitGlib as packagekit import logging import threading