aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2002-02-07 19:24:08 +0800
committerChris Lahey <clahey@src.gnome.org>2002-02-07 19:24:08 +0800
commitb7ac37f6b1b54cf9262958a4419f00d00dea554e (patch)
tree5abf2d84a4d38a3904c579d60599404428641ec4 /mail
parent9f83d6d31872f5bce584c52738385bc2ae568a05 (diff)
downloadgsoc2013-evolution-b7ac37f6b1b54cf9262958a4419f00d00dea554e.tar.gz
gsoc2013-evolution-b7ac37f6b1b54cf9262958a4419f00d00dea554e.tar.zst
gsoc2013-evolution-b7ac37f6b1b54cf9262958a4419f00d00dea554e.zip
Bumped the required version of gal.
2002-02-07 Christopher James Lahey <clahey@ximian.com> * configure.in: Bumped the required version of gal. From addressbook/ChangeLog: 2002-02-07 Christopher James Lahey <clahey@ximian.com> * gui/widgets/e-addressbook-view.c (e_addressbook_view_setup_menus): Changed this function to use the new GalViewMenus which takes a GalViewInstance, instead of a GalViewCollection. From calendar/ChangeLog: 2002-02-07 Christopher James Lahey <clahey@ximian.com> * gui/e-tasks.c (e_tasks_setup_view_menus), gui/gnome-cal.c (gnome_calendar_setup_view_menus): Made these use the new GalViewMenus stuff. From mail/ChangeLog: 2002-02-07 Christopher James Lahey <clahey@ximian.com> * folder-browser.c, folder-browser.h, folder-browser-ui.c, folder-browser-ui.h (folder_browser_ui_setup_view_menus, folder_browser_ui_discard_view_menus): Changed this to use the new GalViewMenus stuff. Made these exported functions. * mail-callbacks.c, message-browser.c: Changed these to not pass the now removed row parameter to message_list_select. * mail-config.c, mail-config.h (mail_config_folder_to_safe_url): Refactored this out of mail_config_folder_to_cachename. * message-list.c, message-list.h (message_list_select): Removed the row argument. Changed this to use the new function in ETree for finding the next cursor row that matches a test. (message_list_construct): Handle a failed construction of the ETree here. (message_list_setup_etree, save_tree_state): Don't load or save the header state. folder-browser-ui.c deals with this now. From views/ChangeLog: 2002-02-07 Christopher James Lahey <clahey@ximian.com> * addressbook/galview.xml, calendar/galview.xml, mail/galview.xml, tasks/galview.xml: Added default-view parameters. * mail/As_Sent_Folder.galview: New galview. * mail/Makefile.am, mail/galview.xml: Added As_Sent_Folder galview. From widgets/ChangeLog: 2002-02-07 Christopher James Lahey <clahey@ximian.com> * menus/gal-view-menus.c, menus/gal-view-menus.h (gal_view_menus_new): Made this take a GalViewInstance instead of a GalViewCollection. Reworked most of this to utilize the interfaces provided by GalViewInstance. svn path=/trunk/; revision=15592
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog22
-rw-r--r--mail/folder-browser-ui.c119
-rw-r--r--mail/folder-browser-ui.h2
-rw-r--r--mail/folder-browser.c13
-rw-r--r--mail/folder-browser.h4
-rw-r--r--mail/mail-callbacks.c34
-rw-r--r--mail/mail-config.c12
-rw-r--r--mail/mail-config.h1
-rw-r--r--mail/message-browser.c4
-rw-r--r--mail/message-list.c171
-rw-r--r--mail/message-list.h1
11 files changed, 195 insertions, 188 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 9bc145a619..c46abd5f0f 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,25 @@
+2002-02-07 Christopher James Lahey <clahey@ximian.com>
+
+ * folder-browser.c, folder-browser.h, folder-browser-ui.c,
+ folder-browser-ui.h
+ (folder_browser_ui_setup_view_menus,
+ folder_browser_ui_discard_view_menus): Changed this to use the new
+ GalViewMenus stuff. Made these exported functions.
+
+ * mail-callbacks.c, message-browser.c: Changed these to not pass
+ the now removed row parameter to message_list_select.
+
+ * mail-config.c, mail-config.h (mail_config_folder_to_safe_url):
+ Refactored this out of mail_config_folder_to_cachename.
+
+ * message-list.c, message-list.h (message_list_select): Removed
+ the row argument. Changed this to use the new function in ETree
+ for finding the next cursor row that matches a test.
+ (message_list_construct): Handle a failed construction of the
+ ETree here.
+ (message_list_setup_etree, save_tree_state): Don't load or save
+ the header state. folder-browser-ui.c deals with this now.
+
2002-02-06 Jeffrey Stedfast <fejj@ximian.com>
* mail-account-gui.c (mail_account_gui_new): Rearranged the #if
diff --git a/mail/folder-browser-ui.c b/mail/folder-browser-ui.c
index 1fe15cdc2f..d6e27d1711 100644
--- a/mail/folder-browser-ui.c
+++ b/mail/folder-browser-ui.c
@@ -194,61 +194,110 @@ static void ui_add (FolderBrowser *fb,
/* more complex stuff */
static void
-display_view(GalViewCollection *collection,
+display_view(GalViewInstance *instance,
GalView *view,
gpointer data)
{
FolderBrowser *fb = data;
if (GAL_IS_VIEW_ETABLE(view)) {
- e_tree_set_state_object(fb->message_list->tree, GAL_VIEW_ETABLE(view)->state);
+ gal_view_etable_attach_tree (GAL_VIEW_ETABLE(view), fb->message_list->tree);
}
}
-static void
-folder_browser_setup_view_menus (FolderBrowser *fb,
- BonoboUIComponent *uic)
+void
+folder_browser_ui_setup_view_menus (FolderBrowser *fb)
{
- GalViewFactory *factory;
- ETableSpecification *spec;
- char *local_dir;
+ static GalViewCollection *collection = NULL;
+ char *id;
+ gboolean outgoing;
- g_assert (fb->view_collection == NULL);
+ if (fb->uicomp == NULL || fb->folder == NULL)
+ return;
+
+ g_assert (fb->view_instance == NULL);
g_assert (fb->view_menus == NULL);
- fb->view_collection = gal_view_collection_new();
+ outgoing = folder_browser_is_drafts (fb) ||
+ folder_browser_is_sent (fb) ||
+ folder_browser_is_outbox (fb);
+
+ if (collection == NULL) {
+ ETableSpecification *spec;
+ char *local_dir;
+ GalViewFactory *factory;
+
+ collection = gal_view_collection_new();
+
+ local_dir = gnome_util_prepend_user_home ("/evolution/views/mail/");
+ gal_view_collection_set_storage_directories
+ (collection,
+ EVOLUTION_DATADIR "/evolution/views/mail/",
+ local_dir);
+ g_free (local_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);
+ gtk_object_unref (GTK_OBJECT (spec));
+ gal_view_collection_add_factory (collection, factory);
+ gtk_object_unref (GTK_OBJECT (factory));
+
+ gal_view_collection_load(collection);
+ }
+
+ id = mail_config_folder_to_safe_url(fb->folder);
+ fb->view_instance = gal_view_instance_new (collection, id);
+ g_free (id);
+
+ if (outgoing)
+ gal_view_instance_set_default_view (fb->view_instance, "As_Sent_Folder");
+
+ if (!gal_view_instance_exists (fb->view_instance)) {
+ char *path;
+ struct stat st;
+
+ gal_view_instance_load (fb->view_instance);
- local_dir = gnome_util_prepend_user_home ("/evolution/views/mail/");
- gal_view_collection_set_storage_directories(
- fb->view_collection,
- EVOLUTION_DATADIR "/evolution/views/mail/",
- local_dir);
- g_free (local_dir);
+ path = mail_config_folder_to_cachename (fb->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");
+ spec = e_table_specification_new();
+ e_table_specification_load_from_file(spec, EVOLUTION_ETSPECDIR "/message-list.etspec");
+ view = gal_view_etable_new(spec, "");
+ gtk_object_unref (GTK_OBJECT (spec));
- factory = gal_view_factory_etable_new (spec);
- gtk_object_unref (GTK_OBJECT (spec));
- gal_view_collection_add_factory (fb->view_collection, factory);
- gtk_object_unref (GTK_OBJECT (factory));
+ state = e_table_state_new ();
+ e_table_state_load_from_file (state, path);
+ gal_view_etable_set_state (GAL_VIEW_ETABLE (view), state);
+ gtk_object_unref (GTK_OBJECT (state));
+
+ gal_view_instance_set_custom_view (fb->view_instance, view);
+ gtk_object_unref (GTK_OBJECT (view));
+ }
+ g_free (path);
+ }
- gal_view_collection_load(fb->view_collection);
- fb->view_menus = gal_view_menus_new(fb->view_collection);
- gal_view_menus_apply(fb->view_menus, uic, NULL);
- gtk_signal_connect(GTK_OBJECT(fb->view_collection), "display_view",
+ fb->view_menus = gal_view_menus_new(fb->view_instance);
+ gal_view_menus_apply(fb->view_menus, fb->uicomp, NULL);
+ gtk_signal_connect(GTK_OBJECT(fb->view_instance), "display_view",
display_view, fb);
+ display_view (fb->view_instance, gal_view_instance_get_current_view (fb->view_instance), fb);
}
-/* Gets rid of the view collection and view menus objects */
-static void
-folder_browser_discard_view_menus (FolderBrowser *fb)
+/* Gets rid of the view instance and view menus objects */
+void
+folder_browser_ui_discard_view_menus (FolderBrowser *fb)
{
- g_assert (fb->view_collection != NULL);
+ g_assert (fb->view_instance != NULL);
g_assert (fb->view_menus != NULL);
- gtk_object_unref (GTK_OBJECT (fb->view_collection));
- fb->view_collection = NULL;
+ gtk_object_unref (GTK_OBJECT (fb->view_instance));
+ fb->view_instance = NULL;
gtk_object_unref (GTK_OBJECT (fb->view_menus));
fb->view_menus = NULL;
@@ -371,14 +420,16 @@ folder_browser_ui_add_list (FolderBrowser *fb)
folder_browser_setup_property_menu (fb, fb->uicomp);
/* View menu */
- folder_browser_setup_view_menus (fb, fb->uicomp);
+ if (fb->view_instance == NULL)
+ folder_browser_ui_setup_view_menus (fb);
}
void
folder_browser_ui_rm_list (FolderBrowser *fb)
{
/* View menu */
- folder_browser_discard_view_menus (fb);
+ if (fb->view_instance != NULL)
+ folder_browser_ui_discard_view_menus (fb);
}
void
diff --git a/mail/folder-browser-ui.h b/mail/folder-browser-ui.h
index 788ebb7b8d..21c590e1a8 100644
--- a/mail/folder-browser-ui.h
+++ b/mail/folder-browser-ui.h
@@ -24,6 +24,8 @@ void folder_browser_ui_rm_all (FolderBrowser *fb);
void folder_browser_ui_set_selection_state (FolderBrowser *fb, FolderBrowserSelectionState state);
void folder_browser_ui_message_loaded (FolderBrowser *fb);
+void folder_browser_ui_discard_view_menus (FolderBrowser *fb);
+void folder_browser_ui_setup_view_menus (FolderBrowser *fb);
/* Set the sensitivity of a single item */
void fbui_sensitise_item(FolderBrowser *fb, const char *item, int state);
diff --git a/mail/folder-browser.c b/mail/folder-browser.c
index c48260a1b6..92ada2f612 100644
--- a/mail/folder-browser.c
+++ b/mail/folder-browser.c
@@ -155,9 +155,9 @@ folder_browser_finalise (GtkObject *object)
CORBA_exception_free (&ev);
- if (folder_browser->view_collection) {
- gtk_object_unref (GTK_OBJECT (folder_browser->view_collection));
- folder_browser->view_collection = NULL;
+ if (folder_browser->view_instance) {
+ gtk_object_unref (GTK_OBJECT (folder_browser->view_instance));
+ folder_browser->view_instance = NULL;
}
if (folder_browser->view_menus) {
@@ -850,6 +850,11 @@ got_folder(char *uri, CamelFolder *folder, void *data)
camel_object_hook_event(CAMEL_OBJECT(fb->folder), "message_changed",
folder_changed, fb);
+ if (fb->view_instance != NULL && fb->view_menus != NULL)
+ folder_browser_ui_discard_view_menus (fb);
+
+ folder_browser_ui_setup_view_menus (fb);
+
/* when loading a new folder, nothing is selected initially */
if (fb->uicomp)
@@ -1993,7 +1998,7 @@ my_folder_browser_init (GtkObject *object)
FolderBrowser *fb = FOLDER_BROWSER (object);
int i;
- fb->view_collection = NULL;
+ fb->view_instance = NULL;
fb->view_menus = NULL;
fb->pref_master = FALSE;
diff --git a/mail/folder-browser.h b/mail/folder-browser.h
index 848a312327..1b76f82c97 100644
--- a/mail/folder-browser.h
+++ b/mail/folder-browser.h
@@ -78,8 +78,8 @@ struct _FolderBrowser {
int sensitize_timeout_id;
int update_status_bar_idle_id;
- /* View collection and the menu handler object */
- GalViewCollection *view_collection;
+ /* View instance and the menu handler object */
+ GalViewInstance *view_instance;
GalViewMenus *view_menus;
GtkWidget *invisible;
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index e12e628404..6bc8c5df53 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -861,7 +861,7 @@ mail_generate_reply (CamelFolder *folder, CamelMimeMessage *message, const char
const CamelInternetAddress *reply_to, *sender, *to_addrs, *cc_addrs;
const char *name = NULL, *address = NULL, *source = NULL;
const char *message_id, *references, *reply_addr = NULL;
- char *text, *subject, date_str[100], *format;
+ char *text = NULL, *subject, date_str[100], *format;
const MailConfigAccount *me = NULL;
const GSList *accounts = NULL;
GList *to = NULL, *cc = NULL;
@@ -1392,10 +1392,10 @@ transfer_msg_done (gboolean ok, void *data)
are hidden, select the previous */
if ((row + 1 == e_tree_row_count (fb->message_list->tree))
&& mail_config_get_hide_deleted ())
- message_list_select (fb->message_list, row, MESSAGE_LIST_SELECT_PREVIOUS,
+ message_list_select (fb->message_list, MESSAGE_LIST_SELECT_PREVIOUS,
0, CAMEL_MESSAGE_DELETED, FALSE);
else
- message_list_select (fb->message_list, row, MESSAGE_LIST_SELECT_NEXT,
+ message_list_select (fb->message_list, MESSAGE_LIST_SELECT_NEXT,
0, 0, FALSE);
}
@@ -2145,10 +2145,10 @@ delete_msg (GtkWidget *button, gpointer user_data)
are hidden, select the previous */
if ((row+1 == e_tree_row_count (fb->message_list->tree))
&& mail_config_get_hide_deleted ())
- message_list_select (fb->message_list, row, MESSAGE_LIST_SELECT_PREVIOUS,
+ message_list_select (fb->message_list, MESSAGE_LIST_SELECT_PREVIOUS,
0, CAMEL_MESSAGE_DELETED, FALSE);
else
- message_list_select (fb->message_list, row, MESSAGE_LIST_SELECT_NEXT,
+ message_list_select (fb->message_list, MESSAGE_LIST_SELECT_NEXT,
0, 0, FALSE);
}
}
@@ -2163,26 +2163,22 @@ void
next_msg (GtkWidget *button, gpointer user_data)
{
FolderBrowser *fb = FOLDER_BROWSER (user_data);
- int row;
if (FOLDER_BROWSER_IS_DESTROYED (fb))
return;
- row = e_tree_row_of_node (fb->message_list->tree, e_tree_get_cursor (fb->message_list->tree));
- message_list_select (fb->message_list, row, MESSAGE_LIST_SELECT_NEXT, 0, 0, FALSE);
+ message_list_select (fb->message_list, MESSAGE_LIST_SELECT_NEXT, 0, 0, FALSE);
}
void
next_unread_msg (GtkWidget *button, gpointer user_data)
{
FolderBrowser *fb = FOLDER_BROWSER (user_data);
- int row;
if (FOLDER_BROWSER_IS_DESTROYED (fb))
return;
- row = e_tree_row_of_node (fb->message_list->tree, e_tree_get_cursor (fb->message_list->tree));
- message_list_select (fb->message_list, row, MESSAGE_LIST_SELECT_NEXT,
+ message_list_select (fb->message_list, MESSAGE_LIST_SELECT_NEXT,
0, CAMEL_MESSAGE_SEEN, TRUE);
}
@@ -2190,13 +2186,11 @@ void
next_flagged_msg (GtkWidget *button, gpointer user_data)
{
FolderBrowser *fb = FOLDER_BROWSER (user_data);
- int row;
if (FOLDER_BROWSER_IS_DESTROYED (fb))
return;
- row = e_tree_row_of_node (fb->message_list->tree, e_tree_get_cursor (fb->message_list->tree));
- message_list_select (fb->message_list, row, MESSAGE_LIST_SELECT_NEXT,
+ message_list_select (fb->message_list, MESSAGE_LIST_SELECT_NEXT,
CAMEL_MESSAGE_FLAGGED, CAMEL_MESSAGE_FLAGGED, FALSE);
}
@@ -2204,13 +2198,11 @@ void
previous_msg (GtkWidget *button, gpointer user_data)
{
FolderBrowser *fb = FOLDER_BROWSER (user_data);
- int row;
if (FOLDER_BROWSER_IS_DESTROYED (fb))
return;
- row = e_tree_row_of_node (fb->message_list->tree, e_tree_get_cursor (fb->message_list->tree));
- message_list_select (fb->message_list, row, MESSAGE_LIST_SELECT_PREVIOUS,
+ message_list_select (fb->message_list, MESSAGE_LIST_SELECT_PREVIOUS,
0, 0, FALSE);
}
@@ -2218,13 +2210,11 @@ void
previous_unread_msg (GtkWidget *button, gpointer user_data)
{
FolderBrowser *fb = FOLDER_BROWSER (user_data);
- int row;
if (FOLDER_BROWSER_IS_DESTROYED (fb))
return;
- row = e_tree_row_of_node (fb->message_list->tree, e_tree_get_cursor (fb->message_list->tree));
- message_list_select (fb->message_list, row, MESSAGE_LIST_SELECT_PREVIOUS,
+ message_list_select (fb->message_list, MESSAGE_LIST_SELECT_PREVIOUS,
0, CAMEL_MESSAGE_SEEN, TRUE);
}
@@ -2232,13 +2222,11 @@ void
previous_flagged_msg (GtkWidget *button, gpointer user_data)
{
FolderBrowser *fb = FOLDER_BROWSER (user_data);
- int row;
if (FOLDER_BROWSER_IS_DESTROYED (fb))
return;
- row = e_tree_row_of_node (fb->message_list->tree, e_tree_get_cursor (fb->message_list->tree));
- message_list_select (fb->message_list, row, MESSAGE_LIST_SELECT_PREVIOUS,
+ message_list_select (fb->message_list, MESSAGE_LIST_SELECT_PREVIOUS,
CAMEL_MESSAGE_FLAGGED, CAMEL_MESSAGE_FLAGGED, TRUE);
}
diff --git a/mail/mail-config.c b/mail/mail-config.c
index d56e42cbae..a5112b570b 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -2214,17 +2214,25 @@ mail_config_service_set_save_passwd (MailConfigService *service, gboolean save_p
}
char *
-mail_config_folder_to_cachename (CamelFolder *folder, const char *prefix)
+mail_config_folder_to_safe_url (CamelFolder *folder)
{
CamelService *service = CAMEL_SERVICE (folder->parent_store);
- char *service_url, *url, *filename;
+ char *service_url, *url;
service_url = camel_url_to_string (service->url, CAMEL_URL_HIDE_ALL);
url = g_strdup_printf ("%s/%s", service_url, folder->full_name);
g_free (service_url);
e_filename_make_safe (url);
+ return url;
+}
+
+char *
+mail_config_folder_to_cachename (CamelFolder *folder, const char *prefix)
+{
+ char *url, *filename;
+ url = mail_config_folder_to_safe_url (folder);
filename = g_strdup_printf ("%s/config/%s%s", evolution_dir, prefix, url);
g_free (url);
diff --git a/mail/mail-config.h b/mail/mail-config.h
index a517481f55..82dd654e8a 100644
--- a/mail/mail-config.h
+++ b/mail/mail-config.h
@@ -225,6 +225,7 @@ GSList *mail_config_get_sources (void);
/* static utility functions */
char *mail_config_folder_to_cachename (CamelFolder *folder, const char *prefix);
+char *mail_config_folder_to_safe_url (CamelFolder *folder);
gboolean mail_config_check_service (const char *url, CamelProviderType type, GList **authtypes, GtkWindow *window);
diff --git a/mail/message-browser.c b/mail/message-browser.c
index 10ec477e7e..07a9278746 100644
--- a/mail/message-browser.c
+++ b/mail/message-browser.c
@@ -101,10 +101,10 @@ transfer_msg_done (gboolean ok, void *data)
are hidden, select the previous */
if ((row + 1 == e_tree_row_count (mb->fb->message_list->tree))
&& mail_config_get_hide_deleted ())
- message_list_select (mb->fb->message_list, row, MESSAGE_LIST_SELECT_PREVIOUS,
+ message_list_select (mb->fb->message_list, MESSAGE_LIST_SELECT_PREVIOUS,
0, CAMEL_MESSAGE_DELETED, FALSE);
else
- message_list_select (mb->fb->message_list, row, MESSAGE_LIST_SELECT_NEXT,
+ message_list_select (mb->fb->message_list, MESSAGE_LIST_SELECT_NEXT,
0, 0, FALSE);
}
diff --git a/mail/message-list.c b/mail/message-list.c
index 5299c531ef..23f3e97cac 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -359,6 +359,30 @@ get_message_info (MessageList *message_list, ETreePath node)
return info;
}
+struct search_func_data {
+ MessageList *message_list;
+ guint32 flags;
+ guint32 mask;
+};
+
+static gboolean
+search_func (ETreeModel *model, ETreePath path, struct search_func_data *data)
+{
+ CamelMessageInfo *info;
+
+ if (e_tree_model_node_is_root (data->message_list->model, path))
+ return FALSE;
+
+ info = get_message_info (data->message_list, path);
+
+ if (info && (info->flags & data->mask) == data->flags) {
+ gtk_signal_emit (GTK_OBJECT (data->message_list), message_list_signals[MESSAGE_SELECTED],
+ camel_message_info_uid (info));
+ return TRUE;
+ }
+ return FALSE;
+}
+
/**
* message_list_select:
* @message_list: a MessageList
@@ -380,87 +404,30 @@ get_message_info (MessageList *message_list, ETreePath node)
**/
void
message_list_select (MessageList *message_list,
- int base_row,
MessageListSelectDirection direction,
guint32 flags,
guint32 mask,
gboolean wraparound)
{
- CamelMessageInfo *info;
- int vrow, last;
-
+ struct search_func_data data;
+ ETreeFindNextParams params = 0;
+
if (!GTK_WIDGET_HAS_FOCUS (message_list))
gtk_widget_grab_focus (GTK_WIDGET (message_list));
-
- switch (direction) {
- case MESSAGE_LIST_SELECT_PREVIOUS:
- last = -1;
- break;
- case MESSAGE_LIST_SELECT_NEXT:
- last = e_tree_row_count (message_list->tree);
- if (last <= base_row)
- return;
- break;
- default:
- g_warning("Invalid argument to message_list_select");
- return;
- }
-
- /* If it's -1, we want the last view row, not the last model row. */
- /* model_to_view_row etc simply doesn't work for sorted views. Sigh. */
- if (base_row == -1)
- vrow = e_tree_row_count (message_list->tree) - 1;
+
+ data.message_list = message_list;
+ data.flags = flags;
+ data.mask = mask;
+
+ if (direction == MESSAGE_LIST_SELECT_NEXT)
+ params |= E_TREE_FIND_NEXT_FORWARD;
else
- vrow = e_tree_model_to_view_row (message_list->tree, base_row);
-
- if (vrow <= -1)
- return;
-
- /* This means that we'll move at least one message in 'direction'. */
- if (vrow != last)
- vrow += direction;
-
- /* We don't know whether to use < or > due to "direction" */
- while (vrow != last) {
- ETreePath node = e_tree_node_at_row (message_list->tree, vrow);
-
- info = get_message_info (message_list, node);
-
- if (info && (info->flags & mask) == flags) {
- e_tree_set_cursor (message_list->tree, node);
-
- gtk_signal_emit (GTK_OBJECT (message_list), message_list_signals[MESSAGE_SELECTED],
- camel_message_info_uid (info));
- return;
- }
- vrow += direction;
- }
-
- if (wraparound) {
- ETreePath node;
-
- if (direction == MESSAGE_LIST_SELECT_NEXT) {
- base_row = 0;
- vrow = 0;
- } else {
- base_row = -1;
- vrow = e_tree_row_count (message_list->tree) - 1;
- }
-
- /* lets see if the first/last (depending on direction)
- row matches our selection criteria */
- node = e_tree_node_at_row (message_list->tree, vrow);
- info = get_message_info (message_list, node);
- if (info && (info->flags & mask) == flags) {
- e_tree_set_cursor (message_list->tree, node);
-
- gtk_signal_emit (GTK_OBJECT (message_list), message_list_signals[MESSAGE_SELECTED],
- camel_message_info_uid (info));
- return;
- }
-
- message_list_select (message_list, base_row, direction, flags, mask, FALSE);
- }
+ params |= E_TREE_FIND_NEXT_BACKWARD;
+
+ if (wraparound)
+ params |= E_TREE_FIND_NEXT_WRAP;
+
+ e_tree_find_next (message_list->tree, params, (ETreePathFunc) search_func, &data);
}
@@ -1050,26 +1017,14 @@ save_tree_state(MessageList *ml)
if (ml->folder == NULL || ml->tree == NULL)
return;
- filename = mail_config_folder_to_cachename(ml->folder, "et-header-");
- e_tree_save_state(ml->tree, filename);
- g_free(filename);
-
filename = mail_config_folder_to_cachename(ml->folder, "et-expanded-");
e_tree_save_expanded_state(ml->tree, filename);
g_free(filename);
}
-static void
-sort_info_changed (GtkWidget *widget, MessageList *ml)
-{
- save_tree_state(ml);
-}
-
static void
message_list_setup_etree (MessageList *message_list, gboolean outgoing)
{
- ETableState *etstate;
-
/* build the spec based on the folder, and possibly from a saved file */
/* otherwise, leave default */
if (message_list->folder) {
@@ -1084,21 +1039,6 @@ message_list_setup_etree (MessageList *message_list, gboolean outgoing)
name = camel_service_get_name (CAMEL_SERVICE (message_list->folder->parent_store), TRUE);
d(printf ("folder name is '%s'\n", name));
- path = mail_config_folder_to_cachename (message_list->folder, "et-header-");
- if (path && stat (path, &st) == 0 && st.st_size > 0 && S_ISREG (st.st_mode)) {
- /* build based on saved file */
- e_tree_load_state (message_list->tree, path);
- } else if (outgoing) {
- /* Swap From/To for Drafts, Sent, Outbox */
- char *state = "<ETableState>"
- "<column source=\"0\"/> <column source=\"1\"/> "
- "<column source=\"8\"/> <column source=\"5\"/> "
- "<column source=\"6\"/> <grouping> </grouping> </ETableState>";
-
- e_tree_set_state (message_list->tree, state);
- }
- g_free (path);
-
path = mail_config_folder_to_cachename (message_list->folder, "et-expanded-");
if (path && stat (path, &st) == 0 && st.st_size > 0 && S_ISREG (st.st_mode)) {
/* build based on saved file */
@@ -1107,18 +1047,6 @@ message_list_setup_etree (MessageList *message_list, gboolean outgoing)
g_free (path);
g_free (name);
-
- etstate = e_tree_get_state_object (message_list->tree);
- gtk_signal_connect (GTK_OBJECT (etstate->sort_info),
- "sort_info_changed",
- GTK_SIGNAL_FUNC (sort_info_changed),
- message_list);
- gtk_signal_connect (GTK_OBJECT (etstate->sort_info),
- "group_info_changed",
- GTK_SIGNAL_FUNC (sort_info_changed),
- message_list);
-
- gtk_object_unref (GTK_OBJECT (etstate));
}
}
@@ -1227,6 +1155,7 @@ message_list_class_init (GtkObjectClass *object_class)
static void
message_list_construct (MessageList *message_list)
{
+ gboolean construct_failed;
message_list->model =
e_tree_memory_callbacks_new (ml_tree_icon_at,
@@ -1258,14 +1187,16 @@ message_list_construct (MessageList *message_list)
* The etree
*/
message_list->extras = message_list_create_extras ();
- e_tree_scrolled_construct_from_spec_file (E_TREE_SCROLLED (message_list),
- message_list->model,
- message_list->extras,
- EVOLUTION_ETSPECDIR "/message-list.etspec",
- NULL);
-
+ construct_failed = (e_tree_scrolled_construct_from_spec_file (E_TREE_SCROLLED (message_list),
+ message_list->model,
+ message_list->extras,
+ EVOLUTION_ETSPECDIR "/message-list.etspec",
+ NULL)
+ == NULL);
+
message_list->tree = e_tree_scrolled_get_tree(E_TREE_SCROLLED (message_list));
- e_tree_root_node_set_visible (message_list->tree, FALSE);
+ if (!construct_failed)
+ e_tree_root_node_set_visible (message_list->tree, FALSE);
gtk_signal_connect (GTK_OBJECT (message_list->tree), "cursor_activated",
GTK_SIGNAL_FUNC (on_cursor_activated_cmd),
@@ -2572,5 +2503,5 @@ mail_regen_list (MessageList *ml, const char *search, const char *hideexpr, Came
m->folder = ml->folder;
camel_object_ref (CAMEL_OBJECT (m->folder));
- e_thread_put (mail_thread_new, (EMsg *)m);
+ e_thread_put (mail_thread_queued, (EMsg *)m);
}
diff --git a/mail/message-list.h b/mail/message-list.h
index cfed0c7e67..ed2652024f 100644
--- a/mail/message-list.h
+++ b/mail/message-list.h
@@ -116,7 +116,6 @@ void message_list_foreach (MessageList *message_list,
gpointer user_data);
void message_list_select (MessageList *message_list,
- int base_row,
MessageListSelectDirection direction,
guint32 flags,
guint32 mask,