Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Link Mauve
python-nbxmpp
Commits
a131806a
Commit
a131806a
authored
Jul 28, 2013
by
Yann Leboulanger
Browse files
fix some new GLib things
parent
feef43f3
Changes
1
Hide whitespace changes
Inline
Side-by-side
nbxmpp/idlequeue.py
View file @
a131806a
...
...
@@ -25,10 +25,10 @@ log = logging.getLogger('nbxmpp.idlequeue')
# needed for get_idleqeue
try
:
from
gi.repository
import
G
Object
HAVE_G
OBJECT
=
True
from
gi.repository
import
G
Lib
HAVE_G
LIB
=
True
except
ImportError
:
HAVE_G
OBJECT
=
False
HAVE_G
LIB
=
False
# needed for idlecommand
if
os
.
name
==
'nt'
:
...
...
@@ -36,10 +36,11 @@ if os.name == 'nt':
elif
os
.
name
==
'posix'
:
import
fcntl
FLAG_WRITE
=
20
# write only
FLAG_READ
=
19
# read only
FLAG_READ_WRITE
=
23
# read and write
FLAG_CLOSE
=
16
# wait for close
FLAG_WRITE
=
GLib
.
IOCondition
.
OUT
|
GLib
.
IOCondition
.
HUP
FLAG_READ
=
GLib
.
IOCondition
.
IN
|
GLib
.
IOCondition
.
PRI
|
GLib
.
IOCondition
.
HUP
FLAG_READ_WRITE
=
GLib
.
IOCondition
.
OUT
|
GLib
.
IOCondition
.
IN
|
\
GLib
.
IOCondition
.
PRI
|
GLib
.
IOCondition
.
HUP
FLAG_CLOSE
=
GLib
.
IOCondition
.
HUP
PENDING_READ
=
3
# waiting read event
PENDING_WRITE
=
4
# waiting write event
...
...
@@ -54,7 +55,7 @@ def get_idlequeue():
# gobject.io_add_watch does not work on windows
return
SelectIdleQueue
()
else
:
if
HAVE_G
OBJECT
:
if
HAVE_G
LIB
:
# Gajim's default Idlequeue
return
GlibIdleQueue
()
else
:
...
...
@@ -516,15 +517,15 @@ class GlibIdleQueue(IdleQueue):
self
.
events
=
{}
# time() is already called in glib, we just get the last value
# overrides IdleQueue.current_time()
self
.
current_time
=
G
Object
.
get_current_time
self
.
current_time
=
G
Lib
.
get_current_time
def
_add_idle
(
self
,
fd
,
flags
):
"""
This method is called when we plug a new idle object. Start listening for
events from fd
"""
res
=
G
Object
.
io_add_watch
(
fd
,
flags
,
self
.
_process_event
s
,
priority
=
GObject
.
PRIORITY_LOW
)
res
=
G
Lib
.
io_add_watch
(
fd
,
GLib
.
PRIORITY_LOW
,
flag
s
,
self
.
_process_events
)
# store the id of the watch, so that we can remove it on unplug
self
.
events
[
fd
]
=
res
...
...
@@ -543,7 +544,7 @@ class GlibIdleQueue(IdleQueue):
"""
if
not
fd
in
self
.
events
:
return
G
Object
.
source_remove
(
self
.
events
[
fd
])
G
Lib
.
source_remove
(
self
.
events
[
fd
])
del
(
self
.
events
[
fd
])
def
process
(
self
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment