aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2003-12-12 04:55:01 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2003-12-12 04:55:01 +0800
commita706f49f2604162d8724f8366d10a27f2015002d (patch)
tree41da37dc2d83efa1c364237e751b7e9d3120309d /mail
parente0f24af03fc5b9e9a367e1956520a3944d17b3dd (diff)
downloadgsoc2013-evolution-a706f49f2604162d8724f8366d10a27f2015002d.tar
gsoc2013-evolution-a706f49f2604162d8724f8366d10a27f2015002d.tar.gz
gsoc2013-evolution-a706f49f2604162d8724f8366d10a27f2015002d.tar.bz2
gsoc2013-evolution-a706f49f2604162d8724f8366d10a27f2015002d.tar.lz
gsoc2013-evolution-a706f49f2604162d8724f8366d10a27f2015002d.tar.xz
gsoc2013-evolution-a706f49f2604162d8724f8366d10a27f2015002d.tar.zst
gsoc2013-evolution-a706f49f2604162d8724f8366d10a27f2015002d.zip
Fixes bug #1717.
2003-12-11 Jeffrey Stedfast <fejj@ximian.com> Fixes bug #1717. * em-folder-browser.c (emfb_list_built): If we have a uid to select, select that instead of selecting the first unread. (emfb_set_folder): CamelObject::meta_get() actually returns a strdup'd buffer, so we need to free it. Get the last selected uid and set that up as the uid to select when the message-list finishes building. (emfb_list_message_selected): Save the selected uid. (emfb_init): Connect to the message-list's message_selected signal so that we can save selected state (don't want to do this in EMFolderView or MessageList because we don't want the state to be saved for the EMMessageBrowser). svn path=/trunk/; revision=23928
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog16
-rw-r--r--mail/em-folder-browser.c74
2 files changed, 67 insertions, 23 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 245db7055e..d03dc72d9e 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,5 +1,21 @@
2003-12-11 Jeffrey Stedfast <fejj@ximian.com>
+ Fixes bug #1717.
+
+ * em-folder-browser.c (emfb_list_built): If we have a uid to
+ select, select that instead of selecting the first unread.
+ (emfb_set_folder): CamelObject::meta_get() actually returns a
+ strdup'd buffer, so we need to free it. Get the last selected uid
+ and set that up as the uid to select when the message-list
+ finishes building.
+ (emfb_list_message_selected): Save the selected uid.
+ (emfb_init): Connect to the message-list's message_selected signal
+ so that we can save selected state (don't want to do this in
+ EMFolderView or MessageList because we don't want the state to be
+ saved for the EMMessageBrowser).
+
+2003-12-11 Jeffrey Stedfast <fejj@ximian.com>
+
* em-folder-tree.c: Shorten the namespace of some internal
functions to just emft.
(emft_popup_delete_rec): Don't delete the contents of a folder if
diff --git a/mail/em-folder-browser.c b/mail/em-folder-browser.c
index 0f1cfc6922..50ea24749c 100644
--- a/mail/em-folder-browser.c
+++ b/mail/em-folder-browser.c
@@ -100,6 +100,8 @@ struct _EMFolderBrowserPrivate {
guint vpane_resize_id;
guint list_built_id; /* hook onto list-built for delayed 'select first unread' stuff */
+
+ char *select_uid;
};
static void emfb_activate(EMFolderView *emfv, BonoboUIComponent *uic, int state);
@@ -107,11 +109,12 @@ static void emfb_set_folder(EMFolderView *emfv, CamelFolder *folder, const char
/* FilterBar stuff ... */
static void emfb_search_config_search(EFilterBar *efb, FilterRule *rule, int id, const char *query, void *data);
-static void emfb_search_menu_activated(ESearchBar *esb, int id, EMFolderBrowser *fb);
+static void emfb_search_menu_activated(ESearchBar *esb, int id, EMFolderBrowser *emfb);
static void emfb_search_search_activated(ESearchBar *esb, EMFolderBrowser *emfb);
-static void emfb_search_query_changed(ESearchBar *esb, EMFolderBrowser *fb);
+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 *fb);
+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 const EMFolderViewEnable emfb_enable_map[];
@@ -212,15 +215,17 @@ emfb_init(GObject *o)
gtk_paned_add2((GtkPaned *)emfb->vpane, p->preview);
gtk_widget_show(p->preview);
- g_signal_connect(emfb->view.list->tree, "key_press", G_CALLBACK(emfb_list_key_press), emfb);
+ g_signal_connect (((EMFolderView *) emfb)->list->tree, "key_press", G_CALLBACK(emfb_list_key_press), emfb);
+ g_signal_connect (((EMFolderView *) emfb)->list, "message_selected", G_CALLBACK (emfb_list_message_selected), emfb);
}
static void
emfb_finalise(GObject *o)
{
EMFolderBrowser *emfb = (EMFolderBrowser *)o;
-
- g_free(emfb->priv);
+
+ g_free (emfb->priv->select_uid);
+ g_free (emfb->priv);
((GObjectClass *)emfb_parent)->finalize(o);
}
@@ -440,6 +445,15 @@ emfb_list_key_press(ETree *tree, int row, ETreePath path, int col, GdkEvent *ev,
return TRUE;
}
+static void
+emfb_list_message_selected (MessageList *ml, const char *uid, EMFolderBrowser *emfb)
+{
+ EMFolderView *emfv = (EMFolderView *) emfb;
+
+ camel_object_meta_set (emfv->folder, "evolution:selected_uid", uid);
+ camel_object_state_write (emfv->folder);
+}
+
/* ********************************************************************** */
static void
@@ -747,16 +761,23 @@ emfb_view_preview(BonoboUIComponent *uic, const char *path, Bonobo_UIComponent_E
/* TODO: This should probably be handled by message-list, by storing/queueing
up the select operation if its busy rebuilding the message-list */
static void
-emfb_list_built(MessageList *ml, EMFolderBrowser *emfb)
+emfb_list_built (MessageList *ml, EMFolderBrowser *emfb)
{
- g_signal_handler_disconnect(ml, emfb->priv->list_built_id);
+ EMFolderView *emfv = (EMFolderView *) emfb;
+
+ g_signal_handler_disconnect (ml, emfb->priv->list_built_id);
emfb->priv->list_built_id = 0;
- /* FIXME: if the 1st message in the list is unread, this will actually select the second unread msg */
- /* FIXME: this usually happens "too soon" and so the toolbar/menu-items remain desensitised even tho with the message selected they should be sensitive */
- if (((EMFolderView *)emfb)->list->cursor_uid == NULL)
- message_list_select(((EMFolderView *)emfb)->list,
- MESSAGE_LIST_SELECT_NEXT, 0, CAMEL_MESSAGE_SEEN, TRUE);
+ if (emfv->list->cursor_uid == NULL) {
+ if (emfb->priv->select_uid) {
+ message_list_select_uid (ml, emfb->priv->select_uid);
+ g_free (emfb->priv->select_uid);
+ emfb->priv->select_uid = NULL;
+ } else {
+ /* FIXME: if the 1st message in the list is unread, this will actually select the second unread msg */
+ message_list_select (ml, MESSAGE_LIST_SELECT_NEXT, 0, CAMEL_MESSAGE_SEEN, TRUE);
+ }
+ }
}
@@ -868,23 +889,30 @@ emfb_create_view_instance (EMFolderBrowser *emfb, CamelFolder *folder, const cha
static void
emfb_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri)
{
+ EMFolderBrowser *emfb = (EMFolderBrowser *) emfv;
+
/* This is required since we get activated the first time
before the folder is open and need to override the
defaults */
if (folder) {
char *sstate;
- if ((sstate = camel_object_meta_get(folder, "evolution:show_preview")))
- em_folder_browser_show_preview((EMFolderBrowser *)emfv, sstate[0] != '0');
+ if ((sstate = camel_object_meta_get (folder, "evolution:show_preview"))) {
+ em_folder_browser_show_preview ((EMFolderBrowser *) emfv, sstate[0] != '0');
+ g_free (sstate);
+ }
+
+ if ((sstate = camel_object_meta_get (folder, "evolution:thread_list"))) {
+ message_list_set_threaded (emfv->list, sstate[0] != '0');
+ g_free (sstate);
+ }
- if ((sstate = camel_object_meta_get(folder, "evolution:thread_list")))
- message_list_set_threaded(emfv->list, sstate[0] != '0');
+ if ((sstate = camel_object_meta_get (folder, "evolution:selected_uid")))
+ emfb->priv->select_uid = sstate;
-#if 0
- if (emfv->list->cursor_uid == NULL && ((EMFolderBrowser *)emfv)->priv->list_built_id == 0)
- ((EMFolderBrowser *)emfv)->priv->list_built_id =
- g_signal_connect(emfv->list, "message_list_built", G_CALLBACK(emfb_list_built), emfv);
-#endif
+ if (emfv->list->cursor_uid == NULL && emfb->priv->list_built_id == 0)
+ emfb->priv->list_built_id =
+ g_signal_connect (emfv->list, "message_list_built", G_CALLBACK (emfb_list_built), emfv);
emfb_create_view_instance ((EMFolderBrowser *) emfv, folder, uri);
}
@@ -944,7 +972,7 @@ emfb_activate(EMFolderView *emfv, BonoboUIComponent *uic, int act)
gtk_paned_set_position((GtkPaned *)emfb->vpane, gconf_client_get_int (gconf, "/apps/evolution/mail/display/paned_size", NULL));
g_signal_handler_unblock(emfb->vpane, emfb->priv->vpane_resize_id);
#endif
-
+
/* (Pre)view toggle */
if (emfv->folder
&& (sstate = camel_object_meta_get(emfv->folder, "evolution:show_preview"))) {