diff options
author | Benjamin Otte <otte@redhat.com> | 2020-07-22 01:43:40 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2020-07-22 14:30:49 +0200 |
commit | e8c4e1205a51bd705c1daa1f8c069d3fc9d0144e (patch) | |
tree | 9b5f8f8701de9de6943a82bbdc8de194377f9b18 | |
parent | bf5c5403575c9f84308d0bfda9549ef0903a5bad (diff) | |
download | gtk+-e8c4e1205a51bd705c1daa1f8c069d3fc9d0144e.tar.gz |
gtk-demo: Make colors demo do incremental sorting
-rw-r--r-- | demos/gtk-demo/listview_colors.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/demos/gtk-demo/listview_colors.c b/demos/gtk-demo/listview_colors.c index af20292f4a..21f03e0be0 100644 --- a/demos/gtk-demo/listview_colors.c +++ b/demos/gtk-demo/listview_colors.c @@ -662,7 +662,8 @@ create_color_grid (void) { GtkWidget *gridview; GtkListItemFactory *factory; - GListModel *model, *selection; + GListModel *selection; + GtkSortListModel *sort_model; gridview = gtk_grid_view_new (); gtk_scrollable_set_hscroll_policy (GTK_SCROLLABLE (gridview), GTK_SCROLL_NATURAL); @@ -676,12 +677,13 @@ create_color_grid (void) gtk_grid_view_set_max_columns (GTK_GRID_VIEW (gridview), 24); gtk_grid_view_set_enable_rubberband (GTK_GRID_VIEW (gridview), TRUE); - model = G_LIST_MODEL (gtk_sort_list_model_new (gtk_color_list_new (0), NULL)); + sort_model = gtk_sort_list_model_new (gtk_color_list_new (0), NULL); + gtk_sort_list_model_set_incremental (sort_model, TRUE); - selection = G_LIST_MODEL (gtk_multi_selection_new (model)); + selection = G_LIST_MODEL (gtk_multi_selection_new (G_LIST_MODEL (sort_model))); gtk_grid_view_set_model (GTK_GRID_VIEW (gridview), selection); g_object_unref (selection); - g_object_unref (model); + g_object_unref (sort_model); return gridview; } |