evolution-rss r496 - in trunk: . src



Author: lucilanga
Date: Mon Apr  6 17:10:10 2009
New Revision: 496
URL: http://svn.gnome.org/viewvc/evolution-rss?rev=496&view=rev

Log:
2009-04-06  Lucian Langa  <lucilanga gnome org>

* src/network-soup.c:
* src/network.h: use system proxy support

Modified:
   trunk/ChangeLog
   trunk/src/network-soup.c
   trunk/src/network.h

Modified: trunk/src/network-soup.c
==============================================================================
--- trunk/src/network-soup.c	(original)
+++ trunk/src/network-soup.c	Mon Apr  6 17:10:10 2009
@@ -29,6 +29,7 @@
 
 #define SS_TIMEOUT 30
 
+gint proxy_type = 0;
 extern rssfeed *rf;
 
 typedef struct {
@@ -186,21 +187,21 @@
         gconf_client_get_string(rss_gconf, GCONF_KEY_PASS_PROXY, NULL);
 #else
     gboolean use_proxy =
-   	gconf_client_get_bool(rss_gconf, GCONF_E_USE_PROXY_KEY, NULL);
+   	gconf_client_get_bool(rss_gconf, RIGHT_KEY(USE_HTTP_PROXY), NULL);
     guint proxy_type =
-   	gconf_client_get_int(rss_gconf, GCONF_E_PROXY_TYPE_KEY, NULL);
+   	gconf_client_get_int(rss_gconf, KEY_GCONF_EVO_PROXY_TYPE, NULL);
     if (proxy_type != 2)	//emulate the same behaviour
 	use_proxy = 0;
     gint port_proxy =
-        gconf_client_get_int(rss_gconf, GCONF_E_HTTP_PORT_KEY, NULL);
+        gconf_client_get_int(rss_gconf, RIGHT_KEY(HTTP_PORT), NULL);
     gchar *host_proxy =
-        gconf_client_get_string(rss_gconf, GCONF_E_HTTP_HOST_KEY, NULL);
+        gconf_client_get_string(rss_gconf, RIGHT_KEY(HTTP_HOST), NULL);
     gboolean auth_proxy =
-        gconf_client_get_bool(rss_gconf, GCONF_E_USE_AUTH_KEY, NULL);
+        gconf_client_get_bool(rss_gconf, RIGHT_KEY(HTTP_USE_AUTH), NULL);
     gchar *user_proxy =
-        gconf_client_get_string(rss_gconf, GCONF_E_AUTH_USER_KEY, NULL);
+        gconf_client_get_string(rss_gconf, RIGHT_KEY(HTTP_AUTH_USER), NULL);
     gchar *pass_proxy =
-        gconf_client_get_string(rss_gconf, GCONF_E_AUTH_PWD_KEY, NULL);
+        gconf_client_get_string(rss_gconf, RIGHT_KEY(HTTP_AUTH_PWD), NULL);
 #endif
 
     if (use_proxy && host_proxy && port_proxy > 0)
@@ -643,6 +644,9 @@
 void
 rss_soup_init(void)
 {
+	proxy_type = gconf_client_get_int (rss_gconf, KEY_GCONF_EVO_PROXY_TYPE, NULL);
+        if (proxy_type < PROXY_TYPE_SYSTEM || proxy_type > PROXY_TYPE_AUTO_URL)
+                proxy_type = PROXY_TYPE_SYSTEM;
  //       SoupCookieJar *soup_jar;
 //      soup_jar = soup_cookie_jar_sqlite_new ("/home/cooly/.newcookies.sqlite", TRUE);
 }

Modified: trunk/src/network.h
==============================================================================
--- trunk/src/network.h	(original)
+++ trunk/src/network.h	Mon Apr  6 17:10:10 2009
@@ -1,5 +1,5 @@
 /* Evolution RSS Reader Plugin
- * Copyright (C) 2007 Lucian Langa <cooly gnome eu org>
+ * Copyright (C) 2007-2009 Lucian Langa <cooly gnome eu org>
  *
  * This progronam is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -29,7 +29,44 @@
 #define GCONF_KEY_PASS_PROXY "/apps/evolution/evolution-rss/pass_proxy"
 #define GCONF_KEY_NETWORK_TIMEOUT "/apps/evolution/evolution-rss/network_timeout"
 
-#define GCONF_E_SHELL_NETWORK_CONFIG_PATH "/apps/evolution/shell/network_config/"
+/* GConf paths and keys from e-d-s e-proxy.c*/
+#define PATH_GCONF_EVO_NETWORK_CONFIG "/apps/evolution/shell/network_config"
+#define KEY_GCONF_EVO_PROXY_TYPE       PATH_GCONF_EVO_NETWORK_CONFIG "/proxy_type"
+
+#define KEY_GCONF_EVO_USE_HTTP_PROXY    PATH_GCONF_EVO_NETWORK_CONFIG "/use_http_proxy"
+#define KEY_GCONF_EVO_HTTP_HOST         PATH_GCONF_EVO_NETWORK_CONFIG "/http_host"
+#define KEY_GCONF_EVO_HTTP_PORT         PATH_GCONF_EVO_NETWORK_CONFIG "/http_port"
+#define KEY_GCONF_EVO_HTTP_USE_AUTH     PATH_GCONF_EVO_NETWORK_CONFIG "/use_authentication"
+#define KEY_GCONF_EVO_HTTP_AUTH_USER    PATH_GCONF_EVO_NETWORK_CONFIG "/authentication_user"
+#define KEY_GCONF_EVO_HTTP_AUTH_PWD     PATH_GCONF_EVO_NETWORK_CONFIG "/authentication_password"
+#define KEY_GCONF_EVO_HTTP_IGNORE_HOSTS PATH_GCONF_EVO_NETWORK_CONFIG "/ignore_hosts"
+#define KEY_GCONF_EVO_HTTPS_HOST        PATH_GCONF_EVO_NETWORK_CONFIG "/secure_host"
+#define KEY_GCONF_EVO_HTTPS_PORT        PATH_GCONF_EVO_NETWORK_CONFIG "/secure_port"
+#define KEY_GCONF_EVO_SOCKS_HOST        PATH_GCONF_EVO_NETWORK_CONFIG "/socks_host"
+#define KEY_GCONF_EVO_SOCKS_PORT        PATH_GCONF_EVO_NETWORK_CONFIG "/socks_port"
+#define KEY_GCONF_EVO_AUTOCONFIG_URL    PATH_GCONF_EVO_NETWORK_CONFIG "/autoconfig_url"
+
+#define PATH_GCONF_SYS_PROXY "/system/proxy"
+#define PATH_GCONF_SYS_HTTP_PROXY "/system/http_proxy"
+
+#define KEY_GCONF_SYS_USE_HTTP_PROXY    PATH_GCONF_SYS_HTTP_PROXY "/use_http_proxy"
+#define KEY_GCONF_SYS_HTTP_HOST         PATH_GCONF_SYS_HTTP_PROXY "/host"
+#define KEY_GCONF_SYS_HTTP_PORT         PATH_GCONF_SYS_HTTP_PROXY "/port"
+#define KEY_GCONF_SYS_HTTP_USE_AUTH     PATH_GCONF_SYS_HTTP_PROXY "/use_authentication"
+#define KEY_GCONF_SYS_HTTP_AUTH_USER    PATH_GCONF_SYS_HTTP_PROXY "/authentication_user"
+#define KEY_GCONF_SYS_HTTP_AUTH_PWD     PATH_GCONF_SYS_HTTP_PROXY "/authentication_password"
+#define KEY_GCONF_SYS_HTTP_IGNORE_HOSTS PATH_GCONF_SYS_HTTP_PROXY "/ignore_hosts"
+#define KEY_GCONF_SYS_HTTPS_HOST        PATH_GCONF_SYS_PROXY "/secure_host"
+#define KEY_GCONF_SYS_HTTPS_PORT        PATH_GCONF_SYS_PROXY "/secure_port"
+#define KEY_GCONF_SYS_SOCKS_HOST        PATH_GCONF_SYS_PROXY "/socks_host"
+#define KEY_GCONF_SYS_SOCKS_PORT        PATH_GCONF_SYS_PROXY "/socks_port"
+#define KEY_GCONF_SYS_AUTOCONFIG_URL    PATH_GCONF_SYS_PROXY "/autoconfig_url"
+
+#define RIGHT_KEY(sufix) (proxy_type == PROXY_TYPE_SYSTEM ? KEY_GCONF_SYS_ ## sufix : KEY_GCONF_EVO_ ## sufix)
+
+
+/*#define GCONF_E_SHELL_NETWORK_CONFIG_PATH "/apps/evolution/shell/network_config/"
+
 #define GCONF_E_HTTP_HOST_KEY GCONF_E_SHELL_NETWORK_CONFIG_PATH "http_host"
 #define GCONF_E_HTTP_PORT_KEY GCONF_E_SHELL_NETWORK_CONFIG_PATH "http_port"
 #define GCONF_E_HTTPS_HOST_KEY GCONF_E_SHELL_NETWORK_CONFIG_PATH "secure_host"
@@ -42,22 +79,14 @@
 #define GCONF_E_AUTH_USER_KEY GCONF_E_SHELL_NETWORK_CONFIG_PATH "authentication_user"
 #define GCONF_E_AUTH_PWD_KEY  GCONF_E_SHELL_NETWORK_CONFIG_PATH "authentication_password"
 #define GCONF_E_USE_PROXY_KEY GCONF_E_SHELL_NETWORK_CONFIG_PATH "use_http_proxy"
-#define GCONF_E_AUTOCONFIG_URL_KEY GCONF_E_SHELL_NETWORK_CONFIG_PATH "autoconfig_url"
+#define GCONF_E_AUTOCONFIG_URL_KEY GCONF_E_SHELL_NETWORK_CONFIG_PATH "autoconfig_url"*/
 
-#define GCONF_SYS_PROXY_PATH "/system/proxy/"
-#define GCONF_SYS_HTTP_PROXY_PATH "/system/http_proxy"
-#define GCONF_SYS_HTTP_HOST_KEY GCONF_SYS_HTTP_PROXY_PATH "host"
-#define GCONF_SYS_HTTP_PORT_KEY GCONF_SYS_HTTP_PROXY_PATH "port"
-#define GCONF_SYS_HTTPS_HOST_KEY GCONF_SYS_PROXY_PATH "secure_host"
-#define GCONF_SYS_HTTPS_PORT_KEY GCONF_SYS_PROXY_PATH "secure_port"
-#define GCONF_SYS_SOCKS_HOST_KEY GCONF_SYS_PROXY_PATH "socks_host"
-#define GCONF_SYS_SOCKS_PORT_KEY GCONF_SYS_PROXY_PATH "socks_port"
-#define GCONF_SYS_AUTOCONFIG_URL_KEY GCONF_SYS_PROXY_PATH "autoconfig_url"
-#define GCONF_SYS_IGNORE_HOSTS_KEY GCONF_SYS_HTTP_PROXY_PATH "ignore_hosts"
-#define GCONF_SYS_USE_PROXY_KEY GCONF_SYS_HTTP_PROXY_PATH "use_http_proxy"
-#define GCONF_SYS_USE_AUTH_KEY GCONF_SYS_HTTP_PROXY_PATH "use_authentication"
-#define GCONF_SYS_AUTH_USER_KEY GCONF_SYS_HTTP_PROXY_PATH "authentication_user"
-#define GCONF_SYS_AUTH_PWD_KEY GCONF_SYS_HTTP_PROXY_PATH "authentication_password"
+enum ProxyType {
+        PROXY_TYPE_SYSTEM = 0,
+        PROXY_TYPE_NO_PROXY,
+        PROXY_TYPE_MANUAL,
+        PROXY_TYPE_AUTO_URL /* no auto-proxy at the moment */
+};
 
 typedef enum {
 	NET_ERROR_GENERIC,



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