From e0610b2e0cea191f631dc825cdc8023cdcd9433d Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 11 Jan 2009 14:20:50 +0000 Subject: Continue chipping away at EMFolderView and EMFolderBrowser. Migrate from gnome_url_show() to e_show_uri(). svn path=/branches/kill-bonobo/; revision=37038 --- mail/Makefile.am | 2 - mail/e-mail-browser.c | 2 + mail/e-mail-reader.c | 324 +++++++++++++++- mail/e-mail-reader.h | 1 + mail/e-mail-shell-content.c | 113 ++---- mail/e-mail-shell-content.h | 8 - mail/e-mail-shell-module.c | 2 - mail/e-mail-shell-view-actions.c | 175 +++------ mail/e-mail-shell-view-private.c | 101 +++-- mail/em-config.c | 2 - mail/em-folder-view.c | 805 +++++++++++++++++++-------------------- mail/em-menu.c | 2 - mail/em-popup.c | 10 +- 13 files changed, 845 insertions(+), 702 deletions(-) (limited to 'mail') diff --git a/mail/Makefile.am b/mail/Makefile.am index 1ce0ae79ad..2139df572c 100644 --- a/mail/Makefile.am +++ b/mail/Makefile.am @@ -93,8 +93,6 @@ libevolution_module_mail_la_SOURCES = \ em-folder-tree.h \ em-folder-tree-model.c \ em-folder-tree-model.h \ - em-folder-view.c \ - em-folder-view.h \ em-folder-utils.c \ em-folder-utils.h \ em-format.c \ diff --git a/mail/e-mail-browser.c b/mail/e-mail-browser.c index e6c1072304..ad736236cf 100644 --- a/mail/e-mail-browser.c +++ b/mail/e-mail-browser.c @@ -424,6 +424,8 @@ mail_browser_get_action_group (EMailReader *reader) static gboolean mail_browser_get_hide_deleted (EMailReader *reader) { + /* FIXME */ + return FALSE; } static EMFormatHTMLDisplay * diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c index bdf9ec84b0..7260dcd47e 100644 --- a/mail/e-mail-reader.c +++ b/mail/e-mail-reader.c @@ -35,6 +35,7 @@ #include "shell/e-shell.h" #include "widgets/misc/e-charset-picker.h" +#include "mail/e-mail-browser.h" #include "mail/e-mail-reader-utils.h" #include "mail/e-mail-shell-module.h" #include "mail/em-composer-utils.h" @@ -45,9 +46,17 @@ #include "mail/mail-autofilter.h" #include "mail/mail-ops.h" +enum { + CHANGED, + FOLDER_LOADED, + LAST_SIGNAL +}; + /* Remembers the previously selected folder when transferring messages. */ static gchar *default_xfer_messages_uri; +static guint signals[LAST_SIGNAL]; + static void action_mail_add_sender_cb (GtkAction *action, EMailReader *reader) @@ -862,7 +871,22 @@ static void action_mail_select_all_cb (GtkAction *action, EMailReader *reader) { - /* FIXME */ + EMFormatHTMLDisplay *html_display; + GtkActionGroup *action_group; + GtkHTML *html; + const gchar *action_name; + gboolean selection_active; + + html_display = e_mail_reader_get_html_display (reader); + html = ((EMFormatHTML *) html_display)->html; + + gtk_html_select_all (html); + + action_name = "mail-clipboard-copy"; + action_group = e_mail_reader_get_action_group (reader); + action = gtk_action_group_get_action (action_group, action_name); + selection_active = gtk_html_command (html, "is-selection-active"); + gtk_action_set_sensitive (action, selection_active); } static void @@ -886,7 +910,32 @@ static void action_mail_show_source_cb (GtkAction *action, EMailReader *reader) { - /* FIXME */ + EMFormatHTMLDisplay *html_display; + EShellModule *shell_module; + MessageList *message_list; + CamelFolder *folder; + GtkWidget *browser; + GPtrArray *uids; + const gchar *folder_uri; + + message_list = e_mail_reader_get_message_list (reader); + shell_module = e_mail_reader_get_shell_module (reader); + + folder = message_list->folder; + folder_uri = message_list->folder_uri; + uids = message_list_get_selected (message_list); + g_return_if_fail (uids->len > 0); + + /* FIXME Set session. */ + browser = e_mail_browser_new (shell_module); + reader = E_MAIL_READER (browser); + html_display = e_mail_reader_get_html_display (reader); + em_format_set_mode ((EMFormat *) html_display, EM_FORMAT_SOURCE); + e_mail_reader_set_folder (reader, folder, folder_uri); + e_mail_reader_set_message (reader, uids->pdata[0], FALSE); + gtk_widget_show (browser); + + message_list_free_uids (message_list, uids); } static void @@ -933,6 +982,46 @@ action_mail_undelete_cb (GtkAction *action, e_mail_reader_mark_selected (reader, mask, set); } +static void +action_mail_uri_call_to_cb (GtkAction *action, + EMailReader *reader) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_uri_copy_cb (GtkAction *action, + EMailReader *reader) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_uri_copy_address_cb (GtkAction *action, + EMailReader *reader) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_uri_to_search_folder_recipient_cb (GtkAction *action, + EMailReader *reader) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_uri_to_search_folder_sender_cb (GtkAction *action, + EMailReader *reader) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + static void action_mail_zoom_100_cb (GtkAction *action, EMailReader *reader) @@ -991,7 +1080,7 @@ static GtkActionEntry mail_reader_entries[] = { { "mail-copy", "mail-copy", - N_("_Copy to Folder"), + N_("_Copy to Folder..."), "y", N_("Copy selected messages to another folder"), G_CALLBACK (action_mail_copy_cb) }, @@ -1173,7 +1262,7 @@ static GtkActionEntry mail_reader_entries[] = { { "mail-move", "mail-move", - N_("_Move to Folder"), + N_("_Move to Folder..."), "v", N_("Move selected messages to another folder"), G_CALLBACK (action_mail_move_cb) }, @@ -1339,6 +1428,41 @@ static GtkActionEntry mail_reader_entries[] = { N_("Undelete the selected messages"), G_CALLBACK (action_mail_undelete_cb) }, + { "mail-uri-call-to", + NULL, + N_("C_all To..."), + NULL, + NULL, /* XXX Add a tooltip! */ + G_CALLBACK (action_mail_uri_call_to_cb) }, + + { "mail-uri-copy", + NULL, + N_("_Copy Link Location"), + NULL, + NULL, /* XXX Add a tooltip! */ + G_CALLBACK (action_mail_uri_copy_cb) }, + + { "mail-uri-copy-address", + GTK_STOCK_COPY, + N_("Copy _Email Address"), + NULL, + NULL, /* XXX Add a tooltip! */ + G_CALLBACK (action_mail_uri_copy_address_cb) }, + + { "mail-uri-to-search-folder-recipient", + NULL, + N_("_To This Address"), + NULL, + NULL, /* XXX Add a tooltip! */ + G_CALLBACK (action_mail_uri_to_search_folder_recipient_cb) }, + + { "mail-uri-to-search-folder-sender", + NULL, + N_("_From This Address"), + NULL, + NULL, /* XXX Add a tooltip! */ + G_CALLBACK (action_mail_uri_to_search_folder_sender_cb) }, + { "mail-zoom-100", GTK_STOCK_ZOOM_100, N_("_Normal Size"), @@ -1360,6 +1484,57 @@ static GtkActionEntry mail_reader_entries[] = { N_("Decrease the text size"), G_CALLBACK (action_mail_zoom_out_cb) }, + /*** Popup Menu Variations ***/ + + { "mail-popup-flag-for-followup", + "stock_mail-flag-for-followup", + N_("Mark for Follo_w Up..."), + NULL, + N_("Flag the selected messages for follow-up"), + G_CALLBACK (action_mail_flag_for_followup_cb) }, + + { "mail-popup-mark-important", + "mail-mark-important", + N_("Mark as _Important"), + NULL, + N_("Mark the selected messages as important"), + G_CALLBACK (action_mail_mark_important_cb) }, + + { "mail-popup-mark-junk", + "mail-mark-junk", + N_("Mark as _Junk"), + NULL, + N_("Mark the selected messages as junk"), + G_CALLBACK (action_mail_mark_junk_cb) }, + + { "mail-popup-mark-notjunk", + "mail-mark-notjunk", + N_("Mark as _Not Junk"), + NULL, + N_("Mark the selected messages as not being junk"), + G_CALLBACK (action_mail_mark_notjunk_cb) }, + + { "mail-popup-mark-read", + "mail-mark-read", + N_("Mark as _Read"), + NULL, + N_("Mark the selected messages as having been read"), + G_CALLBACK (action_mail_mark_read_cb) }, + + { "mail-popup-mark-unimportant", + NULL, + N_("Mark as Uni_mportant"), + NULL, + N_("Mark the selected message as unimportant"), + G_CALLBACK (action_mail_mark_unimportant_cb) }, + + { "mail-popup-mark-unread", + "mail-mark-unread", + N_("Mark as _Unread"), + NULL, + N_("Mark the selected messages as not having been read"), + G_CALLBACK (action_mail_mark_unread_cb) }, + /*** Menus ***/ { "mail-create-rule-menu", @@ -1390,6 +1565,13 @@ static GtkActionEntry mail_reader_entries[] = { NULL, NULL }, + { "mail-label-menu", + NULL, + N_("_Label"), + NULL, + NULL, + NULL }, + { "mail-mark-as-menu", NULL, N_("Mar_k As"), @@ -1404,6 +1586,13 @@ static GtkActionEntry mail_reader_entries[] = { NULL, NULL }, + { "mail-uri-to-search-folder-menu", + NULL, + N_("Create _Search Folder"), + NULL, + NULL, + NULL }, + { "mail-zoom-menu", NULL, N_("_Zoom"), @@ -1431,6 +1620,59 @@ static GtkToggleActionEntry mail_reader_toggle_entries[] = { FALSE } }; +static void +mail_reader_link_clicked_cb (EMailReader *reader, + const gchar *uri, + EMFormatHTMLDisplay *html_display) +{ + GtkHTML *html; + GtkWindow *window; + MessageList *message_list; + const gchar *folder_uri; + + html = ((EMFormatHTML *) html_display)->html; + message_list = e_mail_reader_get_message_list (reader); + window = e_mail_reader_get_window (reader); + folder_uri = message_list->folder_uri; + + if (g_str_has_prefix (uri, "##")) + return; + + if (g_ascii_strncasecmp (uri, "mailto:", 7) == 0) + em_utils_compose_new_message_with_mailto (uri, folder_uri); + + else if (*uri == '#') + gtk_html_jump_to_anchor (html, uri + 1); + + else if (g_ascii_strncasecmp (uri, "thismessage:", 12) == 0) + /* ignore */ ; + + else if (g_ascii_strncasecmp (uri, "cid:", 4) == 0) + /* ignore */ ; + + else + e_show_uri (window, uri); +} + +static gboolean +mail_reader_html_button_release_event_cb (EMailReader *reader, + GdkEventButton *button, + GtkHTML *html) +{ + GtkActionGroup *action_group; + GtkAction *action; + const gchar *action_name; + gboolean selection_active; + + action_name = "mail-clipboard-copy"; + action_group = e_mail_reader_get_action_group (reader); + action = gtk_action_group_get_action (action_group, action_name); + selection_active = gtk_html_command (html, "is-selection-active"); + gtk_action_set_sensitive (action, selection_active); + + return FALSE; +} + static void mail_reader_double_click_cb (EMailReader *reader, gint row, @@ -1529,10 +1771,12 @@ mail_reader_message_read_cb (EMailReader *reader) message_list = e_mail_reader_get_message_list (reader); uid = g_object_get_data (G_OBJECT (reader), "mark-read-uid"); - g_return_if_fail (uid != NULL); + g_return_val_if_fail (uid != NULL, FALSE); if (g_strcmp0 (message_list->cursor_uid, uid) == 0) e_mail_reader_mark_as_read (reader, uid); + + return FALSE; } static void @@ -1675,6 +1919,14 @@ mail_reader_message_selected_cb (EMailReader *reader, data = GUINT_TO_POINTER (source_id); g_object_set_data (G_OBJECT (reader), key, data); + + e_mail_reader_changed (reader); +} + +static void +mail_reader_emit_folder_loaded (EMailReader *reader) +{ + g_signal_emit (reader, signals[FOLDER_LOADED], 0); } static void @@ -1698,6 +1950,8 @@ mail_reader_set_folder (EMailReader *reader, em_format_format ((EMFormat *) html_display, NULL, NULL, NULL); message_list_set_folder (message_list, folder, folder_uri, outgoing); + + mail_reader_emit_folder_loaded (reader); } static void @@ -1745,6 +1999,22 @@ mail_reader_class_init (EMailReaderIface *iface) { iface->set_folder = mail_reader_set_folder; iface->set_message = mail_reader_set_message; + + signals[CHANGED] = g_signal_new ( + "changed", + G_OBJECT_CLASS_TYPE (iface), + G_SIGNAL_RUN_FIRST, + 0, NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + signals[FOLDER_LOADED] = g_signal_new ( + "folder-loaded", + G_OBJECT_CLASS_TYPE (iface), + G_SIGNAL_RUN_FIRST, + 0, NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); } GType @@ -1778,8 +2048,9 @@ e_mail_reader_get_type (void) void e_mail_reader_init (EMailReader *reader) { - MessageList *message_list; + EMFormatHTMLDisplay *html_display; GtkActionGroup *action_group; + MessageList *message_list; GConfBridge *bridge; GtkAction *action; const gchar *action_name; @@ -1788,6 +2059,7 @@ e_mail_reader_init (EMailReader *reader) g_return_if_fail (E_IS_MAIL_READER (reader)); action_group = e_mail_reader_get_action_group (reader); + html_display = e_mail_reader_get_html_display (reader); message_list = e_mail_reader_get_message_list (reader); gtk_action_group_add_actions ( @@ -1815,24 +2087,44 @@ e_mail_reader_init (EMailReader *reader) /* Fine tuning. */ - action = gtk_action_group_get_action (action_group, "mail-delete"); + action_name = "mail-clipboard-copy"; + action = gtk_action_group_get_action (action_group, action_name); + gtk_action_set_sensitive (action, FALSE); + + action_name = "mail-delete"; + action = gtk_action_group_get_action (action_group, action_name); g_object_set (action, "short-label", _("Delete"), NULL); - action = gtk_action_group_get_action (action_group, "mail-next"); + action_name = "mail-next"; + action = gtk_action_group_get_action (action_group, action_name); g_object_set (action, "short-label", _("Next"), NULL); - action = gtk_action_group_get_action (action_group, "mail-previous"); + action_name = "mail-previous"; + action = gtk_action_group_get_action (action_group, action_name); g_object_set (action, "short-label", _("Previous"), NULL); - action = gtk_action_group_get_action (action_group, "mail-reply-sender"); + action_name = "mail-reply-sender"; + action = gtk_action_group_get_action (action_group, action_name); g_object_set (action, "short-label", _("Reply"), NULL); /* Connect signals. */ + g_signal_connect_swapped ( + html_display, "link-clicked", + G_CALLBACK (mail_reader_link_clicked_cb), reader); + + g_signal_connect_swapped ( + ((EMFormatHTML *) html_display)->html, "button-release-event", + G_CALLBACK (mail_reader_html_button_release_event_cb), reader); + g_signal_connect_swapped ( message_list, "message-selected", G_CALLBACK (mail_reader_message_selected_cb), reader); + g_signal_connect_swapped ( + message_list, "message-list-built", + G_CALLBACK (mail_reader_emit_folder_loaded), reader); + g_signal_connect_swapped ( message_list->tree, "double-click", G_CALLBACK (mail_reader_double_click_cb), reader); @@ -1840,6 +2132,18 @@ e_mail_reader_init (EMailReader *reader) g_signal_connect_swapped ( message_list->tree, "key-press", G_CALLBACK (mail_reader_key_press_cb), reader); + + g_signal_connect_swapped ( + message_list->tree, "selection-change", + G_CALLBACK (e_mail_reader_changed), reader); +} + +void +e_mail_reader_changed (EMailReader *reader) +{ + g_return_if_fail (E_IS_MAIL_READER (reader)); + + g_signal_emit (reader, signals[CHANGED], 0); } GtkActionGroup * diff --git a/mail/e-mail-reader.h b/mail/e-mail-reader.h index bb9e8d461f..bf8f986145 100644 --- a/mail/e-mail-reader.h +++ b/mail/e-mail-reader.h @@ -71,6 +71,7 @@ struct _EMailReaderIface { GType e_mail_reader_get_type (void); void e_mail_reader_init (EMailReader *reader); +void e_mail_reader_changed (EMailReader *reader); GtkActionGroup * e_mail_reader_get_action_group (EMailReader *reader); gboolean e_mail_reader_get_hide_deleted (EMailReader *reader); diff --git a/mail/e-mail-shell-content.c b/mail/e-mail-shell-content.c index e06e68acfc..d0d51baf1b 100644 --- a/mail/e-mail-shell-content.c +++ b/mail/e-mail-shell-content.c @@ -43,9 +43,9 @@ struct _EMailShellContentPrivate { GtkWidget *paned; - GtkWidget *folder_view; + GtkWidget *message_list; - EMFormatHTMLDisplay *preview; + EMFormatHTMLDisplay *html_display; GalViewInstance *view_instance; guint paned_binding_id; @@ -66,14 +66,15 @@ static void mail_shell_content_display_view_cb (EMailShellContent *mail_shell_content, GalView *gal_view) { - EMFolderView *folder_view; + EMailReader *reader; + MessageList *message_list; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); + reader = E_MAIL_READER (mail_shell_content); + message_list = e_mail_reader_get_message_list (reader); if (GAL_IS_VIEW_ETABLE (gal_view)) gal_view_etable_attach_tree ( - GAL_VIEW_ETABLE (gal_view), - folder_view->list->tree); + GAL_VIEW_ETABLE (gal_view), message_list->tree); } static void @@ -135,14 +136,14 @@ mail_shell_content_dispose (GObject *object) priv->paned = NULL; } - if (priv->folder_view != NULL) { - g_object_unref (priv->folder_view); - priv->folder_view = NULL; + if (priv->message_list != NULL) { + g_object_unref (priv->message_list); + priv->message_list = NULL; } - if (priv->preview != NULL) { - g_object_unref (priv->preview); - priv->preview = NULL; + if (priv->html_display != NULL) { + g_object_unref (priv->html_display); + priv->html_display = NULL; } if (priv->view_instance != NULL) { @@ -199,11 +200,9 @@ mail_shell_content_constructed (GObject *object) container = widget; - /* XXX Kill EMFolderView? */ - priv->folder_view = em_folder_view_new (); - g_object_ref_sink (priv->folder_view); - widget = GTK_WIDGET (((EMFolderView *) priv->folder_view)->list); + widget = message_list_new (); gtk_paned_add1 (GTK_PANED (container), widget); + priv->message_list = g_object_ref (widget); gtk_widget_show (widget); widget = gtk_scrolled_window_new (NULL, NULL); @@ -217,9 +216,8 @@ mail_shell_content_constructed (GObject *object) container = widget; - /* XXX Kill EMFolderView? */ - priv->preview = ((EMFolderView *) priv->folder_view)->preview; - widget = GTK_WIDGET (((EMFormatHTML *) priv->preview)->html); + priv->html_display = em_format_html_display_new (); + widget = GTK_WIDGET (((EMFormatHTML *) priv->html_display)->html); gtk_container_add (GTK_CONTAINER (container), widget); gtk_widget_show (widget); @@ -240,8 +238,9 @@ mail_shell_content_constructed (GObject *object) static guint32 mail_shell_content_check_state (EShellContent *shell_content) { + EMailReader *reader; EMailShellContent *mail_shell_content; - EMFolderView *folder_view; + MessageList *message_list; GPtrArray *uids; CamelFolder *folder; CamelStore *store; @@ -262,11 +261,12 @@ mail_shell_content_check_state (EShellContent *shell_content) guint32 state = 0; guint ii; + reader = E_MAIL_READER (shell_content); + message_list = e_mail_reader_get_message_list (reader); mail_shell_content = E_MAIL_SHELL_CONTENT (shell_content); - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - uids = message_list_get_selected (folder_view->list); - folder_uri = folder_view->folder_uri; - folder = folder_view->folder; + uids = message_list_get_selected (message_list); + folder_uri = message_list->folder_uri; + folder = message_list->folder; store = CAMEL_STORE (folder->parent_store); draft_or_outbox = @@ -386,23 +386,21 @@ mail_shell_content_get_hide_deleted (EMailReader *reader) static EMFormatHTMLDisplay * mail_shell_content_get_html_display (EMailReader *reader) { - EMailShellContent *mail_shell_content; + EMailShellContentPrivate *priv; - mail_shell_content = E_MAIL_SHELL_CONTENT (reader); + priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (reader); - return e_mail_shell_content_get_preview_format (mail_shell_content); + return priv->html_display; } static MessageList * mail_shell_content_get_message_list (EMailReader *reader) { - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; + EMailShellContentPrivate *priv; - mail_shell_content = E_MAIL_SHELL_CONTENT (reader); - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); + priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (reader); - return folder_view->list; + return MESSAGE_LIST (priv->message_list); } static EShellModule * @@ -540,24 +538,6 @@ e_mail_shell_content_new (EShellView *shell_view) "shell-view", shell_view, NULL); } -EMFolderView * -e_mail_shell_content_get_folder_view (EMailShellContent *mail_shell_content) -{ - g_return_val_if_fail ( - E_IS_MAIL_SHELL_CONTENT (mail_shell_content), NULL); - - return EM_FOLDER_VIEW (mail_shell_content->priv->folder_view); -} - -EMFormatHTMLDisplay * -e_mail_shell_content_get_preview_format (EMailShellContent *mail_shell_content) -{ - g_return_val_if_fail ( - E_IS_MAIL_SHELL_CONTENT (mail_shell_content), NULL); - - return mail_shell_content->priv->preview; -} - gboolean e_mail_shell_content_get_preview_visible (EMailShellContent *mail_shell_content) { @@ -592,19 +572,6 @@ e_mail_shell_content_set_preview_visible (EMailShellContent *mail_shell_content, g_object_notify (G_OBJECT (mail_shell_content), "preview-visible"); } -GtkWidget * -e_mail_shell_content_get_preview_widget (EMailShellContent *mail_shell_content) -{ - EMFormatHTML *format; - - g_return_val_if_fail ( - E_IS_MAIL_SHELL_CONTENT (mail_shell_content), NULL); - - format = (EMFormatHTML *) mail_shell_content->priv->preview; - - return GTK_WIDGET (format->html); -} - gboolean e_mail_shell_content_get_vertical_view (EMailShellContent *mail_shell_content) { @@ -671,12 +638,13 @@ e_mail_shell_content_set_vertical_view (EMailShellContent *mail_shell_content, void e_mail_shell_content_update_view_instance (EMailShellContent *mail_shell_content) { + EMailReader *reader; EShellContent *shell_content; EShellView *shell_view; EShellViewClass *shell_view_class; GalViewCollection *view_collection; GalViewInstance *view_instance; - EMFolderView *folder_view; + MessageList *message_list; gboolean outgoing_folder; gboolean show_vertical_view; gchar *view_id; @@ -688,21 +656,22 @@ e_mail_shell_content_update_view_instance (EMailShellContent *mail_shell_content shell_view_class = E_SHELL_VIEW_GET_CLASS (shell_view); view_collection = shell_view_class->view_collection; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); + reader = E_MAIL_READER (mail_shell_content); + message_list = e_mail_reader_get_message_list (reader); /* If no folder is selected, return silently. */ - if (folder_view->folder == NULL) + if (message_list->folder == NULL) return; /* If we have a folder, we should also have a URI. */ - g_return_if_fail (folder_view->folder_uri != NULL); + g_return_if_fail (message_list->folder_uri != NULL); if (mail_shell_content->priv->view_instance != NULL) { g_object_unref (mail_shell_content->priv->view_instance); mail_shell_content->priv->view_instance = NULL; } - view_id = mail_config_folder_to_safe_url (folder_view->folder); + view_id = mail_config_folder_to_safe_url (message_list->folder); view_instance = e_shell_view_new_view_instance (shell_view, view_id); mail_shell_content->priv->view_instance = view_instance; @@ -740,11 +709,11 @@ e_mail_shell_content_update_view_instance (EMailShellContent *mail_shell_content outgoing_folder = em_utils_folder_is_drafts ( - folder_view->folder, folder_view->folder_uri) || + message_list->folder, message_list->folder_uri) || em_utils_folder_is_outbox ( - folder_view->folder, folder_view->folder_uri) || + message_list->folder, message_list->folder_uri) || em_utils_folder_is_sent ( - folder_view->folder, folder_view->folder_uri); + message_list->folder, message_list->folder_uri); if (outgoing_folder) { if (show_vertical_view) @@ -764,7 +733,7 @@ e_mail_shell_content_update_view_instance (EMailShellContent *mail_shell_content gchar *state_filename; state_filename = mail_config_folder_to_cachename ( - folder_view->folder, "et-header-"); + message_list->folder, "et-header-"); if (g_file_test (state_filename, G_FILE_TEST_IS_REGULAR)) { ETableSpecification *spec; diff --git a/mail/e-mail-shell-content.h b/mail/e-mail-shell-content.h index 593969e5a5..5a94df559c 100644 --- a/mail/e-mail-shell-content.h +++ b/mail/e-mail-shell-content.h @@ -25,7 +25,6 @@ #include #include -#include "em-folder-view.h" #include "em-format-html-display.h" /* Standard GObject macros */ @@ -86,18 +85,11 @@ struct _EMailShellContentClass { GType e_mail_shell_content_get_type (void); GtkWidget * e_mail_shell_content_new (EShellView *shell_view); -EMFolderView * e_mail_shell_content_get_folder_view - (EMailShellContent *mail_shell_content); -EMFormatHTMLDisplay * - e_mail_shell_content_get_preview_format - (EMailShellContent *mail_shell_content); gboolean e_mail_shell_content_get_preview_visible (EMailShellContent *mail_shell_content); void e_mail_shell_content_set_preview_visible (EMailShellContent *mail_shell_content, gboolean preview_visible); -GtkWidget * e_mail_shell_content_get_preview_widget - (EMailShellContent *mail_shell_content); gboolean e_mail_shell_content_get_vertical_view (EMailShellContent *mail_shell_content); void e_mail_shell_content_set_vertical_view diff --git a/mail/e-mail-shell-module.c b/mail/e-mail-shell-module.c index 1185e13575..96d7a5ebbd 100644 --- a/mail/e-mail-shell-module.c +++ b/mail/e-mail-shell-module.c @@ -119,8 +119,6 @@ static guint mail_sync_timeout_source_id; extern gint camel_application_is_exiting; -G_LOCK_DEFINE_STATIC (local_store); - static StoreInfo * store_info_new (CamelStore *store, const gchar *name) diff --git a/mail/e-mail-shell-view-actions.c b/mail/e-mail-shell-view-actions.c index 611ceff204..817b2283ae 100644 --- a/mail/e-mail-shell-view-actions.c +++ b/mail/e-mail-shell-view-actions.c @@ -94,20 +94,20 @@ static void action_mail_folder_expunge_cb (GtkAction *action, EMailShellView *mail_shell_view) { - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; + EMailReader *reader; + MessageList *message_list; EShellWindow *shell_window; EShellView *shell_view; shell_view = E_SHELL_VIEW (mail_shell_view); shell_window = e_shell_view_get_shell_window (shell_view); - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - g_return_if_fail (folder_view->folder != NULL); + reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content); + message_list = e_mail_reader_get_message_list (reader); + g_return_if_fail (message_list->folder != NULL); em_utils_expunge_folder ( - GTK_WIDGET (shell_window), folder_view->folder); + GTK_WIDGET (shell_window), message_list->folder); } static void @@ -223,26 +223,26 @@ static void action_mail_folder_select_thread_cb (GtkAction *action, EMailShellView *mail_shell_view) { - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; + MessageList *message_list; + EMailReader *reader; - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); + reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content); + message_list = e_mail_reader_get_message_list (reader); - message_list_select_thread (folder_view->list); + message_list_select_thread (message_list); } static void action_mail_folder_select_subthread_cb (GtkAction *action, EMailShellView *mail_shell_view) { - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; + MessageList *message_list; + EMailReader *reader; - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); + reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content); + message_list = e_mail_reader_get_message_list (reader); - message_list_select_subthread (folder_view->list); + message_list_select_subthread (message_list); } static void @@ -257,14 +257,14 @@ static void action_mail_hide_read_cb (GtkAction *action, EMailShellView *mail_shell_view) { - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; + MessageList *message_list; + EMailReader *reader; - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); + reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content); + message_list = e_mail_reader_get_message_list (reader); message_list_hide_add ( - folder_view->list, + message_list, "(match-all (system-flag \"seen\"))", ML_HIDE_SAME, ML_HIDE_SAME); } @@ -273,16 +273,16 @@ static void action_mail_hide_selected_cb (GtkAction *action, EMailShellView *mail_shell_view) { - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; + MessageList *message_list; + EMailReader *reader; GPtrArray *uids; - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); + reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content); + message_list = e_mail_reader_get_message_list (reader); - uids = message_list_get_selected (folder_view->list); - message_list_hide_uids (folder_view->list, uids); - message_list_free_uids (folder_view->list, uids); + uids = message_list_get_selected (message_list); + message_list_hide_uids (message_list, uids); + message_list_free_uids (message_list, uids); } static void @@ -303,13 +303,13 @@ static void action_mail_show_hidden_cb (GtkAction *action, EMailShellView *mail_shell_view) { - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; + MessageList *message_list; + EMailReader *reader; - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); + reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content); + message_list = e_mail_reader_get_message_list (reader); - message_list_hide_clear (folder_view->list); + message_list_hide_clear (message_list); } static void @@ -323,26 +323,26 @@ static void action_mail_threads_collapse_all_cb (GtkAction *action, EMailShellView *mail_shell_view) { - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; + MessageList *message_list; + EMailReader *reader; - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); + reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content); + message_list = e_mail_reader_get_message_list (reader); - message_list_set_threaded_collapse_all (folder_view->list); + message_list_set_threaded_collapse_all (message_list); } static void action_mail_threads_expand_all_cb (GtkAction *action, EMailShellView *mail_shell_view) { - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; + MessageList *message_list; + EMailReader *reader; - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); + reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content); + message_list = e_mail_reader_get_message_list (reader); - message_list_set_threaded_expand_all (folder_view->list); + message_list_set_threaded_expand_all (message_list); } static void @@ -391,46 +391,6 @@ action_mail_tools_subscriptions_cb (GtkAction *action, /* XXX Dialog destroys itself. */ } -static void -action_mail_uri_call_to_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - /* FIXME */ - g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); -} - -static void -action_mail_uri_copy_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - /* FIXME */ - g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); -} - -static void -action_mail_uri_copy_address_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - /* FIXME */ - g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); -} - -static void -action_mail_uri_to_search_folder_recipient_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - /* FIXME */ - g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); -} - -static void -action_mail_uri_to_search_folder_sender_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - /* FIXME */ - g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); -} - static void action_mail_view_cb (GtkRadioAction *action, GtkRadioAction *current, @@ -623,41 +583,6 @@ static GtkActionEntry mail_entries[] = { N_("Subscribe or unsubscribe to folders on remote servers"), G_CALLBACK (action_mail_tools_subscriptions_cb) }, - { "mail-uri-call-to", - NULL, - N_("C_all To..."), - NULL, - NULL, /* XXX Add a tooltip! */ - G_CALLBACK (action_mail_uri_call_to_cb) }, - - { "mail-uri-copy", - GTK_STOCK_COPY, - N_("_Copy Link Location"), - NULL, - NULL, /* XXX Add a tooltip! */ - G_CALLBACK (action_mail_uri_copy_cb) }, - - { "mail-uri-copy-address", - GTK_STOCK_COPY, - N_("Copy _Email Address"), - NULL, - NULL, /* XXX Add a tooltip! */ - G_CALLBACK (action_mail_uri_copy_address_cb) }, - - { "mail-uri-to-search-folder-recipient", - NULL, - N_("_To This Address"), - NULL, - NULL, /* XXX Add a tooltip! */ - G_CALLBACK (action_mail_uri_to_search_folder_recipient_cb) }, - - { "mail-uri-to-search-folder-sender", - NULL, - N_("_From This Address"), - NULL, - NULL, /* XXX Add a tooltip! */ - G_CALLBACK (action_mail_uri_to_search_folder_sender_cb) }, - /*** Menus ***/ { "mail-folder-menu", @@ -667,25 +592,11 @@ static GtkActionEntry mail_entries[] = { NULL, NULL }, - { "mail-label-menu", - NULL, - N_("_Label"), - NULL, - NULL, - NULL }, - { "mail-preview-menu", NULL, N_("_Preview"), NULL, NULL, - NULL }, - - { "mail-uri-to-search-folder-menu", - NULL, - N_("Create _Search Folder"), - NULL, - NULL, NULL } }; diff --git a/mail/e-mail-shell-view-private.c b/mail/e-mail-shell-view-private.c index 8dbaf56877..728f056421 100644 --- a/mail/e-mail-shell-view-private.c +++ b/mail/e-mail-shell-view-private.c @@ -30,14 +30,12 @@ mail_shell_view_folder_tree_selected_cb (EMailShellView *mail_shell_view, guint32 flags, EMFolderTree *folder_tree) { - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; + EMailReader *reader; - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); + reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content); if ((flags & CAMEL_FOLDER_NOSELECT) || full_name == NULL) - em_folder_view_set_folder (folder_view, NULL, NULL); + e_mail_reader_set_folder (reader, NULL, NULL); else { EMFolderTreeModel *model; @@ -45,7 +43,7 @@ mail_shell_view_folder_tree_selected_cb (EMailShellView *mail_shell_view, em_folder_tree_model_set_selected (model, uri); em_folder_tree_model_save_state (model); - em_folder_view_set_folder_uri (folder_view, uri); + e_mail_reader_set_folder_uri (reader, uri); } } @@ -59,9 +57,23 @@ mail_shell_view_folder_tree_popup_event_cb (EShellView *shell_view, e_shell_view_show_popup_menu (shell_view, widget_path, event); } +static gboolean +mail_shell_view_message_list_right_click_cb (EShellView *shell_view, + gint row, + ETreePath path, + gint col, + GdkEventButton *event) +{ + const gchar *widget_path; + + widget_path = "/mail-message-popup"; + e_shell_view_show_popup_menu (shell_view, widget_path, event); + + return TRUE; +} + static void -mail_shell_view_folder_view_changed_cb (EMailShellView *mail_shell_view, - EMFolderView *folder_view) +mail_shell_view_reader_changed_cb (EMailShellView *mail_shell_view) { EMailShellContent *mail_shell_content; @@ -142,14 +154,14 @@ void e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view) { EMailShellViewPrivate *priv = mail_shell_view->priv; - EMailShellContent *mail_shell_content; EMailShellSidebar *mail_shell_sidebar; EShellView *shell_view; EShellContent *shell_content; EShellSidebar *shell_sidebar; EMFolderTreeModel *folder_tree_model; EMFolderTree *folder_tree; - EMFolderView *folder_view; + MessageList *message_list; + EMailReader *reader; gchar *uri; shell_view = E_SHELL_VIEW (mail_shell_view); @@ -160,8 +172,8 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view) priv->mail_shell_content = g_object_ref (shell_content); priv->mail_shell_sidebar = g_object_ref (shell_sidebar); - mail_shell_content = E_MAIL_SHELL_CONTENT (shell_content); - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); + reader = E_MAIL_READER (shell_content); + message_list = e_mail_reader_get_message_list (reader); mail_shell_sidebar = E_MAIL_SHELL_SIDEBAR (shell_sidebar); folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar); @@ -177,18 +189,23 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view) mail_shell_view); g_signal_connect_swapped ( - folder_view, "changed", - G_CALLBACK (mail_shell_view_folder_view_changed_cb), + message_list->tree, "right-click", + G_CALLBACK (mail_shell_view_message_list_right_click_cb), + mail_shell_view); + + g_signal_connect_swapped ( + reader, "changed", + G_CALLBACK (mail_shell_view_reader_changed_cb), mail_shell_view); /* Use the same callback as "changed". */ g_signal_connect_swapped ( - folder_view, "loaded", - G_CALLBACK (mail_shell_view_folder_view_changed_cb), + reader, "folder-loaded", + G_CALLBACK (mail_shell_view_reader_changed_cb), mail_shell_view); e_mail_shell_view_actions_init (mail_shell_view); - e_mail_reader_init (E_MAIL_READER (mail_shell_content)); + e_mail_reader_init (reader); /* Restore the previously selected folder. */ folder_tree_model = em_folder_tree_get_model (folder_tree); @@ -199,7 +216,7 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view) expanded = em_folder_tree_model_get_expanded_uri ( folder_tree_model, uri); em_folder_tree_set_selected (folder_tree, uri, FALSE); - em_folder_view_set_folder_uri (folder_view, uri); + e_mail_reader_set_folder_uri (reader, uri); if (!expanded) em_folder_tree_model_set_expanded_uri ( @@ -229,11 +246,11 @@ e_mail_shell_view_private_finalize (EMailShellView *mail_shell_view) void e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view) { - EMailShellContent *mail_shell_content; EShellSidebar *shell_sidebar; EShellModule *shell_module; EShellView *shell_view; - EMFolderView *folder_view; + EMailReader *reader; + MessageList *message_list; CamelStore *local_store; CamelFolder *folder; GPtrArray *selected; @@ -255,10 +272,10 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view) shell_sidebar = e_shell_view_get_shell_sidebar (shell_view); local_store = e_mail_shell_module_get_local_store (shell_module); - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - folder_uri = folder_view->folder_uri; - folder = folder_view->folder; + reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content); + message_list = e_mail_reader_get_message_list (reader); + folder_uri = message_list->folder_uri; + folder = message_list->folder; /* If no folder is selected, reset the sidebar banners * to their default values and stop. */ @@ -286,7 +303,7 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view) NULL); buffer = g_string_sized_new (256); - selected = message_list_get_selected (folder_view->list); + selected = message_list_get_selected (message_list); if (selected->len > 1) g_string_append_printf ( @@ -305,7 +322,7 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view) "%d deleted", num_deleted), num_deleted); /* "Junk" folder (hide deleted messages) */ - else if (folder_view->hide_deleted) + else if (e_mail_reader_get_hide_deleted (reader)) g_string_append_printf ( buffer, ngettext ("%d junk", "%d junk", num_junked_not_deleted), @@ -337,7 +354,7 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view) /* Normal folder */ } else { - if (!folder_view->hide_deleted) + if (!e_mail_reader_get_hide_deleted (reader)) num_visible += num_deleted - num_junked + num_junked_not_deleted; @@ -351,7 +368,7 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view) num_visible), num_visible); } - message_list_free_uids (folder_view->list, selected); + message_list_free_uids (message_list, selected); /* Choose a suitable folder name for displaying. */ if (folder->parent_store == local_store && ( @@ -399,8 +416,8 @@ void e_mail_shell_view_create_filter_from_selected (EMailShellView *mail_shell_view, gint filter_type) { - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; + EMailReader *reader; + MessageList *message_list; CamelFolder *folder; const gchar *filter_source; const gchar *folder_uri; @@ -413,10 +430,10 @@ e_mail_shell_view_create_filter_from_selected (EMailShellView *mail_shell_view, g_return_if_fail (E_IS_MAIL_SHELL_VIEW (mail_shell_view)); - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - folder_uri = folder_view->folder_uri; - folder = folder_view->folder; + reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content); + message_list = e_mail_reader_get_message_list (reader); + folder_uri = message_list->folder_uri; + folder = message_list->folder; if (em_utils_folder_is_sent (folder, folder_uri)) filter_source = FILTER_SOURCE_OUTGOING; @@ -425,7 +442,7 @@ e_mail_shell_view_create_filter_from_selected (EMailShellView *mail_shell_view, else filter_source = FILTER_SOURCE_INCOMING; - uids = message_list_get_selected (folder_view->list); + uids = message_list_get_selected (message_list); if (uids->len == 1) { filter_data = g_malloc (sizeof (*filter_data)); @@ -465,8 +482,8 @@ void e_mail_shell_view_create_vfolder_from_selected (EMailShellView *mail_shell_view, gint vfolder_type) { - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; + EMailReader *reader; + MessageList *message_list; CamelFolder *folder; const gchar *folder_uri; GPtrArray *uids; @@ -478,12 +495,12 @@ e_mail_shell_view_create_vfolder_from_selected (EMailShellView *mail_shell_view, g_return_if_fail (E_IS_MAIL_SHELL_VIEW (mail_shell_view)); - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - folder_uri = folder_view->folder_uri; - folder = folder_view->folder; + reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content); + message_list = e_mail_reader_get_message_list (reader); + folder_uri = message_list->folder_uri; + folder = message_list->folder; - uids = message_list_get_selected (folder_view->list); + uids = message_list_get_selected (message_list); if (uids->len == 1) { vfolder_data = g_malloc (sizeof (*vfolder_data)); diff --git a/mail/em-config.c b/mail/em-config.c index 9075fc3842..94df437519 100644 --- a/mail/em-config.c +++ b/mail/em-config.c @@ -29,8 +29,6 @@ #include -#include - #include "em-config.h" #include "libedataserver/e-msgport.h" #include "em-utils.h" diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c index e940b841a4..68b682c14c 100644 --- a/mail/em-folder-view.c +++ b/mail/em-folder-view.c @@ -40,8 +40,6 @@ #undef interface #endif -#include - #include #include @@ -108,31 +106,6 @@ #include #endif -static void emfv_list_message_selected(MessageList *ml, const char *uid, EMFolderView *emfv); -static void emfv_list_built(MessageList *ml, EMFolderView *emfv); -static int emfv_list_right_click(ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, EMFolderView *emfv); -static void emfv_list_selection_change(ETree *tree, EMFolderView *emfv); - -static void emfv_format_link_clicked(EMFormatHTMLDisplay *efhd, const char *uri, EMFolderView *); -static int emfv_format_popup_event(EMFormatHTMLDisplay *efhd, GdkEventButton *event, const char *uri, CamelMimePart *part, EMFolderView *); - -static void emfv_enable_menus(EMFolderView *emfv); - -static void emfv_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri); -static void emfv_set_folder_uri(EMFolderView *emfv, const char *uri); -static void emfv_set_message(EMFolderView *emfv, const char *uid, int nomarkseen); -static void emfv_activate(EMFolderView *emfv, BonoboUIComponent *uic, int state); - -static void emfv_setting_setup(EMFolderView *emfv); - -static void emfv_on_url_cb(GObject *emitter, const char *url, EMFolderView *emfv); -static void emfv_on_url(EMFolderView *emfv, const char *uri, const char *nice_uri); - -static void emfv_set_seen (EMFolderView *emfv, const char *uid); -static gboolean emfv_on_html_button_released_cb (GtkHTML *html, GdkEventButton *button, EMFolderView *emfv); -static gboolean emfv_popup_menu (GtkWidget *widget); - - /* this is added to emfv->enable_map in :init() */ static const EMFolderViewEnable emfv_enable_map[] = { { "EditCut", EM_POPUP_SELECT_MANY }, @@ -246,39 +219,39 @@ emfv_init(GObject *o) struct _EMFolderViewPrivate *p; extern CamelSession *session; - gtk_box_set_homogeneous (GTK_BOX (emfv), FALSE); - - p = emfv->priv = g_malloc0(sizeof(struct _EMFolderViewPrivate)); - - emfv->statusbar_active = TRUE; - emfv->list_active = FALSE; - - emfv->ui_files = g_slist_append(NULL, - g_build_filename (EVOLUTION_UIDIR, - "evolution-mail-message.xml", - NULL)); - - emfv->ui_app_name = "evolution-mail"; +// gtk_box_set_homogeneous (GTK_BOX (emfv), FALSE); +// +// p = emfv->priv = g_malloc0(sizeof(struct _EMFolderViewPrivate)); +// +// emfv->statusbar_active = TRUE; +// emfv->list_active = FALSE; +// +// emfv->ui_files = g_slist_append(NULL, +// g_build_filename (EVOLUTION_UIDIR, +// "evolution-mail-message.xml", +// NULL)); +// +// emfv->ui_app_name = "evolution-mail"; emfv->enable_map = g_slist_prepend(NULL, (void *)emfv_enable_map); - 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); +// 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? */ - g_signal_connect(emfv->list->tree, "right_click", G_CALLBACK(emfv_list_right_click), emfv); +// 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); +// 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); - g_signal_connect(emfv->preview, "link_clicked", G_CALLBACK(emfv_format_link_clicked), emfv); +// 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); +// 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 @@ -293,84 +266,84 @@ emfv_init(GObject *o) emfv_setting_setup(emfv); } -static void -free_one_ui_file (gpointer data, - gpointer user_data) -{ - g_free (data); -} - -static void -emfv_finalise(GObject *o) -{ - EMFolderView *emfv = (EMFolderView *)o; - struct _EMFolderViewPrivate *p = emfv->priv; - - g_slist_foreach (emfv->ui_files, free_one_ui_file, NULL); - g_slist_free(emfv->ui_files); - g_slist_free(emfv->enable_map); - - g_free(p); - - ((GObjectClass *)emfv_parent)->finalize(o); -} - -static void -emfv_destroy (GtkObject *o) -{ - EMFolderView *emfv = (EMFolderView *) o; - struct _EMFolderViewPrivate *p = emfv->priv; - - p->destroyed = TRUE; - - if (emfv->list && emfv->list->seen_id) { - g_source_remove(emfv->list->seen_id); - emfv->list->seen_id = 0; - } - - if (p->setting_notify_id) { - GConfClient *gconf = gconf_client_get_default(); - - gconf_client_notify_remove(gconf, p->setting_notify_id); - p->setting_notify_id = 0; - g_object_unref(gconf); - } - - if (emfv->folder) { - camel_object_unref(emfv->folder); - g_free(emfv->folder_uri); - emfv->folder = NULL; - emfv->folder_uri = NULL; - } - - if (emfv->async) { - mail_async_event_destroy(emfv->async); - emfv->async = NULL; - } - - if (p->invisible) { - gtk_object_destroy((GtkObject *)p->invisible); - p->invisible = NULL; - } - - if (p->selected_id != 0) { - g_source_remove(p->selected_id); - p->selected_id = 0; - } - - g_free(p->selected_uid); - p->selected_uid = NULL; - - g_free (emfv->displayed_uid); - emfv->displayed_uid = NULL; +//static void +//free_one_ui_file (gpointer data, +// gpointer user_data) +//{ +// g_free (data); +//} - emfv->preview = NULL; - emfv->list = NULL; - emfv->preview_active = FALSE; - emfv->uic = NULL; +//static void +//emfv_finalise(GObject *o) +//{ +// EMFolderView *emfv = (EMFolderView *)o; +// struct _EMFolderViewPrivate *p = emfv->priv; +// +// g_slist_foreach (emfv->ui_files, free_one_ui_file, NULL); +/ g_slist_free(emfv->ui_files); +/// g_slist_free(emfv->enable_map); +// +// g_free(p); +// +// ((GObjectClass *)emfv_parent)->finalize(o); +//} - ((GtkObjectClass *) emfv_parent)->destroy (o); -} +//static void +//emfv_destroy (GtkObject *o) +//{ +// EMFolderView *emfv = (EMFolderView *) o; +// struct _EMFolderViewPrivate *p = emfv->priv; +// +// p->destroyed = TRUE; +// +// if (emfv->list && emfv->list->seen_id) { +// g_source_remove(emfv->list->seen_id); +// emfv->list->seen_id = 0; +// } +// +// if (p->setting_notify_id) { +// GConfClient *gconf = gconf_client_get_default(); +// +// gconf_client_notify_remove(gconf, p->setting_notify_id); +// p->setting_notify_id = 0; +// g_object_unref(gconf); +// } +// +// if (emfv->folder) { +// camel_object_unref(emfv->folder); +// g_free(emfv->folder_uri); +// emfv->folder = NULL; +// emfv->folder_uri = NULL; +// } +// +// if (emfv->async) { +// mail_async_event_destroy(emfv->async); +// emfv->async = NULL; +// } +// +// if (p->invisible) { +// gtk_object_destroy((GtkObject *)p->invisible); +// p->invisible = NULL; +// } +// +// if (p->selected_id != 0) { +// g_source_remove(p->selected_id); +// p->selected_id = 0; +// } +// +// g_free(p->selected_uid); +// p->selected_uid = NULL; +// +// g_free (emfv->displayed_uid); +// emfv->displayed_uid = NULL; +// +// emfv->preview = NULL; +// emfv->list = NULL; +// emfv->preview_active = FALSE; +// emfv->uic = NULL; +// +// ((GtkObjectClass *) emfv_parent)->destroy (o); +//} static void emfv_class_init(GObjectClass *klass) @@ -418,116 +391,115 @@ emfv_class_init(GObjectClass *klass) 0); } -GType -em_folder_view_get_type(void) -{ - static GType type = 0; - - if (type == 0) { - static const GTypeInfo info = { - sizeof(EMFolderViewClass), - NULL, NULL, - (GClassInitFunc)emfv_class_init, - NULL, NULL, - sizeof(EMFolderView), 0, - (GInstanceInitFunc)emfv_init - }; - emfv_parent = g_type_class_ref(gtk_vbox_get_type()); - type = g_type_register_static(gtk_vbox_get_type(), "EMFolderView", &info, 0); - } - - return type; -} - -GtkWidget *em_folder_view_new(void) -{ - EMFolderView *emfv = g_object_new(em_folder_view_get_type(), NULL); +//GType +//em_folder_view_get_type(void) +//{ +// static GType type = 0; +// +// if (type == 0) { +// static const GTypeInfo info = { +// sizeof(EMFolderViewClass), +// NULL, NULL, +// (GClassInitFunc)emfv_class_init, +// NULL, NULL, +// sizeof(EMFolderView), 0, +// (GInstanceInitFunc)emfv_init +// }; +// emfv_parent = g_type_class_ref(gtk_vbox_get_type()); +// type = g_type_register_static(gtk_vbox_get_type(), "EMFolderView", &info, 0); +// } +// +// return type; +//} - return (GtkWidget *)emfv; -} +//GtkWidget *em_folder_view_new(void) +//{ +// EMFolderView *emfv = g_object_new(em_folder_view_get_type(), NULL); +// +// return (GtkWidget *)emfv; +//} /* 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) -{ - GPtrArray *uids; - int i; - - if (emfv->folder == NULL) - return 0; - - uids = message_list_get_selected(emfv->list); - camel_folder_freeze(emfv->folder); - - for (i=0; ilen; i++) - camel_folder_set_message_flags(emfv->folder, uids->pdata[i], mask, set); - - message_list_free_uids(emfv->list, uids); - camel_folder_thaw(emfv->folder); - - return i; -} +//int +//em_folder_view_mark_selected(EMFolderView *emfv, guint32 mask, guint32 set) +//{ +// GPtrArray *uids; +// int i; +// +// if (emfv->folder == NULL) +// return 0; +// +// uids = message_list_get_selected(emfv->list); +// camel_folder_freeze(emfv->folder); +// +// for (i=0; ilen; i++) +// camel_folder_set_message_flags(emfv->folder, uids->pdata[i], mask, set); +// +// message_list_free_uids(emfv->list, uids); +// camel_folder_thaw(emfv->folder); +// +// return i; +//} /* should this be elsewhere/take a uid list? */ -int -em_folder_view_open_selected(EMFolderView *emfv) -{ - GPtrArray *uids, *views; - int i = 0; - - uids = message_list_get_selected(emfv->list); - - if (uids->len >= 10) { - char *num = g_strdup_printf("%d", uids->len); - int doit; - - doit = em_utils_prompt_user((GtkWindow *)gtk_widget_get_toplevel((GtkWidget *)emfv), - "/apps/evolution/mail/prompts/open_many", - "mail:ask-open-many", num, NULL); - g_free(num); - if (!doit) { - message_list_free_uids(emfv->list, uids); - return 0; - } - } - - if (em_utils_folder_is_drafts(emfv->folder, emfv->folder_uri) - || em_utils_folder_is_templates(emfv->folder, emfv->folder_uri) - || em_utils_folder_is_outbox(emfv->folder, emfv->folder_uri)) { - em_utils_edit_messages(emfv->folder, uids, TRUE); - return uids->len; - } - - /* for vfolders we need to edit the *original*, not the vfolder copy */ - views = g_ptr_array_new(); - for (i=0;ilen;i++) { - if (camel_object_is((CamelObject *)emfv->folder, camel_vee_folder_get_type())) { - CamelVeeMessageInfo *vinfo = (CamelVeeMessageInfo *)camel_folder_get_message_info(emfv->folder, uids->pdata[i]); - - if (vinfo) { - char *uid; - /* TODO: get_location shouldn't strdup the uid */ - CamelFolder *f = camel_vee_folder_get_location((CamelVeeFolder *)emfv->folder, vinfo, &uid); - char *uri = mail_tools_folder_to_url(f); - - if (em_utils_folder_is_drafts(f, uri) || em_utils_folder_is_outbox(f, uri)) { - GPtrArray *edits = g_ptr_array_new(); - - g_ptr_array_add(edits, uid); - em_utils_edit_messages(f, edits, TRUE); - } else { - g_free(uid); - g_ptr_array_add(views, g_strdup(uids->pdata[i])); - } - g_free(uri); - } - } else { - g_ptr_array_add(views, g_strdup(uids->pdata[i])); - } - } +//int +//em_folder_view_open_selected(EMFolderView *emfv) +//{ +// GPtrArray *uids, *views; +// int i = 0; +// +// uids = message_list_get_selected(emfv->list); +// +// if (uids->len >= 10) { +// char *num = g_strdup_printf("%d", uids->len); +// int doit; +// +// doit = em_utils_prompt_user((GtkWindow *)gtk_widget_get_toplevel((GtkWidget *)emfv), +// "/apps/evolution/mail/prompts/open_many", +// "mail:ask-open-many", num, NULL); +// g_free(num); +// if (!doit) { +// message_list_free_uids(emfv->list, uids); +// return 0; +// } +// } +// +// if (em_utils_folder_is_drafts(emfv->folder, emfv->folder_uri) +// || em_utils_folder_is_templates(emfv->folder, emfv->folder_uri) +// || em_utils_folder_is_outbox(emfv->folder, emfv->folder_uri)) { +// em_utils_edit_messages(emfv->folder, uids, TRUE); +// return uids->len; +// } +// +// /* for vfolders we need to edit the *original*, not the vfolder copy */ +// views = g_ptr_array_new(); +// for (i=0;ilen;i++) { +// if (camel_object_is((CamelObject *)emfv->folder, camel_vee_folder_get_type())) { +// CamelVeeMessageInfo *vinfo = (CamelVeeMessageInfo *)camel_folder_get_message_info(emfv->folder, uids->pdata[i]); +// +// if (vinfo) { +// char *uid; +// /* TODO: get_location shouldn't strdup the uid */ +// CamelFolder *f = camel_vee_folder_get_location((CamelVeeFolder *)emfv->folder, vinfo, &uid); +// char *uri = mail_tools_folder_to_url(f); +// +// if (em_utils_folder_is_drafts(f, uri) || em_utils_folder_is_outbox(f, uri)) { +// GPtrArray *edits = g_ptr_array_new(); +// +// g_ptr_array_add(edits, uid); +// em_utils_edit_messages(f, edits, TRUE); +// } else { +// g_free(uid); +// g_ptr_array_add(views, g_strdup(uids->pdata[i])); +// } +// g_free(uri); +// } +// } else { +// g_ptr_array_add(views, g_strdup(uids->pdata[i])); +// } +// } -#if 0 /* KILL-BONOBO */ /* TODO: have an em_utils_open_messages call? */ for (i=0; ilen; i++) { EMMessageBrowser *emmb; @@ -547,84 +519,81 @@ em_folder_view_open_selected(EMFolderView *emfv) em_utils_handle_receipt (emfv->folder, uids->pdata[i], NULL); g_free(views->pdata[i]); } -#endif - g_ptr_array_free(views, TRUE); - - message_list_free_uids(emfv->list, uids); - - return i; -} +// g_ptr_array_free(views, TRUE); +// +// message_list_free_uids(emfv->list, uids); +// +// return i; +//} /* ********************************************************************** */ -static void -emfv_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri) -{ - int isout = (folder && uri - && (em_utils_folder_is_drafts(folder, uri) - || em_utils_folder_is_sent(folder, uri) - || em_utils_folder_is_outbox(folder, uri))); - - if (folder == emfv->folder) - return; - - if (emfv->priv->selected_id) - g_source_remove(emfv->priv->selected_id); - - if (emfv->preview) - em_format_format ((EMFormat *) emfv->preview, NULL, NULL, NULL); - - message_list_set_folder(emfv->list, folder, uri, isout); - g_free(emfv->folder_uri); - emfv->folder_uri = uri ? g_strdup(uri):NULL; - - if (emfv->folder) { - emfv->hide_deleted = emfv->list->hidedeleted; /* <- a bit nasty but makes it track the display better */ - mail_sync_folder (emfv->folder, NULL, NULL); - camel_object_unref(emfv->folder); - } - - emfv->folder = folder; - if (folder) { - /* We need to set this up to get the right view options for the message-list, - * even if we're not showing it */ -#if 0 /* KILL-BONOBO */ - emfv_setup_view_instance(emfv); -#endif - camel_object_ref(folder); - } - - emfv_enable_menus(emfv); - - /* TODO: should probably be called after all processing, not just this class's impl */ - g_signal_emit(emfv, signals[EMFV_LOADED], 0); -} - -static void -emfv_got_folder(char *uri, CamelFolder *folder, void *data) -{ - EMFolderView *emfv = data; - - em_folder_view_set_folder(emfv, folder, uri); -} +//static void +//emfv_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri) +//{ +// int isout = (folder && uri +// && (em_utils_folder_is_drafts(folder, uri) +// || em_utils_folder_is_sent(folder, uri) +// || em_utils_folder_is_outbox(folder, uri))); +// +// if (folder == emfv->folder) +// return; +// +// if (emfv->priv->selected_id) +// g_source_remove(emfv->priv->selected_id); +// +// if (emfv->preview) +// em_format_format ((EMFormat *) emfv->preview, NULL, NULL, NULL); +// +// message_list_set_folder(emfv->list, folder, uri, isout); +// g_free(emfv->folder_uri); +// emfv->folder_uri = uri ? g_strdup(uri):NULL; +// +// if (emfv->folder) { +// emfv->hide_deleted = emfv->list->hidedeleted; /* <- a bit nasty but makes it track the display better */ +// mail_sync_folder (emfv->folder, NULL, NULL); +// camel_object_unref(emfv->folder); +// } +// +// emfv->folder = folder; +// if (folder) { +// /* We need to set this up to get the right view options for the message-list, +// * even if we're not showing it */ +// emfv_setup_view_instance(emfv); +// camel_object_ref(folder); +// } +// +// emfv_enable_menus(emfv); +// +// /* TODO: should probably be called after all processing, not just this class's impl */ +// g_signal_emit(emfv, signals[EMFV_LOADED], 0); +//} -static void -emfv_set_folder_uri(EMFolderView *emfv, const char *uri) -{ - mail_get_folder(uri, 0, emfv_got_folder, emfv, mail_msg_fast_ordered_push); -} +//static void +//emfv_got_folder(char *uri, CamelFolder *folder, void *data) +//{ +// EMFolderView *emfv = data; +// +// em_folder_view_set_folder(emfv, folder, uri); +//} -static void -emfv_set_message(EMFolderView *emfv, const char *uid, int nomarkseen) -{ - e_profile_event_emit("goto.uid", uid?uid:"", 0); +//static void +//emfv_set_folder_uri(EMFolderView *emfv, const char *uri) +//{ +// mail_get_folder(uri, 0, emfv_got_folder, emfv, mail_msg_fast_ordered_push); +//} - /* This could possible race with other set messages, but likelyhood is small */ - emfv->priv->nomarkseen = nomarkseen; - message_list_select_uid(emfv->list, uid); - /* force an update, since we may not get an updated event if we select the same uid */ - emfv_list_message_selected(emfv->list, uid, emfv); -} +//static void +//emfv_set_message(EMFolderView *emfv, const char *uid, int nomarkseen) +//{ +// e_profile_event_emit("goto.uid", uid?uid:"", 0); +// +// /* This could possible race with other set messages, but likelyhood is small */ +// emfv->priv->nomarkseen = nomarkseen; +// message_list_select_uid(emfv->list, uid); +// /* force an update, since we may not get an updated event if we select the same uid */ +// emfv_list_message_selected(emfv->list, uid, emfv); +//} /* ********************************************************************** */ @@ -655,33 +624,31 @@ emfv_selection_clear_event(GtkWidget *widget, GdkEventSelection *event, EMFolder /* Popup menu In many cases these are the functions called by the bonobo callbacks too */ -static void -emfv_popup_open(EPopup *ep, EPopupItem *pitem, void *data) -{ - EMFolderView *emfv = data; - em_folder_view_open_selected(emfv); -} - -static void -emfv_popup_source(EPopup *ep, EPopupItem *pitem, void *data) -{ -#if 0 /* KILL-BONOBO */ - EMFolderView *emfv = data; - EMMessageBrowser *emmb; - GPtrArray *uids; - - uids = message_list_get_selected(emfv->list); - - emmb = (EMMessageBrowser *)em_message_browser_window_new(); - em_format_set_session((EMFormat *)((EMFolderView *)emmb)->preview, ((EMFormat *)emfv->preview)->session); - em_folder_view_set_folder((EMFolderView *)emmb, emfv->folder, emfv->folder_uri); - em_format_set_mode((EMFormat *)((EMFolderView *)emmb)->preview, EM_FORMAT_SOURCE); - em_folder_view_set_message((EMFolderView *)emmb, uids->pdata[0], FALSE); - gtk_widget_show(emmb->window); +//static void +//emfv_popup_open(EPopup *ep, EPopupItem *pitem, void *data) +//{ +// EMFolderView *emfv = data; +// em_folder_view_open_selected(emfv); +//} - message_list_free_uids(emfv->list, uids); -#endif -} +//static void +//emfv_popup_source(EPopup *ep, EPopupItem *pitem, void *data) +//{ +// EMFolderView *emfv = data; +// EMMessageBrowser *emmb; +// GPtrArray *uids; +// +// uids = message_list_get_selected(emfv->list); +// +// emmb = (EMMessageBrowser *)em_message_browser_window_new(); +// em_format_set_session((EMFormat *)((EMFolderView *)emmb)->preview, ((EMFormat *)emfv->preview)->session); +// em_folder_view_set_folder((EMFolderView *)emmb, emfv->folder, emfv->folder_uri); +// em_format_set_mode((EMFormat *)((EMFolderView *)emmb)->preview, EM_FORMAT_SOURCE); +// em_folder_view_set_message((EMFolderView *)emmb, uids->pdata[0], FALSE); +// gtk_widget_show(emmb->window); +// +// message_list_free_uids(emfv->list, uids); +//} //#define DelInVFolderCheckName "DelInVFolderCheck" //#define DelInVFolderKey "/apps/evolution/mail/prompts/delete_in_vfolder" @@ -1010,8 +977,8 @@ from(BonoboUIComponent *uid, void *data, const char *path) \ } //EMFV_MAP_CALLBACK(emfv_message_delete, emfv_popup_delete) -EMFV_MAP_CALLBACK(emfv_message_open, emfv_popup_open) -EMFV_MAP_CALLBACK(emfv_message_source, emfv_popup_source) +//EMFV_MAP_CALLBACK(emfv_message_open, emfv_popup_open) +//EMFV_MAP_CALLBACK(emfv_message_source, emfv_popup_source) static void prepare_offline(void *key, void *value, void *data) @@ -1061,22 +1028,21 @@ emfv_edit_paste(BonoboUIComponent *uid, void *data, const char *path) message_list_paste(emfv->list); } -static void -emfv_select_all_text(BonoboUIComponent *uid, void *data, const char *path) -{ - EMFolderView *emfv = data; - gboolean selected; - - gtk_html_select_all (((EMFormatHTML *)emfv->preview)->html); - selected = gtk_html_command (((EMFormatHTML *)emfv->preview)->html, "is-selection-active"); - bonobo_ui_component_set_prop(emfv->uic, "/commands/EditCopy", "sensitive", selected?"1":"0", NULL); - -} +//static void +//emfv_select_all_text(BonoboUIComponent *uid, void *data, const char *path) +//{ +// EMFolderView *emfv = data; +// gboolean selected; +// +// gtk_html_select_all (((EMFormatHTML *)emfv->preview)->html); +// selected = gtk_html_command (((EMFormatHTML *)emfv->preview)->html, "is-selection-active"); +// bonobo_ui_component_set_prop(emfv->uic, "/commands/EditCopy", "sensitive", selected?"1":"0", NULL); +// +//} static void emfv_message_search(BonoboUIComponent *uic, void *data, const char *path) { -#if 0 /* KILL-BONOBO */ EMFolderView *emfv = data; if (!emfv->list_active) /* We are in new mail window */ @@ -1086,7 +1052,6 @@ emfv_message_search(BonoboUIComponent *uic, void *data, const char *path) gtk_widget_grab_focus (((ESearchBar *)((EMFolderBrowser *) emfv)->search)->entry); gtk_option_menu_set_history (GTK_OPTION_MENU (((ESearchBar *)((EMFolderBrowser *) emfv)->search)->scopeoption), 3); } -#endif } static void @@ -1153,14 +1118,14 @@ static BonoboUIVerb emfv_message_verbs[] = { BONOBO_UI_UNSAFE_VERB ("EditCopy", emfv_edit_copy), BONOBO_UI_UNSAFE_VERB ("EditPaste", emfv_edit_paste), - BONOBO_UI_UNSAFE_VERB ("SelectAllText", emfv_select_all_text), +// BONOBO_UI_UNSAFE_VERB ("SelectAllText", emfv_select_all_text), // BONOBO_UI_UNSAFE_VERB ("MessageDelete", emfv_message_delete), // BONOBO_UI_UNSAFE_VERB ("MessageDeleteKey", emfv_message_delete), - BONOBO_UI_UNSAFE_VERB ("MessageOpen", emfv_message_open), +// BONOBO_UI_UNSAFE_VERB ("MessageOpen", emfv_message_open), BONOBO_UI_UNSAFE_VERB ("MessageSearch", emfv_message_search), - BONOBO_UI_UNSAFE_VERB ("ViewSource", emfv_message_source), +// BONOBO_UI_UNSAFE_VERB ("ViewSource", emfv_message_source), BONOBO_UI_VERB_END }; @@ -1309,10 +1274,8 @@ emfv_activate(EMFolderView *emfv, BonoboUIComponent *uic, int act) bonobo_ui_component_set_translate (uic, "/", "", NULL); /* We need to set this up to get the right view options for the message-list, even if we're not showing it */ -#if 0 /* KILL-BONOBO */ if (emfv->folder) emfv_setup_view_instance(emfv); -#endif } else { const BonoboUIVerb *v; @@ -1565,34 +1528,34 @@ emfv_message_selected_timeout(void *data) return FALSE; } -static void -emfv_list_message_selected(MessageList *ml, const char *uid, EMFolderView *emfv) -{ - e_profile_event_emit("goto.listuid", uid, 0); - - if (emfv->preview_active) { - if (emfv->priv->selected_id != 0) - g_source_remove(emfv->priv->selected_id); - - emfv->priv->selected_id = g_timeout_add(100, emfv_message_selected_timeout, emfv); - - g_free(emfv->priv->selected_uid); - emfv->priv->selected_uid = g_strdup(uid); - } - - emfv_enable_menus(emfv); - - g_signal_emit(emfv, signals[EMFV_CHANGED], 0); -} +//static void +//emfv_list_message_selected(MessageList *ml, const char *uid, EMFolderView *emfv) +//{ +// e_profile_event_emit("goto.listuid", uid, 0); +// +// if (emfv->preview_active) { +// if (emfv->priv->selected_id != 0) +// g_source_remove(emfv->priv->selected_id); +// +// emfv->priv->selected_id = g_timeout_add(100, emfv_message_selected_timeout, emfv); +// +// g_free(emfv->priv->selected_uid); +// emfv->priv->selected_uid = g_strdup(uid); +// } +// +// emfv_enable_menus(emfv); +// +// g_signal_emit(emfv, signals[EMFV_CHANGED], 0); +//} -static void -emfv_list_built(MessageList *ml, EMFolderView *emfv) -{ - if (!emfv->priv->destroyed) { - emfv_enable_menus(emfv); - g_signal_emit(emfv, signals[EMFV_LOADED], 0); - } -} +//static void +//emfv_list_built(MessageList *ml, EMFolderView *emfv) +//{ +// if (!emfv->priv->destroyed) { +// emfv_enable_menus(emfv); +// g_signal_emit(emfv, signals[EMFV_LOADED], 0); +// } +//} //static void //emfv_list_double_click(ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, EMFolderView *emfv) @@ -1604,13 +1567,13 @@ emfv_list_built(MessageList *ml, EMFolderView *emfv) // em_folder_view_open_selected(emfv); //} -static int -emfv_list_right_click(ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, EMFolderView *emfv) -{ - emfv_popup(emfv, event, FALSE); - - return TRUE; -} +//static int +//emfv_list_right_click(ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, EMFolderView *emfv) +//{ +// emfv_popup(emfv, event, FALSE); +// +// return TRUE; +//} //static int //emfv_list_key_press(ETree *tree, int row, ETreePath path, int col, GdkEvent *ev, EMFolderView *emfv) @@ -1679,39 +1642,39 @@ emfv_popup_menu (GtkWidget *widget) return TRUE; } -static void -emfv_list_selection_change(ETree *tree, EMFolderView *emfv) -{ - /* we can't just listen to the message-list message selected thing, since we dont get them - in all cases. blah */ - g_signal_emit(emfv, signals[EMFV_CHANGED], 0); -} - -static void -emfv_format_link_clicked(EMFormatHTMLDisplay *efhd, const char *uri, EMFolderView *emfv) -{ - if (!strncmp (uri, "##", 2)) - return; - - if (!g_ascii_strncasecmp (uri, "mailto:", 7)) { - em_utils_compose_new_message_with_mailto (uri, emfv->folder_uri); - } else if (*uri == '#') { - gtk_html_jump_to_anchor (((EMFormatHTML *) efhd)->html, uri + 1); - } else if (!g_ascii_strncasecmp (uri, "thismessage:", 12)) { - /* ignore */ - } else if (!g_ascii_strncasecmp (uri, "cid:", 4)) { - /* ignore */ - } else { - GError *err = NULL; - - gnome_url_show (uri, &err); +//static void +//emfv_list_selection_change(ETree *tree, EMFolderView *emfv) +//{ +// /* we can't just listen to the message-list message selected thing, since we dont get them +// in all cases. blah */ +// g_signal_emit(emfv, signals[EMFV_CHANGED], 0); +//} - if (err) { - g_warning ("gnome_url_show: %s", err->message); - g_error_free (err); - } - } -} +//static void +//emfv_format_link_clicked(EMFormatHTMLDisplay *efhd, const char *uri, EMFolderView *emfv) +//{ +// if (!strncmp (uri, "##", 2)) +// return; +// +// if (!g_ascii_strncasecmp (uri, "mailto:", 7)) { +// em_utils_compose_new_message_with_mailto (uri, emfv->folder_uri); +// } else if (*uri == '#') { +// gtk_html_jump_to_anchor (((EMFormatHTML *) efhd)->html, uri + 1); +// } else if (!g_ascii_strncasecmp (uri, "thismessage:", 12)) { +// /* ignore */ +// } else if (!g_ascii_strncasecmp (uri, "cid:", 4)) { +// /* ignore */ +// } else { +// GError *err = NULL; +// +// gnome_url_show (uri, &err); +/ +/// if (err) { +// g_warning ("gnome_url_show: %s", err->message); +// g_error_free (err); +// } +// } +//} static gchar * url_unescape_amp (const gchar *url) @@ -2026,7 +1989,6 @@ static GHashTable *emfv_setting_key; static void emfv_setting_notify(GConfClient *gconf, guint cnxn_id, GConfEntry *entry, EMFolderView *emfv) { -#if 0 /* KILL-BONOBO */ GConfValue *value; char *tkey; @@ -2190,7 +2152,6 @@ emfv_setting_notify(GConfClient *gconf, guint cnxn_id, GConfEntry *entry, EMFold gtk_paned_set_position (GTK_PANED (emfb->vpane), paned_size); break; } } -#endif } static void @@ -2285,14 +2246,14 @@ emfv_on_url_cb (GObject *emitter, const char *url, EMFolderView *emfv) g_free (nice_url); } -static gboolean -emfv_on_html_button_released_cb (GtkHTML *html, GdkEventButton *button, EMFolderView *emfv) -{ - gboolean selected; - - selected = gtk_html_command (html, "is-selection-active"); - bonobo_ui_component_set_prop(emfv->uic, "/commands/EditCopy", "sensitive", selected?"1":"0", NULL); - - return FALSE; -} +//static gboolean +//emfv_on_html_button_released_cb (GtkHTML *html, GdkEventButton *button, EMFolderView *emfv) +//{ +// gboolean selected; +// +// selected = gtk_html_command (html, "is-selection-active"); +// bonobo_ui_component_set_prop(emfv->uic, "/commands/EditCopy", "sensitive", selected?"1":"0", NULL); +// +// return FALSE; +//} diff --git a/mail/em-menu.c b/mail/em-menu.c index 9894054dc7..fc2e43d455 100644 --- a/mail/em-menu.c +++ b/mail/em-menu.c @@ -29,8 +29,6 @@ #include -#include - #include "em-menu.h" #include "libedataserver/e-msgport.h" #include "em-utils.h" diff --git a/mail/em-popup.c b/mail/em-popup.c index 34abb6a0a9..18d4875a8d 100644 --- a/mail/em-popup.c +++ b/mail/em-popup.c @@ -31,8 +31,6 @@ #include #include -#include - #include "em-popup.h" #include "libedataserver/e-msgport.h" #include "em-utils.h" @@ -587,13 +585,9 @@ static void emp_uri_popup_link_open(EPopup *ep, EPopupItem *item, void *data) { EMPopupTargetURI *t = (EMPopupTargetURI *)ep->target; - GError *err = NULL; - gnome_url_show(t->uri, &err); - if (err) { - g_warning("gnome_url_show: %s", err->message); - g_error_free(err); - } + /* FIXME Pass a parent window. */ + e_show_uri (NULL, t->uri); } static void -- cgit