actions, file: Don't require selected layers for export

As of 443947c6, we no longer require passing
the selected drawables to the export plug-ins
(as each plug-in now grabs those from the
image itself).
Therefore, we can remove the restriction that
there must be a selected layer before you
can export or save an image.

(cherry picked from commit 6a37900610)
This commit is contained in:
Alx Sa 2025-11-19 22:18:29 +00:00 committed by Bruno Lopes
parent d6ffc927ff
commit a07fc8697d
No known key found for this signature in database
3 changed files with 6 additions and 30 deletions

View file

@ -255,7 +255,6 @@ file_actions_update (GimpActionGroup *group,
{
Gimp *gimp = action_data_get_gimp (data);
GimpImage *image = action_data_get_image (data);
GList *drawables = NULL;
GFile *file = NULL;
GFile *source = NULL;
GFile *export = NULL;
@ -263,8 +262,6 @@ file_actions_update (GimpActionGroup *group,
if (image)
{
drawables = gimp_image_get_selected_drawables (image);
file = gimp_image_get_file (image);
source = gimp_image_get_imported_file (image);
export = gimp_image_get_exported_file (image);
@ -281,16 +278,16 @@ file_actions_update (GimpActionGroup *group,
#define SET_SENSITIVE(action,condition) \
gimp_action_group_set_action_sensitive (group, action, (condition) != 0, NULL)
SET_SENSITIVE ("file-save", drawables);
SET_SENSITIVE ("file-save-as", drawables);
SET_SENSITIVE ("file-save-a-copy", drawables);
SET_SENSITIVE ("file-save-and-close", drawables);
SET_SENSITIVE ("file-save", image);
SET_SENSITIVE ("file-save-as", image);
SET_SENSITIVE ("file-save-a-copy", image);
SET_SENSITIVE ("file-save-and-close", image);
SET_SENSITIVE ("file-revert", file || source);
SET_SENSITIVE ("file-export", drawables);
SET_SENSITIVE ("file-export", image);
SET_VISIBLE ("file-export", ! show_overwrite);
SET_SENSITIVE ("file-overwrite", show_overwrite);
SET_VISIBLE ("file-overwrite", show_overwrite);
SET_SENSITIVE ("file-export-as", drawables);
SET_SENSITIVE ("file-export-as", image);
SET_SENSITIVE ("file-create-template", image);
SET_SENSITIVE ("file-copy-location", file || source || export);
SET_SENSITIVE ("file-show-in-file-manager", file || source || export);
@ -351,8 +348,6 @@ file_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("file-close-all", image);
#undef SET_SENSITIVE
g_list_free (drawables);
}

View file

@ -226,7 +226,6 @@ file_save_cmd_callback (GimpAction *action,
Gimp *gimp;
GimpDisplay *display;
GimpImage *image;
GList *drawables;
GtkWidget *widget;
GimpSaveMode save_mode;
GFile *file = NULL;
@ -239,14 +238,6 @@ file_save_cmd_callback (GimpAction *action,
save_mode = (GimpSaveMode) g_variant_get_int32 (value);
drawables = gimp_image_get_selected_drawables (image);
if (! drawables)
{
g_list_free (drawables);
return;
}
g_list_free (drawables);
file = gimp_image_get_file (image);
switch (save_mode)

View file

@ -69,7 +69,6 @@ file_save (Gimp *gimp,
GFile *local_file = NULL;
gboolean mounted = TRUE;
GError *my_error = NULL;
GList *drawables_list;
GimpExportOptions *options = NULL;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), GIMP_PDB_CALLING_ERROR);
@ -97,15 +96,6 @@ file_save (Gimp *gimp,
*/
options = g_object_new (GIMP_TYPE_EXPORT_OPTIONS, NULL);
drawables_list = gimp_image_get_selected_drawables (image);
if (! drawables_list)
{
g_set_error_literal (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
_("There is no active layer to save"));
goto out;
}
/* FIXME enable these tests for remote files again, needs testing */
if (g_file_is_native (file) &&
g_file_query_exists (file, NULL))