diff options
Diffstat (limited to 'mail')
-rw-r--r-- | mail/mail-types.h | 39 | ||||
-rw-r--r-- | mail/message-list.c | 68 |
2 files changed, 104 insertions, 3 deletions
diff --git a/mail/mail-types.h b/mail/mail-types.h new file mode 100644 index 0000000000..c5b690563d --- /dev/null +++ b/mail/mail-types.h @@ -0,0 +1,39 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ + +/* + * Copyright 2000 Helix Code, Inc. (http://www.helixcode.com) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + */ + +#ifndef MAIL_TYPES_H +#define MAIL_TYPES_H 1 + +#ifdef __cplusplus +extern "C" { +#pragma } +#endif /* __cplusplus }*/ + + +typedef struct _FolderBrowser FolderBrowser; +typedef struct _MessageList MessageList; +typedef struct _MailDisplay MailDisplay; + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* MAIL_TYPES_H */ diff --git a/mail/message-list.c b/mail/message-list.c index 3870b412a7..d3be8d36f0 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -45,6 +45,14 @@ static BonoboObjectClass *message_list_parent_class; static POA_Evolution_MessageList__vepv evolution_message_list_vepv; +static void +on_row_selection_cmd (ETable *table, + int row, + gboolean selected, + gpointer user_data); + + + /* * SimpleTableModel::col_count */ @@ -440,6 +448,9 @@ message_list_init (GtkObject *object) */ message_list->etable = e_table_new (message_list->header_model, message_list->table_model, "<ETableSpecification> <columns-shown> <column> 0 </column> <column> 1 </column> <column> 2 </column> <column> 3 </column> <column> 4 </column> <column> 5 </column> <column> 6 </column> <column> 7 </column> <column> 8 </column> <column> 9 </column> </columns-shown> <grouping> <group column=\"4\" ascending=\"1\"> <leaf column=\"5\" ascending=\"1\"/> </group> </grouping> </ETableSpecification>"); + + gtk_signal_connect(GTK_OBJECT(message_list->etable), "row_selection", + GTK_SIGNAL_FUNC(on_row_selection_cmd), message_list); gtk_widget_show(message_list->etable); @@ -662,7 +673,7 @@ message_list_set_folder (MessageList *message_list, CamelFolder *camel_folder) if (msg_info_array->len > 0 ) { msg_info = g_array_index (msg_info_array, CamelMessageInfo, 0); - message = camel_folder_get_message_by_uid (camel_folder, + message = camel_folder_get_message_by_uid (message_list->folder, msg_info.uid, &ex); if (camel_exception_get_id (&ex)) { @@ -673,9 +684,9 @@ message_list_set_folder (MessageList *message_list, CamelFolder *camel_folder) } printf ("Message = %p\n", message); - if (message) + /*if (message) mail_display_set_message (message_list->parent_folder_browser->mail_display, - CAMEL_MEDIUM (message)); + CAMEL_MEDIUM (message));*/ @@ -691,3 +702,54 @@ message_list_get_widget (MessageList *message_list) } E_MAKE_TYPE (message_list, "MessageList", MessageList, message_list_class_init, message_list_init, PARENT_TYPE); + + + +static void +on_row_selection_cmd (ETable *table, + int row, + gboolean selected, + gpointer user_data) +{ + MessageList *message_list; + CamelException ex; + gboolean folder_exists; + CamelMimeMessage *message; + + message_list = MESSAGE_LIST (user_data); + camel_exception_init (&ex); + + if ( selected ) { + g_print ("Row %d selected\n", row); + /* FIXME : put that in a separate function */ + /* display the (first) message (in this case) */ + if (camel_folder_has_uid_capability (message_list->folder)) { + const GArray *msg_info_array; + CamelMessageInfo msg_info; + + msg_info_array = camel_folder_summary_get_message_info_list + (message_list->folder_summary); + + if (msg_info_array->len > 0 ) { + msg_info = g_array_index (msg_info_array, CamelMessageInfo, row); + + message = camel_folder_get_message_by_uid (message_list->folder, + msg_info.uid, + &ex); + if (camel_exception_get_id (&ex)) { + printf ("Unable to get message: %s\n", + ex.desc?ex.desc:"unknown_reason"); + return; + } + } + + printf ("Message = %p\n", message); + if (message) + mail_display_set_message (message_list->parent_folder_browser->mail_display, + CAMEL_MEDIUM (message)); + } + } else { + g_print ("Row %d unselected\n", row); + } +} + |