aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2001-05-16 02:45:42 +0800
committerDan Winship <danw@src.gnome.org>2001-05-16 02:45:42 +0800
commitdadc54fa9885cbe38e84ed667fea13c9d3ee7603 (patch)
treea358f95b9e0d9b375a860f0b3d77a5d6fe1c7c9f
parent7cc37466c122693397465b443811aa20d855c04f (diff)
downloadgsoc2013-evolution-dadc54fa9885cbe38e84ed667fea13c9d3ee7603.tar
gsoc2013-evolution-dadc54fa9885cbe38e84ed667fea13c9d3ee7603.tar.gz
gsoc2013-evolution-dadc54fa9885cbe38e84ed667fea13c9d3ee7603.tar.bz2
gsoc2013-evolution-dadc54fa9885cbe38e84ed667fea13c9d3ee7603.tar.lz
gsoc2013-evolution-dadc54fa9885cbe38e84ed667fea13c9d3ee7603.tar.xz
gsoc2013-evolution-dadc54fa9885cbe38e84ed667fea13c9d3ee7603.tar.zst
gsoc2013-evolution-dadc54fa9885cbe38e84ed667fea13c9d3ee7603.zip
Load http images if the user has force-loaded images too.
* mail-display.c (on_url_requested): Load http images if the user has force-loaded images too. (mail_display_redisplay): Update for normal/headers/source changes. (mail_display_load_images): New. Force HTTP image loading for the current message. * mail-config.c (mail_config_get_message_display_style, mail_config_set_message_display_style): Updated and renamed from mail_config_{get,set}_view_source * mail-callbacks.c (load_images): New. * folder-browser.c (folder_browser_set_message_display_style): Renamed and updated from folder_browser_toggle_view_source. * folder-browser-factory.c (verbs): Add ViewLoadImages. (control_activate): Update for normal/headers/source change to radio group. svn path=/trunk/; revision=9820
-rw-r--r--mail/ChangeLog21
-rw-r--r--mail/folder-browser-factory.c20
-rw-r--r--mail/folder-browser.c27
-rw-r--r--mail/folder-browser.h13
-rw-r--r--mail/mail-callbacks.c8
-rw-r--r--mail/mail-callbacks.h1
-rw-r--r--mail/mail-config.c26
-rw-r--r--mail/mail-config.h16
-rw-r--r--mail/mail-display.c24
-rw-r--r--mail/mail-display.h3
10 files changed, 113 insertions, 46 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index ec299377a8..c30573b8f6 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,5 +1,26 @@
2001-05-15 Dan Winship <danw@ximian.com>
+ * mail-display.c (on_url_requested): Load http images if the user
+ has force-loaded images too.
+ (mail_display_redisplay): Update for normal/headers/source changes.
+ (mail_display_load_images): New. Force HTTP image loading for the
+ current message.
+
+ * mail-config.c (mail_config_get_message_display_style,
+ mail_config_set_message_display_style): Updated and renamed from
+ mail_config_{get,set}_view_source
+
+ * mail-callbacks.c (load_images): New.
+
+ * folder-browser.c (folder_browser_set_message_display_style):
+ Renamed and updated from folder_browser_toggle_view_source.
+
+ * folder-browser-factory.c (verbs): Add ViewLoadImages.
+ (control_activate): Update for normal/headers/source change to
+ radio group.
+
+2001-05-15 Dan Winship <danw@ximian.com>
+
* folder-browser-factory.c (verbs): Update for changes in
evolution-mail.xml (many commands were renamed to better match the
current menu layout).
diff --git a/mail/folder-browser-factory.c b/mail/folder-browser-factory.c
index daf087d9ff..31ee715eff 100644
--- a/mail/folder-browser-factory.c
+++ b/mail/folder-browser-factory.c
@@ -91,9 +91,9 @@ BonoboUIVerb verbs [] = {
BONOBO_UI_UNSAFE_VERB ("ToolsVFolders", vfolder_edit_vfolders),
BONOBO_UI_UNSAFE_VERB ("ToolsVFolderSender", vfolder_sender),
BONOBO_UI_UNSAFE_VERB ("ToolsVFolderSubject", vfolder_subject),
-/* BONOBO_UI_UNSAFE_VERB ("ViewFullHeaders", view_full_headers), */
BONOBO_UI_UNSAFE_VERB ("ViewHideRead", hide_read),
BONOBO_UI_UNSAFE_VERB ("ViewHideSelected", hide_selected),
+ BONOBO_UI_UNSAFE_VERB ("ViewLoadImages", load_images),
BONOBO_UI_UNSAFE_VERB ("ViewShowAll", hide_none),
BONOBO_UI_VERB_END
@@ -203,6 +203,13 @@ folder_browser_setup_property_menu (FolderBrowser *fb,
g_free (name);
}
+/* Must be in the same order as MailConfigDisplayStyle */
+char *message_display_styles[] = {
+ "/commands/ViewNormal",
+ "/commands/ViewFullHeaders",
+ "/commands/ViewSource"
+};
+
static void
control_activate (BonoboControl *control,
BonoboUIComponent *uic,
@@ -236,11 +243,14 @@ control_activate (BonoboControl *control,
/* FIXME: this kind of bypasses bonobo but seems the only way when we change components */
folder_browser_toggle_threads(uic, "", Bonobo_UIComponent_STATE_CHANGED, state?"1":"0", folder_browser);
- state = mail_config_get_view_source();
- bonobo_ui_component_set_prop(uic, "/commands/ViewSource", "state", state?"1":"0", NULL);
- bonobo_ui_component_add_listener(uic, "ViewSource", folder_browser_toggle_view_source, folder_browser);
+ state = mail_config_get_message_display_style ();
+ bonobo_ui_component_set_prop (uic, message_display_styles[state],
+ "state", "1", NULL);
+ bonobo_ui_component_add_listener (uic, "ViewNormal", folder_browser_set_message_display_style, folder_browser);
+ bonobo_ui_component_add_listener (uic, "ViewFullHeaders", folder_browser_set_message_display_style, folder_browser);
+ bonobo_ui_component_add_listener (uic, "ViewSource", folder_browser_set_message_display_style, folder_browser);
/* FIXME: this kind of bypasses bonobo but seems the only way when we change components */
- folder_browser_toggle_view_source(uic, "", Bonobo_UIComponent_STATE_CHANGED, state?"1":"0", folder_browser);
+ folder_browser_set_message_display_style (uic, strrchr (message_display_styles[state], '/') + 1, Bonobo_UIComponent_STATE_CHANGED, "1", folder_browser);
if (fb->folder && CAMEL_IS_VTRASH_FOLDER(fb->folder)) {
bonobo_ui_component_set_prop(uic, "/commands/HideDeleted", "sensitive", "0", NULL);
diff --git a/mail/folder-browser.c b/mail/folder-browser.c
index 6e84a5061a..5469a2d782 100644
--- a/mail/folder-browser.c
+++ b/mail/folder-browser.c
@@ -382,19 +382,26 @@ folder_browser_toggle_hide_deleted (BonoboUIComponent *component,
}
void
-folder_browser_toggle_view_source (BonoboUIComponent *component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- gpointer user_data)
+folder_browser_set_message_display_style (BonoboUIComponent *component,
+ const char *path,
+ Bonobo_UIComponent_EventType type,
+ const char *state,
+ gpointer user_data)
{
+ extern char *message_display_styles[];
FolderBrowser *fb = user_data;
-
- if (type != Bonobo_UIComponent_STATE_CHANGED)
+ int i;
+
+ if (type != Bonobo_UIComponent_STATE_CHANGED || atoi(state) == 0)
return;
-
- mail_config_set_view_source (atoi (state));
- mail_display_redisplay (fb->mail_display, TRUE);
+
+ for (i = 0; i < MAIL_CONFIG_DISPLAY_MAX; i++) {
+ if (strstr (message_display_styles[i], path)) {
+ mail_config_set_message_display_style (i);
+ mail_display_redisplay (fb->mail_display, TRUE);
+ return;
+ }
+ }
}
void
diff --git a/mail/folder-browser.h b/mail/folder-browser.h
index e428465340..6b5ab5fa84 100644
--- a/mail/folder-browser.h
+++ b/mail/folder-browser.h
@@ -109,15 +109,16 @@ void folder_browser_toggle_threads (BonoboUIComponent *component,
const char *state,
gpointer user_data);
-void folder_browser_toggle_view_source (BonoboUIComponent *component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- gpointer user_data);
-
void folder_browser_toggle_hide_deleted (BonoboUIComponent *component,
const char *path,
Bonobo_UIComponent_EventType type,
const char *state,
gpointer user_data);
+
+void folder_browser_set_message_display_style (BonoboUIComponent *component,
+ const char *path,
+ Bonobo_UIComponent_EventType type,
+ const char *state,
+ gpointer user_data);
+
#endif /* _FOLDER_BROWSER_H_ */
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index ca0ba70d53..fe262c389e 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -1224,6 +1224,14 @@ search_msg (GtkWidget *widget, gpointer user_data)
gtk_widget_show_all (w);
}
+void
+load_images (GtkWidget *widget, gpointer user_data)
+{
+ FolderBrowser *fb = FOLDER_BROWSER (user_data);
+
+ mail_display_load_images (fb->mail_display);
+}
+
static void
save_msg_ok (GtkWidget *widget, gpointer user_data)
{
diff --git a/mail/mail-callbacks.h b/mail/mail-callbacks.h
index a800d9a04e..ad3f193737 100644
--- a/mail/mail-callbacks.h
+++ b/mail/mail-callbacks.h
@@ -67,6 +67,7 @@ void next_unread_msg (GtkWidget *widget, gpointer user_data);
void previous_unread_msg (GtkWidget *widget, gpointer user_data);
void resend_msg (GtkWidget *widget, gpointer user_data);
void search_msg (GtkWidget *widget, gpointer user_data);
+void load_images (GtkWidget *widget, gpointer user_data);
void select_all (BonoboUIComponent *uih, void *user_data, const char *path);
void invert_selection (BonoboUIComponent *uih, void *user_data, const char *path);
diff --git a/mail/mail-config.c b/mail/mail-config.c
index bead41108f..8da0a17c3c 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -51,7 +51,6 @@
typedef struct {
gboolean thread_list;
- gboolean view_source;
gboolean hide_deleted;
gint paned_size;
gboolean send_html;
@@ -68,6 +67,7 @@ typedef struct {
MailConfigHTTPMode http_mode;
MailConfigForwardStyle default_forward_style;
+ MailConfigDisplayStyle message_display_style;
} MailConfig;
static const char GCONFPATH[] = "/apps/Evolution/Mail";
@@ -690,18 +690,6 @@ mail_config_set_thread_list (gboolean value)
}
gboolean
-mail_config_get_view_source (void)
-{
- return config->view_source;
-}
-
-void
-mail_config_set_view_source (gboolean value)
-{
- config->view_source = value;
-}
-
-gboolean
mail_config_get_hide_deleted (void)
{
return config->hide_deleted;
@@ -913,6 +901,18 @@ mail_config_set_default_forward_style (MailConfigForwardStyle style)
config->default_forward_style = style;
}
+MailConfigDisplayStyle
+mail_config_get_message_display_style (void)
+{
+ return config->message_display_style;
+}
+
+void
+mail_config_set_message_display_style (MailConfigDisplayStyle style)
+{
+ config->message_display_style = style;
+}
+
const MailConfigAccount *
mail_config_get_default_account (void)
{
diff --git a/mail/mail-config.h b/mail/mail-config.h
index 46b6e17035..cba1675838 100644
--- a/mail/mail-config.h
+++ b/mail/mail-config.h
@@ -61,14 +61,20 @@ typedef struct {
typedef enum {
MAIL_CONFIG_HTTP_NEVER, MAIL_CONFIG_HTTP_SOMETIMES,
- MAIL_CONFIG_HTTP_ALWAYS,
+ MAIL_CONFIG_HTTP_ALWAYS
} MailConfigHTTPMode;
typedef enum {
MAIL_CONFIG_FORWARD_ATTACHED, MAIL_CONFIG_FORWARD_INLINE,
- MAIL_CONFIG_FORWARD_QUOTED,
+ MAIL_CONFIG_FORWARD_QUOTED
} MailConfigForwardStyle;
+typedef enum {
+ MAIL_CONFIG_DISPLAY_NORMAL, MAIL_CONFIG_DISPLAY_FULL_HEADERS,
+ MAIL_CONFIG_DISPLAY_SOURCE,
+ MAIL_CONFIG_DISPLAY_MAX
+} MailConfigDisplayStyle;
+
/* Identities */
MailConfigIdentity *identity_copy (const MailConfigIdentity *id);
void identity_destroy (MailConfigIdentity *id);
@@ -95,9 +101,6 @@ gboolean mail_config_is_configured (void);
gboolean mail_config_get_thread_list (void);
void mail_config_set_thread_list (gboolean value);
-gboolean mail_config_get_view_source (void);
-void mail_config_set_view_source (gboolean value);
-
gboolean mail_config_get_hide_deleted (void);
void mail_config_set_hide_deleted (gboolean value);
@@ -131,6 +134,9 @@ void mail_config_set_http_mode (MailConfigHTTPMode);
MailConfigForwardStyle mail_config_get_default_forward_style (void);
void mail_config_set_default_forward_style (MailConfigForwardStyle);
+MailConfigDisplayStyle mail_config_get_message_display_style (void);
+void mail_config_set_message_display_style (MailConfigDisplayStyle);
+
const MailConfigAccount *mail_config_get_default_account (void);
const MailConfigAccount *mail_config_get_account_by_name (const char *account_name);
const MailConfigAccount *mail_config_get_account_by_source_url (const char *url);
diff --git a/mail/mail-display.c b/mail/mail-display.c
index 28701b566e..d1433622cb 100644
--- a/mail/mail-display.c
+++ b/mail/mail-display.c
@@ -37,13 +37,14 @@
#include <e-util/e-html-utils.h>
+#include "e-searching-tokenizer.h"
#include "mail-display.h"
#include "mail-config.h"
-#include "mail.h"
-#include "art/empty.xpm"
-
#include "mail-ops.h"
#include "mail-mt.h"
+#include "mail.h"
+
+#include "art/empty.xpm"
#define PARENT_TYPE (gtk_vbox_get_type ())
@@ -936,7 +937,8 @@ on_url_requested (GtkHTML *html, const char *url, GtkHTMLStream *handle,
/* See if it's something we can load. */
if (strncmp (url, "http:", 5) == 0 &&
- mail_config_get_http_mode () == MAIL_CONFIG_HTTP_ALWAYS) {
+ (mail_config_get_http_mode () == MAIL_CONFIG_HTTP_ALWAYS ||
+ g_datalist_get_data (md->data, "load_images"))) {
ba = g_byte_array_new ();
g_hash_table_insert (urls, g_strdup (url), ba);
mail_display_redisplay_when_loaded (md, ba, load_http, g_strdup (url));
@@ -1113,7 +1115,7 @@ mail_display_redisplay (MailDisplay *md, gboolean unscroll)
mail_html_write (md->html, md->stream, "%s%s", HTML_HEADER, "<BODY>\n");
if (md->current_message) {
- if (mail_config_get_view_source ())
+ if (mail_config_get_message_display_style () == MAIL_CONFIG_DISPLAY_SOURCE)
mail_format_raw_message (md->current_message, md);
else
mail_format_mime_message (md->current_message, md);
@@ -1156,6 +1158,18 @@ mail_display_set_message (MailDisplay *md, CamelMedium *medium)
}
}
+/**
+ * mail_display_load_images:
+ * @md: the mail display object
+ *
+ * Load all HTTP images in the current message
+ **/
+void
+mail_display_load_images (MailDisplay *md)
+{
+ g_datalist_set_data (md->data, "load_images", GINT_TO_POINTER (1));
+ mail_display_redisplay (md, FALSE);
+}
/*----------------------------------------------------------------------*
* Standard Gtk+ Class functions
diff --git a/mail/mail-display.h b/mail/mail-display.h
index 4f78e7cc1d..4e21e6db1c 100644
--- a/mail/mail-display.h
+++ b/mail/mail-display.h
@@ -50,8 +50,7 @@ void mail_display_redisplay_when_loaded (MailDisplay *md,
void mail_display_set_message (MailDisplay *mail_display,
CamelMedium *medium);
-void mail_display_toggle_raw (MailDisplay *mail_display,
- gboolean toggle);
+void mail_display_load_images (MailDisplay *mail_display);
#define HTML_HEADER "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 TRANSITIONAL//EN\">\n<HTML>\n<HEAD>\n<META NAME=\"GENERATOR\" CONTENT=\"Evolution Mail Component\">\n</HEAD>\n"