From 3c7a575407bef757d434808904a4c4dc1ba60cb3 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 21 Jan 2009 21:03:14 +0000 Subject: Fix some runtime warnings. Copy that nasty message list scrolling hack to EMailShellContent. Remember the scrollbar position for each folder. Now I just have to make it select a message automatically. svn path=/branches/kill-bonobo/; revision=37119 --- mail/em-folder-browser.c | 196 +++++++++++++++++++++++------------------------ 1 file changed, 98 insertions(+), 98 deletions(-) (limited to 'mail/em-folder-browser.c') diff --git a/mail/em-folder-browser.c b/mail/em-folder-browser.c index 9f53ae43c0..705e87269d 100644 --- a/mail/em-folder-browser.c +++ b/mail/em-folder-browser.c @@ -539,16 +539,16 @@ emfb_init(GObject *o) } -static void -emfb_finalise(GObject *o) -{ - EMFolderBrowser *emfb = (EMFolderBrowser *)o; - - g_free (emfb->priv->select_uid); - g_free (emfb->priv); - - ((GObjectClass *)emfb_parent)->finalize(o); -} +//static void +//emfb_finalise(GObject *o) +//{ +// EMFolderBrowser *emfb = (EMFolderBrowser *)o; +// +// g_free (emfb->priv->select_uid); +// g_free (emfb->priv); +// +// ((GObjectClass *)emfb_parent)->finalize(o); +//} static void emfb_destroy(GtkObject *o) @@ -1351,44 +1351,44 @@ emfb_hide_deleted(BonoboUIComponent *uic, const char *path, Bonobo_UIComponent_E em_folder_view_set_hide_deleted(emfv, state[0] != '0'); } -static void -emfb_list_scrolled (MessageList *ml, EMFolderBrowser *emfb) -{ - EMFolderView *emfv = (EMFolderView *) emfb; - double position; - char *state; - - position = message_list_get_scrollbar_position (ml); - state = g_strdup_printf ("%f", position); - - if (camel_object_meta_set (emfv->folder, "evolution:list_scroll_position", state)) - camel_object_state_write (emfv->folder); - - g_free (state); -} - -static gboolean -scroll_idle_cb (EMFolderBrowser *emfb) -{ - EMFolderView *emfv = (EMFolderView *) emfb; - double position; - char *state; - - if ((state = camel_object_meta_get (emfv->folder, "evolution:list_scroll_position"))) { - position = strtod (state, NULL); - g_free (state); - } else { - position = emfb->priv->default_scroll_position; - } - - message_list_set_scrollbar_position (emfv->list, position); - - emfb->priv->list_scrolled_id = g_signal_connect (emfv->list, "message_list_scrolled", G_CALLBACK (emfb_list_scrolled), emfb); - - emfb->priv->idle_scroll_id = 0; - - return FALSE; -} +//static void +//emfb_list_scrolled (MessageList *ml, EMFolderBrowser *emfb) +//{ +// EMFolderView *emfv = (EMFolderView *) emfb; +// double position; +// char *state; +// +// position = message_list_get_scrollbar_position (ml); +// state = g_strdup_printf ("%f", position); +// +// if (camel_object_meta_set (emfv->folder, "evolution:list_scroll_position", state)) +// camel_object_state_write (emfv->folder); +// +// g_free (state); +//} + +//static gboolean +//scroll_idle_cb (EMFolderBrowser *emfb) +//{ +// EMFolderView *emfv = (EMFolderView *) emfb; +// double position; +// char *state; +// +// if ((state = camel_object_meta_get (emfv->folder, "evolution:list_scroll_position"))) { +// position = strtod (state, NULL); +// g_free (state); +// } else { +// position = emfb->priv->default_scroll_position; +// } +// +// message_list_set_scrollbar_position (emfv->list, position); +// +// emfb->priv->list_scrolled_id = g_signal_connect (emfv->list, "message_list_scrolled", G_CALLBACK (emfb_list_scrolled), emfb); +// +// emfb->priv->idle_scroll_id = 0; +// +// return FALSE; +//} static void emfb_gui_folder_changed(CamelFolder *folder, void *dummy, EMFolderBrowser *emfb) @@ -1415,60 +1415,60 @@ emfb_folder_changed(CamelFolder *folder, CamelFolderChangeInfo *changes, EMFolde mail_async_event_emit(emfb->view.async, MAIL_ASYNC_GUI, (MailAsyncFunc)emfb_gui_folder_changed, folder, NULL, emfb); } -static void -emfb_etree_unfreeze (GtkWidget *widget, GdkEvent *event, EMFolderView *emfv) -{ - - ETableItem *item = e_tree_get_item (emfv->list->tree); - - g_object_set_data (G_OBJECT (((GnomeCanvasItem *) item)->canvas), "freeze-cursor", 0); -} +//static void +//emfb_etree_unfreeze (GtkWidget *widget, GdkEvent *event, EMFolderView *emfv) +//{ +// +// ETableItem *item = e_tree_get_item (emfv->list->tree); +// +// g_object_set_data (G_OBJECT (((GnomeCanvasItem *) item)->canvas), "freeze-cursor", 0); +//} /* TODO: This should probably be handled by message-list, by storing/queueing up the select operation if its busy rebuilding the message-list */ -static void -emfb_list_built (MessageList *ml, EMFolderBrowser *emfb) -{ - EMFolderView *emfv = (EMFolderView *) emfb; - double position = 0.0f; - - g_signal_handler_disconnect (ml, emfb->priv->list_built_id); - emfb->priv->list_built_id = 0; - - if (emfv->list->cursor_uid == NULL) { - if (emfb->priv->select_uid) { - CamelMessageInfo *mi; - - /* If the message isn't in the folder yet, keep select_uid around, it could be caught by - folder_changed, at some later date */ - mi = camel_folder_get_message_info(emfv->folder, emfb->priv->select_uid); - if (mi) { - camel_folder_free_message_info(emfv->folder, mi); - em_folder_view_set_message(emfv, emfb->priv->select_uid, TRUE); - g_free (emfb->priv->select_uid); - emfb->priv->select_uid = NULL; - } - - /* change the default to the current position */ - position = message_list_get_scrollbar_position (ml); - } else { - /* NOTE: not all users want this, so we need a preference for it perhaps? see bug #52887 */ - /* FIXME: if the 1st message in the list is unread, this will actually select the second unread msg */ - /*message_list_select (ml, MESSAGE_LIST_SELECT_NEXT, 0, CAMEL_MESSAGE_SEEN, TRUE);*/ - } - } - - emfb->priv->default_scroll_position = position; - - /* FIXME: this is a gross workaround for an etable bug that I can't fix - bug #55303 */ - /* this needs to be a lower priority than anything in e-table-item/e-canvas, since - * e_canvas_item_region_show_relay() uses a timeout, we have to use a timeout of the - * same interval but a lower priority. */ - emfb->priv->idle_scroll_id = g_timeout_add_full (G_PRIORITY_LOW, 250, (GSourceFunc) scroll_idle_cb, emfb, NULL); - /* FIXME: This is another ugly hack done to hide a bug that above hack leaves. */ - g_signal_connect (((GtkScrolledWindow *) ml)->vscrollbar, "button-press-event", G_CALLBACK (emfb_etree_unfreeze), emfb); -} +//static void +//emfb_list_built (MessageList *ml, EMFolderBrowser *emfb) +//{ +// EMFolderView *emfv = (EMFolderView *) emfb; +// double position = 0.0f; +// +// g_signal_handler_disconnect (ml, emfb->priv->list_built_id); +// emfb->priv->list_built_id = 0; +// +// if (emfv->list->cursor_uid == NULL) { +// if (emfb->priv->select_uid) { +// CamelMessageInfo *mi; +// +// /* If the message isn't in the folder yet, keep select_uid around, it could be caught by +// folder_changed, at some later date */ +// mi = camel_folder_get_message_info(emfv->folder, emfb->priv->select_uid); +// if (mi) { +// camel_folder_free_message_info(emfv->folder, mi); +// em_folder_view_set_message(emfv, emfb->priv->select_uid, TRUE); +// g_free (emfb->priv->select_uid); +// emfb->priv->select_uid = NULL; +// } +// +// /* change the default to the current position */ +// position = message_list_get_scrollbar_position (ml); +// } else { +// /* NOTE: not all users want this, so we need a preference for it perhaps? see bug #52887 */ +// /* FIXME: if the 1st message in the list is unread, this will actually select the second unread msg */ +// /*message_list_select (ml, MESSAGE_LIST_SELECT_NEXT, 0, CAMEL_MESSAGE_SEEN, TRUE);*/ +// } +// } +// +// emfb->priv->default_scroll_position = position; +// +// /* FIXME: this is a gross workaround for an etable bug that I can't fix - bug #55303 */ +// /* this needs to be a lower priority than anything in e-table-item/e-canvas, since +// * e_canvas_item_region_show_relay() uses a timeout, we have to use a timeout of the +// * same interval but a lower priority. */ +// emfb->priv->idle_scroll_id = g_timeout_add_full (G_PRIORITY_LOW, 250, (GSourceFunc) scroll_idle_cb, emfb, NULL); +// /* FIXME: This is another ugly hack done to hide a bug that above hack leaves. */ +// g_signal_connect (((GtkScrolledWindow *) ml)->vscrollbar, "button-press-event", G_CALLBACK (emfb_etree_unfreeze), emfb); +//} static void emfb_set_search_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri) -- cgit v1.2.3