[gimp] Use separate shortcuts for 'File->Export to' and 'File->Overwrite'
- From: Martin Nordholts <martinn src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] Use separate shortcuts for 'File->Export to' and 'File->Overwrite'
- Date: Thu, 13 Aug 2009 19:50:52 +0000 (UTC)
commit 4df574acd60acd4a1adfeae82b7c8866a6cf3ea7
Author: Martin Nordholts <martinn src gnome org>
Date: Thu Aug 13 21:47:47 2009 +0200
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.
app/actions/actions-types.h | 2 +-
app/actions/file-actions.c | 37 +++++++++++++++++++++++++------------
app/widgets/gimphelp-ids.h | 1 +
menus/image-menu.xml.in | 1 +
4 files changed, 28 insertions(+), 13 deletions(-)
---
diff --git a/app/actions/actions-types.h b/app/actions/actions-types.h
index 846bcd3..cd86f96 100644
--- a/app/actions/actions-types.h
+++ b/app/actions/actions-types.h
@@ -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;
diff --git a/app/actions/file-actions.c b/app/actions/file-actions.c
index 61bc4c9..2b4deaf 100644
--- a/app/actions/file-actions.c
+++ b/app/actions/file-actions.c
@@ -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
- label = g_strdup_printf (_("Export to %s"),
- file_utils_uri_display_basename (export_to));
-
+ 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,
diff --git a/app/widgets/gimphelp-ids.h b/app/widgets/gimphelp-ids.h
index 3966e2c..21827de 100644
--- a/app/widgets/gimphelp-ids.h
+++ b/app/widgets/gimphelp-ids.h
@@ -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"
diff --git a/menus/image-menu.xml.in b/menus/image-menu.xml.in
index 85b7ac8..c9e5e72 100644
--- a/menus/image-menu.xml.in
+++ b/menus/image-menu.xml.in
@@ -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" />
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]