Skip to content

Commit

Permalink
Merge pull request cboxdoerfer#293 from mrubli/issue-290
Browse files Browse the repository at this point in the history
window: save column widths on shutdown (fixes cboxdoerfer#290)
  • Loading branch information
cboxdoerfer committed Sep 26, 2021
2 parents 88fc05d + 6448417 commit 40a84b1
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/fsearch_window.c
Expand Up @@ -1221,6 +1221,23 @@ fsearch_application_window_prepare_shutdown(gpointer self) {
g_clear_pointer(&config->sort_by, g_free);
}
config->sort_by = get_sort_name_for_type(fsearch_list_view_get_sort_order(win->result_view->list_view));

// update the config with the widths of all columns whose width we can store
const struct { int type; uint32_t *width; } columns[] = {
{ DATABASE_INDEX_TYPE_NAME, &config->name_column_width },
{ DATABASE_INDEX_TYPE_PATH, &config->path_column_width },
{ DATABASE_INDEX_TYPE_FILETYPE, &config->type_column_width },
{ DATABASE_INDEX_TYPE_EXTENSION, &config->extension_column_width },
{ DATABASE_INDEX_TYPE_SIZE, &config->size_column_width },
{ DATABASE_INDEX_TYPE_MODIFICATION_TIME, &config->modified_column_width },
};
for (int i = 0; i < G_N_ELEMENTS(columns); i++) {
const FsearchListViewColumn *col = fsearch_list_view_get_first_column_for_type(
win->result_view->list_view, columns[i].type);
if (col) {
*columns[i].width = col->width;
}
}
}
}

Expand Down

0 comments on commit 40a84b1

Please sign in to comment.