Skip to content

Commit

Permalink
Ensure search popover hidden when no results, lose unneeded code
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Wootten committed Feb 1, 2024
1 parent 3ae88c3 commit c140ca7
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions src/View/Widgets/SearchResults.vala
Original file line number Diff line number Diff line change
Expand Up @@ -614,11 +614,12 @@ namespace Files.View.Chrome {

if (items + headers <= 1) {
disconnect_view_cursor_changed_signal ();
} else {
connect_view_cursor_changed_signal ();
popdown ();
return;
}

Idle.add (() => {
connect_view_cursor_changed_signal ();
if (search_tree_view.get_realized ()) {
popup ();
Gtk.Window toplevel = (Gtk.Window)(parent.get_ancestor (typeof (Gtk.Window)));
Expand Down Expand Up @@ -789,13 +790,6 @@ namespace Files.View.Chrome {
}

protected void clear () {
/* Disconnect the cursor-changed signal so that it does not get emitted when entries removed
* causing incorrect files to get selected in icon search_tree_view */
bool was_popped_up = visible;
if (was_popped_up) {
disconnect_view_cursor_changed_signal ();
}

Gtk.TreeIter parent, iter;
for (var valid = list.get_iter_first (out parent);
valid;
Expand All @@ -807,12 +801,6 @@ namespace Files.View.Chrome {

while (list.remove (ref iter));
}

resize_popup ();
if (was_popped_up && visible) {
/* Reconnect signal only if remained popped up */
connect_view_cursor_changed_signal ();
}
}

bool send_search_finished () {
Expand Down

0 comments on commit c140ca7

Please sign in to comment.