Skip to content
Merged
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
12 changes: 3 additions & 9 deletions src/Views/GridView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ public class Slingshot.Widgets.Grid : Gtk.Box {
public uint columns;
}

private Gee.HashMap<uint, Gtk.Grid> grids;
private Hdy.Carousel paginator;
private Page page;

Expand Down Expand Up @@ -59,7 +58,7 @@ public class Slingshot.Widgets.Grid : Gtk.Box {
set {
// Clamp to valid values for keyboard navigation
_current_grid_key = value.clamp (1, paginator.n_pages);
var grid = grids.@get (_current_grid_key);
var grid = (Gtk.Grid) paginator.get_children ().nth_data (_current_grid_key - 1);
if (grid == null) {
return;
}
Expand Down Expand Up @@ -89,8 +88,6 @@ public class Slingshot.Widgets.Grid : Gtk.Box {
add (paginator);
add (page_switcher);

grids = new Gee.HashMap<uint, Gtk.Grid> (null, null);

can_focus = true;
focus_in_event.connect_after (() => {
refocus ();
Expand All @@ -102,11 +99,10 @@ public class Slingshot.Widgets.Grid : Gtk.Box {
}

public void populate (Backend.AppSystem app_system) {
foreach (Gtk.Grid grid in grids.values) {
grid.destroy ();
foreach (unowned var child in paginator.get_children ()) {
paginator.remove (child);
}

grids.clear ();
_current_grid_key = 0; // Avoids clamp
var grid = add_new_grid (); // Increments current_grid_key to 1

Expand Down Expand Up @@ -159,12 +155,10 @@ public class Slingshot.Widgets.Grid : Gtk.Box {

paginator.add (grid);
current_grid_key = current_grid_key + 1;
grids.set (current_grid_key, grid);

return grid;
}


private Gtk.Widget? get_widget_at (uint col, uint row) {
if (col < 1 || col > page.columns || row < 1 || row > page.rows) {
return null;
Expand Down