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

print dialog: Fix initial selection

Closes #6996

See merge request GNOME/gtk!7704
This commit is contained in:
Matthias Clasen 2024-09-10 18:35:08 +00:00
commit 348e938698

View File

@ -887,12 +887,17 @@ gtk_print_unix_dialog_init (GtkPrintUnixDialog *dialog)
filtered = G_LIST_MODEL (gtk_filter_list_model_new (sorted, filter)); filtered = G_LIST_MODEL (gtk_filter_list_model_new (sorted, filter));
selection = G_LIST_MODEL (gtk_single_selection_new (filtered)); selection = G_LIST_MODEL (gtk_single_selection_new (NULL));
gtk_single_selection_set_autoselect (GTK_SINGLE_SELECTION (selection), FALSE); gtk_single_selection_set_autoselect (GTK_SINGLE_SELECTION (selection), FALSE);
gtk_single_selection_set_selected (GTK_SINGLE_SELECTION (selection), GTK_INVALID_LIST_POSITION);
gtk_column_view_set_model (GTK_COLUMN_VIEW (dialog->printer_list), GTK_SELECTION_MODEL (selection));
g_signal_connect (selection, "items-changed", G_CALLBACK (printer_added_cb), dialog); g_signal_connect (selection, "items-changed", G_CALLBACK (printer_added_cb), dialog);
g_signal_connect_swapped (selection, "notify::selected", G_CALLBACK (selected_printer_changed), dialog); g_signal_connect_swapped (selection, "notify::selected", G_CALLBACK (selected_printer_changed), dialog);
gtk_single_selection_set_model (GTK_SINGLE_SELECTION (selection), filtered);
g_object_unref (filtered);
gtk_column_view_set_model (GTK_COLUMN_VIEW (dialog->printer_list), GTK_SELECTION_MODEL (selection));
g_object_unref (selection); g_object_unref (selection);
gtk_print_load_custom_papers (dialog->custom_paper_list); gtk_print_load_custom_papers (dialog->custom_paper_list);