gget r23 - trunk/gget



Author: johans
Date: Sun Jul  6 10:11:00 2008
New Revision: 23
URL: http://svn.gnome.org/viewvc/gget?rev=23&view=rev

Log:
Added more proxy code. Use GNOMEs system wide proxy settings if wanted.

Modified:
   trunk/gget/Configuration.py
   trunk/gget/DownloadManager.py
   trunk/gget/PreferencesDialog.py

Modified: trunk/gget/Configuration.py
==============================================================================
--- trunk/gget/Configuration.py	(original)
+++ trunk/gget/Configuration.py	Sun Jul  6 10:11:00 2008
@@ -29,7 +29,6 @@
 DIR_GGET       = "/apps/gget"
 DIR_GNOME      = "/desktop/gnome"
 DIR_PROXY      = "/system/proxy"
-DIR_HTTP_PROXY = "/system/http_proxy"
 
 KEY_SHOW_STATUSBAR    = "/general/show_statusbar"
 KEY_SHOW_TOOLBAR      = "/general/show_toolbar"
@@ -61,7 +60,20 @@
 KEY_PROXY_USER        = "/network/proxy_user"
 KEY_PROXY_PASSWORD    = "/network/proxy_password"
 
-KEY_TOOLBAR_STYLE = "/interface/toolbar_style"
+KEY_TOOLBAR_STYLE              = "/interface/toolbar_style"
+
+KEY_SYSTEM_USE_HTTP_PROXY      = "/system/http_proxy/use_http_proxy"
+KEY_SYSTEM_HTTP_PROXY_HOST     = "/system/http_proxy/host"
+KEY_SYSTEM_HTTP_PROXY_PORT     = "/system/http_proxy/port"
+KEY_SYSTEM_USE_HTTP_PROXY_AUTH = "/system/http_proxy/use_authentication"
+KEY_SYSTEM_HTTP_PROXY_USER     = "/system/http_proxy/authentication_user"
+KEY_SYSTEM_HTTP_PROXY_PASS     = "/system/http_proxy/authentication_password"
+KEY_SYSTEM_PROXY_USE_SAME      = "/system/http_proxy/use_same_proxy"
+
+KEY_PROXY_HTTPS_HOST           = "/system/proxy/secure_host"
+KEY_PROXY_HTTPS_PORT           = "/system/proxy/secure_port"
+KEY_PROXY_FTP_HOST             = "/system/proxy/ftp_host"
+KEY_PROXY_FTP_PORT             = "/system/proxy/ftp_port"
 
 FUNCTION_SUFFIXES = {KEY_SHOW_TOOLBAR:      'bool',
                      KEY_SHOW_STATUSBAR:    'bool',
@@ -86,14 +98,27 @@
                      KEY_EXTENSIONS:        'list',
                      KEY_EXTENSION_FOLDERS: 'list',
 
-                     KEY_PROXY_MODE:        'string',
-                     KEY_PROXY_HOST:        'string',
-                     KEY_PROXY_PORT:        'int',
-                     KEY_PROXY_AUTH:        'bool',
-                     KEY_PROXY_USER:        'string',
-                     KEY_PROXY_PASSWORD:    'string',
-
-                     KEY_TOOLBAR_STYLE:     'string'
+                     KEY_PROXY_MODE:     'string',
+                     KEY_PROXY_HOST:     'string',
+                     KEY_PROXY_PORT:     'int',
+                     KEY_PROXY_AUTH:     'bool',
+                     KEY_PROXY_USER:     'string',
+                     KEY_PROXY_PASSWORD: 'string',
+
+                     KEY_TOOLBAR_STYLE: 'string',
+
+                     KEY_SYSTEM_USE_HTTP_PROXY:      'bool',
+                     KEY_SYSTEM_HTTP_PROXY_HOST:     'string',
+                     KEY_SYSTEM_HTTP_PROXY_PORT:     'int',
+                     KEY_SYSTEM_USE_HTTP_PROXY_AUTH: 'bool',
+                     KEY_SYSTEM_HTTP_PROXY_USER:     'string',
+                     KEY_SYSTEM_HTTP_PROXY_PASS:     'string',
+                     KEY_SYSTEM_PROXY_USE_SAME:      'bool',
+
+                     KEY_PROXY_HTTPS_HOST: 'string',
+                     KEY_PROXY_HTTPS_PORT: 'int',
+                     KEY_PROXY_FTP_HOST:   'string',
+                     KEY_PROXY_FTP_PORT:   'int'
                      }
 
 class Configuration(object):
