Commit 124273da authored by Michael Gratton's avatar Michael Gratton 🤞

Explicitly handle find bar being closed, update search terms if set.

parent 973b6a3f
......@@ -282,9 +282,10 @@ public class ConversationViewer : Gtk.Stack {
}
[GtkCallback]
private void on_find_search_started(Object obj, ParamSpec param) {
if (this.conversation_find_bar.get_search_mode()) {
if (this.current_list != null) {
private void on_find_mode_changed(Object obj, ParamSpec param) {
if (this.current_list != null) {
if (this.conversation_find_bar.get_search_mode()) {
// Find was enabled
ConversationEmail? email_view =
this.current_list.get_selection_view();
if (email_view != null) {
......@@ -294,12 +295,20 @@ public class ConversationViewer : Gtk.Stack {
this.conversation_find_entry.select_region(0, -1);
}
}
} else {
// Find was disabled
this.current_list.unmark_search_terms();
if (!(this.current_list.location is Geary.SearchFolder)) {
//this.current_list.update_collapsed_state();
} else {
this.current_list.load_search_terms.begin();
}
}
}
}
[GtkCallback]
private void on_find_search_changed(Gtk.SearchEntry entry) {
private void on_find_text_changed(Gtk.SearchEntry entry) {
this.conversation_find_next.set_sensitive(false);
this.conversation_find_prev.set_sensitive(false);
if (this.current_list != null) {
......@@ -308,16 +317,6 @@ public class ConversationViewer : Gtk.Stack {
// Have a search string
this.current_list.highlight_search_terms(terms);
// XXX scroll to first match
} else {
// Have no search string
// if (location is Geary.SearchFolder) {
// // Re-display the search results
// yield this.current_list.load_search_terms(
// (Geary.SearchFolder) location
// );
// } else {
this.current_list.unmark_search_terms();
// }
}
}
}
......
......@@ -41,7 +41,7 @@
<property name="app_paintable">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<signal name="notify::search-mode-enabled" handler="on_find_search_started" swapped="no"/>
<signal name="notify::search-mode-enabled" handler="on_find_mode_changed" swapped="no"/>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
......@@ -56,7 +56,7 @@
<property name="placeholder_text" translatable="yes">Find in conversation</property>
<signal name="next-match" handler="on_find_next" swapped="no"/>
<signal name="previous-match" handler="on_find_prev" swapped="no"/>
<signal name="search-changed" handler="on_find_search_changed" swapped="no"/>
<signal name="search-changed" handler="on_find_text_changed" swapped="no"/>
</object>
<packing>
<property name="left_attach">0</property>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment