app: Make 'Export to' fall back to 'Export...'

Make 'Export to' always sensitive (as long as there is an image at
all). And make it fall back to 'Export...' if no export target has
been set yet. Note that it is not necessarily visible at all times,
sometimes 'Overwrite' shadows it. It shall still be invokable though.

Reference:
[Gimp-developer] Isn't this behaviour unintuative?
http://lists.xcf.berkeley.edu/lists/gimp-developer/2011-June/026885.html
This commit is contained in:
Martin Nordholts 2011-06-30 23:44:50 +02:00
parent 9866d70c68
commit c73bdc0971
3 changed files with 20 additions and 7 deletions

View file

@ -46,7 +46,8 @@ typedef enum
GIMP_SAVE_MODE_SAVE_A_COPY,
GIMP_SAVE_MODE_SAVE_AND_CLOSE,
GIMP_SAVE_MODE_EXPORT,
GIMP_SAVE_MODE_EXPORT_TO /* Also used for 'Overwrite' */
GIMP_SAVE_MODE_EXPORT_TO,
GIMP_SAVE_MODE_OVERWRITE
} GimpSaveMode;

View file

@ -151,7 +151,7 @@ static const GimpEnumActionEntry file_save_actions[] =
{ "file-overwrite", NULL,
NC_("file-action", "Over_write"), "",
NC_("file-action", "Export the image back to the imported file in the import format"),
GIMP_SAVE_MODE_EXPORT_TO, FALSE,
GIMP_SAVE_MODE_OVERWRITE, FALSE,
GIMP_HELP_FILE_OVERWRITE },
{ "file-export", NULL,
@ -280,8 +280,8 @@ file_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("file-save-as", drawable);
SET_SENSITIVE ("file-save-a-copy", drawable);
SET_SENSITIVE ("file-revert", image && (gimp_image_get_uri (image) || source));
SET_SENSITIVE ("file-export-to", export);
SET_VISIBLE ("file-export-to", export || ! show_overwrite);
SET_SENSITIVE ("file-export-to", drawable);
SET_VISIBLE ("file-export-to", ! show_overwrite);
SET_SENSITIVE ("file-overwrite", show_overwrite);
SET_VISIBLE ("file-overwrite", show_overwrite);
SET_SENSITIVE ("file-export", drawable);

View file

@ -284,14 +284,26 @@ file_save_cmd_callback (GtkAction *action,
break;
case GIMP_SAVE_MODE_EXPORT_TO:
case GIMP_SAVE_MODE_OVERWRITE:
{
const gchar *uri;
GimpPlugInProcedure *export_proc;
uri = gimp_image_get_exported_uri (image);
if (save_mode == GIMP_SAVE_MODE_EXPORT_TO)
{
uri = gimp_image_get_exported_uri (image);
if (!uri)
uri = gimp_image_get_imported_uri (image);
if (! uri)
{
/* Behave as if Export... was invoked */
file_export_dialog_show (gimp, image, widget);
break;
}
}
else if (save_mode == GIMP_SAVE_MODE_OVERWRITE)
{
uri = gimp_image_get_imported_uri (image);
}
if (uri)
{