We discussed it on IRC, and Julian had time to test a port to newer
APIs.  The draft untested patch is attached.

-- 
Happy hacking
Petter Reinholdtsen
>From 1e4444ddeb90127be9f3e5cc665ce4fed0d97567 Mon Sep 17 00:00:00 2001
From: Julian Andres Klode <j...@debian.org>
Date: Thu, 1 Oct 2015 22:54:21 +0200
Subject: [PATCH] Port to GObject introspection

Closes: #775554
---
 debian/control | 18 ++++++++++--------
 isenkramd      | 19 ++++++++-----------
 2 files changed, 18 insertions(+), 19 deletions(-)

diff --git a/debian/control b/debian/control
index d8cb828..224b1d1 100644
--- a/debian/control
+++ b/debian/control
@@ -5,12 +5,13 @@ Maintainer: Petter Reinholdtsen <p...@debian.org>
 Build-Depends: debhelper (>= 8), po-debconf
 Build-Depends-Indep: dash (>= 0.5.4-12)
   , python (>= 2.6.6-3~)
-  , python-gudev
-  , python-gobject
-  , python-notify
   , aptdaemon
-  , python-aptdaemon-gtk
+  , python-aptdaemon.gtk3widgets
   , libgnome2-perl
+  , python-gi,
+  , gir1.2-gudev-1.0
+  , gir1.2-gtk-3.0
+  , gir1.2-notify-0.7
 Standards-Version: 3.9.5
 XS-Testsuite: autopkgtest
 Vcs-Browser: http://anonscm.debian.org/cgit/collab-maint/isenkram.git
@@ -24,11 +25,12 @@ Architecture: all
 Depends: ${misc:Depends}
   , ${python:Depends}
   , isenkram-cli
-  , python-gudev
-  , python-gobject
-  , python-notify
-  , python-aptdaemon-gtk
+  , python-aptdaemon.gtk3widgets
   , libgnome2-perl
+  , python-gi,
+  , gir1.2-gudev-1.0
+  , gir1.2-gtk-3.0
+  , gir1.2-notify-0.7
 Recommends: aptdaemon
 Description: Suggest packages to install when inserting new hardware (GUI 
popup)
  Try to figure out which packages to suggest for use with a freshly
diff --git a/isenkramd b/isenkramd
index e279e53..5bb1fc9 100755
--- a/isenkramd
+++ b/isenkramd
@@ -28,16 +28,13 @@ __author__ = "Petter Reinholdtsen <p...@hungry.com>"
 
 import string
 #import pygtk
-import gtk
-import gobject
-import gudev
-import pynotify
+from gi.repository import GLib, Gtk, GUdev, Notify
 import subprocess
 import glob
 import fnmatch
 import isenkram.lookup
 import aptdaemon.client
-from aptdaemon.gtkwidgets import AptErrorDialog, \
+from aptdaemon.gtk3widgets import AptErrorDialog, \
                                  AptConfirmDialog, \
                                  AptProgressDialog
 import aptdaemon.errors
@@ -61,7 +58,7 @@ class AptDaemonGUIClient(object):
             dia = AptConfirmDialog(trans, parent=self.win)
             res = dia.run()
             dia.hide()
-            if res != gtk.RESPONSE_OK:
+            if res != Gtk.ResponseType.OK:
                 return
         self._run_transaction(trans)
 
@@ -88,7 +85,7 @@ class AptDaemonGUIClient(object):
     def __init__(self, package):
         self.win = None
         self.package = package
-        self.loop = gobject.MainLoop()
+        self.loop = GLib.MainLoop()
         self.ac = aptdaemon.client.AptClient()
 
     def run(self):
@@ -116,12 +113,12 @@ def notify(bus, vendor, device, pkgs):
     print "info: " + text
 
     # Initializite pynotify
-    if not pynotify.init("isenkramd"):
+    if not Notify.init("isenkramd"):
         return False
     global n
     global npkgs
     npkgs = pkgs
-    n = pynotify.Notification(title, text)
+    n = Notify.Notification(summary=title, body=text)
     n.set_timeout(10000)
     n.add_action("clicked",
                  "Please install program(s)",
@@ -203,10 +200,10 @@ def uevent_callback(client, action, device, user_data):
                 notify(bus, int(vendorid, 16), int(deviceid, 16), newpkg)
 
 def main():
-    client = gudev.Client([])
+    client = GUdev.Client()
     client.connect("uevent", uevent_callback, None)
 
-    loop = gobject.MainLoop()
+    loop = GLib.MainLoop()
     print "info: ready to accept hardware events"
     loop.run()
 
-- 
2.5.3

Reply via email to