1
1
mirror of https://gitlab.gnome.org/GNOME/gimp.git synced 2025-10-06 17:52:42 +02:00

file-export* labels and actions renamed.

Follows updated save+export specification.
For renamed actions (file-export and file-export-to respectively to
file-export-as and file-export to mimick file-save*), menurc from
GIMP 2.8 will be correctly migrated.
This commit is contained in:
Jehan
2013-11-13 15:15:45 +13:00
parent 9ffa9ac6e3
commit 4b14ed2e5e
7 changed files with 55 additions and 38 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_AS,
GIMP_SAVE_MODE_OVERWRITE
} GimpSaveMode;

View File

@@ -142,11 +142,11 @@ static const GimpEnumActionEntry file_save_actions[] =
GIMP_SAVE_MODE_SAVE_AND_CLOSE, FALSE,
GIMP_HELP_FILE_SAVE },
{ "file-export-to", NULL,
NC_("file-action", "Export to"), "<primary>E",
{ "file-export", NULL,
NC_("file-action", "Export"), "<primary>E",
NC_("file-action", "Export the image again"),
GIMP_SAVE_MODE_EXPORT_TO, FALSE,
GIMP_HELP_FILE_EXPORT_TO },
GIMP_SAVE_MODE_EXPORT, FALSE,
GIMP_HELP_FILE_EXPORT },
{ "file-overwrite", NULL,
NC_("file-action", "Over_write"), "",
@@ -154,11 +154,11 @@ static const GimpEnumActionEntry file_save_actions[] =
GIMP_SAVE_MODE_OVERWRITE, FALSE,
GIMP_HELP_FILE_OVERWRITE },
{ "file-export", NULL,
NC_("file-action", "Export..."), "<primary><shift>E",
{ "file-export-as", NULL,
NC_("file-action", "Export As..."), "<primary><shift>E",
NC_("file-action", "Export the image to various file formats such as PNG or JPEG"),
GIMP_SAVE_MODE_EXPORT, FALSE,
GIMP_HELP_FILE_EXPORT }
GIMP_SAVE_MODE_EXPORT_AS, FALSE,
GIMP_HELP_FILE_EXPORT_AS }
};
void
@@ -280,17 +280,17 @@ 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", drawable);
SET_VISIBLE ("file-export-to", ! show_overwrite);
SET_SENSITIVE ("file-export", drawable);
SET_VISIBLE ("file-export", ! show_overwrite);
SET_SENSITIVE ("file-overwrite", show_overwrite);
SET_VISIBLE ("file-overwrite", show_overwrite);
SET_SENSITIVE ("file-export", drawable);
SET_SENSITIVE ("file-export-as", drawable);
SET_SENSITIVE ("file-create-template", image);
if (export)
{
gchar *label = file_actions_create_label (_("Export to %s"), export);
gimp_action_group_set_action_label (group, "file-export-to", label);
gimp_action_group_set_action_label (group, "file-export", label);
g_free (label);
}
else if (show_overwrite)
@@ -298,12 +298,11 @@ file_actions_update (GimpActionGroup *group,
gchar *label = file_actions_create_label (_("Over_write %s"), source);
gimp_action_group_set_action_label (group, "file-overwrite", label);
g_free (label);
}
else
{
gimp_action_group_set_action_label (group,
"file-export-to", _("Export to"));
"file-export", _("Export"));
}
/* needed for the empty display */

View File

