diff options
author | Christopher James Lahey <clahey@helixcode.com> | 2000-09-09 00:52:48 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2000-09-09 00:52:48 +0800 |
commit | bbb5bf71555a351bce1ab8353ee0d961d5523d65 (patch) | |
tree | 1037edde01f5193285366538089d4a609862f519 /mail/message-list.c | |
parent | 48c3fcd45d757f8e60e7ed37ca96fd843e690d0b (diff) | |
download | gsoc2013-evolution-bbb5bf71555a351bce1ab8353ee0d961d5523d65.tar.gz gsoc2013-evolution-bbb5bf71555a351bce1ab8353ee0d961d5523d65.tar.zst gsoc2013-evolution-bbb5bf71555a351bce1ab8353ee0d961d5523d65.zip |
Fixed some warnings.
2000-09-08 Christopher James Lahey <clahey@helixcode.com>
* folder-browser.c, mail-config-gui.c, mail-ops.c: Fixed some
warnings.
* message-list.c: Added base ETableModel functions.
svn path=/trunk/; revision=5268
Diffstat (limited to 'mail/message-list.c')
-rw-r--r-- | mail/message-list.c | 159 |
1 files changed, 158 insertions, 1 deletions
diff --git a/mail/message-list.c b/mail/message-list.c index 6b4ce3de9b..65f035fe5b 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -211,6 +211,157 @@ select_msg (MessageList *message_list, gint row) } +/* + * SimpleTableModel::col_count + */ +static int +ml_col_count (ETableModel *etm, void *data) +{ + return COL_LAST; +} + +static void * +ml_duplicate_value (ETableModel *etm, int col, const void *value, void *data) +{ + switch (col){ + case COL_ONLINE_STATUS: + case COL_MESSAGE_STATUS: + case COL_PRIORITY: + case COL_ATTACHMENT: + case COL_DELETED: + case COL_UNREAD: + case COL_SENT: + case COL_RECEIVED: + return (void *) value; + + case COL_FROM: + case COL_SUBJECT: + case COL_TO: + case COL_SIZE: + return g_strdup (value); + default: + g_assert_not_reached (); + } + return NULL; +} + +static void +ml_free_value (ETableModel *etm, int col, void *value, void *data) +{ + switch (col){ + case COL_ONLINE_STATUS: + case COL_MESSAGE_STATUS: + case COL_PRIORITY: + case COL_ATTACHMENT: + case COL_DELETED: + case COL_UNREAD: + case COL_SENT: + case COL_RECEIVED: + break; + + case COL_FROM: + case COL_SUBJECT: + case COL_TO: + case COL_SIZE: + g_free (value); + break; + default: + g_assert_not_reached (); + } +} + +static void * +ml_initialize_value (ETableModel *etm, int col, void *data) +{ + switch (col){ + case COL_ONLINE_STATUS: + case COL_MESSAGE_STATUS: + case COL_PRIORITY: + case COL_ATTACHMENT: + case COL_DELETED: + case COL_UNREAD: + case COL_SENT: + case COL_RECEIVED: + return NULL; + + case COL_FROM: + case COL_SUBJECT: + case COL_TO: + case COL_SIZE: + return g_strdup(""); + default: + g_assert_not_reached (); + } + + return NULL; +} + +static gboolean +ml_value_is_empty (ETableModel *etm, int col, const void *value, void *data) +{ + switch (col){ + case COL_ONLINE_STATUS: + case COL_MESSAGE_STATUS: + case COL_PRIORITY: + case COL_ATTACHMENT: + case COL_DELETED: + case COL_UNREAD: + case COL_SENT: + case COL_RECEIVED: + return value == NULL; + + case COL_FROM: + case COL_SUBJECT: + case COL_TO: + case COL_SIZE: + return !(value && *(char *)value); + default: + g_assert_not_reached (); + return FALSE; + } +} + +static char * +ml_value_to_string (ETableModel *etm, int col, const void *value, void *data) +{ + switch (col){ + case COL_MESSAGE_STATUS: + switch ((int) value) { + case 0: + return g_strdup("Unseen"); + break; + case 1: + return g_strdup("Seen"); + break; + case 2: + return g_strdup("Answered"); + break; + default: + return g_strdup(""); + break; + } + break; + case COL_ONLINE_STATUS: + case COL_PRIORITY: + case COL_ATTACHMENT: + case COL_DELETED: + case COL_UNREAD: + return g_strdup_printf("%d", (int) value); + case COL_SENT: + case COL_RECEIVED: + return filter_date(value); + + case COL_FROM: + case COL_SUBJECT: + case COL_TO: + case COL_SIZE: + return g_strdup(value); + default: + g_assert_not_reached (); + return NULL; + } +} + static GdkPixbuf * ml_tree_icon_at (ETreeModel *etm, ETreePath *path, void *model_data) { @@ -587,7 +738,13 @@ message_list_init (GtkObject *object) char *spec; message_list->table_model = (ETableModel *) - e_tree_simple_new (ml_tree_icon_at, ml_tree_value_at, + 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); |