fix idle problems

This commit is contained in:
Yann Leboulanger 2005-05-20 14:03:02 +00:00
parent b5ed8ee163
commit 715fde5a87
2 changed files with 8 additions and 5 deletions

View File

@ -6,7 +6,7 @@ LDFLAGS = `pkg-config --libs gtk+-2.0 pygtk-2.0`
all: idle.so
idle.so:
$(CC) $(CFLAGS) $(LDFLAGS) -shared idle.c $^ -o $@
$(CC) $(CFLAGS) $(LDFLAGS) -shared idle.c $^ -o $@ -L/usr/X11R6/lib -lX11 -lXss -lXext
clean:
rm -f *.so

View File

@ -27,9 +27,12 @@ STATE_AWAKE = "awake"
SUPPORTED = 1
try:
import common.idle
import common.idle as idle # when we launch gajim from sources
except:
SUPPORTED = 0
try:
import idle # when Gajim is installed
except:
SUPPORTED = 0
class Sleepy:
@ -39,7 +42,7 @@ class Sleepy:
self.interval2 = interval2
self.state = STATE_AWAKE ## assume were awake to stake with
try:
common.idle.init()
idle.init()
except:
SUPPORTED = 0
self.state = STATE_UNKNOWN
@ -47,7 +50,7 @@ class Sleepy:
def poll(self):
if not SUPPORTED: return 0
idleTime = common.idle.getIdleSec()
idleTime = idle.getIdleSec()
if idleTime > self.interval2:
self.state = STATE_XAWAY
elif idleTime > self.interval1: