Skip to content

Attempt to enable folder creation in file chooser dialogs on macOS #18953

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/control/jobs/control_jobs.c
Original file line number Diff line number Diff line change
Expand Up @@ -2153,6 +2153,8 @@ void dt_control_move_images()
_("select directory"), GTK_WINDOW(win), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
_("_select as destination"), _("_cancel"));

gtk_file_chooser_set_create_folders(GTK_FILE_CHOOSER(filechooser), TRUE);

dt_conf_get_folder_to_file_chooser("ui_last/move_path", GTK_FILE_CHOOSER(filechooser));
if(gtk_native_dialog_run(GTK_NATIVE_DIALOG(filechooser)) == GTK_RESPONSE_ACCEPT)
{
Expand Down Expand Up @@ -2211,6 +2213,8 @@ void dt_control_copy_images()
_("_select as destination"),
_("_cancel"));

gtk_file_chooser_set_create_folders(GTK_FILE_CHOOSER(filechooser), TRUE);

dt_conf_get_folder_to_file_chooser("ui_last/copy_path",
GTK_FILE_CHOOSER(filechooser));
if(gtk_native_dialog_run(GTK_NATIVE_DIALOG(filechooser)) == GTK_RESPONSE_ACCEPT)
Expand Down
1 change: 1 addition & 0 deletions src/gui/accelerators.c
Original file line number Diff line number Diff line change
Expand Up @@ -2682,6 +2682,7 @@ static void _export_clicked(GtkButton *button, gpointer user_data)
_("select file to export"), GTK_WINDOW(win), GTK_FILE_CHOOSER_ACTION_SAVE,
_("_export"), _("_cancel"));

gtk_file_chooser_set_create_folders(GTK_FILE_CHOOSER(chooser), TRUE);
gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(chooser), TRUE);
dt_conf_get_folder_to_file_chooser("ui_last/export_path", GTK_FILE_CHOOSER(chooser));
gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(chooser), "shortcutsrc");
Expand Down
2 changes: 2 additions & 0 deletions src/gui/preferences.c
Original file line number Diff line number Diff line change
Expand Up @@ -1267,6 +1267,8 @@ static void export_preset(GtkButton *button,
_("select directory"), GTK_WINDOW(win), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
_("_save"), _("_cancel"));

gtk_file_chooser_set_create_folders(GTK_FILE_CHOOSER(filechooser), TRUE);

dt_conf_get_folder_to_file_chooser("ui_last/export_path", GTK_FILE_CHOOSER(filechooser));

if(gtk_native_dialog_run(GTK_NATIVE_DIALOG(filechooser)) == GTK_RESPONSE_ACCEPT)
Expand Down
5 changes: 4 additions & 1 deletion src/gui/presets.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
This file is part of darktable,
Copyright (C) 2010-2024 darktable developers.
Copyright (C) 2010-2025 darktable developers.

darktable is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -423,6 +423,9 @@ static void _edit_preset_response(GtkDialog *dialog,
GtkFileChooserNative *filechooser = gtk_file_chooser_native_new(
_("select directory"), GTK_WINDOW(dialog), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
_("_select as output destination"), _("_cancel"));

gtk_file_chooser_set_create_folders(GTK_FILE_CHOOSER(filechooser), TRUE);

dt_conf_get_folder_to_file_chooser("ui_last/export_path",
GTK_FILE_CHOOSER(filechooser));

Expand Down
4 changes: 3 additions & 1 deletion src/imageio/storage/disk.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
This file is part of darktable,
Copyright (C) 2010-2024 darktable developers.
Copyright (C) 2010-2025 darktable developers.

darktable is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -197,6 +197,8 @@ static void button_clicked(GtkWidget *widget,
_("select directory"), GTK_WINDOW(win), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
_("_select as output destination"), _("_cancel"));

gtk_file_chooser_set_create_folders(GTK_FILE_CHOOSER(filechooser), TRUE);

gchar *old = g_strdup(gtk_entry_get_text(d->entry));
gchar *dirname;
gchar *filename;
Expand Down
4 changes: 3 additions & 1 deletion src/imageio/storage/gallery.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
This file is part of darktable,
Copyright (C) 2011-2024 darktable developers.
Copyright (C) 2011-2025 darktable developers.

darktable is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -148,6 +148,8 @@ static void button_clicked(GtkWidget *widget,
_("select directory"), GTK_WINDOW(win), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
_("_select as output destination"), _("_cancel"));

gtk_file_chooser_set_create_folders(GTK_FILE_CHOOSER(filechooser), TRUE);

gchar *old = g_strdup(gtk_entry_get_text(d->entry));
char *c = g_strstr_len(old, -1, "$");
if(c) *c = '\0';
Expand Down
4 changes: 3 additions & 1 deletion src/imageio/storage/latex.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
This file is part of darktable,
Copyright (C) 2012-2024 darktable developers.
Copyright (C) 2012-2025 darktable developers.

darktable is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -144,6 +144,8 @@ static void button_clicked(GtkWidget *widget, dt_imageio_module_storage_t *self)
_("select directory"), GTK_WINDOW(win), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
_("_select as output destination"), _("_cancel"));

