diff options
author | Not Zed <NotZed@Ximian.com> | 2004-05-05 21:28:03 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2004-05-05 21:28:03 +0800 |
commit | 6cb88a7819367f8ece5b563a2910571d3c46f77e (patch) | |
tree | f0e65c5b29f03df042d276ae5ee2f9a14c0935c3 /mail/em-folder-view.c | |
parent | 8eef58bfe428505bc48fe4a2df67d81d04516526 (diff) | |
download | gsoc2013-evolution-6cb88a7819367f8ece5b563a2910571d3c46f77e.tar.gz gsoc2013-evolution-6cb88a7819367f8ece5b563a2910571d3c46f77e.tar.zst gsoc2013-evolution-6cb88a7819367f8ece5b563a2910571d3c46f77e.zip |
** See bug #57720.
2004-05-05 Not Zed <NotZed@Ximian.com>
** See bug #57720.
* em-folder-browser.c (emfb_create_view_menus): removed some stuff
done in create_view_instance in the superclass.
* em-folder-view.c (emfv_create_view_instance): moved here from
em-folder-browser, setup the view instance for the folder.
(emfv_set_folder): if the folder is set, create the view instance.
* em-folder-browser.c: moved the galview instance and menu
pointers to EMFolderView, since they're basically meta-data on the
messagelist @ to fix issues.
* em-folder-view.c (em_folder_view_open_selected): copy over the
threaded list value when the message browser is brought up.
** some clean up
* evolution-mail.schemas.in.in: removed xmailer_mask stuff.
* em-migrate.c (mail_display_map[]): Removed xmailer_mask stuff.
* em-folder-view.c (emfv_setting_notify): removed xmailer_mask stuff.
* em-format-html.c (em_format_html_set_xmailer_mask): removed.
This isn't used anymore.
** Fixes the double-draw on separate mail view.
* message-list.c (on_cursor_activated_cmd): noop if the cursor and
uid match for all cases (clearing uid).
(on_selection_changed_cmd): noop if the cursor and new selection
hasn't changed & fix a memleak.
svn path=/trunk/; revision=25806
Diffstat (limited to 'mail/em-folder-view.c')
-rw-r--r-- | mail/em-folder-view.c | 121 |
1 files changed, 115 insertions, 6 deletions
diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c index 2f83ec768c..dd4311ab8a 100644 --- a/mail/em-folder-view.c +++ b/mail/em-folder-view.c @@ -25,6 +25,9 @@ #endif #include <string.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> #include <gtk/gtkvbox.h> #include <gtk/gtkbutton.h> @@ -37,6 +40,9 @@ #include <gconf/gconf-client.h> +#include <gal/menus/gal-view-etable.h> +#include <gal/menus/gal-view-factory-etable.h> + #include <camel/camel-mime-message.h> #include <camel/camel-stream.h> #include <camel/camel-stream-filter.h> @@ -77,9 +83,10 @@ #include "mail-mt.h" #include "mail-ops.h" -#include "mail-config.h" /* hrm, pity we need this ... */ +#include "mail-config.h" #include "mail-autofilter.h" #include "mail-vfolder.h" +#include "mail-component.h" #include "evolution-shell-component-utils.h" /* Pixmap stuff, sigh */ @@ -355,6 +362,7 @@ em_folder_view_open_selected(EMFolderView *emfv) EMMessageBrowser *emmb; emmb = (EMMessageBrowser *)em_message_browser_window_new(); + message_list_set_threaded(((EMFolderView *)emmb)->list, emfv->list->threaded); /* FIXME: session needs to be passed easier than this */ em_format_set_session((EMFormat *)((EMFolderView *)emmb)->preview, ((EMFormat *)emfv->preview)->session); em_folder_view_set_folder((EMFolderView *)emmb, emfv->folder, emfv->folder_uri); @@ -368,6 +376,101 @@ em_folder_view_open_selected(EMFolderView *emfv) return i; } +/* ******************************************************************************** */ +static GalViewCollection *collection = NULL; + +static void +emfv_list_display_view(GalViewInstance *instance, GalView *view, EMFolderView *emfv) +{ + if (GAL_IS_VIEW_ETABLE(view)) + gal_view_etable_attach_tree(GAL_VIEW_ETABLE(view), emfv->list->tree); +} + +static void +emfv_create_view_instance(EMFolderView *emfv) +{ + gboolean outgoing; + char *id; + + g_assert(emfv->folder); + g_assert(emfv->folder_uri); + + if (collection == NULL) { + ETableSpecification *spec; + GalViewFactory *factory; + const char *evolution_dir; + char *dir; + + collection = gal_view_collection_new (); + + gal_view_collection_set_title (collection, _("Mail")); + + evolution_dir = mail_component_peek_base_directory (mail_component_peek ()); + dir = g_build_filename (evolution_dir, "mail", "views", NULL); + gal_view_collection_set_storage_directories (collection, EVOLUTION_GALVIEWSDIR "/mail/", dir); + g_free (dir); + + spec = e_table_specification_new (); + e_table_specification_load_from_file (spec, EVOLUTION_ETSPECDIR "/message-list.etspec"); + + factory = gal_view_factory_etable_new (spec); + g_object_unref (spec); + gal_view_collection_add_factory (collection, factory); + g_object_unref (factory); + + gal_view_collection_load (collection); + } + + if (emfv->view_instance) { + g_object_unref(emfv->view_instance); + emfv->view_instance = NULL; + } + + outgoing = em_utils_folder_is_drafts (emfv->folder, emfv->folder_uri) + || em_utils_folder_is_sent (emfv->folder, emfv->folder_uri) + || em_utils_folder_is_outbox (emfv->folder, emfv->folder_uri); + + /* TODO: should this go through mail-config api? */ + id = mail_config_folder_to_safe_url (emfv->folder); + emfv->view_instance = gal_view_instance_new (collection, id); + g_free (id); + + if (outgoing) + gal_view_instance_set_default_view (emfv->view_instance, "As_Sent_Folder"); + + gal_view_instance_load (emfv->view_instance); + + if (!gal_view_instance_exists (emfv->view_instance)) { + struct stat st; + char *path; + + path = mail_config_folder_to_cachename (emfv->folder, "et-header-"); + if (path && stat (path, &st) == 0 && st.st_size > 0 && S_ISREG (st.st_mode)) { + ETableSpecification *spec; + ETableState *state; + GalView *view; + + spec = e_table_specification_new (); + e_table_specification_load_from_file (spec, EVOLUTION_ETSPECDIR "/message-list.etspec"); + view = gal_view_etable_new (spec, ""); + g_object_unref (spec); + + state = e_table_state_new (); + e_table_state_load_from_file (state, path); + gal_view_etable_set_state (GAL_VIEW_ETABLE (view), state); + g_object_unref (state); + + gal_view_instance_set_custom_view (emfv->view_instance, view); + g_object_unref (view); + } + + g_free (path); + } + + g_signal_connect (emfv->view_instance, "display_view", G_CALLBACK (emfv_list_display_view), emfv); + emfv_list_display_view (emfv->view_instance, gal_view_instance_get_current_view (emfv->view_instance), emfv); +} + /* ********************************************************************** */ static void @@ -401,6 +504,8 @@ emfv_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri) (CamelObjectEventHookFunc)emfv_folder_changed, emfv); camel_object_ref(folder); mail_refresh_folder(folder, NULL, NULL); + /* We need to set this up to get the right view options for the message-list, even if we're not showing it */ + emfv_create_view_instance(emfv); } emfv_enable_menus(emfv); @@ -1654,6 +1759,10 @@ emfv_activate(EMFolderView *emfv, BonoboUIComponent *uic, int act) emfv_enable_menus(emfv); if (emfv->statusbar_active) bonobo_ui_component_set_translate (uic, "/", "<status><item name=\"main\"/></status>", 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 (emfv->folder) + emfv_create_view_instance(emfv); } else { const BonoboUIVerb *v; @@ -1661,6 +1770,11 @@ emfv_activate(EMFolderView *emfv, BonoboUIComponent *uic, int act) for (v = &emfv_message_verbs[0]; v->cname; v++) bonobo_ui_component_remove_verb(uic, v->cname); + if (emfv->view_instance) { + g_object_unref(emfv->view_instance); + emfv->view_instance = NULL; + } + if (emfv->folder) mail_sync_folder(emfv->folder, NULL, NULL); @@ -2028,7 +2142,6 @@ enum { EMFV_MARK_SEEN, EMFV_MARK_SEEN_TIMEOUT, EMFV_LOAD_HTTP, - EMFV_XMAILER_MASK, EMFV_HEADERS, EMFV_SETTINGS /* last, for loop count */ }; @@ -2044,7 +2157,6 @@ static const char * const emfv_display_keys[] = { "mark_seen", "mark_seen_timeout", "load_http_images", - "xmailer_mask", "headers", }; @@ -2108,9 +2220,6 @@ emfv_setting_notify(GConfClient *gconf, guint cnxn_id, GConfEntry *entry, EMFold case EMFV_LOAD_HTTP: em_format_html_set_load_http((EMFormatHTML *)emfv->preview, gconf_value_get_int(value)); break; - case EMFV_XMAILER_MASK: - em_format_html_set_xmailer_mask((EMFormatHTML *)emfv->preview, gconf_value_get_int (value)); - break; case EMFV_HEADERS: { GSList *header_config_list, *p; EMFormat *emf = (EMFormat *)emfv->preview; |