aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@src.gnome.org>2009-02-15 11:27:31 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2009-02-15 11:27:31 +0800
commitf7e298665b02f72890c6681e6d21ef5601beccbb (patch)
tree4df0be16faf8d03b1881bd5f9e89280195ec341c /mail
parentccd8e3964f548798eb05a430b3ea81b2760069cc (diff)
downloadgsoc2013-evolution-f7e298665b02f72890c6681e6d21ef5601beccbb.tar
gsoc2013-evolution-f7e298665b02f72890c6681e6d21ef5601beccbb.tar.gz
gsoc2013-evolution-f7e298665b02f72890c6681e6d21ef5601beccbb.tar.bz2
gsoc2013-evolution-f7e298665b02f72890c6681e6d21ef5601beccbb.tar.lz
gsoc2013-evolution-f7e298665b02f72890c6681e6d21ef5601beccbb.tar.xz
gsoc2013-evolution-f7e298665b02f72890c6681e6d21ef5601beccbb.tar.zst
gsoc2013-evolution-f7e298665b02f72890c6681e6d21ef5601beccbb.zip
Merge revisions 37200:3266 from trunk.
svn path=/branches/kill-bonobo/; revision=37270
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog101
-rw-r--r--mail/em-event.c16
-rw-r--r--mail/em-event.h17
-rw-r--r--mail/em-folder-browser.c15
-rw-r--r--mail/em-format-html-display.c9
-rw-r--r--mail/em-format-html-print.c1
-rw-r--r--mail/em-format-html.c31
-rw-r--r--mail/em-format.c13
-rw-r--r--mail/em-format.h1
-rw-r--r--mail/em-network-prefs.c171
-rw-r--r--mail/em-network-prefs.h5
-rw-r--r--mail/em-utils.c80
-rw-r--r--mail/em-utils.h2
-rw-r--r--mail/importers/elm-importer.c2
-rw-r--r--mail/importers/pine-importer.c2
15 files changed, 248 insertions, 218 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index c65af1896a..3be6315b11 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,104 @@
+2009-02-11 Andre Klapper <a9016009@gmx.de>
+
+ * em-folder-browser.c:
+ * em-migrate.c:
+ Substitute some deprecated gtk+ functions.
+
+2009-02-11 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #569700
+
+ * em-format-html.c: (emfh_gethttp):
+ Stop reading from a network when operation was canceled.
+
+2009-02-11 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #333716
+
+ * em-format-html.c: (emfh_gethttp):
+ Do not store incomplete or broken files in a cache.
+
+2009-02-10 Milan Crha <mcrha@redhat.com>
+
+ * em-format-html-display.c: (efhd_format_secure):
+ Format signature/encryption information nicer.
+
+2009-02-09 Milan Crha <mcrha@redhat.com>
+
+ ** Part of fix for bug #555888
+
+ * mail-config.glade:
+ * em-network-prefs.h: (struct _EMNetworkPrefs):
+ * em-network-prefs.c: (emnp_parse_ignore_hosts),
+ (emnp_load_sys_settings), (notify_proxy_type_changed),
+ (em_network_prefs_construct):
+ Do not overwrite user settings with system proxy settings.
+ Register signals at the end, when all widgets are read.
+ Hide socks settings, it is not used at the moment.
+
+ * em-utils.h: (em_utils_get_proxy_uri):
+ * em-utils.c: (em_utils_get_proxy_uri), (emu_proxy_setup):
+ * em-format-html.c: (emfh_gethttp):
+ Use proxy configurable within Evolution.
+
+2009-02-09 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #548623
+
+ * mail-config.glade:
+ * em-network-prefs.h:
+ * em-network-prefs.c: (emnp_set_sensitiveness),
+ (emnp_load_sys_settings), (notify_proxy_type_changed),
+ (em_network_prefs_construct), (emnp_set_markups):
+ No auto-proxy at the moment.
+
+2009-02-05 Milan Crha <mcrha@redhat.com>
+
+ ** Part of fix for bug #554458
+
+ * em-format.c: (em_format_describe_part):
+ Make content type from a mime type first.
+
+2009-02-04 Gilles Dartiguelongue <gdartigu@svn.gnome.org>
+
+ ** Fix for bug #568176
+
+ * em-migrate.c: (em_migrate_setup_progress_dialog),
+ (em_migrate_close_progress_dialog), (em_migrate_set_folder_name),
+ (em_migrate_local_folders_1_4), (migrate_to_db):
+ Make the migration dialog look better.
+
+2009-02-03 Srinivasa Ragavan <sragavan@novell.com>
+
+ ** Fix for bug #569986
+
+ * mail/em-format-html-print.c: Handle printers while doing attachment
+ bar rendering.
+ * mail/em-format-html.c:
+ * mail/em-format.c:
+ * mail/em-format.h:
+
+2009-02-02 Matt McCutchen 2 <matt@mattmccutchen.net>
+
+ ** Fix for bug #567935
+
+ * em-folder-tree.c (emft_popup_uvfolder): Don't use an uninitialized
+ variable.
+
+2009-02-01 Matthew Barnes <mbarnes@redhat.com>
+
+ * em-event.c:
+ * em-event.h:
+ * em-migrate.c:
+ Fix compiler warnings.
+
+2009-02-01 Johnny Jacob <jjohnny@novell.com>
+
+ * em-event.h (struct _EMEventTargetFolderBrowser): Added.
+ * em-event.c (em_event_target_new_folder_browser): Added.
+ (EEventHookTargetMask emeh_folder_browser_masks): Added.
+ * em-folder-browser.c (emfb_init): New e-plugin Hook point.
+
2009-01-30 Srinivasa Ragavan <sragavan@novell.com>
* message-list.c: (regen_list_exec): Fix compiler warnings
diff --git a/mail/em-event.c b/mail/em-event.c
index 0c5a61b454..8a027cce98 100644
--- a/mail/em-event.c
+++ b/mail/em-event.c
@@ -147,6 +147,16 @@ em_event_target_new_folder (EMEvent *eme, const char *uri, unsigned int new)
return t;
}
+EMEventTargetFolderBrowser *
+em_event_target_new_folder_browser (EMEvent *eme, EMFolderBrowser *emfb)
+{
+ EMEventTargetFolderBrowser *t = e_event_target_new(&eme->popup, EM_EVENT_TARGET_FOLDER_BROWSER, sizeof(*t));
+
+ t->emfb = emfb;
+
+ return t;
+}
+
EMEventTargetComposer *
em_event_target_new_composer (EMEvent *eme, const EMsgComposer *composer, guint32 flags)
{
@@ -210,6 +220,10 @@ static const EEventHookTargetMask emeh_folder_masks[] = {
{ NULL }
};
+static const EEventHookTargetMask emeh_folder_browser_masks[] = {
+ { "folderbrowser", EM_EVENT_FOLDER_BROWSER },
+ { NULL }
+};
static const EEventHookTargetMask emeh_composer_masks[] = {
{ "sendoption", EM_EVENT_COMPOSER_SEND_OPTION },
@@ -230,8 +244,10 @@ static const EEventHookTargetMask emeh_custom_icon_masks[] = {
{ "customicon", EM_EVENT_CUSTOM_ICON },
{ NULL }
};
+
static const EEventHookTargetMap emeh_targets[] = {
{ "folder", EM_EVENT_TARGET_FOLDER, emeh_folder_masks },
+ { "folderbrowser", EM_EVENT_TARGET_FOLDER_BROWSER, emeh_folder_browser_masks },
{ "message", EM_EVENT_TARGET_MESSAGE, emeh_message_masks },
{ "composer", EM_EVENT_TARGET_COMPOSER, emeh_composer_masks},
{ "sendreceive", EM_EVENT_TARGET_SEND_RECEIVE, emeh_send_receive_masks},
diff --git a/mail/em-event.h b/mail/em-event.h
index 3afc0146bb..eb45050a27 100644
--- a/mail/em-event.h
+++ b/mail/em-event.h
@@ -27,6 +27,7 @@
#include <glib-object.h>
#include "e-util/e-event.h"
+#include "mail/em-folder-browser.h"
#ifdef __cplusplus
extern "C" {
@@ -44,12 +45,18 @@ typedef struct _EMEventClass EMEventClass;
/* Current target description */
enum _em_event_target_t {
EM_EVENT_TARGET_FOLDER,
+ EM_EVENT_TARGET_FOLDER_BROWSER,
EM_EVENT_TARGET_MESSAGE,
EM_EVENT_TARGET_COMPOSER,
EM_EVENT_TARGET_SEND_RECEIVE,
EM_EVENT_TARGET_CUSTOM_ICON,
};
+/* Flags for FOLDER BROWSER Events*/
+enum {
+ EM_EVENT_FOLDER_BROWSER = 1<< 0,
+};
+
/* Flags that describe TARGET_FOLDER */
enum {
EM_EVENT_FOLDER_NEWMAIL = 1<< 0,
@@ -102,6 +109,15 @@ struct _EMEventTargetComposer {
struct _EMsgComposer *composer;
};
+typedef struct _EMEventTargetFolderBrowser EMEventTargetFolderBrowser;
+
+struct _EMEventTargetFolderBrowser {
+ EEventTarget target;
+
+ struct _EMFolderBrowser *emfb;
+};
+
+
typedef struct _EMEventTargetSendReceive EMEventTargetSendReceive;
struct _EMEventTargetSendReceive {
@@ -139,6 +155,7 @@ GType em_event_get_type(void);
EMEvent *em_event_peek(void);
EMEventTargetFolder *em_event_target_new_folder(EMEvent *emp, const char *uri, guint32 flags);
+EMEventTargetFolderBrowser *em_event_target_new_folder_browser (EMEvent *eme, EMFolderBrowser *emfb);
EMEventTargetComposer *em_event_target_new_composer(EMEvent *emp, const struct _EMsgComposer *composer, guint32 flags);
EMEventTargetMessage *em_event_target_new_message(EMEvent *emp, struct _CamelFolder *folder, struct _CamelMimeMessage *message, const char *uid, guint32 flags);
EMEventTargetSendReceive * em_event_target_new_send_receive(EMEvent *eme, struct _GtkWidget *table, gpointer data, int row, guint32 flags);
diff --git a/mail/em-folder-browser.c b/mail/em-folder-browser.c
index bcc25002b7..572b51239b 100644
--- a/mail/em-folder-browser.c
+++ b/mail/em-folder-browser.c
@@ -88,6 +88,7 @@
#include "em-folder-utils.h"
#include "em-subscribe-editor.h"
#include "em-menu.h"
+#include "em-event.h"
#include "message-list.h"
#include "mail-component.h"
@@ -249,6 +250,9 @@ emfb_init(GObject *o)
RuleContext *search_context = mail_component_peek_search_context (mail_component_peek ());
struct _EMFolderBrowserPrivate *p;
+ EMEvent *eme;
+ EMEventTargetFolderBrowser *target;
+
p = emfb->priv = g_malloc0(sizeof(struct _EMFolderBrowserPrivate));
emfb->view.preview_active = TRUE;
@@ -329,6 +333,17 @@ emfb_init(GObject *o)
// gtk_paned_pack2 (GTK_PANED (emfb->vpane), p->preview, TRUE, FALSE);
// gtk_widget_show(p->preview);
+ /** @HookPoint-EMFolderBrower: Folder Browser
+ * @Id: emfb.created
+ * @Class: org.gnome.evolution.mail.events:1.0
+ * @Target: EMFolderBrowser
+ */
+
+ eme = em_event_peek();
+ target = em_event_target_new_folder_browser (eme, emfb);
+
+ e_event_emit((EEvent *)eme, "emfb.created", (EEventTarget *)target);
+
g_signal_connect (((EMFolderView *) emfb)->list->tree, "key_press", G_CALLBACK(emfb_list_key_press), emfb);
g_signal_connect (((EMFolderView *) emfb)->list, "message_selected", G_CALLBACK (emfb_list_message_selected), emfb);
diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c
index e9516100f0..ff7e77c8f6 100644
--- a/mail/em-format-html-display.c
+++ b/mail/em-format-html-display.c
@@ -1227,14 +1227,17 @@ efhd_format_secure(EMFormat *emf, CamelStream *stream, CamelMimePart *part, Came
pobj = (struct _smime_pobject *)em_format_html_add_pobject((EMFormatHTML *)emf, sizeof(*pobj), classid, part, efhd_xpkcs7mime_button);
pobj->valid = camel_cipher_validity_clone(valid);
pobj->object.free = efhd_xpkcs7mime_free;
- camel_stream_printf(stream, "<td valign=top><object classid=\"%s\"></object></td><td width=100%% valign=top>", classid);
+ camel_stream_printf(stream, "<td valign=center><object classid=\"%s\"></object></td><td width=100%% valign=center>", classid);
g_free(classid);
if (valid->sign.status != CAMEL_CIPHER_VALIDITY_SIGN_NONE) {
- camel_stream_printf(stream, "%s<br>", _(smime_sign_table[valid->sign.status].shortdesc));
+ camel_stream_printf (stream, "%s", _(smime_sign_table[valid->sign.status].shortdesc));
}
if (valid->encrypt.status != CAMEL_CIPHER_VALIDITY_ENCRYPT_NONE) {
- camel_stream_printf(stream, "%s<br>", _(smime_encrypt_table[valid->encrypt.status].shortdesc));
+ if (valid->sign.status != CAMEL_CIPHER_VALIDITY_SIGN_NONE) {
+ camel_stream_printf (stream, "<br>");
+ }
+ camel_stream_printf (stream, "%s", _(smime_encrypt_table[valid->encrypt.status].shortdesc));
}
camel_stream_printf(stream, "</td></tr></table>");
diff --git a/mail/em-format-html-print.c b/mail/em-format-html-print.c
index a903820ca3..985828d2af 100644
--- a/mail/em-format-html-print.c
+++ b/mail/em-format-html-print.c
@@ -71,6 +71,7 @@ efhp_init (GObject *o)
gtk_container_add (GTK_CONTAINER (efhp->window), html);
gtk_widget_realize (html);
efhp->parent.show_icon = FALSE;
+ ((EMFormat *)efhp)->print = TRUE;
}
GType
diff --git a/mail/em-format-html.c b/mail/em-format-html.c
index 99377cce74..02e07939fc 100644
--- a/mail/em-format-html.c
+++ b/mail/em-format-html.c
@@ -493,9 +493,11 @@ static void emfh_gethttp(struct _EMFormatHTMLJob *job, int cancelled)
instream = camel_http_stream_new(CAMEL_HTTP_METHOD_GET, ((EMFormat *)job->format)->session, url);
camel_http_stream_set_user_agent((CamelHttpStream *)instream, "CamelHttpStream/1.0 Evolution/" VERSION);
- proxy = em_utils_get_proxy_uri();
- camel_http_stream_set_proxy((CamelHttpStream *)instream, proxy);
- g_free(proxy);
+ proxy = em_utils_get_proxy_uri (job->u.uri);
+ if (proxy) {
+ camel_http_stream_set_proxy ((CamelHttpStream *)instream, proxy);
+ g_free (proxy);
+ }
camel_operation_start(NULL, _("Retrieving `%s'"), job->u.uri);
tmp_stream = (CamelHttpStream *)instream;
content_type = camel_http_stream_get_content_type(tmp_stream);
@@ -516,6 +518,10 @@ static void emfh_gethttp(struct _EMFormatHTMLJob *job, int cancelled)
costream = camel_data_cache_add(emfh_http_cache, EMFH_HTTP_CACHE_PATH, job->u.uri, NULL);
do {
+ if (camel_operation_cancel_check (NULL)) {
+ n = -1;
+ break;
+ }
/* FIXME: progress reporting in percentage, can we get the length always? do we care? */
n = camel_stream_read(instream, buffer, sizeof (buffer));
if (n > 0) {
@@ -526,17 +532,12 @@ static void emfh_gethttp(struct _EMFormatHTMLJob *job, int cancelled)
camel_operation_progress(NULL, pc_complete);
}
d(printf(" read %d bytes\n", n));
- if (costream && camel_stream_write(costream, buffer, n) == -1) {
- camel_data_cache_remove(emfh_http_cache, EMFH_HTTP_CACHE_PATH, job->u.uri, NULL);
- camel_object_unref(costream);
- costream = NULL;
+ if (costream && camel_stream_write (costream, buffer, n) == -1) {
+ n = -1;
+ break;
}
camel_stream_write(job->stream, buffer, n);
- } else if (n < 0 && costream) {
- camel_data_cache_remove(emfh_http_cache, EMFH_HTTP_CACHE_PATH, job->u.uri, NULL);
- camel_object_unref(costream);
- costream = NULL;
}
} while (n>0);
@@ -544,8 +545,12 @@ static void emfh_gethttp(struct _EMFormatHTMLJob *job, int cancelled)
if (n == 0)
camel_stream_close(job->stream);
- if (costream)
+ if (costream) {
+ /* do not store broken files in a cache */
+ if (n != 0)
+ camel_data_cache_remove(emfh_http_cache, EMFH_HTTP_CACHE_PATH, job->u.uri, NULL);
camel_object_unref(costream);
+ }
camel_object_unref(instream);
done:
@@ -1263,7 +1268,7 @@ efh_format_exec (struct _format_msg *m)
if (handle)
handle->handler((EMFormat *)m->format, (CamelStream *)m->estream, (CamelMimePart *)m->message, handle);
handle = em_format_find_handler((EMFormat *)m->format, "x-evolution/message/post-header-closure");
- if (handle)
+ if (handle && !((EMFormat *)m->format)->print)
handle->handler((EMFormat *)m->format, (CamelStream *)m->estream, (CamelMimePart *)m->message, handle);
}
diff --git a/mail/em-format.c b/mail/em-format.c
index 5b38f6cea3..a807481827 100644
--- a/mail/em-format.c
+++ b/mail/em-format.c
@@ -121,6 +121,7 @@ emf_init(GObject *o)
(GDestroyNotify) NULL,
(GDestroyNotify) emf_free_cache);
emf->composer = FALSE;
+ emf->print = FALSE;
emf->show_photo = TRUE;
emf->photo_local = TRUE;
e_dlist_init(&emf->header_list);
@@ -1135,11 +1136,12 @@ em_format_describe_part(CamelMimePart *part, const char *mime_type)
{
GString *stext;
const char *filename, *description;
- char *out, *desc;
+ char *content_type, *desc;
stext = g_string_new("");
- /* TODO: mime_type isn't content_type on some systems (Win32), thus this will not work there. */
- desc = g_content_type_get_description (mime_type);
+ content_type = g_content_type_from_mime_type (mime_type);
+ desc = g_content_type_get_description (content_type ? content_type : mime_type);
+ g_free (content_type);
g_string_append_printf (stext, _("%s attachment"), desc ? desc : mime_type);
g_free (desc);
if ((filename = camel_mime_part_get_filename (part)))
@@ -1149,10 +1151,7 @@ em_format_describe_part(CamelMimePart *part, const char *mime_type)
!(filename && (strcmp(filename, description) == 0)))
g_string_append_printf(stext, ", \"%s\"", description);
- out = stext->str;
- g_string_free(stext, FALSE);
-
- return out;
+ return g_string_free (stext, FALSE);
}
/* ********************************************************************** */
diff --git a/mail/em-format.h b/mail/em-format.h
index dae97d5b5b..7b2dd4bd56 100644
--- a/mail/em-format.h
+++ b/mail/em-format.h
@@ -228,6 +228,7 @@ struct _EMFormat {
char *charset; /* charset override */
char *default_charset; /* charset fallback */
gboolean composer; /* Formatting from composer ?*/
+ gboolean print;
gboolean show_photo; /* Want to show the photo of the sender ?*/
gboolean photo_local; /* Photos only from local addressbooks */
};
diff --git a/mail/em-network-prefs.c b/mail/em-network-prefs.c
index eeed589cb8..13f71b966e 100644
--- a/mail/em-network-prefs.c
+++ b/mail/em-network-prefs.c
@@ -61,21 +61,6 @@
#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_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"
-
static void em_network_prefs_class_init (EMNetworkPrefsClass *class);
static void em_network_prefs_init (EMNetworkPrefs *dialog);
static void em_network_prefs_destroy (GtkObject *obj);
@@ -184,28 +169,32 @@ emnp_widget_glade(EConfig *ec, EConfigItem *item, struct _GtkWidget *parent, str
static void
emnp_set_sensitiveness (EMNetworkPrefs *prefs, NetworkConfigProxyType type, gboolean sensitivity)
{
+#if 0
if (type == NETWORK_PROXY_AUTOCONFIG) {
gtk_widget_set_sensitive ((GtkWidget *) prefs->auto_proxy_url, sensitivity);
d(g_print ("Setting sensitivity of autoconfig to: %d\n", sensitivity));
- } else if (type == NETWORK_PROXY_MANUAL) {
+ } else
+#endif
+ if (type == NETWORK_PROXY_MANUAL) {
gboolean state;
gtk_widget_set_sensitive ((GtkWidget *) prefs->http_host, sensitivity);
gtk_widget_set_sensitive ((GtkWidget *) prefs->https_host, sensitivity);
- gtk_widget_set_sensitive ((GtkWidget *) prefs->socks_host, sensitivity);
gtk_widget_set_sensitive ((GtkWidget *) prefs->ignore_hosts, sensitivity);
gtk_widget_set_sensitive ((GtkWidget *) prefs->use_auth, sensitivity);
gtk_widget_set_sensitive ((GtkWidget *) prefs->http_port, sensitivity);
gtk_widget_set_sensitive ((GtkWidget *) prefs->https_port, sensitivity);
- gtk_widget_set_sensitive ((GtkWidget *) prefs->socks_port, sensitivity);
gtk_widget_set_sensitive ((GtkWidget *) prefs->lbl_ignore_hosts, sensitivity);
gtk_widget_set_sensitive ((GtkWidget *) prefs->lbl_http_host, sensitivity);
gtk_widget_set_sensitive ((GtkWidget *) prefs->lbl_http_port, sensitivity);
gtk_widget_set_sensitive ((GtkWidget *) prefs->lbl_https_host, sensitivity);
gtk_widget_set_sensitive ((GtkWidget *) prefs->lbl_https_port, sensitivity);
+#if 0
+ gtk_widget_set_sensitive ((GtkWidget *) prefs->socks_host, sensitivity);
+ gtk_widget_set_sensitive ((GtkWidget *) prefs->socks_port, sensitivity);
gtk_widget_set_sensitive ((GtkWidget *) prefs->lbl_socks_host, sensitivity);
gtk_widget_set_sensitive ((GtkWidget *) prefs->lbl_socks_port, sensitivity);
-
+#endif
state = sensitivity && gtk_toggle_button_get_active (prefs->use_auth);
gtk_widget_set_sensitive ((GtkWidget *) prefs->lbl_auth_user, state);
gtk_widget_set_sensitive ((GtkWidget *) prefs->lbl_auth_pwd, state);
@@ -217,89 +206,6 @@ emnp_set_sensitiveness (EMNetworkPrefs *prefs, NetworkConfigProxyType type, gboo
}
static void
-emnp_parse_ignore_hosts (gpointer data, gpointer user_data)
-{
- GString *str = (GString *)user_data;
-
- if (!str)
- return;
-
- /* FIXME: Remove trailing , */
- if (data) {
- str = g_string_append (str, data);
- str = g_string_append_c (str, ',');
- }
-}
-
-static void
-emnp_load_sys_settings (GConfClient *gconf)
-{
- char *buf;
- int port;
- GSList *ignore_hosts;
- gboolean toggle;
- GString *str = NULL;
-
- if (!gconf)
- return;
-
- toggle = gconf_client_get_bool (gconf, GCONF_SYS_USE_PROXY_KEY, NULL);
- if (!toggle) {
- gconf_client_set_bool (gconf, GCONF_E_USE_PROXY_KEY, toggle, NULL);
- return;
- }
-
- toggle = gconf_client_get_bool (gconf, GCONF_SYS_USE_AUTH_KEY, NULL);
- gconf_client_set_bool (gconf, GCONF_E_USE_AUTH_KEY, toggle, NULL);
-
- buf = gconf_client_get_string (gconf, GCONF_SYS_HTTP_HOST_KEY, NULL);
- gconf_client_set_string (gconf, GCONF_E_HTTP_HOST_KEY, buf, NULL);
- g_free (buf);
-
- buf = gconf_client_get_string (gconf, GCONF_SYS_HTTPS_HOST_KEY, NULL);
- gconf_client_set_string (gconf, GCONF_E_HTTPS_HOST_KEY, buf, NULL);
- g_free (buf);
-
- buf = gconf_client_get_string (gconf, GCONF_SYS_SOCKS_HOST_KEY, NULL);
- gconf_client_set_string (gconf, GCONF_E_SOCKS_HOST_KEY, buf, NULL);
- g_free (buf);
-
- buf = gconf_client_get_string (gconf, GCONF_SYS_AUTOCONFIG_URL_KEY, NULL);
- gconf_client_set_string (gconf, GCONF_E_AUTOCONFIG_URL_KEY, buf, NULL);
- g_free (buf);
-
- buf = gconf_client_get_string (gconf, GCONF_SYS_AUTH_USER_KEY, NULL);
- gconf_client_set_string (gconf, GCONF_E_AUTH_USER_KEY, buf, NULL);
- g_free (buf);
-
- buf = gconf_client_get_string (gconf, GCONF_SYS_AUTH_PWD_KEY, NULL);
- gconf_client_set_string (gconf, GCONF_E_AUTH_PWD_KEY, buf, NULL);
- g_free (buf);
-
- port = gconf_client_get_int (gconf, GCONF_SYS_HTTP_PORT_KEY, NULL);
- gconf_client_set_int (gconf, GCONF_E_HTTP_PORT_KEY, port, NULL);
-
- port = gconf_client_get_int (gconf, GCONF_SYS_HTTPS_PORT_KEY, NULL);
- gconf_client_set_int (gconf, GCONF_E_HTTPS_PORT_KEY, port, NULL);
-
- port = gconf_client_get_int (gconf, GCONF_SYS_SOCKS_PORT_KEY, NULL);
- gconf_client_set_int (gconf, GCONF_E_SOCKS_PORT_KEY, port, NULL);
-
- ignore_hosts = gconf_client_get_list (gconf, GCONF_SYS_IGNORE_HOSTS_KEY,
- GCONF_VALUE_STRING, NULL);
- if (ignore_hosts) {
- str = g_string_sized_new (32);
- g_slist_foreach (ignore_hosts, (GFunc) emnp_parse_ignore_hosts, str);
- g_slist_foreach (ignore_hosts, (GFunc) g_free, NULL);
- g_slist_free (ignore_hosts);
-
- gconf_client_set_string (gconf, GCONF_E_IGNORE_HOSTS_KEY,
- str->str, NULL);
- g_string_free (str, TRUE);
- }
-}
-
-static void
notify_proxy_type_changed (GtkWidget *widget, EMNetworkPrefs *prefs)
{
int type;
@@ -311,7 +217,11 @@ notify_proxy_type_changed (GtkWidget *widget, EMNetworkPrefs *prefs)
else if (gtk_toggle_button_get_active (prefs->manual_proxy))
type = NETWORK_PROXY_MANUAL;
else
+#if 0
type = NETWORK_PROXY_AUTOCONFIG;
+#else
+ type = NETWORK_PROXY_SYS_SETTINGS;
+#endif
gconf_client_set_int (prefs->gconf, "/apps/evolution/shell/network_config/proxy_type", type, NULL);
@@ -319,11 +229,6 @@ notify_proxy_type_changed (GtkWidget *widget, EMNetworkPrefs *prefs)
type == NETWORK_PROXY_SYS_SETTINGS) {
emnp_set_sensitiveness (prefs, NETWORK_PROXY_MANUAL, FALSE);
emnp_set_sensitiveness (prefs, NETWORK_PROXY_AUTOCONFIG, FALSE);
- if (type == NETWORK_PROXY_SYS_SETTINGS) {
- d(g_print ("%s:%s: Loading sys settings... \n", G_STRLOC, G_STRFUNC));
- emnp_load_sys_settings (prefs->gconf);
- }
-
} else if (type == NETWORK_PROXY_AUTOCONFIG) {
emnp_set_sensitiveness (prefs, NETWORK_PROXY_MANUAL, FALSE);
emnp_set_sensitiveness (prefs, NETWORK_PROXY_AUTOCONFIG, TRUE);
@@ -383,7 +288,9 @@ emnp_set_markups (EMNetworkPrefs *prefs)
gtk_label_set_use_markup (GTK_LABEL (GTK_BIN(prefs->sys_proxy)->child), TRUE);
gtk_label_set_use_markup (GTK_LABEL (GTK_BIN(prefs->no_proxy)->child), TRUE);
gtk_label_set_use_markup (GTK_LABEL (GTK_BIN(prefs->manual_proxy)->child), TRUE);
+#if 0
gtk_label_set_use_markup (GTK_LABEL (GTK_BIN(prefs->auto_proxy)->child), TRUE);
+#endif
}
static void
@@ -428,9 +335,13 @@ em_network_prefs_construct (EMNetworkPrefs *prefs)
locked = !gconf_client_key_is_writable (prefs->gconf, GCONF_E_PROXY_TYPE_KEY, NULL);
val = gconf_client_get_int (prefs->gconf, GCONF_E_PROXY_TYPE_KEY, NULL);
+
+ /* no auto-proxy at the moment */
+ if (val == NETWORK_PROXY_AUTOCONFIG)
+ val = NETWORK_PROXY_SYS_SETTINGS;
+
prefs->sys_proxy = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "rdoSysSettings"));
gtk_toggle_button_set_active (prefs->sys_proxy, val == NETWORK_PROXY_SYS_SETTINGS);
- g_signal_connect (prefs->sys_proxy, "toggled", G_CALLBACK (notify_proxy_type_changed), prefs);
if (locked)
gtk_widget_set_sensitive ((GtkWidget *) prefs->sys_proxy, FALSE);
@@ -438,38 +349,35 @@ em_network_prefs_construct (EMNetworkPrefs *prefs)
prefs->no_proxy = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "rdoNoProxy"));
gtk_toggle_button_set_active (prefs->no_proxy, val == NETWORK_PROXY_DIRECT_CONNECTION);
- g_signal_connect (prefs->no_proxy, "toggled", G_CALLBACK (notify_proxy_type_changed), prefs);
if (locked)
gtk_widget_set_sensitive ((GtkWidget *) prefs->no_proxy, FALSE);
d(g_print ("No proxy settings ----!!! \n"));
+ /* no auto-proxy at the moment */
+#if 0
prefs->auto_proxy = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "rdoAutoConfig"));
prefs->auto_proxy_url = GTK_ENTRY (glade_xml_get_widget (gui, "txtAutoConfigUrl"));
+
gtk_toggle_button_set_active (prefs->auto_proxy, val == NETWORK_PROXY_AUTOCONFIG);
- g_signal_connect (prefs->auto_proxy, "toggled", G_CALLBACK (notify_proxy_type_changed), prefs);
g_signal_connect(prefs->auto_proxy_url, "changed", G_CALLBACK(widget_entry_changed_cb), GCONF_E_AUTOCONFIG_URL_KEY);
-
if (locked)
gtk_widget_set_sensitive ((GtkWidget *) prefs->auto_proxy, FALSE);
+#endif
d(g_print ("Auto config settings ----!!! \n"));
prefs->manual_proxy = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "rdoManualProxy"));
prefs->http_host = GTK_ENTRY (glade_xml_get_widget (gui, "txtHttpHost"));
prefs->https_host = GTK_ENTRY (glade_xml_get_widget (gui, "txtHttpsHost"));
- prefs->socks_host = GTK_ENTRY (glade_xml_get_widget (gui, "txtSocksHost"));
prefs->ignore_hosts = GTK_ENTRY (glade_xml_get_widget (gui, "txtIgnoreHosts"));
prefs->http_port = GTK_SPIN_BUTTON (glade_xml_get_widget (gui, "spnHttpPort"));
prefs->https_port = GTK_SPIN_BUTTON (glade_xml_get_widget (gui, "spnHttpsPort"));
- prefs->socks_port = GTK_SPIN_BUTTON (glade_xml_get_widget (gui, "spnSocksPort"));
prefs->lbl_http_host = GTK_LABEL (glade_xml_get_widget (gui, "lblHttpHost"));
prefs->lbl_http_port = GTK_LABEL (glade_xml_get_widget (gui, "lblHttpPort"));
prefs->lbl_https_host = GTK_LABEL (glade_xml_get_widget (gui, "lblHttpsHost"));
prefs->lbl_https_port = GTK_LABEL (glade_xml_get_widget (gui, "lblHttpsPort"));
- prefs->lbl_socks_host = GTK_LABEL (glade_xml_get_widget (gui, "lblSocksHost"));
- prefs->lbl_socks_port = GTK_LABEL (glade_xml_get_widget (gui, "lblSocksPort"));
prefs->lbl_ignore_hosts = GTK_LABEL (glade_xml_get_widget (gui, "lblIgnoreHosts"));
prefs->use_auth = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkUseAuth"));
toggle_button_init (prefs, prefs->use_auth, GCONF_E_USE_AUTH_KEY);
@@ -477,28 +385,40 @@ em_network_prefs_construct (EMNetworkPrefs *prefs)
prefs->lbl_auth_pwd = GTK_LABEL (glade_xml_get_widget (gui, "lblAuthPwd"));
prefs->auth_user = GTK_ENTRY (glade_xml_get_widget (gui, "txtAuthUser"));
prefs->auth_pwd = GTK_ENTRY (glade_xml_get_widget (gui, "txtAuthPwd"));
+
+#if 0
+ prefs->socks_host = GTK_ENTRY (glade_xml_get_widget (gui, "txtSocksHost"));
+ prefs->socks_port = GTK_SPIN_BUTTON (glade_xml_get_widget (gui, "spnSocksPort"));
+ prefs->lbl_socks_host = GTK_LABEL (glade_xml_get_widget (gui, "lblSocksHost"));
+ prefs->lbl_socks_port = GTK_LABEL (glade_xml_get_widget (gui, "lblSocksPort"));
+ g_signal_connect (prefs->socks_host, "changed",
+ G_CALLBACK(widget_entry_changed_cb), GCONF_E_SOCKS_HOST_KEY);
+ g_signal_connect (prefs->socks_port, "value_changed",
+ G_CALLBACK(widget_entry_changed_cb), GCONF_E_SOCKS_PORT_KEY);
+#endif
/* Manual proxy options */
g_signal_connect (prefs->http_host, "changed",
G_CALLBACK(widget_entry_changed_cb), GCONF_E_HTTP_HOST_KEY);
g_signal_connect (prefs->https_host, "changed",
G_CALLBACK(widget_entry_changed_cb), GCONF_E_HTTPS_HOST_KEY);
- g_signal_connect (prefs->socks_host, "changed",
- G_CALLBACK(widget_entry_changed_cb), GCONF_E_SOCKS_HOST_KEY);
g_signal_connect (prefs->ignore_hosts, "changed",
G_CALLBACK(widget_entry_changed_cb), GCONF_E_IGNORE_HOSTS_KEY);
g_signal_connect (prefs->http_port, "value_changed",
G_CALLBACK(widget_entry_changed_cb), GCONF_E_HTTP_PORT_KEY);
g_signal_connect (prefs->https_port, "value_changed",
G_CALLBACK(widget_entry_changed_cb), GCONF_E_HTTPS_PORT_KEY);
- g_signal_connect (prefs->socks_port, "value_changed",
- G_CALLBACK(widget_entry_changed_cb), GCONF_E_SOCKS_PORT_KEY);
g_signal_connect (prefs->auth_user, "changed",
G_CALLBACK(widget_entry_changed_cb), GCONF_E_AUTH_USER_KEY);
g_signal_connect (prefs->auth_pwd, "changed",
G_CALLBACK(widget_entry_changed_cb), GCONF_E_AUTH_PWD_KEY);
gtk_toggle_button_set_active (prefs->manual_proxy, val == NETWORK_PROXY_MANUAL);
+ g_signal_connect (prefs->sys_proxy, "toggled", G_CALLBACK (notify_proxy_type_changed), prefs);
+ g_signal_connect (prefs->no_proxy, "toggled", G_CALLBACK (notify_proxy_type_changed), prefs);
+#if 0
+ g_signal_connect (prefs->auto_proxy, "toggled", G_CALLBACK (notify_proxy_type_changed), prefs);
+#endif
g_signal_connect (prefs->manual_proxy, "toggled", G_CALLBACK (notify_proxy_type_changed), prefs);
if (locked)
@@ -513,10 +433,6 @@ em_network_prefs_construct (EMNetworkPrefs *prefs)
gtk_entry_set_text (prefs->https_host, buf ? buf : "");
g_free (buf);
- buf = gconf_client_get_string (prefs->gconf, GCONF_E_SOCKS_HOST_KEY, NULL);
- gtk_entry_set_text (prefs->socks_host, buf ? buf : "");
- g_free (buf);
-
buf = gconf_client_get_string (prefs->gconf, GCONF_E_IGNORE_HOSTS_KEY, NULL);
gtk_entry_set_text (prefs->ignore_hosts, buf ? buf : "");
g_free (buf);
@@ -535,17 +451,20 @@ em_network_prefs_construct (EMNetworkPrefs *prefs)
port = gconf_client_get_int (prefs->gconf, GCONF_E_HTTPS_PORT_KEY, NULL);
gtk_spin_button_set_value (prefs->https_port, (gdouble)port);
+#if 0
+ buf = gconf_client_get_string (prefs->gconf, GCONF_E_SOCKS_HOST_KEY, NULL);
+ gtk_entry_set_text (prefs->socks_host, buf ? buf : "");
+ g_free (buf);
+
port = gconf_client_get_int (prefs->gconf, GCONF_E_SOCKS_PORT_KEY, NULL);
gtk_spin_button_set_value (prefs->socks_port, (gdouble)port);
-
+#endif
emnp_set_markups (prefs);
if (val == NETWORK_PROXY_DIRECT_CONNECTION ||
val == NETWORK_PROXY_SYS_SETTINGS) {
emnp_set_sensitiveness (prefs, NETWORK_PROXY_MANUAL, FALSE);
emnp_set_sensitiveness (prefs, NETWORK_PROXY_AUTOCONFIG, FALSE);
- if (val == NETWORK_PROXY_SYS_SETTINGS)
- emnp_load_sys_settings (prefs->gconf);
} else if (val == NETWORK_PROXY_AUTOCONFIG) {
emnp_set_sensitiveness (prefs, NETWORK_PROXY_MANUAL, FALSE);
emnp_set_sensitiveness (prefs, NETWORK_PROXY_AUTOCONFIG, TRUE);
diff --git a/mail/em-network-prefs.h b/mail/em-network-prefs.h
index 41b4539608..50d986c5d1 100644
--- a/mail/em-network-prefs.h
+++ b/mail/em-network-prefs.h
@@ -69,14 +69,12 @@ struct _EMNetworkPrefs {
GtkToggleButton *sys_proxy;
GtkToggleButton *no_proxy;
GtkToggleButton *manual_proxy;
- GtkToggleButton *auto_proxy;
GtkToggleButton *use_auth;
GtkEntry *http_host;
GtkEntry *https_host;
GtkEntry *socks_host;
GtkEntry *ignore_hosts;
- GtkEntry *auto_proxy_url;
GtkEntry *auth_user;
GtkEntry *auth_pwd;
@@ -85,14 +83,13 @@ struct _EMNetworkPrefs {
GtkLabel *lbl_https_host;
GtkLabel *lbl_https_port;
GtkLabel *lbl_socks_host;
- GtkLabel *lbl_socks_port;
+ GtkLabel *lbl_socks_port;
GtkLabel *lbl_ignore_hosts;
GtkLabel *lbl_auth_user;
GtkLabel *lbl_auth_pwd;
GtkSpinButton *http_port;
GtkSpinButton *https_port;
- GtkSpinButton *socks_port;
};
struct _EMNetworkPrefsClass {
diff --git a/mail/em-utils.c b/mail/em-utils.c
index e7c34310bc..9899c10f8b 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -64,6 +64,7 @@
#include <libedataserver/e-data-server-util.h>
#include <libedataserver/e-flag.h>
+#include <libedataserver/e-proxy.h>
#include "e-util/e-util.h"
#include "e-util/e-util-private.h"
#include "e-util/e-mktemp.h"
@@ -1580,62 +1581,17 @@ 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, int needlock)
-{
- char *server, *uri = NULL;
- int port;
-
- 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);
-
- 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);
-
- 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);
- }
- }
-
- g_free(server);
- }
-
- if (needlock)
- pthread_mutex_lock(&emu_proxy_lock);
-
- g_free(emu_proxy_uri);
- emu_proxy_uri = uri;
-
- if (needlock)
- pthread_mutex_unlock(&emu_proxy_lock);
-
-}
-
-static void
-emu_proxy_changed(GConfClient *client, guint32 cnxn_id, GConfEntry *entry, gpointer user_data)
-{
- emu_set_proxy(client, TRUE);
-}
+static EProxy *emu_proxy = NULL;
+static GStaticMutex emu_proxy_lock = G_STATIC_MUTEX_INIT;
static void *
-emu_proxy_setup(void *data)
+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);
+ if (!emu_proxy) {
+ emu_proxy = e_proxy_new ();
+ e_proxy_setup_proxy (emu_proxy);
+ /* not necessary to listen for changes here */
+ }
return NULL;
}
@@ -1643,25 +1599,25 @@ emu_proxy_setup(void *data)
/**
* em_utils_get_proxy_uri:
*
- * Get the system proxy uri.
+ * Get the system proxy uri for 'pUri'.
*
* Return value: Must be freed when finished with.
**/
char *
-em_utils_get_proxy_uri(void)
+em_utils_get_proxy_uri (const char *pUri)
{
- char *uri;
+ char *uri = NULL;
- pthread_mutex_lock(&emu_proxy_lock);
+ g_static_mutex_lock (&emu_proxy_lock);
- if (!emu_proxy_init) {
- mail_call_main(MAIL_CALL_p_p, (MailMainFunc)emu_proxy_setup, NULL);
- emu_proxy_init = TRUE;
+ if (!emu_proxy) {
+ mail_call_main (MAIL_CALL_p_p, (MailMainFunc)emu_proxy_setup, NULL);
}
- uri = g_strdup(emu_proxy_uri);
+ if (e_proxy_require_proxy_for_uri (emu_proxy, pUri))
+ uri = soup_uri_to_string (e_proxy_peek_uri_for (emu_proxy, pUri), FALSE);
- pthread_mutex_unlock(&emu_proxy_lock);
+ g_static_mutex_unlock (&emu_proxy_lock);
return uri;
}
diff --git a/mail/em-utils.h b/mail/em-utils.h
index adc22d23b6..60c6e22c47 100644
--- a/mail/em-utils.h
+++ b/mail/em-utils.h
@@ -80,7 +80,7 @@ gboolean em_utils_folder_is_outbox(CamelFolder *folder, const char *uri);
void em_utils_adjustment_page(GtkAdjustment *adj, gboolean down);
-char *em_utils_get_proxy_uri(void);
+char *em_utils_get_proxy_uri (const char *uri);
/* FIXME: should this have an override charset? */
char *em_utils_part_to_html(CamelMimePart *part, ssize_t *len, struct _EMFormat *source);
diff --git a/mail/importers/elm-importer.c b/mail/importers/elm-importer.c
index de26d7c0c1..156c8d08cb 100644
--- a/mail/importers/elm-importer.c
+++ b/mail/importers/elm-importer.c
@@ -46,7 +46,7 @@
#include "e-util/e-import.h"
#include "e-util/e-error.h"
-#define d(x) x
+#define d(x)
struct _elm_import_msg {
MailMsg base;
diff --git a/mail/importers/pine-importer.c b/mail/importers/pine-importer.c
index 1036724ad8..e040a4060e 100644
--- a/mail/importers/pine-importer.c
+++ b/mail/importers/pine-importer.c
@@ -49,7 +49,7 @@
#include "e-util/e-import.h"
#include "e-util/e-error.h"
-#define d(x) x
+#define d(x)
struct _pine_import_msg {
MailMsg base;