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 | |
parent | 262ee8128d564206d60c93e479200d1c977fd10d (diff) | |
download | gsoc2013-evolution-68a731e0a02290edf039d419bc36582023624726.tar.gz 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
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | addressbook/ChangeLog | 15 | ||||
-rw-r--r-- | addressbook/gui/widgets/e-minicard-view.c | 4 | ||||
-rw-r--r-- | configure.in | 6 | ||||
-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 | ||||
-rw-r--r-- | shell/ChangeLog | 27 | ||||
-rw-r--r-- | shell/e-shell-view.c | 7 | ||||
-rw-r--r-- | shell/e-storage-set-view.c | 497 | ||||
-rw-r--r-- | shell/e-storage-set-view.h | 6 |
16 files changed, 635 insertions, 508 deletions
@@ -1,3 +1,7 @@ +2001-03-19 Christopher James Lahey <clahey@ximian.com> + + * configure.in: Bumped gal requirement to 0.5.99.8. + 2001-03-19 Ettore Perazzoli <ettore@ximian.com> * configure.in: Make sure we never define `NSPR_CFLAGS' or diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 9a29c8c8e4..21956f8bcc 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,17 @@ +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 + 2001-03-17 Jon Trowbridge <trow@ximian.com> * gui/component/select-names/e-select-names-completion.c: Brutally @@ -277,7 +291,6 @@ * backend/ebook/e-book-types.h: Add enum EBookSimpleQueryStatus. - 2001-03-08 Jon Trowbridge <trow@ximian.com> * gui/component/select-names/e-select-names-popup.c diff --git a/addressbook/gui/widgets/e-minicard-view.c b/addressbook/gui/widgets/e-minicard-view.c index 42284b02db..7afe9e6ca3 100644 --- a/addressbook/gui/widgets/e-minicard-view.c +++ b/addressbook/gui/widgets/e-minicard-view.c @@ -184,7 +184,7 @@ create_card(EBookView *book_view, const GList *cards, EMinicardView *view) e_reflow_add_item(E_REFLOW(view), item, &position); - e_selection_model_simple_insert_row(view->selection, position); + e_selection_model_simple_insert_rows(view->selection, position, 1); } } @@ -225,7 +225,7 @@ remove_card(EBookView *book_view, const char *id, EMinicardView *view) { int position; e_reflow_sorted_remove_item(E_REFLOW_SORTED(view), id, &position); - e_selection_model_simple_delete_row(view->selection, position); + e_selection_model_simple_delete_rows(view->selection, position, 1); } static void diff --git a/configure.in b/configure.in index 4f14ea62c5..0355ae4546 100644 --- a/configure.in +++ b/configure.in @@ -353,14 +353,14 @@ fi dnl ****************************** dnl Gnome App Lib checking dnl ****************************** -AC_MSG_CHECKING(for Gnome App libraries (GAL) >= 0.5.99.7) +AC_MSG_CHECKING(for Gnome App libraries (GAL) >= 0.5.99.8) if gnome-config --libs gal > /dev/null 2>&1; then vers=`gnome-config --modversion gal | sed -e "s/gal-//" -e 's/cvs$//' -e 's/pre$//' | \ awk 'BEGIN { FS = "."; } { print $1 * 1000000 + $2 * 10000 + $3 * 100 + $4;}'` - if test "$vers" -ge 59907; then + if test "$vers" -ge 59908; then AC_MSG_RESULT(found) else - AC_MSG_ERROR(You need at least GNOME Application libs 0.5.99.7 for this version of Evolution) + AC_MSG_ERROR(You need at least GNOME Application libs 0.5.99.8 for this version of Evolution) fi else AC_MSG_ERROR(Did not find GnomeAppLib (GAL) installed) 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; diff --git a/shell/ChangeLog b/shell/ChangeLog index c3ae0600b6..d61acf5ba0 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,30 @@ +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 + 2001-03-19 Ettore Perazzoli <ettore@ximian.com> * evolution-shell-component-client.c: New members diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c index 5875546eba..c88c995c17 100644 --- a/shell/e-shell-view.c +++ b/shell/e-shell-view.c @@ -1774,6 +1774,13 @@ e_shell_view_save_settings (EShellView *shell_view, save_shortcut_bar_icon_modes (shell_view); gnome_config_pop_prefix (); + +#if 0 + char *expanded_state_file = g_strdup_printf ("%s/config/shell-expanded", evolution_dir); + + e_tree_save_expanded_state(E_TREE(priv->storage_set_view), expanded_state_file); + g_free(expanded_state_file); +#endif return TRUE; } diff --git a/shell/e-storage-set-view.c b/shell/e-storage-set-view.c index 6659205bc9..038e75c73a 100644 --- a/shell/e-storage-set-view.c +++ b/shell/e-storage-set-view.c @@ -35,7 +35,7 @@ #include "e-storage-set-view.h" -#include <gal/e-table/e-tree-simple.h> +#include <gal/e-table/e-tree-memory-callbacks.h> #include <gal/e-table/e-cell-tree.h> #include <gal/e-table/e-cell-text.h> @@ -49,7 +49,7 @@ static char *list [] = { * well, and there is no way for us to use the * same value as it's not exported. */ -#define ETABLE_SPEC "<ETableSpecification no-headers=\"true\" selection-mode=\"single\" cursor-mode=\"line\" draw-grid=\"true\" horizontal-scrolling=\"true\"> \ +#define ETREE_SPEC "<ETableSpecification no-headers=\"true\" selection-mode=\"single\" cursor-mode=\"line\" draw-grid=\"falsex\" horizontal-scrolling=\"true\"> \ <ETableColumn model_col=\"0\" _title=\"Folder\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"render_tree\" compare=\"string\"/> \ <ETableState> \ <column source=\"0\"/> \ @@ -58,14 +58,14 @@ static char *list [] = { </ETableSpecification>" -#define PARENT_TYPE E_TABLE_TYPE -static ETableClass *parent_class = NULL; +#define PARENT_TYPE E_TREE_TYPE +static ETreeClass *parent_class = NULL; struct _EStorageSetViewPrivate { EStorageSet *storage_set; ETreeModel *etree_model; - ETreePath *root_node; + ETreePath root_node; GHashTable *path_to_etree_node; @@ -91,6 +91,7 @@ struct _EStorageSetViewPrivate { well as the corresponding row/column numbers in the table. */ int drag_x, drag_y; int drag_column, drag_row; + ETreePath drag_path; }; @@ -135,7 +136,7 @@ static GtkTargetList *target_list; static gboolean add_node_to_hash (EStorageSetView *storage_set_view, const char *path, - ETreePath *node) + ETreePath node) { EStorageSetViewPrivate *priv; char *hash_path; @@ -156,12 +157,12 @@ add_node_to_hash (EStorageSetView *storage_set_view, return TRUE; } -static ETreePath * +static ETreePath lookup_node_in_hash (EStorageSetView *storage_set_view, const char *path) { EStorageSetViewPrivate *priv; - ETreePath *node; + ETreePath node; priv = storage_set_view->priv; @@ -172,12 +173,12 @@ lookup_node_in_hash (EStorageSetView *storage_set_view, return node; } -static ETreePath * +static ETreePath remove_node_from_hash (EStorageSetView *storage_set_view, const char *path) { EStorageSetViewPrivate *priv; - ETreePath *node; + ETreePath node; priv = storage_set_view->priv; @@ -247,21 +248,19 @@ get_pixbuf_for_folder (EStorageSetView *storage_set_view, } static EFolder * -get_folder_at_row (EStorageSetView *storage_set_view, - int row) +get_folder_at_node (EStorageSetView *storage_set_view, + ETreePath path) { EStorageSetViewPrivate *priv; - ETreePath *folder_node_path; const char *folder_path; EFolder *folder; priv = storage_set_view->priv; - folder_node_path = e_tree_model_node_at_row (priv->etree_model, row); - if (folder_node_path == NULL) + if (path == NULL) return NULL; - folder_path = e_tree_model_node_get_data (priv->etree_model, folder_node_path); + folder_path = e_tree_memory_node_get_data (E_TREE_MEMORY(priv->etree_model), path); g_assert (folder_path != NULL); folder = e_storage_set_get_folder (priv->storage_set, folder_path); @@ -374,8 +373,8 @@ free_target_entries (GtkTargetEntry *entries) } static GtkTargetList * -create_target_list_for_row (EStorageSetView *storage_set_view, - int row) +create_target_list_for_node (EStorageSetView *storage_set_view, + ETreePath node) { EStorageSetViewPrivate *priv; GtkTargetList *target_list; @@ -390,7 +389,7 @@ create_target_list_for_row (EStorageSetView *storage_set_view, folder_type_registry = e_storage_set_get_folder_type_registry (priv->storage_set); - folder = get_folder_at_row (storage_set_view, row); + folder = get_folder_at_node (storage_set_view, node); folder_type = e_folder_get_type_string (folder); exported_dnd_types = e_folder_type_registry_get_exported_dnd_types_for_type (folder_type_registry, @@ -573,7 +572,7 @@ destroy (GtkObject *object) priv = storage_set_view->priv; /* need to destroy our tree */ - e_tree_model_node_remove (priv->etree_model, priv->root_node); + e_tree_memory_node_remove (E_TREE_MEMORY(priv->etree_model), priv->root_node); gtk_object_unref (GTK_OBJECT (priv->etree_model)); /* now free up all the paths stored in the hash table and @@ -625,13 +624,13 @@ button_press_event (GtkWidget *widget, { EStorageSetView *storage_set_view; EStorageSetViewPrivate *priv; - ETable *table; + ETree *tree; int row, column; storage_set_view = E_STORAGE_SET_VIEW (widget); priv = storage_set_view->priv; - table = E_TABLE (widget); + tree = E_TREE (widget); /* FIXME correct? */ if (GTK_WIDGET_CLASS (parent_class)->button_press_event != NULL) @@ -640,11 +639,12 @@ button_press_event (GtkWidget *widget, if (event->button != 1) return FALSE; - e_table_get_cell_at (table, event->x, event->y, &row, &column); + e_tree_get_cell_at (tree, event->x, event->y, &row, &column); priv->drag_x = event->x; priv->drag_y = event->y; priv->drag_column = column; + priv->drag_path = e_tree_node_at_row(E_TREE(storage_set_view), row); priv->drag_row = row; /* FIXME correct? */ @@ -657,7 +657,7 @@ motion_notify_event (GtkWidget *widget, { EStorageSetView *storage_set_view; EStorageSetViewPrivate *priv; - ETable *table; + ETree *tree; GtkTargetList *target_list; GdkDragAction actions; GdkDragContext *context; @@ -667,7 +667,7 @@ motion_notify_event (GtkWidget *widget, storage_set_view = E_STORAGE_SET_VIEW (widget); priv = storage_set_view->priv; - table = E_TABLE (widget); + tree = E_TREE (widget); /* FIXME correct? */ if (GTK_WIDGET_CLASS (parent_class)->motion_notify_event != NULL) @@ -681,13 +681,13 @@ motion_notify_event (GtkWidget *widget, && ABS (priv->drag_y - event->y) < DRAG_RESISTANCE) return FALSE; - target_list = create_target_list_for_row (storage_set_view, priv->drag_row); + target_list = create_target_list_for_node (storage_set_view, priv->drag_path); if (target_list == NULL) return FALSE; actions = GDK_ACTION_MOVE | GDK_ACTION_COPY; - context = e_table_drag_begin (table, + context = e_tree_drag_begin (tree, priv->drag_row, priv->drag_column, target_list, actions, 1, (GdkEvent *) event); @@ -697,18 +697,17 @@ motion_notify_event (GtkWidget *widget, } -/* ETable methods. */ +/* ETree methods. */ /* -- Source-side DnD. */ static void -table_drag_begin (ETable *etable, - int row, int col, - GdkDragContext *context) +tree_drag_begin (ETree *etree, + int row, ETreePath path, int col, + GdkDragContext *context) { EStorageSetView *storage_set_view; EStorageSetViewPrivate *priv; - ETreePath *node; EFolder *folder; EFolderTypeRegistry *folder_type_registry; EvolutionShellComponentClient *component_client; @@ -717,16 +716,14 @@ table_drag_begin (ETable *etable, GNOME_Evolution_ShellComponentDnd_Action suggested_action; CORBA_Environment ev; - storage_set_view = E_STORAGE_SET_VIEW (etable); + storage_set_view = E_STORAGE_SET_VIEW (etree); priv = storage_set_view->priv; - node = e_tree_model_node_at_row (priv->etree_model, row); - - priv->selected_row_path = e_tree_model_node_get_data (priv->etree_model, node); + priv->selected_row_path = e_tree_memory_node_get_data (E_TREE_MEMORY(priv->etree_model), path); g_assert (priv->drag_corba_source_interface == CORBA_OBJECT_NIL); - folder = get_folder_at_row (storage_set_view, row); + folder = get_folder_at_node (storage_set_view, path); folder_type_registry = e_storage_set_get_folder_type_registry (priv->storage_set); component_client = e_folder_type_registry_get_handler_for_type (folder_type_registry, e_folder_get_type_string (folder)); @@ -783,16 +780,17 @@ table_drag_begin (ETable *etable, } static void -table_drag_end (ETable *table, - int row, - int col, - GdkDragContext *context) +tree_drag_end (ETree *tree, + int row, + ETreePath path, + int col, + GdkDragContext *context) { EStorageSetView *storage_set_view; EStorageSetViewPrivate *priv; CORBA_Environment ev; - storage_set_view = E_STORAGE_SET_VIEW (table); + storage_set_view = E_STORAGE_SET_VIEW (tree); priv = storage_set_view->priv; if (priv->drag_corba_source_interface == CORBA_OBJECT_NIL) @@ -814,19 +812,20 @@ table_drag_end (ETable *table, } static void -table_drag_data_get (ETable *etable, - int drag_row, - int drag_col, - GdkDragContext *context, - GtkSelectionData *selection_data, - unsigned int info, - guint32 time) +tree_drag_data_get (ETree *etree, + int drag_row, + ETreePath drag_path, + int drag_col, + GdkDragContext *context, + GtkSelectionData *selection_data, + unsigned int info, + guint32 time) { EStorageSetView *storage_set_view; EStorageSetViewPrivate *priv; CORBA_Environment ev; - storage_set_view = E_STORAGE_SET_VIEW (etable); + storage_set_view = E_STORAGE_SET_VIEW (etree); priv = storage_set_view->priv; if (info == 0) { @@ -861,16 +860,17 @@ table_drag_data_get (ETable *etable, } static void -table_drag_data_delete (ETable *table, - int row, - int col, - GdkDragContext *context) +tree_drag_data_delete (ETree *tree, + int row, + ETreePath path, + int col, + GdkDragContext *context) { EStorageSetView *storage_set_view; EStorageSetViewPrivate *priv; CORBA_Environment ev; - storage_set_view = E_STORAGE_SET_VIEW (table); + storage_set_view = E_STORAGE_SET_VIEW (tree); priv = storage_set_view->priv; if (priv->drag_corba_source_interface == CORBA_OBJECT_NIL) @@ -888,18 +888,19 @@ table_drag_data_delete (ETable *table, /* -- Destination-side DnD. */ static gboolean -table_drag_motion (ETable *table, - int row, - int col, - GdkDragContext *context, - int x, - int y, - unsigned int time) +tree_drag_motion (ETree *tree, + int row, + ETreePath path, + int col, + GdkDragContext *context, + int x, + int y, + unsigned int time) { EStorageSetView *storage_set_view; EStorageSetViewPrivate *priv; - storage_set_view = E_STORAGE_SET_VIEW (table); + storage_set_view = E_STORAGE_SET_VIEW (tree); priv = storage_set_view->priv; gdk_drag_status (context, GDK_ACTION_MOVE, time); @@ -908,16 +909,17 @@ table_drag_motion (ETable *table, } static gboolean -table_drag_drop (ETable *etable, - int row, - int col, - GdkDragContext *context, - int x, - int y, - unsigned int time) +tree_drag_drop (ETree *etree, + int row, + ETreePath path, + int col, + GdkDragContext *context, + int x, + int y, + unsigned int time) { if (context->targets != NULL) { - gtk_drag_get_data (GTK_WIDGET (etable), context, + gtk_drag_get_data (GTK_WIDGET (etree), context, GPOINTER_TO_INT (context->targets->data), time); return TRUE; @@ -927,38 +929,38 @@ table_drag_drop (ETable *etable, } static void -table_drag_data_received (ETable *etable, - int row, - int col, - GdkDragContext *context, - int x, - int y, - GtkSelectionData *selection_data, - unsigned int info, - unsigned int time) +tree_drag_data_received (ETree *etree, + int row, + ETreePath path, + int col, + GdkDragContext *context, + int x, + int y, + GtkSelectionData *selection_data, + unsigned int info, + unsigned int time) { EStorageSetView *storage_set_view; EStorageSetViewPrivate *priv; - ETreePath *target_tree_path; const char *target_path; - storage_set_view = E_STORAGE_SET_VIEW (etable); + storage_set_view = E_STORAGE_SET_VIEW (etree); priv = storage_set_view->priv; - target_tree_path = e_tree_model_node_at_row (priv->etree_model, row); - target_path = e_tree_model_node_get_data (priv->etree_model, target_tree_path); + target_path = e_tree_memory_node_get_data (E_TREE_MEMORY(priv->etree_model), path); } static gboolean -right_click (ETable *etable, +right_click (ETree *etree, int row, + ETreePath path, int col, GdkEvent *event) { EStorageSetView *storage_set_view; EStorageSetViewPrivate *priv; - storage_set_view = E_STORAGE_SET_VIEW (etable); + storage_set_view = E_STORAGE_SET_VIEW (etree); priv = storage_set_view->priv; popup_folder_menu (storage_set_view, (GdkEventButton *) event); @@ -967,22 +969,20 @@ right_click (ETable *etable, } static void -cursor_activated (ETable *table, - int row) +cursor_activated (ETree *tree, + int row, + ETreePath path) { EStorageSetView *storage_set_view; - ETreePath *node; EStorageSetViewPrivate *priv; - storage_set_view = E_STORAGE_SET_VIEW (table); + storage_set_view = E_STORAGE_SET_VIEW (tree); priv = storage_set_view->priv; - node = e_tree_model_node_at_row (priv->etree_model, row); + priv->selected_row_path = e_tree_memory_node_get_data (E_TREE_MEMORY(priv->etree_model), path); - priv->selected_row_path = e_tree_model_node_get_data (priv->etree_model, node); - - if (e_tree_model_node_depth (priv->etree_model, node) >= 2) { + if (e_tree_model_node_depth (priv->etree_model, path) >= 2) { /* it was a folder */ gtk_signal_emit (GTK_OBJECT (storage_set_view), signals[FOLDER_SELECTED], priv->selected_row_path); @@ -994,94 +994,76 @@ cursor_activated (ETable *table, } -/* ETableModel Methods */ +/* ETreeModel Methods */ -/* This function returns the number of columns in our ETableModel. */ -static int -etree_col_count (ETableModel *etc, void *data) +static GdkPixbuf* +etree_icon_at (ETreeModel *etree, + ETreePath tree_path, + void *model_data) { - return 2; -} + EStorageSetView *storage_set_view; + EStorageSet *storage_set; + EFolder *folder; + char *path; -/* This function duplicates the value passed to it. */ -static void * -etree_duplicate_value (ETableModel *etc, int col, const void *value, void *data) -{ - if (col == 0) - return g_strdup (value); - else - return (void *)value; -} + /* folders are from depth 2 on. depth 1 are storages and 0 is + our (invisible) root node. */ + if (e_tree_model_node_depth (etree, tree_path) < 2) + return NULL; -/* This function frees the value passed to it. */ -static void -etree_free_value (ETableModel *etc, int col, void *value, void *data) -{ - if (col == 0) - g_free (value); -} + storage_set_view = E_STORAGE_SET_VIEW (model_data); + storage_set = storage_set_view->priv->storage_set; -/* This function creates an empty value. */ -static void * -etree_initialize_value (ETableModel *etc, int col, void *data) -{ - if (col == 0) - return g_strdup (""); - else + path = (char*)e_tree_memory_node_get_data (E_TREE_MEMORY(etree), tree_path); + + folder = e_storage_set_get_folder (storage_set, path); + if (folder == NULL) return NULL; + + return get_pixbuf_for_folder (storage_set_view, folder); } -/* This function reports if a value is empty. */ -static gboolean -etree_value_is_empty (ETableModel *etc, int col, const void *value, void *data) +/* This function returns the number of columns in our ETreeModel. */ +static int +etree_column_count (ETreeModel *etc, void *data) { - if (col == 0) - return !(value && *(char *)value); - else - return !value; + return 2; } -/* This function reports if a value is empty. */ -static char * -etree_value_to_string (ETableModel *etc, int col, const void *value, void *data) +static gboolean +etree_has_save_id (ETreeModel *etm, void *data) { - if (col == 0) - return g_strdup(value); - else - return g_strdup(value ? "Yes" : "No"); + return TRUE; } -/* ETreeModel Methods */ - -static GdkPixbuf* -etree_icon_at (ETreeModel *etree, - ETreePath *tree_path, - void *model_data) +static gchar * +etree_get_save_id (ETreeModel *etm, ETreePath node, void *model_data) { EStorageSetView *storage_set_view; EStorageSet *storage_set; + EStorage *storage; EFolder *folder; char *path; - /* folders are from depth 2 on. depth 1 are storages and 0 is - our (invisible) root node. */ - if (e_tree_model_node_depth (etree, tree_path) < 2) - return NULL; - storage_set_view = E_STORAGE_SET_VIEW (model_data); storage_set = storage_set_view->priv->storage_set; - path = (char*)e_tree_model_node_get_data (etree, tree_path); + path = (char *) e_tree_memory_node_get_data (E_TREE_MEMORY(etm), node); folder = e_storage_set_get_folder (storage_set, path); - if (folder == NULL) - return NULL; + if (folder != NULL) { + return g_strdup (e_folder_get_name (folder)); + } - return get_pixbuf_for_folder (storage_set_view, folder); + storage = e_storage_set_get_storage (storage_set, path + 1); + if (storage != NULL) + return g_strdup (e_storage_get_name (storage)); + + return g_strdup("root"); } -static void* -etree_value_at (ETreeModel *etree, ETreePath *tree_path, int col, void *model_data) +static void * +etree_value_at (ETreeModel *etree, ETreePath tree_path, int col, void *model_data) { EStorageSetView *storage_set_view; EStorageSet *storage_set; @@ -1092,7 +1074,7 @@ etree_value_at (ETreeModel *etree, ETreePath *tree_path, int col, void *model_da storage_set_view = E_STORAGE_SET_VIEW (model_data); storage_set = storage_set_view->priv->storage_set; - path = (char *) e_tree_model_node_get_data (etree, tree_path); + path = (char *) e_tree_memory_node_get_data (E_TREE_MEMORY(etree), tree_path); folder = e_storage_set_get_folder (storage_set, path); if (folder != NULL) { @@ -1110,32 +1092,69 @@ etree_value_at (ETreeModel *etree, ETreePath *tree_path, int col, void *model_da } static void -etree_set_value_at (ETreeModel *etree, ETreePath *path, int col, const void *val, void *model_data) +etree_set_value_at (ETreeModel *etree, ETreePath path, int col, const void *val, void *model_data) { /* nada */ } static gboolean -etree_is_editable (ETreeModel *etree, ETreePath *path, int col, void *model_data) +etree_is_editable (ETreeModel *etree, ETreePath path, int col, void *model_data) { return FALSE; } - -/* StorageSet signal handling. */ -static int -treepath_compare (ETreeModel *model, - ETreePath *node1, - ETreePath *node2) +/* This function duplicates the value passed to it. */ +static void * +etree_duplicate_value (ETreeModel *etc, int col, const void *value, void *data) +{ + if (col == 0) + return g_strdup (value); + else + return (void *)value; +} + +/* This function frees the value passed to it. */ +static void +etree_free_value (ETreeModel *etc, int col, void *value, void *data) +{ + if (col == 0) + g_free (value); +} + +/* This function creates an empty value. */ +static void * +etree_initialize_value (ETreeModel *etc, int col, void *data) { - char *path1, *path2; - path1 = e_tree_model_node_get_data (model, node1); - path2 = e_tree_model_node_get_data (model, node2); + if (col == 0) + return g_strdup (""); + else + return NULL; +} - return strcasecmp (path1, path2); +/* This function reports if a value is empty. */ +static gboolean +etree_value_is_empty (ETreeModel *etc, int col, const void *value, void *data) +{ + if (col == 0) + return !(value && *(char *)value); + else + return !value; +} + +/* This function reports if a value is empty. */ +static char * +etree_value_to_string (ETreeModel *etc, int col, const void *value, void *data) +{ + if (col == 0) + return g_strdup(value); + else + return g_strdup(value ? "Yes" : "No"); } + +/* StorageSet signal handling. */ + static void new_storage_cb (EStorageSet *storage_set, EStorage *storage, @@ -1143,7 +1162,7 @@ new_storage_cb (EStorageSet *storage_set, { EStorageSetView *storage_set_view; EStorageSetViewPrivate *priv; - ETreePath *node; + ETreePath node; char *path; storage_set_view = E_STORAGE_SET_VIEW (data); @@ -1151,21 +1170,17 @@ new_storage_cb (EStorageSet *storage_set, path = g_strconcat (G_DIR_SEPARATOR_S, e_storage_get_name (storage), NULL); - node = e_tree_model_node_insert_id (priv->etree_model, - priv->root_node, - -1, path, path); + node = e_tree_memory_node_insert_id (E_TREE_MEMORY(priv->etree_model), + priv->root_node, + -1, path, path); - e_tree_model_node_set_expanded (priv->etree_model, node, TRUE); + e_tree_node_set_expanded (E_TREE(storage_set), node, TRUE); if (! add_node_to_hash (storage_set_view, path, node)) { g_free (path); - e_tree_model_node_remove (priv->etree_model, node); + e_tree_memory_node_remove (E_TREE_MEMORY(priv->etree_model), node); return; } - - /* FIXME: We want a more specialized sort, e.g. the local folders should always be - on top. */ - e_tree_model_node_set_compare_function (priv->etree_model, priv->root_node, treepath_compare); } static void @@ -1176,7 +1191,7 @@ removed_storage_cb (EStorageSet *storage_set, EStorageSetView *storage_set_view; EStorageSetViewPrivate *priv; ETreeModel *etree; - ETreePath *node; + ETreePath node; char *path; char *node_data; @@ -1188,7 +1203,7 @@ removed_storage_cb (EStorageSet *storage_set, node = remove_node_from_hash (storage_set_view, path); g_free (path); - node_data = e_tree_model_node_remove (etree, node); + node_data = e_tree_memory_node_remove (E_TREE_MEMORY(etree), node); g_free (node_data); } @@ -1200,8 +1215,8 @@ new_folder_cb (EStorageSet *storage_set, EStorageSetView *storage_set_view; EStorageSetViewPrivate *priv; ETreeModel *etree; - ETreePath *parent_node; - ETreePath *new_node; + ETreePath parent_node; + ETreePath new_node; const char *last_separator; char *parent_path; char *copy_of_path; @@ -1226,15 +1241,12 @@ new_folder_cb (EStorageSet *storage_set, g_free (parent_path); copy_of_path = g_strdup (path); - new_node = e_tree_model_node_insert_id (etree, parent_node, -1, copy_of_path, copy_of_path); - e_tree_model_node_set_compare_function (priv->etree_model, new_node, treepath_compare); + new_node = e_tree_memory_node_insert_id (E_TREE_MEMORY(etree), parent_node, -1, copy_of_path, copy_of_path); if (! add_node_to_hash (storage_set_view, path, new_node)) { - e_tree_model_node_remove (etree, new_node); + e_tree_memory_node_remove (E_TREE_MEMORY(etree), new_node); return; } - - e_tree_model_node_sort (priv->etree_model, parent_node); } static void @@ -1245,14 +1257,14 @@ updated_folder_cb (EStorageSet *storage_set, EStorageSetView *storage_set_view; EStorageSetViewPrivate *priv; ETreeModel *etree; - ETreePath *node; + ETreePath node; storage_set_view = E_STORAGE_SET_VIEW (data); priv = storage_set_view->priv; etree = priv->etree_model; node = lookup_node_in_hash (storage_set_view, path); - e_tree_model_node_changed (etree, node); + e_tree_model_node_data_changed (etree, node); } static void @@ -1263,7 +1275,7 @@ removed_folder_cb (EStorageSet *storage_set, EStorageSetView *storage_set_view; EStorageSetViewPrivate *priv; ETreeModel *etree; - ETreePath *node; + ETreePath node; char *node_data; storage_set_view = E_STORAGE_SET_VIEW (data); @@ -1271,7 +1283,7 @@ removed_folder_cb (EStorageSet *storage_set, etree = priv->etree_model; node = remove_node_from_hash (storage_set_view, path); - node_data = e_tree_model_node_remove (etree, node); + node_data = e_tree_memory_node_remove (E_TREE_MEMORY(etree), node); g_free (node_data); } @@ -1280,10 +1292,10 @@ static void class_init (EStorageSetViewClass *klass) { GtkObjectClass *object_class; + ETreeClass *etree_class; GtkWidgetClass *widget_class; - ETableClass *etable_class; - parent_class = gtk_type_class (e_table_get_type ()); + parent_class = gtk_type_class (e_tree_get_type ()); object_class = GTK_OBJECT_CLASS (klass); object_class->destroy = destroy; @@ -1292,16 +1304,16 @@ class_init (EStorageSetViewClass *klass) widget_class->button_press_event = button_press_event; widget_class->motion_notify_event = motion_notify_event; - etable_class = E_TABLE_CLASS (klass); - etable_class->right_click = right_click; - etable_class->cursor_activated = cursor_activated; - etable_class->table_drag_begin = table_drag_begin; - etable_class->table_drag_end = table_drag_end; - etable_class->table_drag_data_get = table_drag_data_get; - etable_class->table_drag_data_delete = table_drag_data_delete; - etable_class->table_drag_motion = table_drag_motion; - etable_class->table_drag_drop = table_drag_drop; - etable_class->table_drag_data_received = table_drag_data_received; + etree_class = E_TREE_CLASS (klass); + etree_class->right_click = right_click; + etree_class->cursor_activated = cursor_activated; + etree_class->tree_drag_begin = tree_drag_begin; + etree_class->tree_drag_end = tree_drag_end; + etree_class->tree_drag_data_get = tree_drag_data_get; + etree_class->tree_drag_data_delete = tree_drag_data_delete; + etree_class->tree_drag_motion = tree_drag_motion; + etree_class->tree_drag_drop = tree_drag_drop; + etree_class->tree_drag_data_received = tree_drag_data_received; signals[FOLDER_SELECTED] = gtk_signal_new ("folder_selected", @@ -1394,7 +1406,7 @@ folder_changed_cb (EFolder *folder, EStorageSetView *storage_set_view; EStorageSetViewPrivate *priv; FolderChangedCallbackData *callback_data; - ETreePath *node; + ETreePath node; callback_data = (FolderChangedCallbackData *) data; @@ -1407,19 +1419,19 @@ folder_changed_cb (EFolder *folder, return; } - e_tree_model_node_changed (priv->etree_model, node); + e_tree_model_node_data_changed (priv->etree_model, node); } static void insert_folders (EStorageSetView *storage_set_view, - ETreePath *parent, + ETreePath parent, EStorage *storage, const char *path) { EStorageSetViewPrivate *priv; ETreeModel *etree; - ETreePath *node; + ETreePath node; GList *folder_path_list; GList *p; const char *storage_name; @@ -1445,9 +1457,8 @@ insert_folders (EStorageSetView *storage_set_view, folder_name = e_folder_get_name (folder); full_path = g_strconcat ("/", storage_name, folder_path, NULL); - node = e_tree_model_node_insert_id (etree, parent, -1, (void *) full_path, full_path); + node = e_tree_memory_node_insert_id (E_TREE_MEMORY(etree), parent, -1, (void *) full_path, full_path); add_node_to_hash (storage_set_view, full_path, node); - e_tree_model_node_set_compare_function (priv->etree_model, node, treepath_compare); insert_folders (storage_set_view, node, storage, folder_path); @@ -1485,15 +1496,14 @@ insert_storages (EStorageSetView *storage_set_view) EStorage *storage = E_STORAGE (p->data); const char *name; char *path; - ETreePath *parent; + ETreePath parent; name = e_storage_get_name (storage); path = g_strconcat ("/", name, NULL); - parent = e_tree_model_node_insert_id (priv->etree_model, priv->root_node, + parent = e_tree_memory_node_insert_id (E_TREE_MEMORY(priv->etree_model), priv->root_node, -1, path, path); - e_tree_model_node_set_expanded (priv->etree_model, parent, TRUE); - e_tree_model_node_set_compare_function (priv->etree_model, parent, treepath_compare); + e_tree_node_set_expanded (E_TREE(storage_set_view), parent, TRUE); g_hash_table_insert (priv->path_to_etree_node, path, parent); @@ -1519,20 +1529,25 @@ e_storage_set_view_construct (EStorageSetView *storage_set_view, priv = storage_set_view->priv; - priv->etree_model = e_tree_simple_new (etree_col_count, - etree_duplicate_value, - etree_free_value, - etree_initialize_value, - etree_value_is_empty, - etree_value_to_string, - etree_icon_at, - etree_value_at, - etree_set_value_at, - etree_is_editable, - storage_set_view); - e_tree_model_root_node_set_visible (priv->etree_model, FALSE); - - priv->root_node = e_tree_model_node_insert (priv->etree_model, NULL, -1, "/Root Node"); + priv->etree_model = e_tree_memory_callbacks_new (etree_icon_at, + + etree_column_count, + + etree_has_save_id, + etree_get_save_id, + etree_value_at, + etree_set_value_at, + etree_is_editable, + + etree_duplicate_value, + etree_free_value, + etree_initialize_value, + etree_value_is_empty, + etree_value_to_string, + + storage_set_view); + + priv->root_node = e_tree_memory_node_insert (E_TREE_MEMORY(priv->etree_model), NULL, -1, "/Root Node"); extras = e_table_extras_new (); cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT); @@ -1540,16 +1555,19 @@ e_storage_set_view_construct (EStorageSetView *storage_set_view, e_table_extras_add_cell (extras, "render_tree", e_cell_tree_new (NULL, NULL, TRUE, cell)); - e_table_construct (E_TABLE (storage_set_view), E_TABLE_MODEL(priv->etree_model), extras, - ETABLE_SPEC, NULL); + e_tree_construct (E_TREE (storage_set_view), priv->etree_model, extras, + ETREE_SPEC, NULL); + + e_tree_root_node_set_visible (E_TREE(storage_set_view), FALSE); + gtk_object_unref (GTK_OBJECT (extras)); #if 0 - e_table_drag_source_set (E_TABLE (storage_set_view), GDK_BUTTON1_MASK, + e_tree_drag_source_set (E_TREE (storage_set_view), GDK_BUTTON1_MASK, source_drag_types, num_source_drag_types, GDK_ACTION_MOVE | GDK_ACTION_COPY); - e_table_drag_dest_set (E_TABLE (storage_set_view), GTK_DEST_DEFAULT_ALL, + e_tree_drag_dest_set (E_TREE (storage_set_view), GTK_DEST_DEFAULT_ALL, source_drag_types, num_source_drag_types, GDK_ACTION_MOVE | GDK_ACTION_COPY); #endif @@ -1596,7 +1614,7 @@ e_storage_set_view_set_current_folder (EStorageSetView *storage_set_view, const char *path) { EStorageSetViewPrivate *priv; - ETreePath *node; + ETreePath node; g_return_if_fail (storage_set_view != NULL); g_return_if_fail (E_IS_STORAGE_SET_VIEW (storage_set_view)); @@ -1609,9 +1627,8 @@ e_storage_set_view_set_current_folder (EStorageSetView *storage_set_view, return; } - e_tree_model_show_node (priv->etree_model, node); - e_table_set_cursor_row (E_TABLE (storage_set_view), - e_tree_model_row_of_node (priv->etree_model, node)); + e_tree_show_node (E_TREE(storage_set_view), node); + e_tree_set_cursor (E_TREE (storage_set_view), node); gtk_signal_emit (GTK_OBJECT (storage_set_view), signals[FOLDER_SELECTED], path); } @@ -1620,9 +1637,8 @@ const char * e_storage_set_view_get_current_folder (EStorageSetView *storage_set_view) { EStorageSetViewPrivate *priv; - ETreePath *etree_node; + ETreePath etree_node; const char *path; - int row; g_return_val_if_fail (storage_set_view != NULL, NULL); g_return_val_if_fail (E_IS_STORAGE_SET_VIEW (storage_set_view), NULL); @@ -1632,13 +1648,12 @@ e_storage_set_view_get_current_folder (EStorageSetView *storage_set_view) if (!priv->show_folders) return NULL; /* Mmh! */ - row = e_table_get_cursor_row (E_TABLE (storage_set_view)); - etree_node = e_tree_model_node_at_row (priv->etree_model, row); + etree_node = e_tree_get_cursor (E_TREE (storage_set_view)); if (etree_node == NULL) return NULL; /* Mmh? */ - path = (char*)e_tree_model_node_get_data(priv->etree_model, etree_node); + path = (char*)e_tree_memory_node_get_data(E_TREE_MEMORY(priv->etree_model), etree_node); return path; } @@ -1658,11 +1673,11 @@ e_storage_set_view_set_show_folders (EStorageSetView *storage_set_view, return; /* tear down existing tree and hash table mappings */ - e_tree_model_node_remove (priv->etree_model, priv->root_node); + e_tree_memory_node_remove (E_TREE_MEMORY(priv->etree_model), priv->root_node); g_hash_table_foreach (priv->path_to_etree_node, path_free_func, NULL); /* now re-add the root node */ - priv->root_node = e_tree_model_node_insert (priv->etree_model, NULL, -1, "/Root Node"); + priv->root_node = e_tree_memory_node_insert (E_TREE_MEMORY(priv->etree_model), NULL, -1, "/Root Node"); /* then reinsert the storages after setting the "show_folders" flag. insert_storages will call insert_folders if diff --git a/shell/e-storage-set-view.h b/shell/e-storage-set-view.h index 88d6f52862..361af21721 100644 --- a/shell/e-storage-set-view.h +++ b/shell/e-storage-set-view.h @@ -24,7 +24,7 @@ #ifndef __E_STORAGE_SET_VIEW_H__ #define __E_STORAGE_SET_VIEW_H__ -#include <gal/e-table/e-table.h> +#include <gal/e-table/e-tree.h> #include "e-storage-set.h" #ifdef __cplusplus @@ -44,13 +44,13 @@ typedef struct _EStorageSetViewPrivate EStorageSetViewPrivate; typedef struct _EStorageSetViewClass EStorageSetViewClass; struct _EStorageSetView { - ETable parent; + ETree parent; EStorageSetViewPrivate *priv; }; struct _EStorageSetViewClass { - ETableClass parent_class; + ETreeClass parent_class; /* Signals. */ |