Skip to content

Commit

Permalink
Don't scroll back to selected picture if the collection didn't change
Browse files Browse the repository at this point in the history
  • Loading branch information
aurelienpierre committed Feb 15, 2025
1 parent ec5a231 commit 9a86a1c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/dtgtk/thumbtable.c
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ static void _dt_collection_lut(dt_thumbtable_t *table)
g_list_free(collection);
}

static void _dt_collection_get_hash(dt_thumbtable_t *table)
static int _dt_collection_get_hash(dt_thumbtable_t *table)
{
// Hash the collection query string
const char *const query = dt_collection_get_query(darktable.collection);
Expand All @@ -667,7 +667,9 @@ static void _dt_collection_get_hash(dt_thumbtable_t *table)
table->collection_inited = TRUE;
table->thumbs_inited = FALSE;
_dt_collection_lut(table);
return 1;
}
return 0;
}

static int _grab_focus(dt_thumbtable_t *table)
Expand All @@ -692,10 +694,10 @@ static void _dt_collection_changed_callback(gpointer instance, dt_collection_cha
dt_thumbtable_t *table = (dt_thumbtable_t *)user_data;

// See if the collection changed
_dt_collection_get_hash(table);
int changed = _dt_collection_get_hash(table);

dt_thumbtable_configure(table);
g_idle_add((GSourceFunc) dt_thumbtable_scroll_to_selection, table);
if(changed) g_idle_add((GSourceFunc) dt_thumbtable_scroll_to_selection, table);
dt_thumbtable_update(table);
g_idle_add((GSourceFunc) _grab_focus, table);
}
Expand Down

0 comments on commit 9a86a1c

Please sign in to comment.