diff options
author | Matthew Barnes <mbarnes@src.gnome.org> | 2009-01-22 05:03:14 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@src.gnome.org> | 2009-01-22 05:03:14 +0800 |
commit | 3c7a575407bef757d434808904a4c4dc1ba60cb3 (patch) | |
tree | a8267e35e73894f0d8646b4d62e1df99e553572a /mail | |
parent | ab00f5b08adb1d74a0c70d935a32ffd982e86f34 (diff) | |
download | gsoc2013-evolution-3c7a575407bef757d434808904a4c4dc1ba60cb3.tar.gz gsoc2013-evolution-3c7a575407bef757d434808904a4c4dc1ba60cb3.tar.zst gsoc2013-evolution-3c7a575407bef757d434808904a4c4dc1ba60cb3.zip |
Fix some runtime warnings.
Copy that nasty message list scrolling hack to EMailShellContent.
Remember the scrollbar position for each folder. Now I just have to make
it select a message automatically.
svn path=/branches/kill-bonobo/; revision=37119
Diffstat (limited to 'mail')
-rw-r--r-- | mail/e-mail-reader-utils.c | 3 | ||||
-rw-r--r-- | mail/e-mail-reader.h | 6 | ||||
-rw-r--r-- | mail/e-mail-shell-content.c | 201 | ||||
-rw-r--r-- | mail/e-mail-shell-module.h | 4 | ||||
-rw-r--r-- | mail/em-composer-utils.c | 9 | ||||
-rw-r--r-- | mail/em-folder-browser.c | 196 | ||||
-rw-r--r-- | mail/em-folder-view.c | 50 | ||||
-rw-r--r-- | mail/em-format.c | 23 | ||||
-rw-r--r-- | mail/em-format.h | 3 | ||||
-rw-r--r-- | mail/em-utils.c | 4 |
10 files changed, 335 insertions, 164 deletions
diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c index 1aea3fa1c9..bfd1c28972 100644 --- a/mail/e-mail-reader-utils.c +++ b/mail/e-mail-reader-utils.c @@ -318,9 +318,6 @@ e_mail_reader_print (EMailReader *reader, html_print = em_format_html_print_new ( (EMFormatHTML *) html_display, action); - em_format_set_session ( - (EMFormat *) html_print, - ((EMFormat *) html_display)->session); em_format_merge_handler ( (EMFormat *) html_print, (EMFormat *) html_display); diff --git a/mail/e-mail-reader.h b/mail/e-mail-reader.h index 4ddf844b6a..5bacc1fb1b 100644 --- a/mail/e-mail-reader.h +++ b/mail/e-mail-reader.h @@ -34,9 +34,15 @@ #define E_MAIL_READER(obj) \ (G_TYPE_CHECK_INSTANCE_CAST \ ((obj), E_TYPE_MAIL_READER, EMailReader)) +#define E_MAIL_READER_IFACE(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_MAIL_READER, EMailReaderIface)) #define E_IS_MAIL_READER(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE \ ((obj), E_TYPE_MAIL_READER)) +#define E_IS_MAIL_READER_IFACE(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_MAIL_READER)) #define E_MAIL_READER_GET_IFACE(obj) \ (G_TYPE_INSTANCE_GET_INTERFACE \ ((obj), E_TYPE_MAIL_READER, EMailReaderIface)) diff --git a/mail/e-mail-shell-content.c b/mail/e-mail-shell-content.c index 747794b662..68eafa1f6c 100644 --- a/mail/e-mail-shell-content.c +++ b/mail/e-mail-shell-content.c @@ -48,7 +48,17 @@ struct _EMailShellContentPrivate { EMFormatHTMLDisplay *html_display; GalViewInstance *view_instance; + gchar *selected_uid; + + /* ETable scrolling hack */ + gdouble default_scrollbar_position; + guint paned_binding_id; + guint scroll_timeout_id; + + /* Signal handler IDs */ + guint message_list_built_id; + guint message_list_scrolled_id; guint preview_visible : 1; guint vertical_view : 1; @@ -63,6 +73,133 @@ enum { static gpointer parent_class; static void +mail_shell_content_etree_unfreeze (MessageList *message_list, + GdkEvent *event) +{ + ETableItem *item; + GObject *object; + + item = e_tree_get_item (message_list->tree); + object = G_OBJECT (((GnomeCanvasItem *) item)->canvas); + + g_object_set_data (object, "freeze-cursor", 0); +} + +static void +mail_shell_content_message_list_scrolled_cb (EMailShellContent *mail_shell_content, + MessageList *message_list) +{ + const gchar *key; + gdouble position; + gchar *value; + + /* Save the scrollbar position for the current folder. */ + + key = "evolution:list_scroll_position"; + position = message_list_get_scrollbar_position (message_list); + value = g_strdup_printf ("%f", position); + + if (camel_object_meta_set (message_list->folder, key, value)) + camel_object_state_write (message_list->folder); + + g_free (value); +} + +static gboolean +mail_shell_content_scroll_timeout_cb (EMailShellContent *mail_shell_content) +{ + EMailShellContentPrivate *priv = mail_shell_content->priv; + MessageList *message_list; + EMailReader *reader; + const gchar *key; + gdouble position; + gchar *value; + + /* Initialize the scrollbar position for the current folder + * and setup a callback to handle scrollbar position changes. */ + + reader = E_MAIL_READER (mail_shell_content); + message_list = e_mail_reader_get_message_list (reader); + position = priv->default_scrollbar_position; + + key = "evolution:list_scroll_position"; + value = camel_object_meta_get (message_list->folder, key); + + if (value != NULL) { + position = strtod (value, NULL); + g_free (value); + } + + message_list_set_scrollbar_position (message_list, position); + + priv->message_list_scrolled_id = g_signal_connect_swapped ( + message_list, "message-list-scrolled", + G_CALLBACK (mail_shell_content_message_list_scrolled_cb), + mail_shell_content); + + priv->scroll_timeout_id = 0; + + return FALSE; +} + +static void +mail_shell_content_message_list_built_cb (EMailShellContent *mail_shell_content, + MessageList *message_list) +{ + EMailShellContentPrivate *priv = mail_shell_content->priv; + GtkScrolledWindow *scrolled_window; + GtkWidget *vscrollbar; + gdouble position = 0.0; + + g_signal_handler_disconnect ( + message_list, priv->message_list_built_id); + priv->message_list_built_id = 0; + + if (message_list->cursor_uid == NULL && priv->selected_uid != NULL) { + CamelMessageInfo *info; + + /* If the message isn't in the folder yet, keep selected_uid + * around, as it could be caught by a set_folder() at some + * later date. */ + info = camel_folder_get_message_info ( + message_list->folder, priv->selected_uid); + if (info != NULL) { + camel_folder_free_message_info ( + message_list->folder, info); + e_mail_reader_set_message ( + E_MAIL_READER (mail_shell_content), + priv->selected_uid, TRUE); + g_free (priv->selected_uid); + priv->selected_uid = NULL; + } + + position = message_list_get_scrollbar_position (message_list); + } + + priv->default_scrollbar_position = position; + + /* FIXME This is a gross workaround for an ETable bug that I can't + * fix (Ximian bug #55303). + * + * Since e_canvas_item_region_show_relay() uses a timeout, + * we have to use a timeout of the same interval but a lower + * priority. */ + priv->scroll_timeout_id = g_timeout_add_full ( + G_PRIORITY_LOW, 250, (GSourceFunc) + mail_shell_content_scroll_timeout_cb, + mail_shell_content, NULL); + + /* FIXME This is another ugly hack to hide a side-effect of the + * previous workaround. */ + scrolled_window = GTK_SCROLLED_WINDOW (message_list); + vscrollbar = gtk_scrolled_window_get_vscrollbar (scrolled_window); + g_signal_connect_swapped ( + vscrollbar, "button-press-event", + G_CALLBACK (mail_shell_content_etree_unfreeze), + message_list); +} + +static void mail_shell_content_display_view_cb (EMailShellContent *mail_shell_content, GalView *gal_view) { @@ -78,6 +215,24 @@ mail_shell_content_display_view_cb (EMailShellContent *mail_shell_content, } static void +mail_shell_content_message_selected_cb (EMailShellContent *mail_shell_content, + const gchar *selected_uid, + MessageList *message_list) +{ + const gchar *key = "evolution:selected_uid"; + CamelFolder *folder; + + folder = message_list->folder; + g_return_if_fail (folder != NULL); + + if (camel_object_meta_set (folder, key, selected_uid)) + camel_object_state_write (folder); + + g_free (mail_shell_content->priv->selected_uid); + mail_shell_content->priv->selected_uid = NULL; +} + +static void mail_shell_content_set_property (GObject *object, guint property_id, const GValue *value, @@ -162,6 +317,8 @@ mail_shell_content_finalize (GObject *object) priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (object); + g_free (priv->selected_uid); + /* Chain up to parent's finalize() method. */ G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -173,6 +330,8 @@ mail_shell_content_constructed (GObject *object) EShellContent *shell_content; EShellView *shell_view; EShellViewClass *shell_view_class; + EMailReader *reader; + MessageList *message_list; GConfBridge *bridge; GtkWidget *container; GtkWidget *widget; @@ -224,7 +383,7 @@ mail_shell_content_constructed (GObject *object) /* Load the view instance. */ e_mail_shell_content_update_view_instance ( - E_MAIL_SHELL_CONTENT (object)); + E_MAIL_SHELL_CONTENT (shell_content)); /* Bind GObject properties to GConf keys. */ @@ -233,6 +392,16 @@ mail_shell_content_constructed (GObject *object) object = G_OBJECT (priv->paned); key = "/apps/evolution/mail/display/paned_size"; gconf_bridge_bind_property_delayed (bridge, key, object, "position"); + + /* Message list customizations. */ + + reader = E_MAIL_READER (shell_content); + message_list = e_mail_reader_get_message_list (reader); + + g_signal_connect_swapped ( + message_list, "message-selected", + G_CALLBACK (mail_shell_content_message_selected_cb), + shell_content); } static guint32 @@ -309,6 +478,35 @@ mail_shell_content_get_window (EMailReader *reader) } static void +mail_shell_content_set_folder (EMailReader *reader, + CamelFolder *folder, + const gchar *folder_uri) +{ + EMailShellContentPrivate *priv; + EMailReaderIface *default_iface; + MessageList *message_list; + + priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (reader); + + message_list = e_mail_reader_get_message_list (reader); + + message_list_freeze (message_list); + + /* Chain up to interface's default set_folder() method. */ + default_iface = g_type_default_interface_peek (E_TYPE_MAIL_READER); + default_iface->set_folder (reader, folder, folder_uri); + + /* This is a one-time-only callback. */ + if (message_list->cursor_uid == NULL && priv->message_list_built_id == 0) + priv->message_list_built_id = g_signal_connect_swapped ( + message_list, "message-list-built", + G_CALLBACK (mail_shell_content_message_list_built_cb), + reader); + + message_list_thaw (message_list); +} + +static void mail_shell_content_class_init (EMailShellContentClass *class) { GObjectClass *object_class; @@ -358,6 +556,7 @@ mail_shell_content_iface_init (EMailReaderIface *iface) iface->get_message_list = mail_shell_content_get_message_list; iface->get_shell_module = mail_shell_content_get_shell_module; iface->get_window = mail_shell_content_get_window; + iface->set_folder = mail_shell_content_set_folder; } static void diff --git a/mail/e-mail-shell-module.h b/mail/e-mail-shell-module.h index d27e35f7d4..de19861ac6 100644 --- a/mail/e-mail-shell-module.h +++ b/mail/e-mail-shell-module.h @@ -33,8 +33,8 @@ G_BEGIN_DECLS /* Globally available shell module. * - * XXX I don't like having this globally available but passing it around to - * all the various utilities that need to access to the module's data + * XXX I don't like having this globally available but passing it around + * to all the various utilities that need to access the module's data * directory and local folders is too much of a pain for now. */ extern EShellModule *mail_shell_module; diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c index 75a237c472..bf94aed15a 100644 --- a/mail/em-composer-utils.c +++ b/mail/em-composer-utils.c @@ -1647,7 +1647,7 @@ em_utils_forward_message_raw (CamelFolder *folder, CamelMimeMessage *message, co g_free (subject); /* and send it */ - out_folder = mail_component_get_folder (NULL, MAIL_COMPONENT_FOLDER_OUTBOX); + out_folder = e_mail_shell_module_get_folder (mail_shell_module, E_MAIL_FOLDER_OUTBOX); info = camel_message_info_new (NULL); camel_message_info_set_flags (info, CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN); mail_append_mail (out_folder, forward, info, emu_forward_raw_done, NULL); @@ -2523,6 +2523,8 @@ em_utils_post_reply_to_message_by_uid (CamelFolder *folder, const char *uid) void em_configure_new_composer (EMsgComposer *composer) { + EComposerHeaderTable *table; + EMFolderTreeModel *model; struct emcs_t *emcs; g_return_if_fail (E_IS_MSG_COMPOSER (composer)); @@ -2541,5 +2543,8 @@ em_configure_new_composer (EMsgComposer *composer) composer, "save-draft", G_CALLBACK (em_utils_composer_save_draft_cb), NULL); - g_debug ("Composer configured."); + /* Supply the composer with a folder tree model. */ + table = e_msg_composer_get_header_table (composer); + model = e_mail_shell_module_get_folder_tree_model (mail_shell_module); + e_composer_header_table_set_folder_tree_model (table, model); } diff --git a/mail/em-folder-browser.c b/mail/em-folder-browser.c index 9f53ae43c0..705e87269d 100644 --- a/mail/em-folder-browser.c +++ b/mail/em-folder-browser.c @@ -539,16 +539,16 @@ emfb_init(GObject *o) } -static void -emfb_finalise(GObject *o) -{ - EMFolderBrowser *emfb = (EMFolderBrowser *)o; - - g_free (emfb->priv->select_uid); - g_free (emfb->priv); - - ((GObjectClass *)emfb_parent)->finalize(o); -} +//static void +//emfb_finalise(GObject *o) +//{ +// EMFolderBrowser *emfb = (EMFolderBrowser *)o; +// +// g_free (emfb->priv->select_uid); +// g_free (emfb->priv); +// +// ((GObjectClass *)emfb_parent)->finalize(o); +//} static void emfb_destroy(GtkObject *o) @@ -1351,44 +1351,44 @@ emfb_hide_deleted(BonoboUIComponent *uic, const char *path, Bonobo_UIComponent_E em_folder_view_set_hide_deleted(emfv, state[0] != '0'); } -static void -emfb_list_scrolled (MessageList *ml, EMFolderBrowser *emfb) -{ - EMFolderView *emfv = (EMFolderView *) emfb; - double position; - char *state; - - position = message_list_get_scrollbar_position (ml); - state = g_strdup_printf ("%f", position); - - if (camel_object_meta_set (emfv->folder, "evolution:list_scroll_position", state)) - camel_object_state_write (emfv->folder); - - g_free (state); -} - -static gboolean -scroll_idle_cb (EMFolderBrowser *emfb) -{ - EMFolderView *emfv = (EMFolderView *) emfb; - double position; - char *state; - - if ((state = camel_object_meta_get (emfv->folder, "evolution:list_scroll_position"))) { - position = strtod (state, NULL); - g_free (state); - } else { - position = emfb->priv->default_scroll_position; - } - - message_list_set_scrollbar_position (emfv->list, position); - - emfb->priv->list_scrolled_id = g_signal_connect (emfv->list, "message_list_scrolled", G_CALLBACK (emfb_list_scrolled), emfb); - - emfb->priv->idle_scroll_id = 0; - - return FALSE; -} +//static void +//emfb_list_scrolled (MessageList *ml, EMFolderBrowser *emfb) +//{ +// EMFolderView *emfv = (EMFolderView *) emfb; +// double position; +// char *state; +// +// position = message_list_get_scrollbar_position (ml); +// state = g_strdup_printf ("%f", position); +// +// if (camel_object_meta_set (emfv->folder, "evolution:list_scroll_position", state)) +// camel_object_state_write (emfv->folder); +// +// g_free (state); +//} + +//static gboolean +//scroll_idle_cb (EMFolderBrowser *emfb) +//{ +// EMFolderView *emfv = (EMFolderView *) emfb; +// double position; +// char *state; +// +// if ((state = camel_object_meta_get (emfv->folder, "evolution:list_scroll_position"))) { +// position = strtod (state, NULL); +// g_free (state); +// } else { +// position = emfb->priv->default_scroll_position; +// } +// +// message_list_set_scrollbar_position (emfv->list, position); +// +// emfb->priv->list_scrolled_id = g_signal_connect (emfv->list, "message_list_scrolled", G_CALLBACK (emfb_list_scrolled), emfb); +// +// emfb->priv->idle_scroll_id = 0; +// +// return FALSE; +//} static void emfb_gui_folder_changed(CamelFolder *folder, void *dummy, EMFolderBrowser *emfb) @@ -1415,60 +1415,60 @@ emfb_folder_changed(CamelFolder *folder, CamelFolderChangeInfo *changes, EMFolde mail_async_event_emit(emfb->view.async, MAIL_ASYNC_GUI, (MailAsyncFunc)emfb_gui_folder_changed, folder, NULL, emfb); } -static void -emfb_etree_unfreeze (GtkWidget *widget, GdkEvent *event, EMFolderView *emfv) -{ - - ETableItem *item = e_tree_get_item (emfv->list->tree); - - g_object_set_data (G_OBJECT (((GnomeCanvasItem *) item)->canvas), "freeze-cursor", 0); -} +//static void +//emfb_etree_unfreeze (GtkWidget *widget, GdkEvent *event, EMFolderView *emfv) +//{ +// +// ETableItem *item = e_tree_get_item (emfv->list->tree); +// +// g_object_set_data (G_OBJECT (((GnomeCanvasItem *) item)->canvas), "freeze-cursor", 0); +//} /* TODO: This should probably be handled by message-list, by storing/queueing up the select operation if its busy rebuilding the message-list */ -static void -emfb_list_built (MessageList *ml, EMFolderBrowser *emfb) -{ - EMFolderView *emfv = (EMFolderView *) emfb; - double position = 0.0f; - - g_signal_handler_disconnect (ml, emfb->priv->list_built_id); - emfb->priv->list_built_id = 0; - - if (emfv->list->cursor_uid == NULL) { - if (emfb->priv->select_uid) { - CamelMessageInfo *mi; - - /* If the message isn't in the folder yet, keep select_uid around, it could be caught by - folder_changed, at some later date */ - mi = camel_folder_get_message_info(emfv->folder, emfb->priv->select_uid); - if (mi) { - camel_folder_free_message_info(emfv->folder, mi); - em_folder_view_set_message(emfv, emfb->priv->select_uid, TRUE); - g_free (emfb->priv->select_uid); - emfb->priv->select_uid = NULL; - } - - /* change the default to the current position */ - position = message_list_get_scrollbar_position (ml); - } else { - /* NOTE: not all users want this, so we need a preference for it perhaps? see bug #52887 */ - /* FIXME: if the 1st message in the list is unread, this will actually select the second unread msg */ - /*message_list_select (ml, MESSAGE_LIST_SELECT_NEXT, 0, CAMEL_MESSAGE_SEEN, TRUE);*/ - } - } - - emfb->priv->default_scroll_position = position; - - /* FIXME: this is a gross workaround for an etable bug that I can't fix - bug #55303 */ - /* this needs to be a lower priority than anything in e-table-item/e-canvas, since - * e_canvas_item_region_show_relay() uses a timeout, we have to use a timeout of the - * same interval but a lower priority. */ - emfb->priv->idle_scroll_id = g_timeout_add_full (G_PRIORITY_LOW, 250, (GSourceFunc) scroll_idle_cb, emfb, NULL); - /* FIXME: This is another ugly hack done to hide a bug that above hack leaves. */ - g_signal_connect (((GtkScrolledWindow *) ml)->vscrollbar, "button-press-event", G_CALLBACK (emfb_etree_unfreeze), emfb); -} +//static void +//emfb_list_built (MessageList *ml, EMFolderBrowser *emfb) +//{ +// EMFolderView *emfv = (EMFolderView *) emfb; +// double position = 0.0f; +// +// g_signal_handler_disconnect (ml, emfb->priv->list_built_id); +// emfb->priv->list_built_id = 0; +// +// if (emfv->list->cursor_uid == NULL) { +// if (emfb->priv->select_uid) { +// CamelMessageInfo *mi; +// +// /* If the message isn't in the folder yet, keep select_uid around, it could be caught by +// folder_changed, at some later date */ +// mi = camel_folder_get_message_info(emfv->folder, emfb->priv->select_uid); +// if (mi) { +// camel_folder_free_message_info(emfv->folder, mi); +// em_folder_view_set_message(emfv, emfb->priv->select_uid, TRUE); +// g_free (emfb->priv->select_uid); +// emfb->priv->select_uid = NULL; +// } +// +// /* change the default to the current position */ +// position = message_list_get_scrollbar_position (ml); +// } else { +// /* NOTE: not all users want this, so we need a preference for it perhaps? see bug #52887 */ +// /* FIXME: if the 1st message in the list is unread, this will actually select the second unread msg */ +// /*message_list_select (ml, MESSAGE_LIST_SELECT_NEXT, 0, CAMEL_MESSAGE_SEEN, TRUE);*/ +// } +// } +// +// emfb->priv->default_scroll_position = position; +// +// /* FIXME: this is a gross workaround for an etable bug that I can't fix - bug #55303 */ +// /* this needs to be a lower priority than anything in e-table-item/e-canvas, since +// * e_canvas_item_region_show_relay() uses a timeout, we have to use a timeout of the +// * same interval but a lower priority. */ +// emfb->priv->idle_scroll_id = g_timeout_add_full (G_PRIORITY_LOW, 250, (GSourceFunc) scroll_idle_cb, emfb, NULL); +// /* FIXME: This is another ugly hack done to hide a bug that above hack leaves. */ +// g_signal_connect (((GtkScrolledWindow *) ml)->vscrollbar, "button-press-event", G_CALLBACK (emfb_etree_unfreeze), emfb); +//} static void emfb_set_search_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri) diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c index 4d94ec3309..ef07a650f5 100644 --- a/mail/em-folder-view.c +++ b/mail/em-folder-view.c @@ -203,13 +203,13 @@ static guint signals[LAST_SIGNAL]; static void emfv_selection_get(GtkWidget *widget, GtkSelectionData *data, guint info, guint time_stamp, EMFolderView *emfv); static void emfv_selection_clear_event(GtkWidget *widget, GdkEventSelection *event, EMFolderView *emfv); -#ifdef ENABLE_PROFILING -static void -emfv_format_complete(EMFormat *emf, EMFolderView *emfv) -{ - e_profile_event_emit("goto.done", emf->uid?emf->uid:"", 0); -} -#endif +//#ifdef ENABLE_PROFILING +//static void +//emfv_format_complete(EMFormat *emf, EMFolderView *emfv) +//{ +// e_profile_event_emit("goto.done", emf->uid?emf->uid:"", 0); +//} +//#endif static void emfv_init(GObject *o) @@ -237,23 +237,23 @@ emfv_init(GObject *o) // emfv->list = (MessageList *)message_list_new(); // g_signal_connect(emfv->list, "message_selected", G_CALLBACK(emfv_list_message_selected), emfv); // g_signal_connect(emfv->list, "message_list_built", G_CALLBACK(emfv_list_built), emfv); - - /* FIXME: should this hang off message-list instead? */ +// +// /* FIXME: should this hang off message-list instead? */ // g_signal_connect(emfv->list->tree, "right_click", G_CALLBACK(emfv_list_right_click), emfv); // g_signal_connect(emfv->list->tree, "double_click", G_CALLBACK(emfv_list_double_click), emfv); // g_signal_connect(emfv->list->tree, "key_press", G_CALLBACK(emfv_list_key_press), emfv); // g_signal_connect(emfv->list->tree, "selection_change", G_CALLBACK(emfv_list_selection_change), emfv); - - emfv->preview = (EMFormatHTMLDisplay *)em_format_html_display_new(); - /* FIXME: set_session should NOT be called here. Should it be a constructor attribute? */ - em_format_set_session ((EMFormat *) emfv->preview, session); +// +// emfv->preview = (EMFormatHTMLDisplay *)em_format_html_display_new(); +// /* FIXME: set_session should NOT be called here. Should it be a constructor attribute? */ +// em_format_set_session ((EMFormat *) emfv->preview, session); // g_signal_connect(emfv->preview, "link_clicked", G_CALLBACK(emfv_format_link_clicked), emfv); g_signal_connect(emfv->preview, "popup_event", G_CALLBACK(emfv_format_popup_event), emfv); g_signal_connect (emfv->preview, "on_url", G_CALLBACK (emfv_on_url_cb), emfv); // g_signal_connect (((EMFormatHTML *)emfv->preview)->html, "button-release-event", G_CALLBACK (emfv_on_html_button_released_cb), emfv); -#ifdef ENABLE_PROFILING - g_signal_connect(emfv->preview, "complete", G_CALLBACK (emfv_format_complete), emfv); -#endif +//#ifdef ENABLE_PROFILING +// g_signal_connect(emfv->preview, "complete", G_CALLBACK (emfv_format_complete), emfv); +//#endif p->invisible = gtk_invisible_new(); g_signal_connect(p->invisible, "selection_get", G_CALLBACK(emfv_selection_get), emfv); g_signal_connect(p->invisible, "selection_clear_event", G_CALLBACK(emfv_selection_clear_event), emfv); @@ -418,8 +418,8 @@ emfv_class_init(GObjectClass *klass) // return (GtkWidget *)emfv; //} -/* flag all selected messages. Return number flagged */ -/* FIXME: Should this be part of message-list instead? */ +///* flag all selected messages. Return number flagged */ +///* FIXME: Should this be part of message-list instead? */ //int //em_folder_view_mark_selected(EMFolderView *emfv, guint32 mask, guint32 set) //{ @@ -812,28 +812,14 @@ emfv_popup_label_new (EPopup *ep, EPopupItem *pitem, void *data) static EPopupItem emfv_popup_items[] = { - { E_POPUP_BAR, "10.emfv", NULL, NULL, NULL, NULL }, - - - { E_POPUP_BAR, "20.emfv", NULL, NULL, NULL, NULL }, - - { E_POPUP_BAR, "40.emfv", NULL, NULL, NULL, NULL }, // { E_POPUP_ITEM, "40.emfv.00", N_("_Delete"), emfv_popup_delete, NULL, "edit-delete", EM_POPUP_SELECT_DELETE|EM_FOLDER_VIEW_SELECT_LISTONLY }, - { E_POPUP_BAR, "50.emfv", NULL, NULL, NULL, NULL }, - { E_POPUP_SUBMENU, "60.label.00", N_("_Label"), NULL, NULL, NULL, EM_POPUP_SELECT_MANY|EM_FOLDER_VIEW_SELECT_LISTONLY }, { E_POPUP_ITEM, "60.label.00/00.label", N_("_None"), emfv_popup_label_clear, NULL, NULL, EM_POPUP_SELECT_MANY|EM_FOLDER_VIEW_SELECT_LISTONLY }, { E_POPUP_BAR, "60.label.00/00.label.00", NULL, NULL, NULL, NULL }, { E_POPUP_BAR, "60.label.00/01.label", NULL, NULL, NULL, NULL }, { E_POPUP_ITEM, "60.label.00/01.label.00", N_("_New Label"), emfv_popup_label_new, NULL, NULL, EM_POPUP_SELECT_MANY|EM_FOLDER_VIEW_SELECT_LISTONLY }, - { E_POPUP_BAR, "70.emfv.06", NULL, NULL, NULL, NULL }, - - - { E_POPUP_BAR, "90.filter", NULL, NULL, NULL, NULL }, - - { E_POPUP_BAR, "90.filter.00/10", NULL, NULL, NULL, NULL }, }; static enum _e_popup_t diff --git a/mail/em-format.c b/mail/em-format.c index 4af272a3ff..ef08d206ff 100644 --- a/mail/em-format.c +++ b/mail/em-format.c @@ -53,6 +53,7 @@ #include "em-format.h" #include "em-utils.h" #include "mail-config.h" +#include "mail-session.h" #define d(x) @@ -125,6 +126,9 @@ emf_init(GObject *o) e_dlist_init(&emf->header_list); em_format_default_headers(emf); emf->part_id = g_string_new(""); + + emf->session = session; + camel_object_ref (emf->session); } static void @@ -774,25 +778,6 @@ emf_busy(EMFormat *emf) /* e_format_format_clone is a macro */ /** - * em_format_set_session: - * @emf: - * @s: - * - * Set the CamelSession to be used for signature verification and decryption - * purposes. If this is not set, then signatures cannot be verified or - * encrypted messages viewed. - **/ -void -em_format_set_session(EMFormat *emf, struct _CamelSession *s) -{ - if (s) - camel_object_ref(s); - if (emf->session) - camel_object_unref(emf->session); - emf->session = s; -} - -/** * em_format_set_mode: * @emf: * @type: diff --git a/mail/em-format.h b/mail/em-format.h index 7d4b00b903..dae97d5b5b 100644 --- a/mail/em-format.h +++ b/mail/em-format.h @@ -269,9 +269,6 @@ struct _EMFormatClass { void (*complete)(EMFormat *); }; -/* helper entry point */ -void em_format_set_session(EMFormat *emf, struct _CamelSession *s); - void em_format_set_mode(EMFormat *emf, em_format_mode_t type); void em_format_set_charset(EMFormat *emf, const char *charset); void em_format_set_default_charset(EMFormat *emf, const char *charset); diff --git a/mail/em-utils.c b/mail/em-utils.c index 8dbadea15b..af53b3df69 100644 --- a/mail/em-utils.c +++ b/mail/em-utils.c @@ -83,8 +83,6 @@ static void emu_save_part_done (CamelMimePart *part, char *name, int done, void *data); -extern struct _CamelSession *session; - #define d(x) /** @@ -1685,7 +1683,6 @@ em_utils_part_to_html(CamelMimePart *part, ssize_t *len, EMFormat *source) emfq = em_format_quote_new(NULL, (CamelStream *)mem, 0); ((EMFormat *) emfq)->composer = TRUE; - em_format_set_session((EMFormat *)emfq, session); if (source) { /* copy over things we can, other things are internal, perhaps need different api than 'clone' */ if (source->default_charset) @@ -1735,7 +1732,6 @@ em_utils_message_to_html(CamelMimeMessage *message, const char *credits, guint32 emfq = em_format_quote_new(credits, (CamelStream *)mem, flags); ((EMFormat *) emfq)->composer = TRUE; - em_format_set_session((EMFormat *)emfq, session); if (!source) { GConfClient *gconf; |