Merge branch 'DefaultExportTypeAlways2' into 'master'

Optionally always offer default file type when exporting (take 2)

See merge request GNOME/gimp!1149
This commit is contained in:
programmer_ceds 2025-07-01 11:04:10 +00:00
commit 8751fca061
6 changed files with 43 additions and 8 deletions

View file

@ -115,6 +115,7 @@ enum
PROP_IMPORT_ADD_ALPHA, PROP_IMPORT_ADD_ALPHA,
PROP_IMPORT_RAW_PLUG_IN, PROP_IMPORT_RAW_PLUG_IN,
PROP_EXPORT_FILE_TYPE, PROP_EXPORT_FILE_TYPE,
PROP_EXPORT_FILE_TYPE_ALWAYS,
PROP_EXPORT_COLOR_PROFILE, PROP_EXPORT_COLOR_PROFILE,
PROP_EXPORT_COMMENT, PROP_EXPORT_COMMENT,
PROP_EXPORT_THUMBNAIL, PROP_EXPORT_THUMBNAIL,
@ -751,6 +752,13 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
GIMP_EXPORT_FILE_PNG, GIMP_EXPORT_FILE_PNG,
GIMP_PARAM_STATIC_STRINGS); GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_EXPORT_FILE_TYPE_ALWAYS,
"export-file-type-always",
"Always offer default export file type",
EXPORT_FILE_TYPE_ALWAYS_BLURB,
FALSE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_EXPORT_COLOR_PROFILE, GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_EXPORT_COLOR_PROFILE,
"export-color-profile", "export-color-profile",
"Export Color Profile", "Export Color Profile",
@ -1174,6 +1182,9 @@ gimp_core_config_set_property (GObject *object,
case PROP_EXPORT_FILE_TYPE: case PROP_EXPORT_FILE_TYPE:
core_config->export_file_type = g_value_get_enum (value); core_config->export_file_type = g_value_get_enum (value);
break; break;
case PROP_EXPORT_FILE_TYPE_ALWAYS:
core_config->export_file_type_always = g_value_get_boolean (value);
break;
case PROP_EXPORT_COLOR_PROFILE: case PROP_EXPORT_COLOR_PROFILE:
core_config->export_color_profile = g_value_get_boolean (value); core_config->export_color_profile = g_value_get_boolean (value);
break; break;
@ -1442,6 +1453,9 @@ gimp_core_config_get_property (GObject *object,
case PROP_EXPORT_FILE_TYPE: case PROP_EXPORT_FILE_TYPE:
g_value_set_enum (value, core_config->export_file_type); g_value_set_enum (value, core_config->export_file_type);
break; break;
case PROP_EXPORT_FILE_TYPE_ALWAYS:
g_value_set_boolean (value, core_config->export_file_type_always);
break;
case PROP_EXPORT_COLOR_PROFILE: case PROP_EXPORT_COLOR_PROFILE:
g_value_set_boolean (value, core_config->export_color_profile); g_value_set_boolean (value, core_config->export_color_profile);
break; break;

View file

@ -99,6 +99,7 @@ struct _GimpCoreConfig
gboolean import_add_alpha; gboolean import_add_alpha;
gchar *import_raw_plug_in; gchar *import_raw_plug_in;
GimpExportFileType export_file_type; GimpExportFileType export_file_type;
gboolean export_file_type_always;
gboolean export_color_profile; gboolean export_color_profile;
gboolean export_comment; gboolean export_comment;
gboolean export_thumbnail; gboolean export_thumbnail;

View file

@ -232,6 +232,9 @@ _("Which plug-in to use for importing raw digital camera files.")
#define EXPORT_FILE_TYPE_BLURB \ #define EXPORT_FILE_TYPE_BLURB \
_("Export file type used by default.") _("Export file type used by default.")
#define EXPORT_FILE_TYPE_ALWAYS_BLURB \
_("Always offer the default export file type when exporting.")
#define EXPORT_COLOR_PROFILE_BLURB \ #define EXPORT_COLOR_PROFILE_BLURB \
_("Export the image's color profile by default.") _("Export the image's color profile by default.")

View file

@ -1604,6 +1604,15 @@ prefs_dialog_new (Gimp *gimp,
_("Default export file t_ype:"), _("Default export file t_ype:"),
GTK_GRID (grid), 0, size_group); GTK_GRID (grid), 0, size_group);
button = prefs_check_button_add (object, "export-file-type-always",
/* Translators: label for
* configuration option (checkbox).
* If selected the default export file type is always
* offered when exporting even if the file type is known..
*/
_("Always offer the default file type when exporting"),
GTK_BOX (vbox2));
/* Raw Image Importer */ /* Raw Image Importer */
vbox2 = prefs_frame_new (_("Raw Image Importer"), vbox2 = prefs_frame_new (_("Raw Image Importer"),
GTK_CONTAINER (vbox), TRUE); GTK_CONTAINER (vbox), TRUE);

View file

@ -165,16 +165,19 @@ gimp_export_dialog_set_image (GimpExportDialog *dialog,
* 4. Default file type set in Preferences * 4. Default file type set in Preferences
*/ */
if (! image->gimp->config->export_file_type_always)
{
ext_file = gimp_image_get_exported_file (image); ext_file = gimp_image_get_exported_file (image);
if (! ext_file) if (ext_file == NULL)
ext_file = gimp_image_get_imported_file (image); ext_file = gimp_image_get_imported_file (image);
if (! ext_file) if (ext_file == NULL)
ext_file = g_object_get_data (G_OBJECT (file_dialog->gimp), ext_file = g_object_get_data (G_OBJECT (file_dialog->gimp),
GIMP_FILE_EXPORT_LAST_FILE_KEY); GIMP_FILE_EXPORT_LAST_FILE_KEY);
}
if (ext_file) if (ext_file != NULL)
{ {
g_object_ref (ext_file); g_object_ref (ext_file);
} }
@ -193,7 +196,7 @@ gimp_export_dialog_set_image (GimpExportDialog *dialog,
g_free (uri); g_free (uri);
} }
if (ext_file) if (ext_file != NULL)
{ {
GFile *tmp_file = gimp_file_with_new_extension (name_file, ext_file); GFile *tmp_file = gimp_file_with_new_extension (name_file, ext_file);
basename = g_path_get_basename (gimp_file_get_utf8_name (tmp_file)); basename = g_path_get_basename (gimp_file_get_utf8_name (tmp_file));

View file

@ -365,6 +365,11 @@
# #
# (export-file-type png) # (export-file-type png)
# Always offer the default file type when exporting an image file. Possible
# values are yes and no
#
# (export-file-type-always no)
# Export the image's color profile by default. Possible values are yes and # Export the image's color profile by default. Possible values are yes and
# no. # no.
# #