[geary/wip/765516-gtk-widget-conversation-viewer: 102/207] Make conversation ListBox activate and sort call lambdas full methods.
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/765516-gtk-widget-conversation-viewer: 102/207] Make conversation ListBox activate and sort call lambdas full methods.
- Date: Tue, 4 Oct 2016 00:04:59 +0000 (UTC)
commit 141099d393238417710000da26ae88634067e0d9
Author: Michael James Gratton <mike vee net>
Date: Fri Jul 8 16:28:58 2016 +1000
Make conversation ListBox activate and sort call lambdas full methods.
.../conversation-viewer/conversation-viewer.vala | 46 +++++++++-----------
1 files changed, 20 insertions(+), 26 deletions(-)
---
diff --git a/src/client/conversation-viewer/conversation-viewer.vala
b/src/client/conversation-viewer/conversation-viewer.vala
index 57a3ab7..8c21b9a 100644
--- a/src/client/conversation-viewer/conversation-viewer.vala
+++ b/src/client/conversation-viewer/conversation-viewer.vala
@@ -130,31 +130,8 @@ public class ConversationViewer : Gtk.Stack {
*/
public ConversationViewer() {
// Setup the conversation list box
- conversation_listbox.set_sort_func((row1, row2) => {
- // If not a ConversationEmail, will be an
- // embedded composer and should always be last.
- ConversationEmail? msg1 = row1.get_child() as ConversationEmail;
- if (msg1 == null) {
- return 1;
- }
- ConversationEmail? msg2 = row2.get_child() as ConversationEmail;
- if (msg2 == null) {
- return -1;
- }
- return Geary.Email.compare_sent_date_ascending(msg1.email, msg2.email);
- });
- conversation_listbox.row_activated.connect((box, row) => {
- // If not a ConversationEmail, will be an
- // embedded composer and should not be activated.
- ConversationEmail? msg = row.get_child() as ConversationEmail;
- if (!row.get_style_context().has_class("geary_last") && msg != null) {
- if (msg.is_collapsed) {
- expand_email(row);
- } else {
- collapse_email(row);
- }
- }
- });
+ conversation_listbox.set_sort_func(on_conversation_listbox_sort);
+ conversation_listbox.row_activated.connect(on_conversation_listbox_row_actvated);
conversation_listbox.realize.connect(() => {
conversation_page.get_vadjustment()
.value_changed.connect(check_mark_read);
@@ -546,7 +523,7 @@ public class ConversationViewer : Gtk.Stack {
set_visible_child(conversation_page);
}
}
-
+
private void on_select_conversation_completed(Object? source, AsyncResult result) {
select_conversation_timeout_id = 0;
try {
@@ -557,6 +534,23 @@ public class ConversationViewer : Gtk.Stack {
}
}
+ private int on_conversation_listbox_sort(Gtk.ListBoxRow row1, Gtk.ListBoxRow row2) {
+ ConversationEmail? msg1 = row1.get_child() as ConversationEmail;
+ ConversationEmail? msg2 = row2.get_child() as ConversationEmail;
+ return Geary.Email.compare_sent_date_ascending(msg1.email, msg2.email);
+ }
+
+ private void on_conversation_listbox_row_actvated(Gtk.ListBoxRow row) {
+ ConversationEmail? msg = row.get_child() as ConversationEmail;
+ if (msg != null && !row.get_style_context().has_class("geary_last")) {
+ if (msg.is_collapsed) {
+ expand_email(row);
+ } else {
+ collapse_email(row);
+ }
+ }
+ }
+
private async void highlight_search_terms() {
Geary.SearchQuery? query = (this.search_folder != null)
? search_folder.search_query
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]