gtk_file_chooser_set_create_folders(GTK_FILE_CHOOSER(filechooser), TRUE);

gchar *old = g_strdup(gtk_entry_get_text(d->entry));
char *c = g_strstr_len(old, -1, "$");
if(c) *c = '\0';
Expand Down
2 changes: 2 additions & 0 deletions src/libs/collect.c
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,8 @@ static void view_popup_menu_onSearchFilmroll(GtkWidget *menuitem,
GTK_WINDOW(win), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
_("_open"), _("_cancel"));

gtk_file_chooser_set_create_folders(GTK_FILE_CHOOSER(filechooser), TRUE);

if(tree_path != NULL)
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(filechooser), tree_path);
else
Expand Down
6 changes: 5 additions & 1 deletion src/libs/import.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
This file is part of darktable,
Copyright (C) 2011-2024 darktable developers.
Copyright (C) 2011-2025 darktable developers.

darktable is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -1862,6 +1862,8 @@ static void _lib_import_select_folder(GtkWidget *widget,
_("select directory"), GTK_WINDOW(win),
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, _("_open"), _("_cancel"));

gtk_file_chooser_set_create_folders(GTK_FILE_CHOOSER(filechooser), TRUE);

// run the native dialog
dt_conf_get_folder_to_file_chooser("ui_last/import_last_place",
GTK_FILE_CHOOSER(filechooser));
Expand Down Expand Up @@ -1975,6 +1977,8 @@ static void _browse_basedir_clicked(GtkWidget *widget,
_("select directory"), GTK_WINDOW(topwindow),
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, _("_open"), _("_cancel"));

gtk_file_chooser_set_create_folders(GTK_FILE_CHOOSER(filechooser), TRUE);

gchar *old = g_strdup(gtk_entry_get_text(basedir));
char *c = g_strstr_len(old, -1, "$");
if(c) *c = '\0';
Expand Down
4 changes: 3 additions & 1 deletion src/libs/styles.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
This file is part of darktable,
Copyright (C) 2010-2024 darktable developers.
Copyright (C) 2010-2025 darktable developers.

darktable is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -451,6 +451,8 @@ static void _export_clicked(GtkWidget *w, dt_lib_styles_t *d)
_("select directory"), GTK_WINDOW(win), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
_("_save"), _("_cancel"));

gtk_file_chooser_set_create_folders(GTK_FILE_CHOOSER(filechooser), TRUE);

dt_conf_get_folder_to_file_chooser("ui_last/export_path", GTK_FILE_CHOOSER(filechooser));
gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(filechooser), FALSE);

Expand Down
4 changes: 3 additions & 1 deletion src/libs/tagging.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
This file is part of darktable,
Copyright (C) 2010-2024 darktable developers.
Copyright (C) 2010-2025 darktable developers.

darktable is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -2628,6 +2628,8 @@ static void _export_button_clicked(GtkButton *button, dt_lib_module_t *self)
_("select file to export to"), GTK_WINDOW(win), GTK_FILE_CHOOSER_ACTION_SAVE,
_("_export"), _("_cancel"));

gtk_file_chooser_set_create_folders(GTK_FILE_CHOOSER(filechooser), TRUE);

gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(filechooser), TRUE);
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(filechooser), last_dirname);
gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(filechooser), export_filename);
Expand Down
Loading