diff options
author | António Fernandes <antoniof@gnome.org> | 2022-04-06 01:22:53 +0100 |
---|---|---|
committer | António Fernandes <antoniof@gnome.org> | 2023-01-10 01:11:33 +0000 |
commit | d5ce96240ac0fc55ec64d3fcf756c84502f4e441 (patch) | |
tree | 3fc0ea463a1e3d6ed4ed05ace82021c29ad6098c /src/nautilus-grid-view.c | |
parent | 510a4202d25b82323a1307918b382aab603190eb (diff) | |
download | nautilus-d5ce96240ac0fc55ec64d3fcf756c84502f4e441.tar.gz |
view-model: Expose row objects to the view
This is going to allow us to reuse the model for a GtkColumnView-based
list view with expanding trees support.
As documented, GtkTreeViewRow:item may be NULL when the item it held
is destroyed. So, we must take care to handle the NULL case when
expected and also warn and return when not expected.
Diffstat (limited to 'src/nautilus-grid-view.c')
-rw-r--r-- | src/nautilus-grid-view.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/nautilus-grid-view.c b/src/nautilus-grid-view.c index b1c32f59f..016f741ba 100644 --- a/src/nautilus-grid-view.c +++ b/src/nautilus-grid-view.c @@ -444,7 +444,8 @@ bind_cell (GtkSignalListItemFactory *factory, NautilusViewItem *item; cell = gtk_list_item_get_child (listitem); - item = NAUTILUS_VIEW_ITEM (gtk_list_item_get_item (listitem)); + item = listitem_get_view_item (listitem); + g_return_if_fail (item != NULL); nautilus_view_item_set_item_ui (item, cell); @@ -476,9 +477,13 @@ unbind_cell (GtkSignalListItemFactory *factory, { NautilusViewItem *item; - item = NAUTILUS_VIEW_ITEM (gtk_list_item_get_item (listitem)); + item = listitem_get_view_item (listitem); - nautilus_view_item_set_item_ui (item, NULL); + /* item may be NULL when row has just been destroyed. */ + if (item != NULL) + { + nautilus_view_item_set_item_ui (item, NULL); + } } static void |