Skip to content

Commit

Permalink
Grid view
Browse files Browse the repository at this point in the history
  • Loading branch information
danirabbit committed Mar 6, 2025
1 parent 8d310c2 commit 494994d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
13 changes: 9 additions & 4 deletions data/styles/SearchPage.scss
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
navigation-view-page.search {
stack.large row {
border-radius: 0.25em;
stack.large child {
border-radius: 1em;
padding-bottom: 0.5em;
}

listview {
gridview {
border-spacing: 2em;
}

search-list-item {
border-spacing: 1em 0;
margin: 0.5em 1em;

image {
margin: 0 -4px;
}
}

picture {
background: #{'@selected_bg_color'};
border-radius: 0.5em;
margin-top: 1em;
margin-top: calc(1em - 3px);
}
}
7 changes: 4 additions & 3 deletions src/Views/SearchView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class AppCenter.SearchView : Adw.NavigationPage {
public bool mimetype { get; set; default = false; }

private AppCenterCore.SearchEngine search_engine;
private Gtk.ListView list_view;
private Gtk.GridView list_view;
private Gtk.NoSelection selection_model;
private Gtk.SearchEntry search_entry;
private Gtk.Stack stack;
Expand Down Expand Up @@ -72,10 +72,11 @@ public class AppCenter.SearchView : Adw.NavigationPage {

var factory = new Gtk.SignalListItemFactory ();

list_view = new Gtk.ListView (selection_model, factory) {
list_view = new Gtk.GridView (selection_model, factory) {
single_click_activate = true,
hexpand = true,
vexpand = true
vexpand = true,
max_columns = 2
};

stack = new Gtk.Stack () {
Expand Down
8 changes: 6 additions & 2 deletions src/Widgets/SearchListItem.vala
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ public class AppCenter.SearchListItem : Gtk.Grid {
remove (action_stack);
}

action_stack = new ActionStack (value);
action_stack = new ActionStack (value) {
halign = END
};
attach (action_stack, 2, 0, 1, 2);

load_screenshot (value);
Expand Down Expand Up @@ -52,6 +54,9 @@ public class AppCenter.SearchListItem : Gtk.Grid {
name_label.add_css_class (Granite.STYLE_CLASS_H3_LABEL);

summary_label = new Gtk.Label (null) {
ellipsize = END,
hexpand = true,
lines = 2,
valign = START,
wrap = true,
xalign = 0
Expand All @@ -61,7 +66,6 @@ public class AppCenter.SearchListItem : Gtk.Grid {

screenshot_picture = new Gtk.Picture () {
content_fit = SCALE_DOWN,
halign = START,
height_request = SCREENSHOT_HEIGHT,
vexpand = true,
visible = false
Expand Down

0 comments on commit 494994d

Please sign in to comment.