Merge branch 'matthiasc/for-master' into 'master'

misc listview scrolling fixes

See merge request GNOME/gtk!2119
This commit is contained in:
Matthias Clasen
2020-06-20 21:21:29 +00:00
2 changed files with 15 additions and 2 deletions

View File

@@ -70,7 +70,6 @@ gtk_weather_info_new (GDateTime *timestamp,
{
result->temperature = copy_from->temperature;
result->weather_type = copy_from->weather_type;
g_object_unref (copy_from);
}
return result;
@@ -161,6 +160,7 @@ create_weather_model (void)
timestamp = g_date_time_new (utc, 2011, 1, 1, 0, 0, 0);
info = gtk_weather_info_new (timestamp, NULL);
g_list_store_append (store, info);
g_object_unref (info);
for (i = 0; lines[i] != NULL && *lines[i]; i++)
{
@@ -176,6 +176,7 @@ create_weather_model (void)
timestamp = new_timestamp;
info = gtk_weather_info_new (timestamp, info);
g_list_store_append (store, info);
g_object_unref (info);
}
info->temperature = parse_temperature (fields[1], info->temperature);
@@ -184,6 +185,7 @@ create_weather_model (void)
g_strfreev (fields);
}
g_date_time_unref (timestamp);
g_strfreev (lines);
g_bytes_unref (data);
g_time_zone_unref (utc);

View File

@@ -269,7 +269,18 @@ gtk_grid_view_get_cell_at_y (GtkGridView *self,
/* skip remaining items at end of row */
if (pos % self->n_columns)
{
skip = pos - pos % self->n_columns;
skip = self->n_columns - pos % self->n_columns;
if (n_items <= skip)
{
g_warning ("ran out of items");
if (position)
*position = 0;
if (offset)
*offset = 0;
if (size)
*size = 0;
return NULL;
}
n_items -= skip;
pos += skip;
}