Use separate shortcuts for 'File->Export to' and 'File->Overwrite'

Since Ctrl+E previously meant something harmless, don't use that
keyboard shortcut for the destructive command 'File->Overwrite'. We
still keep Ctrl+E for 'File->Export to' though, and we do this by
having 'File->Overwrite' as a separate GtkAction with its own keyboard
shortcut slot.
This commit is contained in:
Martin Nordholts 2009-08-13 21:47:47 +02:00
parent 60f11e18ae
commit 4df574acd6
4 changed files with 28 additions and 13 deletions

View File

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

View File

@ -140,10 +140,16 @@ static const GimpEnumActionEntry file_save_actions[] =
{ "file-export-to", NULL,
NC_("file-action", "Export to"), "<control>E",
NC_("file-action", "Export the image back to the import source in the import format"),
NC_("file-action", "Export the image again"),
GIMP_SAVE_MODE_EXPORT_TO, FALSE,
GIMP_HELP_FILE_EXPORT_TO },
{ "file-overwrite", NULL,
NC_("file-action", "Overwrite"), "",
NC_("file-action", "Export the image back to the imported file in the import format"),
GIMP_SAVE_MODE_EXPORT_TO, FALSE,
GIMP_HELP_FILE_OVERWRITE },
{ "file-export", NULL,
NC_("file-action", "Export..."), "<control><shift>E",
NC_("file-action", "Export the image to various file formats such as PNG or JPEG"),
@ -254,6 +260,8 @@ file_actions_update (GimpActionGroup *group,
GIMP_FILE_EXPORT_TO_URI_KEY);
}
#define SET_VISIBLE(action,condition) \
gimp_action_group_set_action_visible (group, action, (condition) != 0)
#define SET_SENSITIVE(action,condition) \
gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
@ -261,24 +269,29 @@ file_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("file-save-as", image && drawable);
SET_SENSITIVE ("file-save-a-copy", image && drawable);
SET_SENSITIVE ("file-revert", image && (GIMP_OBJECT (image)->name || source));
SET_SENSITIVE ("file-export-to", source || export_to);
SET_SENSITIVE ("file-export-to", export_to);
SET_VISIBLE ("file-export-to", export_to || ! source);
SET_SENSITIVE ("file-overwrite", source);
SET_VISIBLE ("file-overwrite", source);
SET_SENSITIVE ("file-export", image && drawable);
SET_SENSITIVE ("file-create-template", image);
if (source || export_to)
if (export_to)
{
gchar *label = NULL;
if (! export_to)
label = g_strdup_printf (_("Overwrite %s"),
file_utils_uri_display_basename (source));
else
gchar *label;
label = g_strdup_printf (_("Export to %s"),
file_utils_uri_display_basename (export_to));
gimp_action_group_set_action_label (group, "file-export-to", label);
g_free (label);
}
else if (source)
{
gchar *label;
label = g_strdup_printf (_("Overwrite %s"),
file_utils_uri_display_basename (source));
gimp_action_group_set_action_label (group, "file-overwrite", label);
g_free (label);
}
else
{
gimp_action_group_set_action_label (group,

View File

@ -36,6 +36,7 @@
#define GIMP_HELP_FILE_SAVE_BY_EXTENSION "gimp-file-save-by-extension"
#define GIMP_HELP_FILE_EXPORT "gimp-file-export"
#define GIMP_HELP_FILE_EXPORT_TO "gimp-file-export-to"
#define GIMP_HELP_FILE_OVERWRITE "gimp-file-overwrite"
#define GIMP_HELP_FILE_SAVE_AS_TEMPLATE "gimp-file-save-as-template"
#define GIMP_HELP_FILE_REVERT "gimp-file-revert"
#define GIMP_HELP_FILE_CLOSE "gimp-file-close"

View File

@ -45,6 +45,7 @@
<separator />
<placeholder name="Export">
<menuitem action="file-export-to" />
<menuitem action="file-overwrite" />
<menuitem action="file-export" />
</placeholder>
<menuitem action="file-create-template" />