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 all: idle.so
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: clean:
rm -f *.so rm -f *.so

View File

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