diff options
author | Christopher James Lahey <clahey@ximian.com> | 2001-03-20 12:48:59 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2001-03-20 12:48:59 +0800 |
commit | 68a731e0a02290edf039d419bc36582023624726 (patch) | |
tree | 21907355e0da0d784dd9791a460178992388bfd6 /mail | |
parent | 262ee8128d564206d60c93e479200d1c977fd10d (diff) | |
download | gsoc2013-evolution-68a731e0a02290edf039d419bc36582023624726.tar gsoc2013-evolution-68a731e0a02290edf039d419bc36582023624726.tar.gz gsoc2013-evolution-68a731e0a02290edf039d419bc36582023624726.tar.bz2 gsoc2013-evolution-68a731e0a02290edf039d419bc36582023624726.tar.lz gsoc2013-evolution-68a731e0a02290edf039d419bc36582023624726.tar.xz gsoc2013-evolution-68a731e0a02290edf039d419bc36582023624726.tar.zst gsoc2013-evolution-68a731e0a02290edf039d419bc36582023624726.zip |
Bumped gal requirement to 0.5.99.8.
2001-03-19 Christopher James Lahey <clahey@ximian.com>
* configure.in: Bumped gal requirement to 0.5.99.8.
From addressbook/ChangeLog:
2001-03-19 Christopher James Lahey <clahey@ximian.com>
* Merged branch:
2001-03-14 Christopher James Lahey <clahey@ximian.com>
* gui/widgets/e-minicard-view.c: Call
e_selection_model_simple_insert_rows and
e_selection_model_simple_delete_rows instead of
e_selection_model_simple_insert_row and
e_selection_model_simple_delete_row.
End of branch
From mail/ChangeLog:
2001-03-19 Christopher James Lahey <clahey@ximian.com>
* Merged e-tree-rework-branch:
2001-03-18 Christopher James Lahey <clahey@ximian.com>
* message-list.c: Added has_save_id and get_save_id methods.
* subscribe-dialog.c: Added arguments for
e_tree_memory_callbacks_new of get_save_id and has_save_id to
NULL.
2001-03-16 Christopher James Lahey <clahey@ximian.com>
* message-list.c: Added a call to
e_tree_memory_set_expanded_default to TRUE. Removed all calls to
set_expanded on nodes while the tree is frozen since this fails
miserably now.
2001-03-13 Christopher James Lahey <clahey@ximian.com>
* message-list.c (message_list_get_layout): Turned off draw-grid.
2001-03-09 Christopher James Lahey <clahey@ximian.com>
* folder-browser-factory.c, folder-browser.c, message-list.c,
message-list.h, subscribe-dialog.c, subscribe-dialog.h,
mail-callbacks.c: Converted these all to use ETree instead of
ETable.
End of branch
From shell/ChangeLog:
2001-03-19 Christopher James Lahey <clahey@ximian.com>
* Merged e-tree-rework-branch:
2001-03-19 Christopher James Lahey <clahey@ximian.com>
* e-storage-set-view.c (etree_get_save_id): Made "root" detection
deal properly with removed nodes.
2001-03-18 Christopher James Lahey <clahey@ximian.com>
* e-shell-view.c (e_shell_view_save_settings): Added some unused
code to implement saving of the expanded state.
* e-storage-set-view.c: Added has_save_id and get_save_id methods.
2001-03-13 Christopher James Lahey <clahey@ximian.com>
* e-storage-set-view.c (ETREE_SPEC): Set draw-grid here to false.
2001-03-09 Christopher James Lahey <clahey@ximian.com>
* e-storage-set-view.c, e-storage-set-view.h: Chaned this to use
ETree instead of ETable.
End of branch
svn path=/trunk/; revision=8839
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 32 | ||||
-rw-r--r-- | mail/folder-browser-factory.c | 2 | ||||
-rw-r--r-- | mail/folder-browser.c | 16 | ||||
-rw-r--r-- | mail/mail-callbacks.c | 8 | ||||
-rw-r--r-- | mail/message-list.c | 359 | ||||
-rw-r--r-- | mail/message-list.h | 17 | ||||
-rw-r--r-- | mail/subscribe-dialog.c | 138 | ||||
-rw-r--r-- | mail/subscribe-dialog.h | 5 |
8 files changed, 319 insertions, 258 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index e9a503fc9e..aa7e6623be 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,35 @@ +2001-03-19 Christopher James Lahey <clahey@ximian.com> + + * Merged e-tree-rework-branch: + +2001-03-18 Christopher James Lahey <clahey@ximian.com> + + * message-list.c: Added has_save_id and get_save_id methods. + + * subscribe-dialog.c: Added arguments for + e_tree_memory_callbacks_new of get_save_id and has_save_id to + NULL. + +2001-03-16 Christopher James Lahey <clahey@ximian.com> + + * message-list.c: Added a call to + e_tree_memory_set_expanded_default to TRUE. Removed all calls to + set_expanded on nodes while the tree is frozen since this fails + miserably now. + +2001-03-13 Christopher James Lahey <clahey@ximian.com> + + * message-list.c (message_list_get_layout): Turned off draw-grid. + +2001-03-09 Christopher James Lahey <clahey@ximian.com> + + * folder-browser-factory.c, folder-browser.c, message-list.c, + message-list.h, subscribe-dialog.c, subscribe-dialog.h, + mail-callbacks.c: Converted these all to use ETree instead of + ETable. + +End of branch + 2001-03-19 Iain Holmes <iain@ximian.com> * importers/pine-importer.c: Pine intelligent mail importer. diff --git a/mail/folder-browser-factory.c b/mail/folder-browser-factory.c index fce9956575..22e0817c34 100644 --- a/mail/folder-browser-factory.c +++ b/mail/folder-browser-factory.c @@ -185,7 +185,7 @@ display_view(GalViewCollection *collection, { FolderBrowser *fb = data; if (GAL_IS_VIEW_ETABLE(view)) { - e_table_set_state_object(e_table_scrolled_get_table(E_TABLE_SCROLLED(fb->message_list)), GAL_VIEW_ETABLE(view)->state); + e_tree_set_state_object(fb->message_list->tree, GAL_VIEW_ETABLE(view)->state); } } diff --git a/mail/folder-browser.c b/mail/folder-browser.c index 6473df58a6..7fa59c3bd6 100644 --- a/mail/folder-browser.c +++ b/mail/folder-browser.c @@ -596,7 +596,7 @@ static EPopupMenu menu[] = { /* handle context menu over message-list */ static gint -on_right_click (ETable *table, gint row, gint col, GdkEvent *event, FolderBrowser *fb) +on_right_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, FolderBrowser *fb) { extern CamelFolder *sent_folder; CamelMessageInfo *info; @@ -723,7 +723,7 @@ display_menu: } static int -etable_key (ETable *table, int row, int col, GdkEvent *ev, FolderBrowser *fb) +etree_key (ETree *tree, int row, ETreePath path, int col, GdkEvent *ev, FolderBrowser *fb) { if ((ev->key.state & !(GDK_SHIFT_MASK | GDK_LOCK_MASK)) != 0) return FALSE; @@ -777,7 +777,7 @@ etable_key (ETable *table, int row, int col, GdkEvent *ev, FolderBrowser *fb) return TRUE; case GDK_Menu: - on_right_click (table, row, col, ev, fb); + on_right_click (tree, row, path, col, ev, fb); return TRUE; default: @@ -788,7 +788,7 @@ etable_key (ETable *table, int row, int col, GdkEvent *ev, FolderBrowser *fb) } static void -on_double_click (ETable *table, gint row, gint col, GdkEvent *event, FolderBrowser *fb) +on_double_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, FolderBrowser *fb) { /* Ignore double-clicks on columns where single-click doesn't * just select. @@ -985,13 +985,13 @@ my_folder_browser_init (GtkObject *object) GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); - gtk_signal_connect (GTK_OBJECT (fb->message_list->table), - "key_press", GTK_SIGNAL_FUNC (etable_key), fb); + gtk_signal_connect (GTK_OBJECT (fb->message_list->tree), + "key_press", GTK_SIGNAL_FUNC (etree_key), fb); - gtk_signal_connect (GTK_OBJECT (fb->message_list->table), + gtk_signal_connect (GTK_OBJECT (fb->message_list->tree), "right_click", GTK_SIGNAL_FUNC (on_right_click), fb); - gtk_signal_connect (GTK_OBJECT (fb->message_list->table), + gtk_signal_connect (GTK_OBJECT (fb->message_list->tree), "double_click", GTK_SIGNAL_FUNC (on_double_click), fb); gtk_signal_connect (GTK_OBJECT(fb->message_list), "message_selected", diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c index d764df5baf..dbaa80a822 100644 --- a/mail/mail-callbacks.c +++ b/mail/mail-callbacks.c @@ -921,7 +921,7 @@ select_all (BonoboUIComponent *uih, void *user_data, const char *path) if (ml->folder == NULL) return; - e_table_select_all (ml->table); + e_tree_select_all (ml->tree); } void @@ -933,7 +933,7 @@ invert_selection (BonoboUIComponent *uih, void *user_data, const char *path) if (ml->folder == NULL) return; - e_table_invert_selection (ml->table); + e_tree_invert_selection (ml->tree); } /* flag all selected messages */ @@ -1160,7 +1160,7 @@ next_msg (GtkWidget *button, gpointer user_data) FolderBrowser *fb = FOLDER_BROWSER (user_data); int row; - row = e_table_get_cursor_row (fb->message_list->table); + 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, CAMEL_MESSAGE_SEEN); @@ -1172,7 +1172,7 @@ previous_msg (GtkWidget *button, gpointer user_data) FolderBrowser *fb = FOLDER_BROWSER (user_data); int row; - row = e_table_get_cursor_row (fb->message_list->table); + 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, 0, CAMEL_MESSAGE_SEEN); diff --git a/mail/message-list.c b/mail/message-list.c index 1e408f4db9..52c9e4da45 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -30,8 +30,7 @@ #include <gal/util/e-util.h> #include <gal/widgets/e-gui-utils.h> -#include <gal/e-table/e-table-header-item.h> -#include <gal/e-table/e-table-item.h> + #include <gal/e-table/e-cell-text.h> #include <gal/e-table/e-cell-toggle.h> #include <gal/e-table/e-cell-checkbox.h> @@ -39,6 +38,8 @@ #include <gal/e-table/e-cell-date.h> #include <gal/e-table/e-cell-size.h> +#include <gal/e-table/e-tree-memory-callbacks.h> + #include "art/mail-new.xpm" #include "art/mail-read.xpm" #include "art/mail-replied.xpm" @@ -85,7 +86,7 @@ #define COL_SIZE_EXPANSION (6.0) #define COL_SIZE_WIDTH_MIN (32) -#define PARENT_TYPE (e_table_scrolled_get_type ()) +#define PARENT_TYPE (e_tree_scrolled_get_type ()) #ifdef SMART_ADDRESS_COMPARE struct _EMailAddress { @@ -96,10 +97,10 @@ struct _EMailAddress { typedef struct _EMailAddress EMailAddress; #endif /* SMART_ADDRESS_COMPARE */ -static ETableScrolledClass *message_list_parent_class; +static ETreeScrolledClass *message_list_parent_class; -static void on_cursor_activated_cmd (ETableScrolled *table, int row, gpointer user_data); -static gint on_click (ETableScrolled *table, gint row, gint col, GdkEvent *event, MessageList *list); +static void on_cursor_activated_cmd (ETree *tree, int row, ETreePath path, gpointer user_data); +static gint on_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, MessageList *list); static char *filter_date (time_t date); static char *filter_size (int size); @@ -326,18 +327,12 @@ filter_size (gint size) /* Gets the uid of the message displayed at a given view row */ static const char * -get_message_uid (MessageList *message_list, int row) +get_message_uid (MessageList *message_list, ETreePath node) { - ETreeModel *model = (ETreeModel *)message_list->table_model; - ETreePath *node; CamelMessageInfo *info; - if (row >= e_table_model_row_count((ETableModel *)model)) - return NULL; - - node = e_tree_model_node_at_row (model, row); g_return_val_if_fail (node != NULL, NULL); - info = e_tree_model_node_get_data (model, node); + info = e_tree_memory_node_get_data (E_TREE_MEMORY(message_list->model), node); return camel_message_info_uid(info); } @@ -346,17 +341,10 @@ get_message_uid (MessageList *message_list, int row) * view row. */ static CamelMessageInfo * -get_message_info (MessageList *message_list, int row) +get_message_info (MessageList *message_list, ETreePath node) { - ETreeModel *model = (ETreeModel *)message_list->table_model; - ETreePath *node; - - if (row >= e_table_model_row_count((ETableModel *)model)) - return NULL; - - node = e_tree_model_node_at_row (model, row); g_return_val_if_fail (node != NULL, NULL); - return e_tree_model_node_get_data (model, node); + return e_tree_memory_node_get_data (E_TREE_MEMORY (message_list->model), node); } /** @@ -382,15 +370,15 @@ message_list_select (MessageList *message_list, int base_row, guint32 flags, guint32 mask) { CamelMessageInfo *info; - int vrow, mrow, last; - ETable *et = message_list->table; + int vrow, last; + ETree *et = message_list->tree; switch (direction) { case MESSAGE_LIST_SELECT_PREVIOUS: last = -1; break; case MESSAGE_LIST_SELECT_NEXT: - last = e_table_model_row_count (message_list->table_model); + last = e_tree_row_count (message_list->tree); break; default: g_warning("Invalid argument to message_list_select"); @@ -398,10 +386,10 @@ message_list_select (MessageList *message_list, int base_row, } if (base_row == -1) - base_row = e_table_model_row_count(message_list->table_model) - 1; + base_row = e_tree_row_count(message_list->tree) - 1; /* model_to_view_row etc simply dont work for sorted views. Sigh. */ - vrow = e_table_model_to_view_row (et, base_row); + vrow = e_tree_model_to_view_row (et, base_row); /* This means that we'll move at least one message in 'direction'. */ if (vrow != last) @@ -409,10 +397,10 @@ message_list_select (MessageList *message_list, int base_row, /* We don't know whether to use < or > due to "direction" */ while (vrow != last) { - mrow = e_table_view_to_model_row (et, vrow); - info = get_message_info (message_list, mrow); + ETreePath node = e_tree_node_at_row(et, vrow); + info = get_message_info (message_list, node); if (info && (info->flags & mask) == flags) { - e_table_set_cursor_row (et, mrow); + e_tree_set_cursor (et, node); gtk_signal_emit(GTK_OBJECT (message_list), message_list_signals [MESSAGE_SELECTED], camel_message_info_uid(info)); return; } @@ -429,8 +417,9 @@ add_uid (MessageList *ml, const char *uid, gpointer data) } static void -message_list_drag_data_get (ETable *table, +message_list_drag_data_get (ETree *tree, int row, + ETreePath path, int col, GdkDragContext *context, GtkSelectionData *selection_data, @@ -461,7 +450,7 @@ message_list_drag_data_get (ETable *table, return; } - minfo = get_message_info (mlist, row); + minfo = get_message_info (mlist, path); if (minfo == NULL) { g_warning("Row %d is invalid", row); g_free(tmpl); @@ -492,13 +481,36 @@ message_list_drag_data_get (ETable *table, * SimpleTableModel::col_count */ static int -ml_col_count (ETableModel *etm, void *data) +ml_column_count (ETreeModel *etm, void *data) { return COL_LAST; } +/* + * SimpleTableModel::has_save_id + */ +static gboolean +ml_has_save_id (ETreeModel *etm, void *data) +{ + return TRUE; +} + +/* + * SimpleTableModel::get_save_id + */ +static char * +ml_get_save_id (ETreeModel *etm, ETreePath path, void *data) +{ + CamelMessageInfo *info; + + info = e_tree_memory_node_get_data (E_TREE_MEMORY(etm), path); + if (info == NULL) + return g_strdup("root"); + return g_strdup (camel_message_info_uid(info)); +} + static void * -ml_duplicate_value (ETableModel *etm, int col, const void *value, void *data) +ml_duplicate_value (ETreeModel *etm, int col, const void *value, void *data) { switch (col){ case COL_MESSAGE_STATUS: @@ -523,7 +535,7 @@ ml_duplicate_value (ETableModel *etm, int col, const void *value, void *data) } static void -ml_free_value (ETableModel *etm, int col, void *value, void *data) +ml_free_value (ETreeModel *etm, int col, void *value, void *data) { switch (col){ case COL_MESSAGE_STATUS: @@ -548,7 +560,7 @@ ml_free_value (ETableModel *etm, int col, void *value, void *data) } static void * -ml_initialize_value (ETableModel *etm, int col, void *data) +ml_initialize_value (ETreeModel *etm, int col, void *data) { switch (col){ case COL_MESSAGE_STATUS: @@ -574,7 +586,7 @@ ml_initialize_value (ETableModel *etm, int col, void *data) } static gboolean -ml_value_is_empty (ETableModel *etm, int col, const void *value, void *data) +ml_value_is_empty (ETreeModel *etm, int col, const void *value, void *data) { switch (col){ case COL_MESSAGE_STATUS: @@ -617,7 +629,7 @@ static const char *score_map[] = { }; static char * -ml_value_to_string (ETableModel *etm, int col, const void *value, void *data) +ml_value_to_string (ETreeModel *etm, int col, const void *value, void *data) { unsigned int i; @@ -658,7 +670,7 @@ ml_value_to_string (ETableModel *etm, int col, const void *value, void *data) } static GdkPixbuf * -ml_tree_icon_at (ETreeModel *etm, ETreePath *path, void *model_data) +ml_tree_icon_at (ETreeModel *etm, ETreePath path, void *model_data) { /* we dont really need an icon ... */ return NULL; @@ -666,55 +678,55 @@ ml_tree_icon_at (ETreeModel *etm, ETreePath *path, void *model_data) /* return true if there are any unread messages in the subtree */ static int -subtree_unread(MessageList *ml, ETreePath *node) +subtree_unread(MessageList *ml, ETreePath node) { CamelMessageInfo *info; - ETreePath *child; + ETreePath child; while (node) { - info = e_tree_model_node_get_data((ETreeModel *)ml->table_model, node); + info = e_tree_memory_node_get_data((ETreeMemory *)ml->model, node); g_assert(info); if (!(info->flags & CAMEL_MESSAGE_SEEN)) return TRUE; - if ((child = e_tree_model_node_get_first_child (E_TREE_MODEL (ml->table_model), node))) + if ((child = e_tree_model_node_get_first_child (E_TREE_MODEL (ml->model), node))) if (subtree_unread(ml, child)) return TRUE; - node = e_tree_model_node_get_next (E_TREE_MODEL (ml->table_model), node); + node = e_tree_model_node_get_next (ml->model, node); } return FALSE; } static int -subtree_size(MessageList *ml, ETreePath *node) +subtree_size(MessageList *ml, ETreePath node) { CamelMessageInfo *info; int size = 0; - ETreePath *child; + ETreePath child; while (node) { - info = e_tree_model_node_get_data((ETreeModel *)ml->table_model, node); + info = e_tree_memory_node_get_data((ETreeMemory *)ml->model, node); g_assert(info); size += info->size; - if ((child = e_tree_model_node_get_first_child (E_TREE_MODEL (ml->table_model), node))) + if ((child = e_tree_model_node_get_first_child (E_TREE_MODEL (ml->model), node))) size += subtree_size(ml, child); - node = e_tree_model_node_get_next (E_TREE_MODEL (ml->table_model), node); + node = e_tree_model_node_get_next (ml->model, node); } return size; } static time_t -subtree_earliest(MessageList *ml, ETreePath *node, int sent) +subtree_earliest(MessageList *ml, ETreePath node, int sent) { CamelMessageInfo *info; time_t earliest = 0, date; ETreePath *child; while (node) { - info = e_tree_model_node_get_data((ETreeModel *)ml->table_model, node); + info = e_tree_memory_node_get_data((ETreeMemory *)ml->model, node); g_assert(info); if (sent) @@ -725,35 +737,35 @@ subtree_earliest(MessageList *ml, ETreePath *node, int sent) if (earliest == 0 || date < earliest) earliest = date; - if ((child = e_tree_model_node_get_first_child (E_TREE_MODEL (ml->table_model), node))) { + if ((child = e_tree_model_node_get_first_child (ml->model, node))) { date = subtree_earliest(ml, child, sent); if (earliest == 0 || (date != 0 && date < earliest)) earliest = date; } - node = e_tree_model_node_get_next (E_TREE_MODEL (ml->table_model), node); + node = e_tree_model_node_get_next (ml->model, node); } return earliest; } static void * -ml_tree_value_at (ETreeModel *etm, ETreePath *path, int col, void *model_data) +ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data) { MessageList *message_list = model_data; CamelMessageInfo *msg_info; /* retrieve the message information array */ - msg_info = e_tree_model_node_get_data (etm, path); + msg_info = e_tree_memory_node_get_data (E_TREE_MEMORY(etm), path); g_assert(msg_info); switch (col){ case COL_MESSAGE_STATUS: { - ETreePath *child; + ETreePath child; /* if a tree is collapsed, then scan its insides for details */ child = e_tree_model_node_get_first_child(etm, path); - if (child && !e_tree_model_node_is_expanded(etm, path)) { + if (child && !e_tree_node_is_expanded(message_list->tree, path)) { if (subtree_unread(message_list, child)) return (void *)3; else @@ -797,10 +809,10 @@ ml_tree_value_at (ETreeModel *etm, ETreePath *path, int col, void *model_data) case COL_DELETED: return GINT_TO_POINTER ((msg_info->flags & CAMEL_MESSAGE_DELETED) != 0); case COL_UNREAD: { - ETreePath *child; + ETreePath child; child = e_tree_model_node_get_first_child(etm, path); - if (child && !e_tree_model_node_is_expanded(etm, path) + if (child && !e_tree_node_is_expanded(message_list->tree, path) && (msg_info->flags & CAMEL_MESSAGE_SEEN)) { return (void *)subtree_unread(message_list, child); } @@ -824,14 +836,14 @@ ml_tree_value_at (ETreeModel *etm, ETreePath *path, int col, void *model_data) } static void -ml_tree_set_value_at (ETreeModel *etm, ETreePath *path, int col, +ml_tree_set_value_at (ETreeModel *etm, ETreePath path, int col, const void *val, void *model_data) { g_assert_not_reached (); } static gboolean -ml_tree_is_cell_editable (ETreeModel *etm, ETreePath *path, int col, void *model_data) +ml_tree_is_cell_editable (ETreeModel *etm, ETreePath path, int col, void *model_data) { return FALSE; } @@ -989,11 +1001,11 @@ save_header_state(MessageList *ml) { char *filename; - if (ml->folder == NULL || ml->table == NULL) + if (ml->folder == NULL || ml->tree == NULL) return; filename = mail_config_folder_to_cachename(ml->folder, "et-header-"); - e_table_save_state(ml->table, filename); + e_tree_save_state(ml->tree, filename); g_free(filename); } @@ -1009,7 +1021,7 @@ char * message_list_get_layout (MessageList *message_list) { /* Default: Status, Attachments, Priority, From, Subject, Date */ - return g_strdup ("<ETableSpecification cursor-mode=\"line\" draw-grid=\"true\" draw-focus=\"true\" selection-mode=\"browse\">" + return g_strdup ("<ETableSpecification cursor-mode=\"line\" draw-grid=\"false\" draw-focus=\"true\" selection-mode=\"browse\">" "<ETableColumn model_col= \"0\" _title=\"Status\" pixbuf=\"status\" expansion=\"0.0\" minimum_width=\"18\" resizable=\"false\" cell=\"render_message_status\" compare=\"integer\" sortable=\"false\"/>" "<ETableColumn model_col= \"1\" _title=\"Flagged\" pixbuf=\"flagged\" expansion=\"0.0\" minimum_width=\"18\" resizable=\"false\" cell=\"render_flagged\" compare=\"integer\"/>" "<ETableColumn model_col= \"2\" _title=\"Score\" pixbuf=\"score\" expansion=\"0.0\" minimum_width=\"18\" resizable=\"false\" cell=\"render_score\" compare=\"integer\"/>" @@ -1027,7 +1039,7 @@ message_list_get_layout (MessageList *message_list) } static void -message_list_setup_etable(MessageList *message_list) +message_list_setup_etree(MessageList *message_list) { /* build the spec based on the folder, and possibly from a saved file */ /* otherwise, leave default */ @@ -1042,7 +1054,7 @@ message_list_setup_etable(MessageList *message_list) if (path && stat (path, &st) == 0 && st.st_size > 0 && S_ISREG (st.st_mode)) { /* build based on saved file */ - e_table_load_state (message_list->table, path); + e_tree_load_state (message_list->tree, path); } else if (strstr (name, "/Drafts") || strstr (name, "/Outbox") || strstr (name, "/Sent")) { /* these folders have special defaults */ char *state = "<ETableState>" @@ -1050,7 +1062,7 @@ message_list_setup_etable(MessageList *message_list) "<column source=\"8\"/> <column source=\"5\"/> " "<column source=\"6\"/> <grouping> </grouping> </ETableState>"; - e_table_set_state (message_list->table, state); + e_tree_set_state (message_list->tree, state); } g_free (path); @@ -1089,8 +1101,8 @@ message_list_destroy (GtkObject *object) save_header_state(message_list); hide_save_state(message_list); } - - gtk_object_unref (GTK_OBJECT (message_list->table_model)); + + gtk_object_unref (GTK_OBJECT (message_list->model)); if (message_list->idle_id != 0) g_source_remove(message_list->idle_id); @@ -1149,47 +1161,57 @@ message_list_construct (MessageList *message_list) ETableExtras *extras; char *spec; - message_list->table_model = (ETableModel *) - e_tree_simple_new (ml_col_count, - ml_duplicate_value, - ml_free_value, - ml_initialize_value, - ml_value_is_empty, - ml_value_to_string, - ml_tree_icon_at, ml_tree_value_at, - ml_tree_set_value_at, - ml_tree_is_cell_editable, - message_list); - gtk_object_ref (GTK_OBJECT (message_list->table_model)); - gtk_object_sink (GTK_OBJECT (message_list->table_model)); - - e_tree_model_root_node_set_visible ((ETreeModel *)message_list->table_model, FALSE); + message_list->model = + e_tree_memory_callbacks_new (ml_tree_icon_at, + + ml_column_count, + + ml_has_save_id, + ml_get_save_id, + + ml_tree_value_at, + ml_tree_set_value_at, + ml_tree_is_cell_editable, + + ml_duplicate_value, + ml_free_value, + ml_initialize_value, + ml_value_is_empty, + ml_value_to_string, + + message_list); + gtk_object_ref (GTK_OBJECT (message_list->model)); + gtk_object_sink (GTK_OBJECT (message_list->model)); + e_tree_memory_set_expanded_default(E_TREE_MEMORY(message_list->model), TRUE); + /* - * The etable + * The etree */ spec = message_list_get_layout (message_list); extras = message_list_create_extras (); - e_table_scrolled_construct (E_TABLE_SCROLLED (message_list), - message_list->table_model, - extras, spec, NULL); - message_list->table = - e_table_scrolled_get_table (E_TABLE_SCROLLED (message_list)); + e_tree_scrolled_construct (E_TREE_SCROLLED (message_list), + message_list->model, + extras, spec, NULL); + + message_list->tree = e_tree_scrolled_get_tree(E_TREE_SCROLLED (message_list)); + e_tree_root_node_set_visible (message_list->tree, FALSE); + g_free (spec); gtk_object_sink (GTK_OBJECT (extras)); - gtk_signal_connect (GTK_OBJECT (message_list->table), "cursor_activated", + gtk_signal_connect (GTK_OBJECT (message_list->tree), "cursor_activated", GTK_SIGNAL_FUNC (on_cursor_activated_cmd), message_list); - gtk_signal_connect (GTK_OBJECT (message_list->table), "click", + gtk_signal_connect (GTK_OBJECT (message_list->tree), "click", GTK_SIGNAL_FUNC (on_click), message_list); /* drag & drop */ - e_table_drag_source_set (message_list->table, GDK_BUTTON1_MASK, + e_tree_drag_source_set (message_list->tree, GDK_BUTTON1_MASK, drag_types, num_drag_types, GDK_ACTION_MOVE); - gtk_signal_connect (GTK_OBJECT (message_list->table), "drag_data_get", + gtk_signal_connect (GTK_OBJECT (message_list->tree), "drag_data_get", GTK_SIGNAL_FUNC (message_list_drag_data_get), message_list); } @@ -1213,14 +1235,14 @@ clear_info(char *key, ETreePath *node, MessageList *ml) { CamelMessageInfo *info; - info = e_tree_model_node_get_data((ETreeModel *)ml->table_model, node); + info = e_tree_memory_node_get_data((ETreeMemory *)ml->model, node); camel_folder_free_message_info(ml->folder, info); } static void clear_tree (MessageList *ml) { - ETreeModel *etm = E_TREE_MODEL (ml->table_model); + ETreeModel *etm = ml->model; #ifdef TIMEIT struct timeval start, end; @@ -1238,11 +1260,10 @@ clear_tree (MessageList *ml) if (ml->tree_root) { /* we should be frozen already */ - e_tree_model_node_remove (etm, ml->tree_root); + e_tree_memory_node_remove (E_TREE_MEMORY(etm), ml->tree_root); } - ml->tree_root = e_tree_model_node_insert (etm, NULL, 0, NULL); - e_tree_model_node_set_expanded (etm, ml->tree_root, TRUE); + ml->tree_root = e_tree_memory_node_insert (E_TREE_MEMORY(etm), NULL, 0, NULL); #ifdef TIMEIT gettimeofday(&end, NULL); @@ -1256,21 +1277,21 @@ clear_tree (MessageList *ml) /* we save the node id to the file if the node should be closed when we start up. We only save nodeid's for messages with children */ static void -save_node_state(MessageList *ml, FILE *out, ETreePath *node) +save_node_state(MessageList *ml, FILE *out, ETreePath node) { CamelMessageInfo *info; while (node) { - ETreePath *child = e_tree_model_node_get_first_child (E_TREE_MODEL (ml->table_model), node); + ETreePath child = e_tree_model_node_get_first_child (ml->model, node); if (child) { - if (!e_tree_model_node_is_expanded((ETreeModel *)ml->table_model, node)) { - info = e_tree_model_node_get_data((ETreeModel *)ml->table_model, node); + if (!e_tree_node_is_expanded(ml->tree, node)) { + info = e_tree_memory_node_get_data(E_TREE_MEMORY(ml->model), node); g_assert(info); fprintf(out, "%08x%08x\n", info->message_id.id.part.hi, info->message_id.id.part.lo); } save_node_state(ml, out, child); } - node = e_tree_model_node_get_next (E_TREE_MODEL (ml->table_model), node); + node = e_tree_model_node_get_next (ml->model, node); } } @@ -1304,16 +1325,16 @@ static void save_tree_state(MessageList *ml) { char *filename; - ETreePath *node; - ETreePath *child; + ETreePath node; + ETreePath child; FILE *out; int rem; filename = mail_config_folder_to_cachename(ml->folder, "treestate-"); out = fopen(filename, "w"); if (out) { - node = e_tree_model_get_root((ETreeModel *)ml->table_model); - child = e_tree_model_node_get_first_child ((ETreeModel *)ml->table_model, node); + node = e_tree_model_get_root(ml->model); + child = e_tree_model_node_get_first_child (ml->model, node); if (node && child) { save_node_state(ml, out, child); } @@ -1341,16 +1362,16 @@ free_tree_state(GHashTable *expanded_nodes) /* only call if we have a tree model */ /* builds the tree structure */ -static void build_subtree (MessageList *ml, ETreePath *parent, CamelFolderThreadNode *c, int *row, GHashTable *); +static void build_subtree (MessageList *ml, ETreePath parent, CamelFolderThreadNode *c, int *row, GHashTable *); -static void build_subtree_diff (MessageList *ml, ETreePath *parent, ETreePath *path, CamelFolderThreadNode *c, int *row, GHashTable *expanded_nodes); +static void build_subtree_diff (MessageList *ml, ETreePath parent, ETreePath path, CamelFolderThreadNode *c, int *row, GHashTable *expanded_nodes); static void build_tree (MessageList *ml, CamelFolderThread *thread, CamelFolderChangeInfo *changes) { int row = 0; GHashTable *expanded_nodes; - ETreeModel *etm = (ETreeModel *)ml->table_model; + ETreeModel *etm = ml->model; ETreePath *top; char *saveuid = NULL; @@ -1371,8 +1392,7 @@ build_tree (MessageList *ml, CamelFolderThread *thread, CamelFolderChangeInfo *c #endif if (ml->tree_root == NULL) { - ml->tree_root = e_tree_model_node_insert(etm, NULL, 0, NULL); - e_tree_model_node_set_expanded(etm, ml->tree_root, TRUE); + ml->tree_root = e_tree_memory_node_insert(E_TREE_MEMORY(etm), NULL, 0, NULL); } if (ml->cursor_uid) @@ -1384,19 +1404,19 @@ build_tree (MessageList *ml, CamelFolderThread *thread, CamelFolderChangeInfo *c #ifndef BROKEN_ETREE if (top == NULL || changes == NULL) { #endif - e_tree_model_freeze(etm); + e_tree_memory_freeze(E_TREE_MEMORY(etm)); clear_tree (ml); build_subtree(ml, ml->tree_root, thread->tree, &row, expanded_nodes); - e_tree_model_thaw(etm); + e_tree_memory_thaw(E_TREE_MEMORY(etm)); #ifndef BROKEN_ETREE } else { - static int tree_equal(ETreeModel *etm, ETreePath *ap, CamelFolderThreadNode *bp); + static int tree_equal(ETreeModel *etm, ETreePath ap, CamelFolderThreadNode *bp); build_subtree_diff(ml, ml->tree_root, top, thread->tree, &row, expanded_nodes); top = e_tree_model_node_get_first_child(etm, ml->tree_root); - tree_equal((ETreeModel *)ml->table_model, top, thread->tree); + tree_equal(ml->model, top, thread->tree); } #endif @@ -1407,8 +1427,7 @@ build_tree (MessageList *ml, CamelFolderThread *thread, CamelFolderChangeInfo *c ml->cursor_uid = NULL; gtk_signal_emit((GtkObject *)ml, message_list_signals[MESSAGE_SELECTED], NULL); } else { - int row = e_tree_model_row_of_node(etm, node); - e_table_set_cursor_row(ml->table, row); + e_tree_set_cursor(ml->tree, node); } g_free(saveuid); } @@ -1429,22 +1448,20 @@ build_tree (MessageList *ml, CamelFolderThread *thread, CamelFolderChangeInfo *c is faster than inserting to the right row :( */ /* Otherwise, this code would probably go as it does the same thing essentially */ static void -build_subtree (MessageList *ml, ETreePath *parent, CamelFolderThreadNode *c, int *row, GHashTable *expanded_nodes) +build_subtree (MessageList *ml, ETreePath parent, CamelFolderThreadNode *c, int *row, GHashTable *expanded_nodes) { - ETreeModel *tree = E_TREE_MODEL (ml->table_model); - ETreePath *node; + ETreeModel *tree = ml->model; + ETreePath node; while (c) { /* phantom nodes no longer allowed */ g_assert(c->message); - node = e_tree_model_node_insert(tree, parent, -1, (void *)c->message); + node = e_tree_memory_node_insert(E_TREE_MEMORY(tree), parent, -1, (void *)c->message); g_hash_table_insert(ml->uid_nodemap, (void *)camel_message_info_uid(c->message), node); camel_folder_ref_message_info(ml->folder, (CamelMessageInfo *)c->message); + if (c->child) { - char key[17]; - sprintf(key, "%08x%08x", c->message->message_id.id.part.hi, c->message->message_id.id.part.lo); - e_tree_model_node_set_expanded(tree, node, g_hash_table_lookup(expanded_nodes, key) == 0); build_subtree(ml, node, c->child, row, expanded_nodes); } c = c->next; @@ -1454,11 +1471,11 @@ build_subtree (MessageList *ml, ETreePath *parent, CamelFolderThreadNode *c, int /* compares a thread tree node with the etable tree node to see if they point to the same object */ static int -node_equal(ETreeModel *etm, ETreePath *ap, CamelFolderThreadNode *bp) +node_equal(ETreeModel *etm, ETreePath ap, CamelFolderThreadNode *bp) { CamelMessageInfo *info; - info = e_tree_model_node_get_data(etm, ap); + info = e_tree_memory_node_get_data(E_TREE_MEMORY(etm), ap); if (bp->message && strcmp(camel_message_info_uid(info), camel_message_info_uid(bp->message))==0) return 1; @@ -1469,14 +1486,14 @@ node_equal(ETreeModel *etm, ETreePath *ap, CamelFolderThreadNode *bp) #ifndef BROKEN_ETREE /* debug function - compare the two trees to see if they are the same */ static int -tree_equal(ETreeModel *etm, ETreePath *ap, CamelFolderThreadNode *bp) +tree_equal(ETreeModel *etm, ETreePath ap, CamelFolderThreadNode *bp) { CamelMessageInfo *info; while (ap && bp) { if (!node_equal(etm, ap, bp)) { g_warning("Nodes in tree differ"); - info = e_tree_model_node_get_data(etm, ap); + info = e_tree_memory_node_get_data(E_TREE_MEMORY(etm), ap); printf("table uid = %s\n", camel_message_info_uid(info)); printf("camel uid = %s\n", camel_message_info_uid(bp->message)); return FALSE; @@ -1491,7 +1508,7 @@ tree_equal(ETreeModel *etm, ETreePath *ap, CamelFolderThreadNode *bp) if (ap || bp) { g_warning("Tree differs, out of nodes in one branch"); if (ap) { - info = e_tree_model_node_get_data(etm, ap); + info = e_tree_memory_node_get_data(E_TREE_MEMORY(etm), ap); if (info) printf("table uid = %s\n", camel_message_info_uid(info)); else @@ -1509,37 +1526,34 @@ tree_equal(ETreeModel *etm, ETreePath *ap, CamelFolderThreadNode *bp) /* adds a single node, retains save state, and handles adding children if required */ static void -add_node_diff(MessageList *ml, ETreePath *parent, ETreePath *path, CamelFolderThreadNode *c, int *row, int myrow, GHashTable *expanded_nodes) +add_node_diff(MessageList *ml, ETreePath parent, ETreePath path, CamelFolderThreadNode *c, int *row, int myrow, GHashTable *expanded_nodes) { - ETreeModel *etm = E_TREE_MODEL (ml->table_model); - ETreePath *node; + ETreeModel *etm = ml->model; + ETreePath node; g_assert(c->message); /* we just update the hashtable key, umm, does this leak the info on the message node? */ g_hash_table_remove(ml->uid_nodemap, camel_message_info_uid(c->message)); - node = e_tree_model_node_insert(etm, parent, myrow, (void *)c->message); + node = e_tree_memory_node_insert(E_TREE_MEMORY(etm), parent, myrow, (void *)c->message); g_hash_table_insert(ml->uid_nodemap, (void *)camel_message_info_uid(c->message), node); camel_folder_ref_message_info(ml->folder, (CamelMessageInfo *)c->message); (*row)++; if (c->child) { - char key[17]; - sprintf(key, "%08x%08x", c->message->message_id.id.part.hi, c->message->message_id.id.part.lo); - e_tree_model_node_set_expanded(etm, node, g_hash_table_lookup(expanded_nodes, key) == 0); build_subtree_diff(ml, node, NULL, c->child, row, expanded_nodes); } } /* removes node, children recursively and all associated data */ static void -remove_node_diff(MessageList *ml, ETreePath *node, int depth) +remove_node_diff(MessageList *ml, ETreePath node, int depth) { - ETreeModel *etm = E_TREE_MODEL (ml->table_model); - ETreePath *cp, *cn; + ETreeModel *etm = ml->model; + ETreePath cp, cn; CamelMessageInfo *info; - t(printf("Removing node: %s\n", (char *)e_tree_model_node_get_data(etm, node))); + t(printf("Removing node: %s\n", (char *)e_tree_memory_node_get_data(etm, node))); /* we depth-first remove all node data's ... */ cp = e_tree_model_node_get_first_child(etm, node); @@ -1550,24 +1564,24 @@ remove_node_diff(MessageList *ml, ETreePath *node, int depth) } /* and the rowid entry - if and only if it is referencing this node */ - info = e_tree_model_node_get_data(etm, node); + info = e_tree_memory_node_get_data(E_TREE_MEMORY (etm), node); g_assert(info); g_hash_table_remove(ml->uid_nodemap, camel_message_info_uid(info)); camel_folder_free_message_info(ml->folder, info); - e_tree_model_node_set_data(etm, node, NULL); + e_tree_memory_node_set_data(E_TREE_MEMORY(etm), node, NULL); /* and only at the toplevel, remove the node (etree should optimise this remove somewhat) */ if (depth == 0) - e_tree_model_node_remove(etm, node); + e_tree_memory_node_remove(E_TREE_MEMORY(etm), node); } /* applies a new tree structure to an existing tree, but only by changing things that have changed */ static void -build_subtree_diff(MessageList *ml, ETreePath *parent, ETreePath *path, CamelFolderThreadNode *c, int *row, GHashTable *expanded_nodes) +build_subtree_diff(MessageList *ml, ETreePath parent, ETreePath path, CamelFolderThreadNode *c, int *row, GHashTable *expanded_nodes) { - ETreeModel *etm = E_TREE_MODEL (ml->table_model); - ETreePath *ap, *ai, *at, *tmp; + ETreeModel *etm = ml->model; + ETreePath ap, *ai, *at, *tmp; CamelFolderThreadNode *bp, *bi, *bt; int i, j, myrow = 0; @@ -1681,8 +1695,8 @@ static void build_flat_diff(MessageList *ml, CamelFolderChangeInfo *changes); static void build_flat (MessageList *ml, GPtrArray *summary, CamelFolderChangeInfo *changes) { - ETreeModel *etm = E_TREE_MODEL (ml->table_model); - ETreePath *node; + ETreeModel *etm = ml->model; + ETreePath node; char *saveuid = NULL; int i; @@ -1702,16 +1716,16 @@ build_flat (MessageList *ml, GPtrArray *summary, CamelFolderChangeInfo *changes) build_flat_diff(ml, changes); } else { #endif - e_tree_model_freeze(etm); + e_tree_memory_freeze(E_TREE_MEMORY(etm)); clear_tree (ml); for (i = 0; i < summary->len; i++) { CamelMessageInfo *info = summary->pdata[i]; - node = e_tree_model_node_insert(etm, ml->tree_root, -1, info); + node = e_tree_memory_node_insert(E_TREE_MEMORY(etm), ml->tree_root, -1, info); g_hash_table_insert(ml->uid_nodemap, (void *)camel_message_info_uid(info), node); camel_folder_ref_message_info(ml->folder, info); } - e_tree_model_thaw(etm); + e_tree_memory_thaw(E_TREE_MEMORY(etm)); #ifndef BROKEN_ETREE } @@ -1724,8 +1738,7 @@ build_flat (MessageList *ml, GPtrArray *summary, CamelFolderChangeInfo *changes) ml->cursor_uid = NULL; gtk_signal_emit((GtkObject *)ml, message_list_signals[MESSAGE_SELECTED], NULL); } else { - int row = e_tree_model_row_of_node(etm, node); - e_table_set_cursor_row(ml->table, row); + e_tree_set_cursor(ml->tree, node); } g_free(saveuid); } @@ -1745,7 +1758,7 @@ static void build_flat_diff(MessageList *ml, CamelFolderChangeInfo *changes) { int i; - ETreePath *node; + ETreePath node; CamelMessageInfo *info; #ifdef TIMEIT @@ -1762,10 +1775,10 @@ build_flat_diff(MessageList *ml, CamelFolderChangeInfo *changes) for (i=0;i<changes->uid_removed->len;i++) { node = g_hash_table_lookup(ml->uid_nodemap, changes->uid_removed->pdata[i]); if (node) { - info = e_tree_model_node_get_data((ETreeModel *)ml->table_model, node); + info = e_tree_memory_node_get_data(E_TREE_MEMORY(ml->model), node); camel_folder_free_message_info(ml->folder, info); g_hash_table_remove(ml->uid_nodemap, changes->uid_removed->pdata[i]); - e_tree_model_node_remove((ETreeModel *)ml->table_model, node); + e_tree_memory_node_remove(E_TREE_MEMORY(ml->model), node); } } @@ -1775,7 +1788,7 @@ build_flat_diff(MessageList *ml, CamelFolderChangeInfo *changes) info = camel_folder_get_message_info(ml->folder, changes->uid_added->pdata[i]); if (info) { d(printf(" %s\n", (char *)changes->uid_added->pdata[i])); - node = e_tree_model_node_insert((ETreeModel *)ml->table_model, ml->tree_root, -1, info); + node = e_tree_memory_node_insert(E_TREE_MEMORY(ml->model), ml->tree_root, -1, info); g_hash_table_insert(ml->uid_nodemap, (void *)camel_message_info_uid(info), node); } } @@ -1785,7 +1798,7 @@ build_flat_diff(MessageList *ml, CamelFolderChangeInfo *changes) for (i=0;i<changes->uid_changed->len;i++) { ETreePath *node = g_hash_table_lookup(ml->uid_nodemap, changes->uid_changed->pdata[i]); if (node) - e_tree_model_node_changed((ETreeModel *)ml->table_model, node); + e_tree_model_node_data_changed(ml->model, node); } #ifdef TIMEIT @@ -1812,9 +1825,9 @@ main_folder_changed (CamelObject *o, gpointer event_data, gpointer user_data) int i; for (i=0;i<changes->uid_changed->len;i++) { - ETreePath *node = g_hash_table_lookup (ml->uid_nodemap, changes->uid_changed->pdata[i]); + ETreePath node = g_hash_table_lookup (ml->uid_nodemap, changes->uid_changed->pdata[i]); if (node) - e_tree_model_node_changed((ETreeModel *)ml->table_model, node); + e_tree_model_node_data_changed(ml->model, node); } camel_folder_change_info_free(changes); @@ -1850,7 +1863,7 @@ main_message_changed (CamelObject *o, gpointer uid, gpointer user_data) node = g_hash_table_lookup (message_list->uid_nodemap, uid); if (node) - e_tree_model_node_changed ((ETreeModel *)message_list->table_model, node); + e_tree_model_node_data_changed (message_list->model, node); g_free (uid); } @@ -1898,8 +1911,8 @@ message_list_set_folder (MessageList *message_list, CamelFolder *camel_folder) } if (camel_folder) { - /* build the etable suitable for this folder */ - message_list_setup_etable(message_list); + /* build the etree suitable for this folder */ + message_list_setup_etree(message_list); camel_object_hook_event(CAMEL_OBJECT (camel_folder), "folder_changed", folder_changed, message_list); @@ -1928,7 +1941,7 @@ on_cursor_activated_idle (gpointer data) } static void -on_cursor_activated_cmd (ETableScrolled *table, int row, gpointer user_data) +on_cursor_activated_cmd (ETree *tree, int row, ETreePath path, gpointer user_data) { MessageList *message_list; @@ -1936,7 +1949,7 @@ on_cursor_activated_cmd (ETableScrolled *table, int row, gpointer user_data) message_list->cursor_row = row; g_free(message_list->cursor_uid); - message_list->cursor_uid = g_strdup(get_message_uid(message_list, row)); + message_list->cursor_uid = g_strdup(get_message_uid(message_list, path)); if (!message_list->idle_id) { message_list->idle_id = @@ -1946,7 +1959,7 @@ on_cursor_activated_cmd (ETableScrolled *table, int row, gpointer user_data) } static gint -on_click (ETableScrolled *table, gint row, gint col, GdkEvent *event, MessageList *list) +on_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, MessageList *list) { int flag; CamelMessageInfo *info; @@ -1958,7 +1971,7 @@ on_click (ETableScrolled *table, gint row, gint col, GdkEvent *event, MessageLis else return FALSE; - info = get_message_info(list, row); + info = get_message_info(list, path); if (info == NULL) { return FALSE; } @@ -1985,7 +1998,7 @@ mlfe_callback (int row, gpointer user_data) struct message_list_foreach_data *mlfe_data = user_data; const char *uid; - uid = get_message_uid (mlfe_data->message_list, row); + uid = get_message_uid (mlfe_data->message_list, e_tree_node_at_row(mlfe_data->message_list->tree, row)); if (uid) { mlfe_data->callback (mlfe_data->message_list, uid, @@ -2003,8 +2016,8 @@ message_list_foreach (MessageList *message_list, mlfe_data.message_list = message_list; mlfe_data.callback = callback; mlfe_data.user_data = user_data; - e_table_selected_row_foreach (message_list->table, - mlfe_callback, &mlfe_data); + e_tree_selected_row_foreach (message_list->tree, + mlfe_callback, &mlfe_data); } /* set whether we are in threaded view or flat view */ diff --git a/mail/message-list.h b/mail/message-list.h index cd26c2cfef..46739ee519 100644 --- a/mail/message-list.h +++ b/mail/message-list.h @@ -6,9 +6,8 @@ #include <gtk/gtk.h> #include "mail-types.h" -#include <gal/e-table/e-table-scrolled.h> -#include <gal/e-table/e-table-simple.h> -#include <gal/e-table/e-tree-simple.h> +#include <gal/e-table/e-tree-scrolled.h> +#include <gal/e-table/e-tree-model.h> #define MESSAGE_LIST_TYPE (message_list_get_type ()) #define MESSAGE_LIST(o) (GTK_CHECK_CAST ((o), MESSAGE_LIST_TYPE, MessageList)) @@ -45,12 +44,12 @@ enum { #define ML_HIDE_SAME (2147483646) struct _MessageList { - ETableScrolled parent; + ETreeScrolled parent; /* The table */ - ETableModel *table_model; - ETable *table; - ETreePath *tree_root; + ETreeModel *model; + ETree *tree; + ETreePath tree_root; /* The folder */ CamelFolder *folder; @@ -70,7 +69,7 @@ struct _MessageList { /* Are we displaying threaded view? */ gboolean threaded; - /* Where the ETable cursor is. */ + /* Where the ETree cursor is. */ int cursor_row; char *cursor_uid; @@ -82,7 +81,7 @@ struct _MessageList { }; typedef struct { - ETableScrolledClass parent_class; + ETreeScrolledClass parent_class; /* signals - select a message */ void (*message_selected) (MessageList *ml, const char *uid); diff --git a/mail/subscribe-dialog.c b/mail/subscribe-dialog.c index 4a6b773fb8..271f58f0f5 100644 --- a/mail/subscribe-dialog.c +++ b/mail/subscribe-dialog.c @@ -28,12 +28,21 @@ #include <gtkhtml/gtkhtml.h> #include <gal/util/e-util.h> #include <gal/widgets/e-unicode.h> + #include <gal/e-table/e-cell-toggle.h> #include <gal/e-table/e-cell-text.h> #include <gal/e-table/e-cell-tree.h> + #include <gal/e-table/e-table-scrolled.h> -#include <gal/e-table/e-tree-simple.h> +#include <gal/e-table/e-table-simple.h> +#include <gal/e-table/e-table.h> + +#include <gal/e-table/e-tree-scrolled.h> +#include <gal/e-table/e-tree-memory-callbacks.h> +#include <gal/e-table/e-tree.h> + #include <gal/e-paned/e-hpaned.h> + #include <bonobo/bonobo-main.h> #include <bonobo/bonobo-object.h> #include <bonobo/bonobo-generic-factory.h> @@ -66,7 +75,7 @@ static char *list [] = { }; #endif -#define FOLDER_ETABLE_SPEC "<ETableSpecification cursor-mode=\"line\"> \ +#define FOLDER_ETREE_SPEC "<ETableSpecification cursor-mode=\"line\"> \ <ETableColumn model_col=\"0\" pixbuf=\"subscribed-image\" expansion=\"0.0\" minimum_width=\"16\" resizable=\"false\" cell=\"cell_toggle\" compare=\"integer\"/> \ <ETableColumn model_col=\"1\" _title=\"Folder\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"cell_tree\" compare=\"string\"/> \ <ETableState> \ @@ -390,14 +399,14 @@ folder_info_subscribed (SubscribeDialog *sc, CamelFolderInfo *info) static void node_changed_cb (SubscribeDialog *sc, gboolean changed, gpointer data) { - ETreePath *node = data; + ETreePath node = data; if (changed) - e_tree_model_node_changed (sc->folder_model, node); + e_tree_model_node_data_changed (sc->folder_model, node); } static void -subscribe_folder_info (SubscribeDialog *sc, CamelFolderInfo *info, ETreePath *node) +subscribe_folder_info (SubscribeDialog *sc, CamelFolderInfo *info, ETreePath node) { /* folders without urls cannot be subscribed to */ if (info->url == NULL) @@ -407,7 +416,7 @@ subscribe_folder_info (SubscribeDialog *sc, CamelFolderInfo *info, ETreePath *no } static void -unsubscribe_folder_info (SubscribeDialog *sc, CamelFolderInfo *info, ETreePath *node) +unsubscribe_folder_info (SubscribeDialog *sc, CamelFolderInfo *info, ETreePath node) { /* folders without urls cannot be subscribed to */ if (info->url == NULL) @@ -430,9 +439,9 @@ subscribe_select_all (BonoboUIComponent *uic, void *user_data, const char *path) { SubscribeDialog *sc = (SubscribeDialog*)user_data; - ETableScrolled *scrolled = E_TABLE_SCROLLED (sc->folder_etable); + ETreeScrolled *scrolled = E_TREE_SCROLLED (sc->folder_etree); - e_table_select_all (scrolled->table); + e_tree_select_all (e_tree_scrolled_get_tree(scrolled)); } static void @@ -440,17 +449,17 @@ subscribe_invert_selection (BonoboUIComponent *uic, void *user_data, const char *path) { SubscribeDialog *sc = (SubscribeDialog*)user_data; - ETableScrolled *scrolled = E_TABLE_SCROLLED (sc->folder_etable); + ETreeScrolled *scrolled = E_TREE_SCROLLED (sc->folder_etree); - e_table_invert_selection (scrolled->table); + e_tree_invert_selection (e_tree_scrolled_get_tree(scrolled)); } static void subscribe_folder_foreach (int model_row, gpointer closure) { SubscribeDialog *sc = SUBSCRIBE_DIALOG (closure); - ETreePath *node = e_tree_model_node_at_row (sc->folder_model, model_row); - CamelFolderInfo *info = e_tree_model_node_get_data (sc->folder_model, node); + ETreePath node = e_tree_node_at_row (e_tree_scrolled_get_tree(E_TREE_SCROLLED(sc->folder_etree)), model_row); + CamelFolderInfo *info = e_tree_memory_node_get_data (E_TREE_MEMORY(sc->folder_model), node); if (!folder_info_subscribed (sc, info)) subscribe_folder_info (sc, info, node); @@ -461,7 +470,7 @@ subscribe_folders (BonoboUIComponent *componet, gpointer user_data, const char * { SubscribeDialog *sc = SUBSCRIBE_DIALOG (user_data); - e_table_selected_row_foreach (E_TABLE_SCROLLED(sc->folder_etable)->table, + e_tree_selected_row_foreach (e_tree_scrolled_get_tree(E_TREE_SCROLLED(sc->folder_etree)), subscribe_folder_foreach, sc); } @@ -469,8 +478,8 @@ static void unsubscribe_folder_foreach (int model_row, gpointer closure) { SubscribeDialog *sc = SUBSCRIBE_DIALOG (closure); - ETreePath *node = e_tree_model_node_at_row (sc->folder_model, model_row); - CamelFolderInfo *info = e_tree_model_node_get_data (sc->folder_model, node); + ETreePath node = e_tree_node_at_row (e_tree_scrolled_get_tree(E_TREE_SCROLLED(sc->folder_etree)), model_row); + CamelFolderInfo *info = e_tree_memory_node_get_data (E_TREE_MEMORY(sc->folder_model), node); if (folder_info_subscribed(sc, info)) unsubscribe_folder_info (sc, info, node); @@ -482,8 +491,8 @@ unsubscribe_folders (BonoboUIComponent *component, gpointer user_data, const cha { SubscribeDialog *sc = SUBSCRIBE_DIALOG (user_data); - e_table_selected_row_foreach (E_TABLE_SCROLLED(sc->folder_etable)->table, - unsubscribe_folder_foreach, sc); + e_tree_selected_row_foreach (e_tree_scrolled_get_tree(E_TREE_SCROLLED(sc->folder_etree)), + unsubscribe_folder_foreach, sc); } static void @@ -587,55 +596,55 @@ put_html (GtkHTML *html, char *text) #endif -/* etable stuff for the subscribe ui */ +/* etree stuff for the subscribe ui */ static int -folder_etable_col_count (ETableModel *etm, void *data) +folder_etree_column_count (ETreeModel *etm, void *data) { return FOLDER_COL_LAST; } static void* -folder_etable_duplicate_value (ETableModel *etm, int col, const void *val, void *data) +folder_etree_duplicate_value (ETreeModel *etm, int col, const void *val, void *data) { return g_strdup (val); } static void -folder_etable_free_value (ETableModel *etm, int col, void *val, void *data) +folder_etree_free_value (ETreeModel *etm, int col, void *val, void *data) { g_free (val); } static void* -folder_etable_init_value (ETableModel *etm, int col, void *data) +folder_etree_init_value (ETreeModel *etm, int col, void *data) { return g_strdup (""); } static gboolean -folder_etable_value_is_empty (ETableModel *etm, int col, const void *val, void *data) +folder_etree_value_is_empty (ETreeModel *etm, int col, const void *val, void *data) { return !(val && *(char *)val); } static char* -folder_etable_value_to_string (ETableModel *etm, int col, const void *val, void *data) +folder_etree_value_to_string (ETreeModel *etm, int col, const void *val, void *data) { return g_strdup(val); } static GdkPixbuf* -folder_etree_icon_at (ETreeModel *etree, ETreePath *path, void *model_data) +folder_etree_icon_at (ETreeModel *etree, ETreePath path, void *model_data) { return NULL; /* XXX no icons for now */ } static void* -folder_etree_value_at (ETreeModel *etree, ETreePath *path, int col, void *model_data) +folder_etree_value_at (ETreeModel *etree, ETreePath path, int col, void *model_data) { SubscribeDialog *dialog = SUBSCRIBE_DIALOG (model_data); - CamelFolderInfo *info = e_tree_model_node_get_data (etree, path); + CamelFolderInfo *info = e_tree_memory_node_get_data (E_TREE_MEMORY(etree), path); if (col == FOLDER_COL_NAME) { return info->name; @@ -652,13 +661,13 @@ folder_etree_value_at (ETreeModel *etree, ETreePath *path, int col, void *model_ } static void -folder_etree_set_value_at (ETreeModel *etree, ETreePath *path, int col, const void *val, void *model_data) +folder_etree_set_value_at (ETreeModel *etree, ETreePath path, int col, const void *val, void *model_data) { /* nothing */ } static gboolean -folder_etree_is_editable (ETreeModel *etree, ETreePath *path, int col, void *model_data) +folder_etree_is_editable (ETreeModel *etree, ETreePath path, int col, void *model_data) { return FALSE; } @@ -733,7 +742,7 @@ store_etable_value_to_string (ETableModel *etm, int col, const void *val, void * static void -build_etree_from_folder_info (SubscribeDialog *sc, ETreePath *parent, CamelFolderInfo *info) +build_etree_from_folder_info (SubscribeDialog *sc, ETreePath parent, CamelFolderInfo *info) { CamelFolderInfo *i; @@ -741,7 +750,7 @@ build_etree_from_folder_info (SubscribeDialog *sc, ETreePath *parent, CamelFolde return; for (i = info; i; i = i->sibling) { - ETreePath *node = e_tree_model_node_insert (sc->folder_model, parent, -1, i); + ETreePath node = e_tree_memory_node_insert (E_TREE_MEMORY(sc->folder_model), parent, -1, i); build_etree_from_folder_info (sc, node, i->child); } } @@ -767,8 +776,8 @@ build_tree (SubscribeDialog *sc, CamelStore *store) return; } - e_tree_model_node_remove (sc->folder_model, sc->folder_root); - sc->folder_root = e_tree_model_node_insert (sc->folder_model, NULL, + e_tree_memory_node_remove (E_TREE_MEMORY(sc->folder_model), sc->folder_root); + sc->folder_root = e_tree_memory_node_insert (E_TREE_MEMORY(sc->folder_model), NULL, 0, NULL); @@ -778,7 +787,7 @@ build_tree (SubscribeDialog *sc, CamelStore *store) } static void -storage_selected_cb (ETable *table, int row, gpointer data) +storage_selected_cb (ETree *table, int row, gpointer data) { SubscribeDialog *sc = SUBSCRIBE_DIALOG (data); CamelStore *store = (CamelStore*)g_list_nth_data (sc->store_list, row); @@ -789,18 +798,17 @@ storage_selected_cb (ETable *table, int row, gpointer data) static void -folder_toggle_cb (ETable *table, int row, int col, GdkEvent *event, gpointer data) +folder_toggle_cb (ETree *tree, int row, ETreePath path, int col, GdkEvent *event, gpointer data) { SubscribeDialog *sc = SUBSCRIBE_DIALOG (data); - ETreePath *node = e_tree_model_node_at_row (sc->folder_model, row); - CamelFolderInfo *info = e_tree_model_node_get_data (sc->folder_model, node); + CamelFolderInfo *info = e_tree_memory_node_get_data (E_TREE_MEMORY(sc->folder_model), path); if (folder_info_subscribed(sc, info)) - unsubscribe_folder_info (sc, info, node); + unsubscribe_folder_info (sc, info, path); else - subscribe_folder_info (sc, info, node); + subscribe_folder_info (sc, info, path); - e_tree_model_node_changed (sc->folder_model, node); + e_tree_model_node_data_changed (sc->folder_model, path); } @@ -953,23 +961,29 @@ subscribe_dialog_gui_init (SubscribeDialog *sc) sc); /* set up the folder etable */ - sc->folder_model = e_tree_simple_new (folder_etable_col_count, - folder_etable_duplicate_value, - folder_etable_free_value, - folder_etable_init_value, - folder_etable_value_is_empty, - folder_etable_value_to_string, - folder_etree_icon_at, - folder_etree_value_at, - folder_etree_set_value_at, - folder_etree_is_editable, - sc); + sc->folder_model = e_tree_memory_callbacks_new (folder_etree_icon_at, - sc->folder_root = e_tree_model_node_insert (sc->folder_model, NULL, - 0, NULL); + folder_etree_column_count, + + NULL, + NULL, + + folder_etree_value_at, + folder_etree_set_value_at, + folder_etree_is_editable, + + folder_etree_duplicate_value, + folder_etree_free_value, + folder_etree_init_value, + folder_etree_value_is_empty, + folder_etree_value_to_string, - e_tree_model_root_node_set_visible (sc->folder_model, FALSE); - e_tree_model_set_expanded_default (sc->folder_model, TRUE); + sc); + + e_tree_memory_set_expanded_default (E_TREE_MEMORY(sc->folder_model), TRUE); + + sc->folder_root = e_tree_memory_node_insert (E_TREE_MEMORY(sc->folder_model), NULL, + 0, NULL); toggles[0] = gdk_pixbuf_new_from_xpm_data ((const char **)empty_xpm); toggles[1] = gdk_pixbuf_new_from_xpm_data ((const char **)mark_xpm); @@ -988,18 +1002,20 @@ subscribe_dialog_gui_init (SubscribeDialog *sc) e_table_extras_add_pixbuf (extras, "subscribed-image", toggles[1]); - sc->folder_etable = e_table_scrolled_new (E_TABLE_MODEL(sc->folder_model), - extras, FOLDER_ETABLE_SPEC, NULL); + sc->folder_etree = e_tree_scrolled_new (E_TREE_MODEL(sc->folder_model), + extras, FOLDER_ETREE_SPEC, NULL); + + e_tree_root_node_set_visible (e_tree_scrolled_get_tree(E_TREE_SCROLLED(sc->folder_etree)), FALSE); gtk_object_sink (GTK_OBJECT (extras)); gdk_pixbuf_unref(toggles[0]); gdk_pixbuf_unref(toggles[1]); - gtk_signal_connect (GTK_OBJECT (e_table_scrolled_get_table(E_TABLE_SCROLLED (sc->folder_etable))), + gtk_signal_connect (GTK_OBJECT (e_tree_scrolled_get_tree(E_TREE_SCROLLED (sc->folder_etree))), "double_click", GTK_SIGNAL_FUNC (folder_toggle_cb), sc); gtk_table_attach ( - GTK_TABLE (sc->table), sc->folder_etable, + GTK_TABLE (sc->table), sc->folder_etree, 0, 1, 1, 3, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, @@ -1015,7 +1031,7 @@ subscribe_dialog_gui_init (SubscribeDialog *sc) gtk_widget_show (sc->description); #endif - gtk_widget_show (sc->folder_etable); + gtk_widget_show (sc->folder_etree); gtk_widget_show (sc->table); gtk_widget_show (sc->store_etable); gtk_widget_show (sc->hpaned); @@ -1035,7 +1051,7 @@ subscribe_dialog_destroy (GtkObject *object) sc = SUBSCRIBE_DIALOG (object); /* free our folder information */ - e_tree_model_node_remove (sc->folder_model, sc->folder_root); + e_tree_memory_node_remove (E_TREE_MEMORY(sc->folder_model), sc->folder_root); gtk_object_unref (GTK_OBJECT (sc->folder_model)); if (sc->folder_info) camel_store_free_folder_info (sc->store, sc->folder_info); diff --git a/mail/subscribe-dialog.h b/mail/subscribe-dialog.h index 68cd8a4876..444a2ca548 100644 --- a/mail/subscribe-dialog.h +++ b/mail/subscribe-dialog.h @@ -28,6 +28,7 @@ #include "camel/camel-store.h" #include <gtk/gtktable.h> #include <gal/e-table/e-tree-model.h> +#include <gal/e-table/e-table-model.h> #include <bonobo/bonobo-control.h> #include <bonobo/bonobo-property-bag.h> #include "shell/evolution-storage.h" @@ -52,9 +53,9 @@ struct _SubscribeDialog { GtkWidget *store_etable; ETableModel *store_model; - GtkWidget *folder_etable; + GtkWidget *folder_etree; ETreeModel *folder_model; - ETreePath *folder_root; + ETreePath folder_root; CamelStore *store; EvolutionStorage *storage; |