From 7470bafcb49c5c34a24577212262cded2b63c599 Mon Sep 17 00:00:00 2001 From: jmalonzo Date: Thu, 10 May 2007 10:15:35 +0000 Subject: [PATCH] Moved URLFetch to threaded by default - removed nonthreaded versions git-svn-id: svn+ssh://svn.gnome.org/svn/straw/trunk@278 141a2093-ea25-0410-9ad2-d44d734a8f13 --- src/lib/Application.py | 28 +++++++-------------------- src/lib/{URLFetch_threaded.py => URLFetch.py} | 2 +- 2 files changed, 8 insertions(+), 22 deletions(-) rename src/lib/{URLFetch_threaded.py => URLFetch.py} (99%) diff --git a/src/lib/Application.py b/src/lib/Application.py index 0569e6b..7b14a23 100644 --- a/src/lib/Application.py +++ b/src/lib/Application.py @@ -783,7 +783,13 @@ import strawdbus class Application: def __init__(self): gnome.program_init(constants.APPNAME.lower(), constants.VERSION) - self._initialize_config_from_environment() + # initialize threading and environment + gobject.threads_init() + config = Config.get_instance() + config.use_threads = True + config.reload_css = os.getenv('STRAW_RELOAD_CSS') is not None + config.no_etags = os.getenv('STRAW_NO_ETAGS') is not None + gtk.window_set_auto_startup_notification(True) self._initialize_gettext() @@ -830,27 +836,7 @@ class Application: strawdbus.start_services() def mainloop(self): - threads = Config.get_instance().use_threads - if threads: gtk.threads_enter() gtk.main() - if threads: gtk.threads_leave() - return - - def _initialize_config_from_environment(self): - threads = os.getenv('STRAW_THREAD_DNS') is not None - if threads: - try: - gobject.threads_init() - except: - threads = False - print "Thread init failed" - else: - threads = True - - config = Config.get_instance() - config.use_threads = threads - config.reload_css = os.getenv('STRAW_RELOAD_CSS') is not None - config.no_etags = os.getenv('STRAW_NO_ETAGS') is not None return def _initialize_gettext(self): diff --git a/src/lib/URLFetch_threaded.py b/src/lib/URLFetch.py similarity index 99% rename from src/lib/URLFetch_threaded.py rename to src/lib/URLFetch.py index 93b4786..ba72815 100644 --- a/src/lib/URLFetch_threaded.py +++ b/src/lib/URLFetch.py @@ -3,7 +3,7 @@ Module for retrieving data from a URL (a threaded version using urllib2). """ -__copyright__ = "Copyright (c) 2006 Straw developers" +__copyright__ = "Copyright (c) 2007 Straw developers" __license__ = """ Straw is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software -- 2.11.4.GIT