listview: Remove an unused member variable

It's only used in the allocate function, so make it a local varaible
there.
This commit is contained in:
Benjamin Otte 2023-03-03 02:35:56 +01:00 committed by Benjamin Otte
parent 9ee0696923
commit b962defc11
2 changed files with 7 additions and 9 deletions

View File

@ -481,7 +481,7 @@ gtk_list_view_size_allocate (GtkWidget *widget,
GtkListView *self = GTK_LIST_VIEW (widget); GtkListView *self = GTK_LIST_VIEW (widget);
GtkListTile *tile; GtkListTile *tile;
GArray *heights; GArray *heights;
int min, nat, row_height, y; int min, nat, row_height, y, list_width;
GtkOrientation orientation, opposite_orientation; GtkOrientation orientation, opposite_orientation;
GtkScrollablePolicy scroll_policy, opposite_scroll_policy; GtkScrollablePolicy scroll_policy, opposite_scroll_policy;
@ -501,11 +501,11 @@ gtk_list_view_size_allocate (GtkWidget *widget,
gtk_list_view_measure_across (widget, opposite_orientation, gtk_list_view_measure_across (widget, opposite_orientation,
-1, -1,
&min, &nat); &min, &nat);
self->list_width = orientation == GTK_ORIENTATION_VERTICAL ? width : height; list_width = orientation == GTK_ORIENTATION_VERTICAL ? width : height;
if (opposite_scroll_policy == GTK_SCROLL_MINIMUM) if (opposite_scroll_policy == GTK_SCROLL_MINIMUM)
self->list_width = MAX (min, self->list_width); list_width = MAX (min, list_width);
else else
self->list_width = MAX (nat, self->list_width); list_width = MAX (nat, list_width);
/* step 2: determine height of known list items and gc the list */ /* step 2: determine height of known list items and gc the list */
heights = g_array_new (FALSE, FALSE, sizeof (int)); heights = g_array_new (FALSE, FALSE, sizeof (int));
@ -518,13 +518,13 @@ gtk_list_view_size_allocate (GtkWidget *widget,
continue; continue;
gtk_widget_measure (tile->widget, orientation, gtk_widget_measure (tile->widget, orientation,
self->list_width, list_width,
&min, &nat, NULL, NULL); &min, &nat, NULL, NULL);
if (scroll_policy == GTK_SCROLL_MINIMUM) if (scroll_policy == GTK_SCROLL_MINIMUM)
row_height = min; row_height = min;
else else
row_height = nat; row_height = nat;
gtk_list_tile_set_area_size (self->item_manager, tile, self->list_width, row_height); gtk_list_tile_set_area_size (self->item_manager, tile, list_width, row_height);
g_array_append_val (heights, row_height); g_array_append_val (heights, row_height);
} }
@ -539,7 +539,7 @@ gtk_list_view_size_allocate (GtkWidget *widget,
{ {
gtk_list_tile_set_area_position (self->item_manager, tile, 0, y); gtk_list_tile_set_area_position (self->item_manager, tile, 0, y);
if (tile->widget == NULL) if (tile->widget == NULL)
gtk_list_tile_set_area_size (self->item_manager, tile, self->list_width, row_height * tile->n_items); gtk_list_tile_set_area_size (self->item_manager, tile, list_width, row_height * tile->n_items);
y += tile->area.height; y += tile->area.height;
} }

View File

@ -31,8 +31,6 @@ struct _GtkListView
GtkListItemManager *item_manager; GtkListItemManager *item_manager;
gboolean show_separators; gboolean show_separators;
int list_width;
}; };
struct _GtkListViewClass struct _GtkListViewClass