@@ -286,24 +286,24 @@ file_save_cmd_callback (GtkAction *action,
FALSE, display);
break;
case GIMP_SAVE_MODE_EXPORT:
case GIMP_SAVE_MODE_EXPORT_AS:
file_export_dialog_show (gimp, image, widget);
break;
case GIMP_SAVE_MODE_EXPORT_TO:
case GIMP_SAVE_MODE_EXPORT:
case GIMP_SAVE_MODE_OVERWRITE:
{
const gchar *uri = NULL;
GimpPlugInProcedure *export_proc;
gboolean overwrite;
gboolean overwrite = FALSE;
if (save_mode == GIMP_SAVE_MODE_EXPORT_TO)
if (save_mode == GIMP_SAVE_MODE_EXPORT)
{
uri = gimp_image_get_exported_uri (image);
if (! uri)
{
/* Behave as if Export... was invoked */
/* Behave as if Export As... was invoked */
file_export_dialog_show (gimp, image, widget);
break;
}

View File

@@ -439,18 +439,19 @@ user_install_mkdir_with_parents (GimpUserInstall *install,
return TRUE;
}
/* The regexp pattern of all options changed from previous menurc.
/* The regexp pattern of all options changed from menurc of GIMP 2.8.
* Add any pattern that we want to recognize for replacement in the menurc of
* the next release*/
#define MENURC_OVER20_UPDATE_PATTERN "NOMATCH^"
#define MENURC_28_UPDATE_PATTERN "\"<Actions>/file/file-export-to\"|" \
"\"<Actions>/file/file-export\""
/**
* callback to use for updating any change value in the menurc.
* callback to use for updating a menurc from GIMP 2.8.
* data is unused (always NULL).
* The updated value will be matched line by line.
*/
static gboolean
user_update_menurc_over20 (const GMatchInfo *matched_value,
user_update_menurc_28 (const GMatchInfo *matched_value,
GString *new_value,
gpointer data)
{
@@ -462,10 +463,21 @@ user_update_menurc_over20 (const GMatchInfo *matched_value,
if (strcmp (match, "\"<Actions>/view/view-close\"") == 0)
g_string_append (new_value, "\"<Actions>/file/file-close\"");
else
*/
if (strcmp (match, "\"<Actions>/file/file-export\"") == 0)
{
g_string_append (new_value, "\"<Actions>/file/file-export-as\"");
}
else if (strcmp (match, "\"<Actions>/file/file-export-to\"") == 0)
{
g_string_append (new_value, "\"<Actions>/file/file-export\"");
}
else
{
/* Should not happen. Just in case we match something unexpected by mistake. */
g_string_append (new_value, match);
}
g_free (match);
return FALSE;
@@ -624,11 +636,17 @@ user_install_migrate_files (GimpUserInstall *install)
if (strcmp (basename, "menurc") == 0)
{
switch (install->old_minor)
{
case 0:
/* skip menurc for gimp 2.0 as the format has changed */
if (install->old_minor == 0)
goto next_file;
update_pattern = MENURC_OVER20_UPDATE_PATTERN;
update_callback = user_update_menurc_over20;
break;
case 8:
update_pattern = MENURC_28_UPDATE_PATTERN;
update_callback = user_update_menurc_28;
break;
}
}
g_snprintf (dest, sizeof (dest), "%s%c%s",

View File

@@ -112,7 +112,7 @@ file_save_dialog_new (Gimp *gimp,
GIMP_FILE_CHOOSER_ACTION_EXPORT,
_("Export Image"), "gimp-file-export",
_("_Export"),
GIMP_HELP_FILE_EXPORT);
GIMP_HELP_FILE_EXPORT_AS);
state = g_object_get_data (G_OBJECT (gimp), "gimp-file-export-dialog-state");
}

View File

@@ -35,7 +35,7 @@
#define GIMP_HELP_FILE_SAVE_A_COPY "gimp-file-save-a-copy"
#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_EXPORT_AS "gimp-file-export-as"
#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"

View File

@@ -43,9 +43,9 @@
<menuitem action="file-revert" />
<separator />
<placeholder name="Export">
<menuitem action="file-export-to" />
<menuitem action="file-overwrite" />
<menuitem action="file-export" />
<menuitem action="file-export-as" />
<menuitem action="file-overwrite" />
</placeholder>
<menuitem action="file-create-template" />
<separator />