@@ -116,18 +141,11 @@
         if self.client.dir_exists(DIR_GGET):
             self.client.add_dir(DIR_GGET, gconf.CLIENT_PRELOAD_RECURSIVE)
             self.debug = args[0] or os.getenv("GGET_DEBUG")
-            self.__init_option_cache()
         else:
             ed = ErrorDialog(_("Could not find configuration directory in GConf"), _("Please make sure that gget.schemas was correctly installed."))
             ed.run()
             sys.exit(1)
 
-    def __init_option_cache(self):
-        self.option_cache = {}
-        for key in FUNCTION_SUFFIXES.keys():
-            self.option_cache[key] = getattr(self, 'get_' +
-                                             os.path.basename(key))(False)
-
     def add_notify(self, key, callback, dir=DIR_GGET):
         self.client.notify_add(dir + key, callback)
 
@@ -147,18 +165,13 @@
         if type:
             getattr(self.client, 'set_' +
                     FUNCTION_SUFFIXES[option])(dir + option, type, value)
-            self.option_cache[option] = value
         else:
             getattr(self.client, 'set_' +
                     FUNCTION_SUFFIXES[option])(DIR_GGET + option, value)
-            self.option_cache[option] = value
 
     # Show Statusbar
-    def get_show_statusbar(self, use_cache=True):
-        if use_cache:
-            return self.option_cache[KEY_SHOW_STATUSBAR]
-        else:
-            return self.__get_option(KEY_SHOW_STATUSBAR)
+    def get_show_statusbar(self):
+        return self.__get_option(KEY_SHOW_STATUSBAR)
 
     def set_show_statusbar(self, show_statusbar):
         self.__set_option(KEY_SHOW_STATUSBAR, show_statusbar)
@@ -166,11 +179,8 @@
     show_statusbar = property(get_show_statusbar, set_show_statusbar)
 
     # Show Toolbar
-    def get_show_toolbar(self, use_cache=True):
-        if use_cache:
-            return self.option_cache[KEY_SHOW_TOOLBAR]
-        else:
-            return self.__get_option(KEY_SHOW_TOOLBAR)
+    def get_show_toolbar(self):
+        return self.__get_option(KEY_SHOW_TOOLBAR)
 
     def set_show_toolbar(self, show_toolbar):
         self.__set_option(KEY_SHOW_TOOLBAR, show_toolbar)
@@ -178,11 +188,8 @@
     show_toolbar = property(get_show_toolbar, set_show_toolbar)
 
     # Show Status icon
-    def get_show_status_icon(self, use_cache=True):
-        if use_cache:
-            return self.option_cache[KEY_SHOW_STATUS_ICON]
-        else:
-            return self.__get_option(KEY_SHOW_STATUS_ICON)
+    def get_show_status_icon(self):
+        return self.__get_option(KEY_SHOW_STATUS_ICON)
 
     def set_show_status_icon(self, show_status_icon):
         self.__set_option(KEY_SHOW_STATUS_ICON, show_status_icon)
@@ -190,11 +197,8 @@
     show_status_icon = property(get_show_status_icon, set_show_status_icon)
 
     # Show Main window
-    def get_show_main_window(self, use_cache=True):
-        if use_cache:
-            return self.option_cache[KEY_SHOW_MAIN_WINDOW]
-        else:
-            return self.__get_option(KEY_SHOW_MAIN_WINDOW)
+    def get_show_main_window(self):
+        return self.__get_option(KEY_SHOW_MAIN_WINDOW)
 
     def set_show_main_window(self, show_main_window):
         self.__set_option(KEY_SHOW_MAIN_WINDOW, show_main_window)
@@ -202,11 +206,8 @@
     show_main_window = property(get_show_main_window, set_show_main_window)
 
     # Autostart
-    def get_autostart(self, use_cache=True):
-        if use_cache:
-            return self.option_cache[KEY_AUTOSTART]
-        else:
-            return self.__get_option(KEY_AUTOSTART)
+    def get_autostart(self):
+        return self.__get_option(KEY_AUTOSTART)
 
     def set_autostart(self, autostart):
         self.__set_option(KEY_AUTOSTART, autostart)
