aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2005-01-18 13:32:19 +0800
committerMichael Zucci <zucchi@src.gnome.org>2005-01-18 13:32:19 +0800
commitc075b7d96c7c9e4bbfc32f1541c96c6a3ef538e3 (patch)
treee8d21d0b47fa689138ebee5159b33255051cb404 /mail
parent5d2343810cde0d4dca4e9a18abea26ac32dbb700 (diff)
downloadgsoc2013-evolution-c075b7d96c7c9e4bbfc32f1541c96c6a3ef538e3.tar
gsoc2013-evolution-c075b7d96c7c9e4bbfc32f1541c96c6a3ef538e3.tar.gz
gsoc2013-evolution-c075b7d96c7c9e4bbfc32f1541c96c6a3ef538e3.tar.bz2
gsoc2013-evolution-c075b7d96c7c9e4bbfc32f1541c96c6a3ef538e3.tar.lz
gsoc2013-evolution-c075b7d96c7c9e4bbfc32f1541c96c6a3ef538e3.tar.xz
gsoc2013-evolution-c075b7d96c7c9e4bbfc32f1541c96c6a3ef538e3.tar.zst
gsoc2013-evolution-c075b7d96c7c9e4bbfc32f1541c96c6a3ef538e3.zip
kill old 'load http 0 now=0' debug.
2005-01-18 Not Zed <NotZed@Ximian.com> * em-format-html.c (emfh_gethttp): kill old 'load http 0 now=0' debug. ** See bug #70563. * em-utils.c (emu_set_proxy, emu_proxy_setup) (em_utils_get_proxy_uri): make sure the init code is called from main thread (gconf usage), and add locking for data consistency. svn path=/trunk/; revision=28424
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog10
-rw-r--r--mail/em-format-html.c1
-rw-r--r--mail/em-utils.c83
3 files changed, 60 insertions, 34 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 7b8809f848..b2541d926f 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,13 @@
+2005-01-18 Not Zed <NotZed@Ximian.com>
+
+ * em-format-html.c (emfh_gethttp): kill old 'load http 0 now=0' debug.
+
+ ** See bug #70563.
+
+ * em-utils.c (emu_set_proxy, emu_proxy_setup)
+ (em_utils_get_proxy_uri): make sure the init code is called from
+ main thread (gconf usage), and add locking for data consistency.
+
2005-01-14 Not Zed <NotZed@Ximian.com>
** Related to changes for #65178.
diff --git a/mail/em-format-html.c b/mail/em-format-html.c
index 35c98414c8..36d6b6a9af 100644
--- a/mail/em-format-html.c
+++ b/mail/em-format-html.c
@@ -453,7 +453,6 @@ static void emfh_gethttp(struct _EMFormatHTMLJob *job, int cancelled)
if (instream == NULL) {
char *proxy;
- printf(" load http %d now=%d\n", job->format->load_http, job->format->load_http_now);
if (!(job->format->load_http_now
|| job->format->load_http == MAIL_CONFIG_HTTP_ALWAYS
diff --git a/mail/em-utils.c b/mail/em-utils.c
index b5041ff8bd..0236f2e329 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -1319,47 +1319,63 @@ em_utils_adjustment_page(GtkAdjustment *adj, gboolean down)
/* ********************************************************************** */
static char *emu_proxy_uri;
+static int emu_proxy_init = 0;
+static pthread_mutex_t emu_proxy_lock = PTHREAD_MUTEX_INITIALIZER;
static void
-emu_set_proxy(GConfClient *client)
+emu_set_proxy(GConfClient *client, int needlock)
{
- char *server;
+ char *server, *uri = NULL;
int port;
- if (!gconf_client_get_bool(client, "/system/http_proxy/use_http_proxy", NULL)) {
- g_free(emu_proxy_uri);
- emu_proxy_uri = NULL;
+ if (gconf_client_get_bool(client, "/system/http_proxy/use_http_proxy", NULL)) {
+ server = gconf_client_get_string(client, "/system/http_proxy/host", NULL);
+ port = gconf_client_get_int(client, "/system/http_proxy/port", NULL);
- return;
- }
+ if (server && server[0]) {
+ if (gconf_client_get_bool(client, "/system/http_proxy/use_authentication", NULL)) {
+ char *user = gconf_client_get_string(client, "/system/http_proxy/authentication_user", NULL);
+ char *pass = gconf_client_get_string(client, "/system/http_proxy/authentication_password", NULL);
- /* TODO: Should lock ... */
+ uri = g_strdup_printf("http://%s:%s@%s:%d", user, pass, server, port);
+ g_free(user);
+ g_free(pass);
+ } else {
+ uri = g_strdup_printf("http://%s:%d", server, port);
+ }
+ }
- server = gconf_client_get_string(client, "/system/http_proxy/host", NULL);
- port = gconf_client_get_int(client, "/system/http_proxy/port", NULL);
+ g_free(server);
+ }
- if (server && server[0]) {
- g_free(emu_proxy_uri);
+ if (needlock)
+ pthread_mutex_lock(&emu_proxy_lock);
- if (gconf_client_get_bool(client, "/system/http_proxy/use_authentication", NULL)) {
- char *user = gconf_client_get_string(client, "/system/http_proxy/authentication_user", NULL);
- char *pass = gconf_client_get_string(client, "/system/http_proxy/authentication_password", NULL);
+ g_free(emu_proxy_uri);
+ emu_proxy_uri = uri;
- emu_proxy_uri = g_strdup_printf("http://%s:%s@%s:%d", user, pass, server, port);
- g_free(user);
- g_free(pass);
- } else {
- emu_proxy_uri = g_strdup_printf("http://%s:%d", server, port);
- }
- }
+ if (needlock)
+ pthread_mutex_unlock(&emu_proxy_lock);
- g_free(server);
}
static void
emu_proxy_changed(GConfClient *client, guint32 cnxn_id, GConfEntry *entry, gpointer user_data)
{
- emu_set_proxy(client);
+ emu_set_proxy(client, TRUE);
+}
+
+static void *
+emu_proxy_setup(void *data)
+{
+ GConfClient *client = gconf_client_get_default();
+
+ gconf_client_add_dir(client, "/system/http_proxy", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
+ gconf_client_notify_add(client, "/system/http_proxy", emu_proxy_changed, NULL, NULL, NULL);
+ emu_set_proxy(client, FALSE);
+ g_object_unref(client);
+
+ return NULL;
}
/**
@@ -1372,19 +1388,20 @@ emu_proxy_changed(GConfClient *client, guint32 cnxn_id, GConfEntry *entry, gpoin
char *
em_utils_get_proxy_uri(void)
{
- static int init;
+ char *uri;
- if (!init) {
- GConfClient *client = gconf_client_get_default();
+ pthread_mutex_lock(&emu_proxy_lock);
- gconf_client_add_dir(client, "/system/http_proxy", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
- gconf_client_notify_add(client, "/system/http_proxy", emu_proxy_changed, NULL, NULL, NULL);
- emu_set_proxy(client);
- g_object_unref(client);
- init = TRUE;
+ if (!emu_proxy_init) {
+ mail_call_main(MAIL_CALL_p_p, emu_proxy_setup, NULL);
+ emu_proxy_init = TRUE;
}
- return g_strdup(emu_proxy_uri);
+ uri = g_strdup(emu_proxy_uri);
+
+ pthread_mutex_unlock(&emu_proxy_lock);
+
+ return uri;
}
/**