aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2000-07-09 11:06:56 +0800
committerDan Winship <danw@src.gnome.org>2000-07-09 11:06:56 +0800
commit1cc1f0a7a777be8ae409bbfbf6299167493ebddd (patch)
tree0d50552a55862fa87ec90b7b0ef112314b4212f0
parent541c90527905994cdabb45d98398600a88db7b18 (diff)
downloadgsoc2013-evolution-1cc1f0a7a777be8ae409bbfbf6299167493ebddd.tar
gsoc2013-evolution-1cc1f0a7a777be8ae409bbfbf6299167493ebddd.tar.gz
gsoc2013-evolution-1cc1f0a7a777be8ae409bbfbf6299167493ebddd.tar.bz2
gsoc2013-evolution-1cc1f0a7a777be8ae409bbfbf6299167493ebddd.tar.lz
gsoc2013-evolution-1cc1f0a7a777be8ae409bbfbf6299167493ebddd.tar.xz
gsoc2013-evolution-1cc1f0a7a777be8ae409bbfbf6299167493ebddd.tar.zst
gsoc2013-evolution-1cc1f0a7a777be8ae409bbfbf6299167493ebddd.zip
Add a "Threaded Message List" item to the "View" menu.
* folder-browser-factory.c (control_activate): Add a "Threaded Message List" item to the "View" menu. * message-list.c (message_list_toggle_threads): Handler for that. (build_flat): New function to build a "flat" message list using the tree model. (message_list_regenerate): Build tree or flat message list depending on the global setting. svn path=/trunk/; revision=3999
-rw-r--r--mail/ChangeLog9
-rw-r--r--mail/folder-browser-factory.c12
-rw-r--r--mail/message-list.c65
-rw-r--r--mail/message-list.h8
4 files changed, 69 insertions, 25 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index a7113ff3b9..c780a4aae0 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,5 +1,14 @@
2000-07-08 Dan Winship <danw@helixcode.com>
+ * folder-browser-factory.c (control_activate): Add a "Threaded
+ Message List" item to the "View" menu.
+
+ * message-list.c (message_list_toggle_threads): Handler for that.
+ (build_flat): New function to build a "flat" message list using
+ the tree model.
+ (message_list_regenerate): Build tree or flat message list
+ depending on the global setting.
+
* message-thread.c (get_root_subject): fix a "Re:" parsing bug
2000-07-08 Jeffrey Stedfast <fejj@helixcode.com>
diff --git a/mail/folder-browser-factory.c b/mail/folder-browser-factory.c
index 5f98e6d630..80ce55f281 100644
--- a/mail/folder-browser-factory.c
+++ b/mail/folder-browser-factory.c
@@ -61,6 +61,16 @@ control_activate (BonoboControl *control, BonoboUIHandler *uih,
folder_browser = bonobo_control_get_widget (control);
+ bonobo_ui_handler_menu_new_toggleitem (uih, "/View/Threaded",
+ N_("_Threaded Message List"),
+ NULL, -1, 0, 0, NULL, NULL);
+ bonobo_ui_handler_menu_set_toggle_state (uih, "/View/Threaded",
+ threaded_view);
+ bonobo_ui_handler_menu_set_callback (uih, "/View/Threaded",
+ message_list_toggle_threads,
+ FOLDER_BROWSER (folder_browser)->message_list,
+ NULL);
+
bonobo_ui_handler_menu_new_item (uih, "/Actions/Expunge", N_("_Expunge"),
NULL, -1,
BONOBO_UI_HANDLER_PIXMAP_STOCK,
@@ -122,7 +132,7 @@ control_deactivate (BonoboControl *control, BonoboUIHandler *uih,
{
char *toolbar_name = g_strdup_printf ("/Toolbar%d", fb->serial);
- bonobo_ui_handler_menu_remove (uih, "/File/Mail");
+ bonobo_ui_handler_menu_remove (uih, "/View/Threaded");
bonobo_ui_handler_menu_remove (uih, "/Actions/Expunge");
bonobo_ui_handler_menu_remove (uih, "/Tools/Filter Druid ...");
bonobo_ui_handler_menu_remove (uih, "/Tools/Virtual Folder Druid ...");
diff --git a/mail/message-list.c b/mail/message-list.c
index 299a08ea9e..0fe27a627b 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -440,12 +440,11 @@ message_list_init_renderers (MessageList *message_list)
/*
* for tree view
*/
- if (message_list->is_tree_view) {
- message_list->render_tree =
- e_cell_tree_new(message_list->table_model,
- states_pixmaps[5].pixbuf, states_pixmaps[6].pixbuf,
- TRUE, message_list->render_text);
- }
+ message_list->render_tree =
+ e_cell_tree_new (message_list->table_model,
+ states_pixmaps[5].pixbuf,
+ states_pixmaps[6].pixbuf,
+ TRUE, message_list->render_text);
}
static void
@@ -502,7 +501,7 @@ message_list_init_header (MessageList *message_list)
e_table_col_new (
COL_SUBJECT, _("Subject"),
COL_SUBJECT_EXPANSION, COL_SUBJECT_WIDTH_MIN,
- message_list->is_tree_view?message_list->render_tree:message_list->render_text,
+ message_list->render_tree,
g_str_compare, TRUE);
message_list->table_cols [COL_SENT] =
@@ -556,8 +555,6 @@ message_list_init (GtkObject *object)
MessageList *message_list = MESSAGE_LIST (object);
char *spec;
- message_list->is_tree_view = TRUE;
-
message_list->table_model = (ETableModel *)
e_tree_simple_new (ml_tree_icon_at, ml_tree_value_at,
ml_tree_set_value_at,
@@ -625,9 +622,7 @@ message_list_destroy (GtkObject *object)
gtk_object_unref (GTK_OBJECT (message_list->render_message_status));
gtk_object_unref (GTK_OBJECT (message_list->render_priority));
gtk_object_unref (GTK_OBJECT (message_list->render_attachment));
- if (message_list->is_tree_view) {
- gtk_object_unref (GTK_OBJECT (message_list->render_tree));
- }
+ gtk_object_unref (GTK_OBJECT (message_list->render_tree));
gtk_object_unref (GTK_OBJECT (message_list->etable));
@@ -781,11 +776,25 @@ build_tree (MessageList *ml, ETreePath *parent, struct _container *c,
}
}
+static void
+build_flat (MessageList *ml, ETreePath *parent, GPtrArray *uids)
+{
+ ETreeModel *tree = E_TREE_MODEL (ml->table_model);
+ ETreePath *node;
+ char *uid;
+ int i;
+
+ for (i = 0; i < uids->len; i++) {
+ uid = g_strdup (uids->pdata[i]);
+ node = e_tree_model_node_insert (tree, ml->tree_root, i, uid);
+ g_hash_table_insert (ml->uid_rowmap, uid, GINT_TO_POINTER (i));
+ }
+}
+
void
message_list_regenerate (MessageList *message_list, const char *search)
{
ETreeModel *etm = E_TREE_MODEL (message_list->table_model);
- struct _container *head;
GPtrArray *uids;
int row = 0;
@@ -816,21 +825,21 @@ message_list_regenerate (MessageList *message_list, const char *search)
/* FIXME: free the old tree data */
- /* Clear the old contents */
+ /* Clear the old contents, build the new */
if (message_list->tree_root)
e_tree_model_node_remove(etm, message_list->tree_root);
-
- /* Thread the new */
- head = thread_messages (message_list->folder, uids);
-
- /* And populate ... */
message_list->tree_root =
e_tree_model_node_insert(etm, NULL, 0, message_list);
e_tree_model_node_set_expanded (etm, message_list->tree_root, TRUE);
- build_tree (message_list, message_list->tree_root, head, &row);
- /* No longer need the thread structure or uid list */
- thread_messages_free (head);
+ if (threaded_view) {
+ struct _container *head;
+
+ head = thread_messages (message_list->folder, uids);
+ build_tree (message_list, message_list->tree_root, head, &row);
+ thread_messages_free (head);
+ } else
+ build_flat (message_list, message_list->tree_root, uids);
if (search) {
g_strfreev ((char **)uids->pdata);
@@ -989,3 +998,15 @@ message_list_foreach (MessageList *message_list,
e_table_selected_row_foreach (E_TABLE (message_list->etable),
mlfe_callback, &mlfe_data);
}
+
+gboolean threaded_view = TRUE;
+
+void
+message_list_toggle_threads (BonoboUIHandler *uih, void *user_data,
+ const char *path)
+{
+ MessageList *ml = user_data;
+
+ threaded_view = bonobo_ui_handler_menu_get_toggle_state (uih, path);
+ message_list_regenerate (ml, ml->search);
+}
diff --git a/mail/message-list.h b/mail/message-list.h
index bd4c37f42e..8f3f87073f 100644
--- a/mail/message-list.h
+++ b/mail/message-list.h
@@ -5,6 +5,7 @@
#include "mail-types.h"
#include <bonobo/bonobo-main.h>
#include <bonobo/bonobo-object.h>
+#include <bonobo/bonobo-ui-handler.h>
#include "camel/camel-folder.h"
#include "e-table/e-table.h"
#include "e-table/e-table-simple.h"
@@ -78,8 +79,6 @@ struct _MessageList {
/* row-selection and seen-marking timers */
guint idle_id, seen_id;
-
- gboolean is_tree_view; /* if we're doing tree view */
};
typedef struct {
@@ -104,5 +103,10 @@ void message_list_foreach (MessageList *message_list,
void message_list_select_next(MessageList *message_list, int row,
guint32 flags, guint32 mask);
+extern gboolean threaded_view;
+void message_list_toggle_threads (BonoboUIHandler *uih,
+ void *user_data,
+ const char *path);
+
#endif /* _MESSAGE_LIST_H_ */