Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion src/VirtualizingListBox/VirtualizingListBox.vala
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class VirtualizingListBox : Gtk.Container, Gtk.Scrollable {
public RowFactoryMethod factory_func;

public signal void row_activated (GLib.Object row);
public signal void row_selected (GLib.Object row);
public signal void row_selected (GLib.Object? row);
public signal void selected_rows_changed ();

private Mail.ConversationListStore? _model;
Expand Down Expand Up @@ -723,6 +723,8 @@ public class VirtualizingListBox : Gtk.Container, Gtk.Scrollable {

if (row != null) {
select_and_activate (row);
} else if (unselect_all_internal ()) {
row_selected (selected_row);
}
}

Expand Down Expand Up @@ -754,6 +756,11 @@ public class VirtualizingListBox : Gtk.Container, Gtk.Scrollable {
return null;
}

// A filtered item never gets a row widget, so we cannot scroll to it.
if (model.get_object (index) == null) {
return null;
}

if (index == 0) {
set_value (0.0);
ensure_visible_widgets ();
Expand All @@ -775,12 +782,22 @@ public class VirtualizingListBox : Gtk.Container, Gtk.Scrollable {
}

while (index <= shown_from) {
var previous_value = vadjustment.value;
vadjustment.value--;
if (vadjustment.value == previous_value) {
break;
}

ensure_visible_widgets ();
}

while (index + 1 >= shown_to) {
var previous_value = vadjustment.value;
vadjustment.value++;
if (vadjustment.value == previous_value) {
break;
}

ensure_visible_widgets ();
}

Expand Down