@@ -214,11 +215,8 @@
     autostart = property(get_autostart, set_autostart)
 
     # Autoresume
-    def get_autoresume(self, use_cache=True):
-        if use_cache:
-            return self.option_cache[KEY_AUTORESUME]
-        else:
-            return self.__get_option(KEY_AUTORESUME)
+    def get_autoresume(self):
+        return self.__get_option(KEY_AUTORESUME)
 
     def set_autoresume(self, autoresume):
         self.__set_option(KEY_AUTORESUME, autoresume)
@@ -226,11 +224,8 @@
     autoresume = property(get_autoresume, set_autoresume)
 
     # Window width
-    def get_window_width(self, use_cache=True):
-        if use_cache:
-            return self.option_cache[KEY_WINDOW_WIDTH]
-        else:
-            return self.__get_option(KEY_WINDOW_WIDTH)
+    def get_window_width(self):
+        return self.__get_option(KEY_WINDOW_WIDTH)
 
     def set_window_width(self, window_width):
         self.__set_option(KEY_WINDOW_WIDTH, window_width)
@@ -238,11 +233,8 @@
     window_width = property(get_window_width, set_window_width)
 
     # Window height
-    def get_window_height(self, use_cache=True):
-        if use_cache:
-            return self.option_cache[KEY_WINDOW_HEIGHT]
-        else:
-            return self.__get_option(KEY_WINDOW_HEIGHT)
+    def get_window_height(self):
+        return self.__get_option(KEY_WINDOW_HEIGHT)
 
     def set_window_height(self, window_height):
         self.__set_option(KEY_WINDOW_HEIGHT, window_height)
@@ -250,11 +242,8 @@
     window_height = property(get_window_height, set_window_height)
 
     # Window position x
-    def get_window_position_x(self, use_cache=True):
-        if use_cache:
-            return self.option_cache[KEY_WINDOW_POSITION_X]
-        else:
-            return self.__get_option(KEY_WINDOW_POSITION_X)
+    def get_window_position_x(self):
+        return self.__get_option(KEY_WINDOW_POSITION_X)
 
     def set_window_position_x(self, window_position_x):
         self.__set_option(KEY_WINDOW_POSITION_X, window_position_x)
@@ -262,18 +251,12 @@
     window_position_x = property(get_window_position_x, set_window_position_x)
 
     # Window position y
-    def get_window_position_y(self, use_cache=True):
-        if use_cache:
-            return self.option_cache[KEY_WINDOW_POSITION_Y]
-        else:
-            return self.__get_option(KEY_WINDOW_POSITION_Y)
+    def get_window_position_y(self):
+        return self.__get_option(KEY_WINDOW_POSITION_Y)
 
     # Show status
-    def get_show_status(self, use_cache=True):
-        if use_cache:
-            return self.option_cache[KEY_SHOW_STATUS]
-        else:
-            return self.__get_option(KEY_SHOW_STATUS)
+    def get_show_status(self):
+        return self.__get_option(KEY_SHOW_STATUS)
 
     def set_show_status(self, show_status):
         self.__set_option(KEY_SHOW_STATUS, show_status)
@@ -281,11 +264,8 @@
     show_status = property(get_show_status, set_show_status)
 
     # Show current size
-    def get_show_current_size(self, use_cache=True):
-        if use_cache:
-            return self.option_cache[KEY_SHOW_CURRENT_SIZE]
-        else:
-            return self.__get_option(KEY_SHOW_CURRENT_SIZE)
+    def get_show_current_size(self):
+        return self.__get_option(KEY_SHOW_CURRENT_SIZE)
 
     def set_show_current_size(self, show_current_size):
         self.__set_option(KEY_SHOW_CURRENT_SIZE, show_current_size)
@@ -293,11 +273,8 @@
     show_current_size = property(get_show_current_size, set_show_current_size)
 
     # Show total size
-    def get_show_total_size(self, use_cache=True):
-        if use_cache:
-            return self.option_cache[KEY_SHOW_TOTAL_SIZE]
-        else:
-            return self.__get_option(KEY_SHOW_TOTAL_SIZE)
+    def get_show_total_size(self):
+        return self.__get_option(KEY_SHOW_TOTAL_SIZE)
 
     def set_show_total_size(self, show_total_size):
         self.__set_option(KEY_SHOW_TOTAL_SIZE, show_total_size)
