From: Bruno Abinader Date: Mon, 2 Mar 2009 14:53:47 +0000 (-0400) Subject: Removed ecore necessity from python-purple. X-Git-Url: http://git.maemo.org/git/?p=python-purple;a=commitdiff_plain;h=c2951f59ada56c74f666f005abd656d81e296593;hp=7752e0f4a14a32ede02b8b86c83d9510338a59ed;ds=sidebyside Removed ecore necessity from python-purple. FIXES: - Removed ecore necessity from python-purple. Clients which should use it can now have their own main loop which doesn't need to be ecore. This patch was initially sent by Luca Bigliardi. Signed-off-by: Luca Bigliardi Signed-off-by: Bruno Abinader --- diff --git a/nullclient-ecore.py b/nullclient-ecore.py index fff3d59..571df91 100644 --- a/nullclient-ecore.py +++ b/nullclient-ecore.py @@ -265,6 +265,7 @@ class NullClient(object): # Sets initial parameters self.core = purple.Purple(__NAME__, __VERSION__, __WEBSITE__, \ __DEV_WEBSITE__, debug_enabled=True, default_path='/tmp') + ecore.Timer(0.01, self.core.iterate_main_loop) self.account = None self.buddies = {} self.conversations = {} diff --git a/nullclient.py b/nullclient.py index 0438951..8c7cb6b 100644 --- a/nullclient.py +++ b/nullclient.py @@ -17,10 +17,10 @@ # along with this program. If not, see . # -import ecore import getpass import purple import sys +import time # The information below is needed by libpurple __NAME__ = "nullclient" @@ -60,5 +60,6 @@ if __name__ == '__main__': # Enable account (connects automatically) account.set_enabled(True) - # Initializes ecore mainloop - ecore.main_loop_begin() + while True: + core.iterate_main_loop() + time.sleep(0.01) diff --git a/purple.pyx b/purple.pyx index 17411e7..9c7691d 100644 --- a/purple.pyx +++ b/purple.pyx @@ -22,7 +22,6 @@ cimport purple cdef extern from "c_purple.h": glib.guint glib_input_add(glib.gint fd, eventloop.PurpleInputCondition condition, eventloop.PurpleInputFunction function, glib.gpointer data) -import ecore import signal cdef glib.GHashTable *c_ui_info @@ -91,9 +90,6 @@ cdef class Purple: if default_path: util.purple_util_set_user_dir(default_path) - # adds glib iteration inside ecore main loop - ecore.timer_add(0.001, self.__glib_iteration_when_idle) - # libpurple's built-in DNS resolution forks processes to perform # blocking lookups without blocking the main process. It does not # handle SIGCHLD itself, so if the UI does not you quickly get an army @@ -169,10 +165,6 @@ cdef class Purple: glib.g_hash_table_insert(c_ui_info, "dev_website", c_ui_dev_website) return c_ui_info - def __glib_iteration_when_idle(self): - glib.g_main_context_iteration(NULL, False) - return True - def purple_init(self): '''Initializes the purple. @@ -418,6 +410,10 @@ cdef class Purple: return account_list + def iterate_main_loop(self): + glib.g_main_context_iteration(NULL, False) + return True + def protocols_get_all(self): '''Returns a list of all protocols.