diff options
author | Dan Winship <danw@src.gnome.org> | 2000-07-01 01:46:48 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2000-07-01 01:46:48 +0800 |
commit | 263cc3a01f8afb748a5fb3b6689e6c4b87fc7bf5 (patch) | |
tree | d222300a1e662f926f07ebef96f33a495852dfa8 /mail | |
parent | ac6baa408e751313bdba2672d522b0ae7f38477d (diff) | |
download | gsoc2013-evolution-263cc3a01f8afb748a5fb3b6689e6c4b87fc7bf5.tar.gz gsoc2013-evolution-263cc3a01f8afb748a5fb3b6689e6c4b87fc7bf5.tar.zst gsoc2013-evolution-263cc3a01f8afb748a5fb3b6689e6c4b87fc7bf5.zip |
use the ETable row_selection signal to track how many rows are selected.
* message-list.c (on_row_selection): use the ETable row_selection
signal to track how many rows are selected. Eventually we will use
this info to disable toolbar buttons when you have too few/too
many messages selected, but the current toolbar widget doesn't
allow that.
* message-list.h, message-list.c, mail-ops.c: Change selected_row
and selected_uid fields of MessageList to cursor_row and
cursor_uid to be more correct according to the new ETable
interfaces.
svn path=/trunk/; revision=3829
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 13 | ||||
-rw-r--r-- | mail/mail-ops.c | 2 | ||||
-rw-r--r-- | mail/message-list.c | 34 | ||||
-rw-r--r-- | mail/message-list.h | 4 |
4 files changed, 41 insertions, 12 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 97a4ef54df..041c6d8c93 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,16 @@ +2000-06-30 Dan Winship <danw@helixcode.com> + + * message-list.c (on_row_selection): use the ETable row_selection + signal to track how many rows are selected. Eventually we will use + this info to disable toolbar buttons when you have too few/too + many messages selected, but the current toolbar widget doesn't + allow that. + + * message-list.h, message-list.c, mail-ops.c: Change selected_row + and selected_uid fields of MessageList to cursor_row and + cursor_uid to be more correct according to the new ETable + interfaces. + 2000-06-30 Ettore Perazzoli <ettore@helixcode.com> * component-factory.c: Eeek. Fix typo: add missing star in the diff --git a/mail/mail-ops.c b/mail/mail-ops.c index 19f2c88972..b0b6b4cb89 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -570,7 +570,7 @@ reply (FolderBrowser *fb, gboolean to_all) psd = g_new (struct post_send_data, 1); psd->folder = fb->folder; gtk_object_ref (GTK_OBJECT (psd->folder)); - psd->uid = fb->message_list->selected_uid; + psd->uid = fb->message_list->cursor_uid; psd->flags = CAMEL_MESSAGE_ANSWERED; composer = mail_generate_reply (fb->mail_display->current_message, to_all); diff --git a/mail/message-list.c b/mail/message-list.c index 8d08a91a4e..3167a3fe8c 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -52,7 +52,9 @@ static BonoboObjectClass *message_list_parent_class; static POA_Evolution_MessageList__vepv evolution_message_list_vepv; -static void on_cursor_change_cmd (ETable *table, int row, gpointer user_data); +static void on_cursor_change_cmd (ETable *table, int row, gpointer user_data); +static void on_row_selection (ETable *table, int row, gboolean selected, + gpointer user_data); static void select_row (ETable *table, gpointer user_data); static char *filter_date (const void *data); @@ -127,12 +129,12 @@ mark_msg_seen (gpointer data) MessageList *ml = data; guint32 flags; - if (!ml->selected_uid) + if (!ml->cursor_uid) return FALSE; - flags = camel_folder_get_message_flags (ml->folder, ml->selected_uid, + flags = camel_folder_get_message_flags (ml->folder, ml->cursor_uid, NULL); - camel_folder_set_message_flags (ml->folder, ml->selected_uid, + camel_folder_set_message_flags (ml->folder, ml->cursor_uid, CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN, NULL); return FALSE; @@ -764,6 +766,9 @@ message_list_init (GtkObject *object) gtk_signal_connect (GTK_OBJECT (message_list->etable), "cursor_change", GTK_SIGNAL_FUNC (on_cursor_change_cmd), message_list); + gtk_signal_connect (GTK_OBJECT (message_list->etable), "row_selection", + GTK_SIGNAL_FUNC (on_row_selection), message_list); + gtk_widget_show (message_list->etable); gtk_object_ref (GTK_OBJECT (message_list->table_model)); @@ -952,6 +957,7 @@ message_list_set_search (MessageList *message_list, const char *search) } e_table_model_changed (message_list->table_model); + message_list->rows_selected = 0; select_msg (message_list, 0); } @@ -1011,8 +1017,6 @@ message_list_set_folder (MessageList *message_list, CamelFolder *camel_folder) gtk_object_ref (GTK_OBJECT (camel_folder)); folder_changed (camel_folder, 0, message_list); - - select_msg (message_list, 0); } GtkWidget * @@ -1028,7 +1032,7 @@ on_cursor_change_idle (gpointer data) { MessageList *message_list = data; - select_msg (message_list, message_list->selected_row); + select_msg (message_list, message_list->cursor_row); message_list->idle_id = 0; return FALSE; @@ -1048,13 +1052,25 @@ on_cursor_change_cmd (ETable *table, if (!info) return; - message_list->selected_row = row; - message_list->selected_uid = info->uid; + message_list->cursor_row = row; + message_list->cursor_uid = info->uid; if (!message_list->idle_id) message_list->idle_id = g_idle_add_full (G_PRIORITY_LOW, on_cursor_change_idle, message_list, NULL); } +static void +on_row_selection (ETable *table, int row, gboolean selected, + gpointer user_data) +{ + MessageList *message_list = user_data; + + if (selected) + message_list->rows_selected++; + else + message_list->rows_selected--; +} + /* FIXME: this is all a kludge. */ diff --git a/mail/message-list.h b/mail/message-list.h index 033f0ca23a..d01021d14c 100644 --- a/mail/message-list.h +++ b/mail/message-list.h @@ -73,8 +73,8 @@ struct _MessageList { int match_count; GPtrArray *summary_search_cache; /* summary info cache for searches */ - int selected_row; - const char *selected_uid; + int cursor_row, rows_selected; + const char *cursor_uid; /* row-selection and seen-marking timers */ guint idle_id, seen_id; |