@@ -305,11 +282,8 @@
     show_total_size = property(get_show_total_size, set_show_total_size)
 
     # Show progress
-    def get_show_progress(self, use_cache=True):
-        if use_cache:
-            return self.option_cache[KEY_SHOW_PROGRESS]
-        else:
-            return self.__get_option(KEY_SHOW_PROGRESS)
+    def get_show_progress(self):
+        return self.__get_option(KEY_SHOW_PROGRESS)
 
     def set_show_progress(self, show_progress):
         self.__set_option(KEY_SHOW_PROGRESS, show_progress)
@@ -317,11 +291,8 @@
     show_progress = property(get_show_progress, set_show_progress)
 
     # Show speed
-    def get_show_speed(self, use_cache=True):
-        if use_cache:
-            return self.option_cache[KEY_SHOW_SPEED]
-        else:
-            return self.__get_option(KEY_SHOW_SPEED)
+    def get_show_speed(self):
+        return self.__get_option(KEY_SHOW_SPEED)
 
     def set_show_speed(self, show_speed):
         self.__set_option(KEY_SHOW_SPEED, show_speed)
@@ -329,11 +300,8 @@
     show_speed = property(get_show_speed, set_show_speed)
 
     # Show eta
-    def get_show_eta(self, use_cache=True):
-        if use_cache:
-            return self.option_cache[KEY_SHOW_ETA]
-        else:
-            return self.__get_option(KEY_SHOW_ETA)
+    def get_show_eta(self):
+        return self.__get_option(KEY_SHOW_ETA)
 
     def set_show_eta(self, show_eta):
         self.__set_option(KEY_SHOW_ETA, show_eta)
@@ -346,11 +314,8 @@
     window_position_y = property(get_window_position_y, set_window_position_y)
 
     # Ask for location
-    def get_ask_for_location(self, use_cache=True):
-        if use_cache:
-            return self.option_cache[KEY_ASK_FOR_LOCATION]
-        else:
-            return self.__get_option(KEY_ASK_FOR_LOCATION)
+    def get_ask_for_location(self):
+        return self.__get_option(KEY_ASK_FOR_LOCATION)
 
     def set_ask_for_location(self, ask_for_location):
         self.__set_option(KEY_ASK_FOR_LOCATION, ask_for_location)
@@ -358,11 +323,8 @@
     ask_for_location = property(get_ask_for_location, set_ask_for_location)
 
     # Default folder
-    def get_default_folder(self, use_cache=True):
-        if use_cache:
-            return self.option_cache[KEY_DEFAULT_FOLDER]
-        else:
-            return self.__get_option(KEY_DEFAULT_FOLDER)
+    def get_default_folder(self):
+        return self.__get_option(KEY_DEFAULT_FOLDER)
 
     def set_default_folder(self, default_folder):
         self.__set_option(KEY_DEFAULT_FOLDER, default_folder)
@@ -370,11 +332,8 @@
     default_folder = property(get_default_folder, set_default_folder)
 
     # Check extensions
-    def get_check_extensions(self, use_cache=True):
-        if use_cache:
-            return self.option_cache[KEY_CHECK_EXTENSIONS]
-        else:
-            return self.__get_option(KEY_CHECK_EXTENSIONS)
+    def get_check_extensions(self):
+        return self.__get_option(KEY_CHECK_EXTENSIONS)
 
     def set_check_extensions(self, check_extensions):
         self.__set_option(KEY_CHECK_EXTENSIONS, check_extensions)
@@ -382,11 +341,8 @@
     check_extensions = property(get_check_extensions, set_check_extensions)
 
     # Extensions
-    def get_extensions(self, use_cache=True):
-        if use_cache:
-            return self.option_cache[KEY_EXTENSIONS]
-        else:
-            return self.__get_option(KEY_EXTENSIONS, type=gconf.VALUE_STRING)
+    def get_extensions(self):
+        return self.__get_option(KEY_EXTENSIONS, type=gconf.VALUE_STRING)
 
     def set_extensions(self, extensions):
         self.__set_option(KEY_EXTENSIONS, extensions, type=gconf.VALUE_STRING)
