67 lines
2.5 KiB
Diff
67 lines
2.5 KiB
Diff
From c0a89a86e48667b17dcae934e5f3b15a2475abf3 Mon Sep 17 00:00:00 2001
|
|
From: Julian Sparber <julian@sparber.net>
|
|
Date: Thu, 22 Oct 2020 15:47:09 +0200
|
|
Subject: [PATCH 1/2] conversation-email-row: use is-expanded to add/remove css
|
|
class
|
|
|
|
---
|
|
.../conversation-viewer/conversation-list-box.vala | 12 +++++++++---
|
|
1 file changed, 9 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/src/client/conversation-viewer/conversation-list-box.vala b/src/client/conversation-viewer/conversation-list-box.vala
|
|
index 3eb8240b..f860a2df 100644
|
|
--- a/src/client/conversation-viewer/conversation-list-box.vala
|
|
+++ b/src/client/conversation-viewer/conversation-list-box.vala
|
|
@@ -284,6 +284,7 @@ public class ConversationListBox : Gtk.ListBox, Geary.BaseInterface {
|
|
}
|
|
protected set {
|
|
this._is_expanded = value;
|
|
+ notify_property("is-expanded");
|
|
}
|
|
}
|
|
private bool _is_expanded = false;
|
|
@@ -301,6 +302,7 @@ public class ConversationListBox : Gtk.ListBox, Geary.BaseInterface {
|
|
protected ConversationRow(Geary.Email? email) {
|
|
base_ref();
|
|
this.email = email;
|
|
+ notify["is-expanded"].connect(update_css_class);
|
|
show();
|
|
}
|
|
|
|
@@ -325,6 +327,13 @@ public class ConversationListBox : Gtk.ListBox, Geary.BaseInterface {
|
|
this.size_allocate.connect(on_size_allocate);
|
|
}
|
|
|
|
+ private void update_css_class() {
|
|
+ if (this.is_expanded)
|
|
+ get_style_context().add_class(EXPANDED_CLASS);
|
|
+ else
|
|
+ get_style_context().remove_class(EXPANDED_CLASS);
|
|
+ }
|
|
+
|
|
protected inline void set_style_context_class(string class_name, bool value) {
|
|
if (value) {
|
|
get_style_context().add_class(class_name);
|
|
@@ -392,10 +401,8 @@ public class ConversationListBox : Gtk.ListBox, Geary.BaseInterface {
|
|
|
|
private inline void update_row_expansion() {
|
|
if (this.is_expanded || this.is_pinned) {
|
|
- get_style_context().add_class(EXPANDED_CLASS);
|
|
this.view.expand_email();
|
|
} else {
|
|
- get_style_context().remove_class(EXPANDED_CLASS);
|
|
this.view.collapse_email();
|
|
}
|
|
}
|
|
@@ -436,7 +443,6 @@ public class ConversationListBox : Gtk.ListBox, Geary.BaseInterface {
|
|
base(view.referred);
|
|
this.view = view;
|
|
this.is_expanded = true;
|
|
- get_style_context().add_class(EXPANDED_CLASS);
|
|
add(this.view);
|
|
}
|
|
|
|
--
|
|
2.29.2
|
|
|