[pygobject] Remove static PollFD bindings



commit 56347953abb1e214817186581eaf2b2d8762cf97
Author: Martin Pitt <martinpitt gnome org>
Date:   Wed Oct 24 16:43:25 2012 +0200

    Remove static PollFD bindings
    
    Use the GLib API through GI instead, and provide an override to keep a
    backwards compatible constructor syntax.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=686795

 gi/_glib/Makefile.am  |    2 -
 gi/_glib/glibmodule.c |    2 -
 gi/_glib/pygsource.c  |   98 -------------------------------------------------
 gi/_glib/pygsource.h  |   36 ------------------
 gi/overrides/GLib.py  |   17 +++++++-
 5 files changed, 15 insertions(+), 140 deletions(-)
---
diff --git a/gi/_glib/Makefile.am b/gi/_glib/Makefile.am
index 4feb06b..9d802c5 100644
--- a/gi/_glib/Makefile.am
+++ b/gi/_glib/Makefile.am
@@ -56,8 +56,6 @@ _glib_la_SOURCES = \
        pygoptioncontext.h \
        pygoptiongroup.c \
        pygoptiongroup.h \
-       pygsource.c \
-       pygsource.h \
        pygspawn.c \
        pygspawn.h
 _glib_la_CFLAGS = \
diff --git a/gi/_glib/glibmodule.c b/gi/_glib/glibmodule.c
index 11aee9d..e8e0f4f 100644
--- a/gi/_glib/glibmodule.c
+++ b/gi/_glib/glibmodule.c
@@ -31,7 +31,6 @@
 #include "pyglib-private.h"
 #include "pygoptioncontext.h"
 #include "pygoptiongroup.h"
-#include "pygsource.h"
 #include "pygspawn.h"
 
 /* ---------------- glib module functions -------------------- */
@@ -113,7 +112,6 @@ PYGLIB_MODULE_START(_glib, "_glib")
 
     pyglib_register_api(d);
     pyglib_register_error(d);
-    pyglib_source_register_types(d);
     pyglib_spawn_register_types(d);
     pyglib_option_context_register_types(d);
     pyglib_option_group_register_types(d);
diff --git a/gi/overrides/GLib.py b/gi/overrides/GLib.py
index 3e660d1..0273d40 100644
--- a/gi/overrides/GLib.py
+++ b/gi/overrides/GLib.py
@@ -44,11 +44,10 @@ GError = _glib.GError
 OptionContext = _glib.OptionContext
 OptionGroup = _glib.OptionGroup
 Pid = _glib.Pid
-PollFD = _glib.PollFD
 spawn_async = _glib.spawn_async
 threads_init = _glib.threads_init
 
-__all__ += ['GError', 'OptionContext', 'OptionGroup', 'Pid', 'PollFD',
+__all__ += ['GError', 'OptionContext', 'OptionGroup', 'Pid',
             'spawn_async', 'threads_init']
 
 
@@ -789,6 +788,20 @@ IOChannel = override(IOChannel)
 __all__.append('IOChannel')
 
 
+class PollFD(GLib.PollFD):
+    def __new__(cls, fd, events):
+        pollfd = GLib.PollFD()
+        pollfd.__class__ = cls
+        return pollfd
+
+    def __init__(self, fd, events):
+        self.fd = fd
+        self.events = events
+
+PollFD = override(PollFD)
+__all__.append('PollFD')
+
+
 # The real GLib API is child_watch_add(priority, pid, callback, data).
 # The old static bindings had the following API which we still need to support
 # for a while:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]