@@ -394,12 +350,8 @@
     extensions = property(get_extensions, set_extensions)
 
     # Extension folders
-    def get_extension_folders(self, use_cache=True):
-        if use_cache:
-            return self.option_cache[KEY_EXTENSION_FOLDERS]
-        else:
-            return self.__get_option(KEY_EXTENSION_FOLDERS,
-                    type=gconf.VALUE_STRING)
+    def get_extension_folders(self):
+        return self.__get_option(KEY_EXTENSION_FOLDERS, type=gconf.VALUE_STRING)
 
     def set_extension_folders(self, extension_folders):
         self.__set_option(KEY_EXTENSION_FOLDERS, extension_folders,
@@ -408,11 +360,8 @@
     extension_folders = property(get_extension_folders, set_extension_folders)
 
     # Proxy mode
-    def get_proxy_mode(self, use_cache=True):
-        if use_cache:
-            return self.option_cache[KEY_PROXY_MODE]
-        else:
-            return self.__get_option(KEY_PROXY_MODE)
+    def get_proxy_mode(self):
+        return self.__get_option(KEY_PROXY_MODE)
 
     def set_proxy_mode(self, proxy_mode):
         self.__set_option(KEY_PROXY_MODE, proxy_mode)
@@ -420,11 +369,8 @@
     proxy_mode = property(get_proxy_mode, set_proxy_mode)
 
     # Proxy host
-    def get_proxy_host(self, use_cache=True):
-        if use_cache:
-            return self.option_cache[KEY_PROXY_HOST]
-        else:
-            return self.__get_option(KEY_PROXY_HOST)
+    def get_proxy_host(self):
+        return self.__get_option(KEY_PROXY_HOST)
 
     def set_proxy_host(self, proxy_host):
         self.__set_option(KEY_PROXY_HOST, proxy_host)
@@ -432,11 +378,8 @@
     proxy_host = property(get_proxy_host, set_proxy_host)
 
     # Proxy port
-    def get_proxy_port(self, use_cache=True):
-        if use_cache:
-            return self.option_cache[KEY_PROXY_PORT]
-        else:
-            return self.__get_option(KEY_PROXY_PORT)
+    def get_proxy_port(self):
+        return self.__get_option(KEY_PROXY_PORT)
 
     def set_proxy_port(self, proxy_port):
         self.__set_option(KEY_PROXY_PORT, proxy_port)
@@ -444,11 +387,8 @@
     proxy_port = property(get_proxy_port, set_proxy_port)
 
     # Proxy auth
-    def get_proxy_auth(self, use_cache=True):
-        if use_cache:
-            return self.option_cache[KEY_PROXY_AUTH]
-        else:
-            return self.__get_option(KEY_PROXY_AUTH)
+    def get_proxy_auth(self):
+        return self.__get_option(KEY_PROXY_AUTH)
 
     def set_proxy_auth(self, proxy_auth):
         self.__set_option(KEY_PROXY_AUTH, proxy_auth)
@@ -456,11 +396,8 @@
     proxy_auth = property(get_proxy_auth, set_proxy_auth)
 
     # Proxy user
-    def get_proxy_user(self, use_cache=True):
-        if use_cache:
-            return self.option_cache[KEY_PROXY_USER]
-        else:
-            return self.__get_option(KEY_PROXY_USER)
+    def get_proxy_user(self):
+        return self.__get_option(KEY_PROXY_USER)
 
     def set_proxy_user(self, proxy_user):
         self.__set_option(KEY_PROXY_USER, proxy_user)
@@ -468,11 +405,8 @@
     proxy_user = property(get_proxy_user, set_proxy_user)
 
     # Proxy password
-    def get_proxy_password(self, use_cache=True):
-        if use_cache:
-            return self.option_cache[KEY_PROXY_PASSWORD]
-        else:
-            return self.__get_option(KEY_PROXY_PASSWORD)
+    def get_proxy_password(self):
+        return self.__get_option(KEY_PROXY_PASSWORD)
 
     def set_proxy_password(self, proxy_password):
         self.__set_option(KEY_PROXY_PASSWORD, proxy_password)
@@ -480,15 +414,112 @@
     proxy_password = property(get_proxy_password, set_proxy_password)
 
     # Toolbar style
-    def get_toolbar_style(self, use_cache=True):
-        if use_cache:
-            return self.option_cache[KEY_TOOLBAR_STYLE]
-        else:
-            return self.__get_option(KEY_TOOLBAR_STYLE)
+    def get_toolbar_style(self):
+        return self.__get_option(KEY_TOOLBAR_STYLE)
 
     def set_toolbar_style(self, toolbar_style):
         self.__set_option(KEY_TOOLBAR_STYLE, toolbar_style)
 
     toolbar_style = property(get_toolbar_style, set_toolbar_style)
 
+    # Use HTTP proxy
+    def get_use_http_proxy(self):
+        return self.__get_option(KEY_SYSTEM_USE_HTTP_PROXY)
+
+    def set_use_http_proxy(self, use_http_proxy):
+        self.__set_option(KEY_SYSTEM_USE_HTTP_PROXY, use_http_proxy)
+
+    use_http_proxy = property(get_use_http_proxy, set_use_http_proxy)
+
+    # HTTP proxy host
+    def get_http_proxy_host(self):
+        return self.__get_option(KEY_SYSTEM_HTTP_PROXY_HOST)
+
+    def set_http_proxy_host(self, http_proxy_host):
+        self.__set_option(KEY_SYSTEM_HTTP_PROXY_HOST, http_proxy_host)
+
+    http_proxy_host = property(get_http_proxy_host, set_http_proxy_host)
+
+    # HTTP proxy port
+    def get_http_proxy_port(self):
+        return self.__get_option(KEY_SYSTEM_HTTP_PROXY_PORT)
+
+    def set_http_proxy_port(self, http_proxy_port):
+        self.__set_option(KEY_SYSTEM_HTTP_PROXY_PORT, http_proxy_port)
+
+    http_proxy_port = property(get_http_proxy_port, set_http_proxy_port)
+
+    # Use HTTP proxy auth
+    def get_use_http_proxy_auth(self):
+        return self.__get_option(KEY_SYSTEM_USE_HTTP_PROXY_AUTH)
+
+    def set_use_http_proxy_auth(self, use_http_proxy_auth):
+        self.__set_option(KEY_SYSTEM_USE_HTTP_PROXY_AUTH, use_http_proxy_auth)
+
+    use_http_proxy_auth = property(get_use_http_proxy_auth,
+            set_use_http_proxy_auth)
+
+    # HTTP proxy user
+    def get_http_proxy_user(self):
+        return self.__get_option(KEY_SYSTEM_HTTP_PROXY_USER)
+
+    def set_http_proxy_user(self, http_proxy_user):
+        self.__set_option(KEY_SYSTEM_HTTP_PROXY_USER, http_proxy_user)
+
+    http_proxy_user = property(get_http_proxy_user, set_http_proxy_user)
+
+    # HTTP proxy pass
+    def get_http_proxy_pass(self):
+        return self.__get_option(KEY_SYSTEM_HTTP_PROXY_PASS)
+
+    def set_http_proxy_pass(self, http_proxy_pass):
+        self.__set_option(KEY_SYSTEM_HTTP_PROXY_PASS, http_proxy_pass)
+
+    http_proxy_pass = property(get_http_proxy_pass, set_http_proxy_pass)
+
+    # Proxy use same
+    def get_proxy_use_same(self):
+        return self.__get_option(KEY_SYSTEM_PROXY_USE_SAME)
+
+    def set_proxy_use_same(self, proxy_use_same):
+        self.__set_option(KEY_SYSTEM_PROXY_USE_SAME, proxy_use_same)
+
+    proxy_use_same = property(get_proxy_use_same, set_proxy_use_same)
+
+    # Proxy HTTPS host
+    def get_proxy_https_host(self):
+        return self.__get_option(KEY_SYSTEM_PROXY_HTTPS_HOST)
+
+    def set_proxy_https_host(self, proxy_https_host):
+        self.__set_option(KEY_SYSTEM_PROXY_HTTPS_HOST, proxy_https_host)
+
+    proxy_https_host = property(get_proxy_https_host, set_proxy_https_host)
+
+    # Proxy HTTPS port
+    def get_proxy_https_port(self):
+        return self.__get_option(KEY_SYSTEM_PROXY_HTTPS_PORT)
+
+    def set_proxy_https_port(self, proxy_https_port):
+        self.__set_option(KEY_SYSTEM_PROXY_HTTPS_PORT, proxy_https_port)
+
+    proxy_https_port = property(get_proxy_https_port, set_proxy_https_port)
+
+    # Proxy FTP host
+    def get_proxy_ftp_host(self):
+        return self.__get_option(KEY_SYSTEM_PROXY_FTP_HOST)
+
+    def set_proxy_ftp_host(self, proxy_ftp_host):
+        self.__set_option(KEY_SYSTEM_PROXY_FTP_HOST, proxy_ftp_host)
+
+    proxy_ftp_host = property(get_proxy_ftp_host, set_proxy_ftp_host)
+
+    # Proxy FTP port
+    def get_proxy_ftp_port(self):
+        return self.__get_option(KEY_SYSTEM_PROXY_FTP_PORT)
+
+    def set_proxy_ftp_port(self, proxy_ftp_port):
+        self.__set_option(KEY_SYSTEM_PROXY_FTP_PORT, proxy_ftp_port)
+
+    proxy_ftp_port = property(get_proxy_ftp_port, set_proxy_ftp_port)
+
 # vim: set sw=4 et sts=4 tw=79 fo+=l:

Modified: trunk/gget/DownloadManager.py
==============================================================================
--- trunk/gget/DownloadManager.py	(original)
+++ trunk/gget/DownloadManager.py	Sun Jul  6 10:11:00 2008
@@ -55,12 +55,18 @@
 
         metalink.USER_AGENT = "%s %s" % (NAME, VERSION)
 
+        # Setup proxy
         if self.config.proxy_mode == "gnome":
-            # TODO: Get this from system wide settings
-            # metalink.HTTP_PROXY = ""
-            # metalink.HTTPS_PROXY = ""
-            # metalink.FTP_PROXY = ""
-            pass
+            if self.config.use_http_proxy:
+                if self.config.use_http_proxy_auth:
+                    metalink.HTTP_PROXY = "http://%s:%s %s:%s" % (self.config.http_proxy_user, self.config.http_proxy_pass, self.config.http_proxy_host, self.config.http_proxy_port)
+                    if self.config.use_same_proxy:
+                        metalink.HTTPS_PROXY = "https://%s:%s %s:%s" % (self.config.http_proxy_user, self.config.http_proxy_pass, self.config.proxy_https_host, self.config.proxy_https_port)
+                        metalink.FTP_PROXY = "ftp://%s:%s %s:%s" % (self.config.http_proxy_user, self.config.http_proxy_pass, self.config.proxy_ftp_host, self.config.proxy_ftp_port)
+                else:
+                    metalink.HTTP_PROXY = "http://%s:%s"; % (self.config.http_proxy_host, self.config.http_proxy_port)
+                    metalink.HTTPS_PROXY = "https://%s:%s"; % (self.config.proxy_https_host, self.config.proxy_https_port)
+                    metalink.FTP_PROXY = "ftp://%s:%s"; % (self.config.proxy_ftp_host, self.config.proxy_ftp_port)
         elif self.config.proxy_mode == "manual":
             if self.config.proxy_auth:
                 metalink.HTTP_PROXY = "http://%s:%s %s:%s" % (self.config.proxy_user, self.config.proxy_password, self.config.proxy_host, self.config.proxy_port)

Modified: trunk/gget/PreferencesDialog.py
==============================================================================
--- trunk/gget/PreferencesDialog.py	(original)
+++ trunk/gget/PreferencesDialog.py	Sun Jul  6 10:11:00 2008
@@ -64,6 +64,7 @@
                 self.config.extension_folders):
             self.extensions_model.append((extension, folder))
 
+        self.manual_proxy_vbox.set_sensitive(False)
         if self.config.proxy_mode == "gnome":
             self.gnome_radiobutton.set_active(True)
         elif self.config.proxy_mode == "manual":
@@ -309,7 +310,7 @@
             self.autoresume_checkbutton.set_active(True)
         elif entry.value.type == gconf.VALUE_BOOL:
             value = entry.value.get_bool()
-            self.autoresumet_checkbutton.set_active(value)
+            self.autoresume_checkbutton.set_active(value)
         else:
             self.autoresume_checkbutton.set_active(True)
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]