From 6cb88a7819367f8ece5b563a2910571d3c46f77e Mon Sep 17 00:00:00 2001 From: Not Zed Date: Wed, 5 May 2004 13:28:03 +0000 Subject: ** See bug #57720. 2004-05-05 Not Zed ** 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 --- mail/ChangeLog | 37 ++++++++- mail/em-folder-browser.c | 162 ++++---------------------------------- mail/em-folder-tree.c | 1 - mail/em-folder-view.c | 121 ++++++++++++++++++++++++++-- mail/em-folder-view.h | 7 +- mail/em-format-html.c | 9 --- mail/em-format-html.h | 7 -- mail/em-migrate.c | 1 - mail/evolution-mail.schemas.in.in | 14 ---- mail/message-list.c | 24 ++++-- 10 files changed, 188 insertions(+), 195 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index f13d686e40..092ba21eae 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,39 @@ +2004-05-05 Not Zed + + ** 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. + 2004-05-04 Jeffrey Stedfast Fix for bug #55303, but ideally there would be a nicer way of @@ -37,7 +73,6 @@ * mail-license.glade: Modified the display string and added the appropriate gtk_response types for the buttons. - 2004-05-03 Jeffrey Stedfast Fix for bug #57968 diff --git a/mail/em-folder-browser.c b/mail/em-folder-browser.c index e3082509ca..4a208c7906 100644 --- a/mail/em-folder-browser.c +++ b/mail/em-folder-browser.c @@ -67,9 +67,6 @@ #include /* gal view crap */ -#include -#include -#include #include "widgets/menus/gal-view-menus.h" #include "e-util/e-dialog-utils.h" @@ -94,7 +91,6 @@ struct _EMFolderBrowserPrivate { GtkWidget *subscribe_editor; - GalViewInstance *view_instance; GalViewMenus *view_menus; guint search_menu_activated_id; @@ -123,8 +119,6 @@ static void emfb_search_query_changed(ESearchBar *esb, EMFolderBrowser *emfb); static int emfb_list_key_press(ETree *tree, int row, ETreePath path, int col, GdkEvent *ev, EMFolderBrowser *emfb); static void emfb_list_message_selected (MessageList *ml, const char *uid, EMFolderBrowser *emfb); -static void emfb_create_view_menus(EMFolderBrowser *emfb, BonoboUIComponent *uic); - static const EMFolderViewEnable emfb_enable_map[]; enum { @@ -141,9 +135,6 @@ static ESearchBarItem emfb_search_items[] = { { NULL, -1, NULL } }; -static GalViewCollection *collection = NULL; - - static EMFolderViewClass *emfb_parent; /* Needed since the paned wont take the position its given otherwise ... */ @@ -266,6 +257,7 @@ static void emfb_class_init(GObjectClass *klass) { klass->finalize = emfb_finalise; + ((GtkObjectClass *)klass)->destroy = emfb_destroy; ((EMFolderViewClass *)klass)->set_folder = emfb_set_folder; ((EMFolderViewClass *)klass)->activate = emfb_activate; @@ -869,110 +861,23 @@ emfb_list_built (MessageList *ml, EMFolderBrowser *emfb) emfb->priv->idle_scroll_id = g_timeout_add_full (G_PRIORITY_LOW, 250, (GSourceFunc) scroll_idle_cb, emfb, NULL); } - +/* TODO: All this mess should sit directly on MessageList, but it would + need to become BonoboUIComponent aware ... */ static void -emfb_list_display_view (GalViewInstance *instance, GalView *view, EMFolderBrowser *emfb) +emfb_create_view_menus(EMFolderBrowser *emfb, BonoboUIComponent *uic) { - if (GAL_IS_VIEW_ETABLE (view)) - gal_view_etable_attach_tree (GAL_VIEW_ETABLE (view), emfb->view.list->tree); -} + struct _EMFolderBrowserPrivate *p = emfb->priv; -static void -collection_init (void) -{ - ETableSpecification *spec; - GalViewFactory *factory; - const char *evolution_dir; - char *dir; - - if (collection != NULL) + if (emfb->view.view_instance == NULL) return; - - 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); -} -static void -emfb_create_view_instance (EMFolderBrowser *emfb, CamelFolder *folder, const char *uri) -{ - struct _EMFolderBrowserPrivate *priv = emfb->priv; - gboolean outgoing; - char *id; - - collection_init (); - - if (priv->view_instance) { - g_object_unref (priv->view_instance); - priv->view_instance = NULL; - } - - if (folder == NULL) { - folder = emfb->view.folder; - uri = emfb->view.folder_uri; - } - - outgoing = em_utils_folder_is_drafts (folder, uri) - || em_utils_folder_is_sent (folder, uri) - || em_utils_folder_is_outbox (folder, uri); - - /* TODO: should this go through mail-config api? */ - id = mail_config_folder_to_safe_url (folder); - priv->view_instance = gal_view_instance_new (collection, id); - g_free (id); - - if (outgoing) - gal_view_instance_set_default_view (priv->view_instance, "As_Sent_Folder"); - - gal_view_instance_load (priv->view_instance); - - if (!gal_view_instance_exists (priv->view_instance)) { - struct stat st; - char *path; - - path = mail_config_folder_to_cachename (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 (priv->view_instance, view); - g_object_unref (view); - } - - g_free (path); + if (p->view_menus) { + g_object_unref(p->view_menus); + p->view_menus = NULL; } - - if (priv->view_menus) - gal_view_menus_set_instance (priv->view_menus, priv->view_instance); - - g_signal_connect (priv->view_instance, "display_view", G_CALLBACK (emfb_list_display_view), emfb); - emfb_list_display_view (priv->view_instance, gal_view_instance_get_current_view (priv->view_instance), emfb); + + p->view_menus = gal_view_menus_new (emfb->view.view_instance); + gal_view_menus_apply(p->view_menus, uic, NULL); } static void @@ -1046,7 +951,7 @@ emfb_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri) if (emfv->list->cursor_uid == NULL && emfb->priv->list_built_id == 0) p->list_built_id = g_signal_connect(emfv->list, "message_list_built", G_CALLBACK (emfb_list_built), emfv); - /*emfb_create_view_instance (emfb, folder, uri);*/ + /* NOTE: This relies on our parent class setting up emfv->view_instance */ if (emfv->uic) emfb_create_view_menus (emfb, emfv->uic); } @@ -1054,41 +959,6 @@ emfb_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri) message_list_thaw(emfv->list); } -/* TODO: All this mess should sit directly on MessageList, but it would - need to become BonoboUIComponent aware ... */ - -static void -emfb_create_view_menus(EMFolderBrowser *emfb, BonoboUIComponent *uic) -{ - struct _EMFolderBrowserPrivate *p = emfb->priv; - - if (p->view_instance) { - g_object_unref(p->view_instance); - p->view_instance = NULL; - } - - if (p->view_menus) { - g_object_unref(p->view_menus); - p->view_menus = NULL; - } - - /*g_assert(p->view_instance == NULL); - g_assert(p->view_menus == NULL);*/ - - collection_init (); - - emfb_create_view_instance (emfb, emfb->view.folder, emfb->view.folder_uri); - p->view_menus = gal_view_menus_new (p->view_instance); - gal_view_menus_apply(p->view_menus, uic, NULL); - - /* Due to CORBA reentrancy, the view could be gone now. */ - if (p->view_instance == NULL) - return; - - g_signal_connect(p->view_instance, "display_view", G_CALLBACK(emfb_list_display_view), emfb); - emfb_list_display_view(p->view_instance, gal_view_instance_get_current_view(p->view_instance), emfb); -} - static void emfb_activate(EMFolderView *emfv, BonoboUIComponent *uic, int act) { @@ -1169,6 +1039,7 @@ emfb_activate(EMFolderView *emfv, BonoboUIComponent *uic, int act) if (((EMFolderBrowser *)emfv)->search) e_search_bar_set_ui_component((ESearchBar *)((EMFolderBrowser *)emfv)->search, uic); + /* NOTE: This relies on our parent class setting up emfv->view_instance */ if (emfv->folder) emfb_create_view_menus((EMFolderBrowser *)emfv, uic); } else { @@ -1177,11 +1048,6 @@ emfb_activate(EMFolderView *emfv, BonoboUIComponent *uic, int act) for (v = &emfb_verbs[0]; v->cname; v++) bonobo_ui_component_remove_verb(uic, v->cname); - if (p->view_instance) { - g_object_unref(p->view_instance); - p->view_instance = NULL; - } - if (p->view_menus) { g_object_unref(p->view_menus); p->view_menus = NULL; diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c index 58d7bb1c44..163485749c 100644 --- a/mail/em-folder-tree.c +++ b/mail/em-folder-tree.c @@ -20,7 +20,6 @@ * */ - #ifdef HAVE_CONFIG_H #include #endif 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 +#include +#include +#include #include #include @@ -37,6 +40,9 @@ #include +#include +#include + #include #include #include @@ -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, "/", "", 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; diff --git a/mail/em-folder-view.h b/mail/em-folder-view.h index 23bed7b715..4918814e4b 100644 --- a/mail/em-folder-view.h +++ b/mail/em-folder-view.h @@ -32,6 +32,9 @@ extern "C" { #pragma } #endif /* __cplusplus */ +/* @#$@#$Q@#$@Q!EQ#@$!~!!! GAL, defines its structs anonymously so we need to include this directly, sigh */ +#include + struct _MessageList; struct _EMFormatHTMLDisplay; struct _CamelFolder; @@ -61,6 +64,8 @@ struct _EMFolderView { struct _EMFolderViewPrivate *priv; struct _MessageList *list; + GalViewInstance *view_instance; + struct _EMFormatHTMLDisplay *preview; struct _CamelFolder *folder; @@ -125,7 +130,7 @@ int em_folder_view_print(EMFolderView *emfv, int preview); /* this could be on message-list */ guint32 em_folder_view_disable_mask(EMFolderView *emfv); -void em_folder_view_set_statusbar (EMFolderView *emfv, gboolean statusbar); +void em_folder_view_set_statusbar(EMFolderView *emfv, gboolean statusbar); void em_folder_view_set_hide_deleted(EMFolderView *emfv, gboolean status); #ifdef __cplusplus diff --git a/mail/em-format-html.c b/mail/em-format-html.c index 5302f5b79c..c6ad7b0a4f 100644 --- a/mail/em-format-html.c +++ b/mail/em-format-html.c @@ -282,15 +282,6 @@ em_format_html_set_mark_citations(EMFormatHTML *emfh, int state, guint32 citatio } } -void -em_format_html_set_xmailer_mask(EMFormatHTML *emfh, unsigned int xmailer_mask) -{ - if (emfh->xmailer_mask ^ xmailer_mask) { - emfh->xmailer_mask = xmailer_mask; - em_format_redraw((EMFormat *)emfh); - } -} - CamelMimePart * em_format_html_file_part(EMFormatHTML *efh, const char *mime_type, const char *filename) { diff --git a/mail/em-format-html.h b/mail/em-format-html.h index 17248a92d5..bbd0132017 100644 --- a/mail/em-format-html.h +++ b/mail/em-format-html.h @@ -91,11 +91,6 @@ struct _EMFormatHTMLPObject { #define EM_FORMAT_HTML_HEADER_HTML (EM_FORMAT_HEADER_LAST<<1) /* header already in html format */ #define EM_FORMAT_HTML_HEADER_LAST (EM_FORMAT_HEADER_LAST<<8) -/* xmailer_mask bits */ -#define EM_FORMAT_HTML_XMAILER_EVOLUTION (1<<0) -#define EM_FORMAT_HTML_XMAILER_OTHER (1<<1) -#define EM_FORMAT_HTML_XMAILER_RUPERT (1<<2) - #define EM_FORMAT_HTML_VPAD "
\n" struct _EMFormatHTML { @@ -115,7 +110,6 @@ struct _EMFormatHTML { guint32 frame_colour; guint32 content_colour; guint32 citation_colour; - unsigned int xmailer_mask:4; unsigned int load_http:2; unsigned int load_http_now:1; unsigned int mark_citations:1; @@ -135,7 +129,6 @@ void em_format_html_load_http(EMFormatHTML *emf); void em_format_html_set_load_http(EMFormatHTML *emf, int style); void em_format_html_set_mark_citations(EMFormatHTML *emf, int state, guint32 citation_colour); -void em_format_html_set_xmailer_mask(EMFormatHTML *emf, unsigned int xmailer_mask); /* retrieves a pseudo-part icon wrapper for a file */ struct _CamelMimePart *em_format_html_file_part(EMFormatHTML *efh, const char *mime_type, const char *filename); diff --git a/mail/em-migrate.c b/mail/em-migrate.c index 0d7ebc32d4..43c0480f89 100644 --- a/mail/em-migrate.c +++ b/mail/em-migrate.c @@ -812,7 +812,6 @@ static e_gconf_map_t mail_display_map[] = { { "http_images", "mail/display/load_http_images", E_GCONF_MAP_INT }, { "citation_highlight", "mail/display/mark_citations", E_GCONF_MAP_BOOL }, { "citation_color", "mail/display/citation_colour", E_GCONF_MAP_COLOUR }, - { "x_mailer_display_style", "mail/display/xmailer_mask", E_GCONF_MAP_INT }, { 0 }, }; diff --git a/mail/evolution-mail.schemas.in.in b/mail/evolution-mail.schemas.in.in index 01f10052d7..2346d19bf7 100644 --- a/mail/evolution-mail.schemas.in.in +++ b/mail/evolution-mail.schemas.in.in @@ -291,20 +291,6 @@ - - /schemas/apps/evolution/mail/display/xmailer_mask - /apps/evolution/mail/display/xmailer_mask - evolution-mail - int - 0 - - S3kr3t 0pt10n - - S3kr3t 0pt10n. - - - - /schemas/apps/evolution/mail/display/mark_seen /apps/evolution/mail/display/mark_seen diff --git a/mail/message-list.c b/mail/message-list.c index 138832c007..9ae5673bd2 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -2641,8 +2641,9 @@ on_cursor_activated_cmd (ETree *tree, int row, ETreePath path, gpointer user_dat new_uid = NULL; else new_uid = get_message_uid (message_list, path); - - if (message_list->cursor_uid != NULL && new_uid != NULL && !strcmp (message_list->cursor_uid, new_uid)) + + if ((message_list->cursor_uid == NULL && new_uid == NULL) + || (message_list->cursor_uid != NULL && new_uid != NULL && !strcmp (message_list->cursor_uid, new_uid))) return; message_list->cursor_row = row; @@ -2660,18 +2661,27 @@ static void on_selection_changed_cmd(ETree *tree, MessageList *ml) { GPtrArray *uids; + char *newuid; /* not sure if we could just ignore this for the cursor, i think sometimes you only get a selection changed when you should also get a cursor activated? */ uids = message_list_get_selected(ml); - g_free(ml->cursor_uid); if (uids->len == 1) - ml->cursor_uid = g_strdup(uids->pdata[0]); + newuid = uids->pdata[0]; else - ml->cursor_uid = NULL; + newuid = NULL; - if (!ml->idle_id) - ml->idle_id = g_idle_add_full (G_PRIORITY_LOW, on_cursor_activated_idle, ml, NULL); + if ((newuid == NULL && ml->cursor_uid == NULL) + || (newuid != NULL && ml->cursor_uid != NULL && !strcmp(ml->cursor_uid, newuid))) { + /* noop */ + } else { + g_free(ml->cursor_uid); + ml->cursor_uid = g_strdup(newuid); + if (!ml->idle_id) + ml->idle_id = g_idle_add_full (G_PRIORITY_LOW, on_cursor_activated_idle, ml, NULL); + } + + message_list_free_uids(ml, uids); } static gint -- cgit v1.2.3