[gimp] app: update menurc migration.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: update menurc migration.
- Date: Mon, 23 Aug 2021 17:10:59 +0000 (UTC)
commit f888a6f2f0b40388c9f3adf011b2b2ec665afeec
Author: Jehan <jehan girinstud io>
Date: Mon Aug 23 19:06:03 2021 +0200
app: update menurc migration.
- Migrate "view-rotate-reset" to "view-reset" (there is a
"view-rotate-reset" in GIMP 3, but it will be only for rotate; what
was really doing the same-named action in 2.10 is now what
"view-reset" does).
- Make sure we don't migrate "file-export" from a 2.10 config. From a
2.8 or below, we don't to migrate it (same as for 2.8 to 2.10), but in
a 2.10 config, it is already the same action as the one in GIMP 3.
app/core/gimp-user-install.c | 36 +++++++++++++++++++++++++++++-------
1 file changed, 29 insertions(+), 7 deletions(-)
---
diff --git a/app/core/gimp-user-install.c b/app/core/gimp-user-install.c
index 13920723e3..d01a09c3bf 100644
--- a/app/core/gimp-user-install.c
+++ b/app/core/gimp-user-install.c
@@ -497,7 +497,8 @@ user_install_mkdir_with_parents (GimpUserInstall *install,
"\"<Actions>/plug-in/plug-in-gauss\"" "|" \
"\"<Actions>/tools/tools-value-[1-4]-.*\"" "|" \
"\"<Actions>/vectors/vectors-path-tool\"" "|" \
- "\"<Actions>/tools/tools-blend\""
+ "\"<Actions>/tools/tools-blend\"" "|" \
+ "\"<Actions>/view/view-rotate-reset\""
/**
* callback to use for updating a menurc from GIMP over 2.0.
@@ -509,7 +510,8 @@ user_update_menurc_over20 (const GMatchInfo *matched_value,
GString *new_value,
gpointer data)
{
- gchar *match = g_match_info_fetch (matched_value, 0);
+ GimpUserInstall *install = (GimpUserInstall *) data;
+ gchar *match = g_match_info_fetch (matched_value, 0);
/* "*-paste-as-new" renamed to "*-paste-as-new-image"
*/
@@ -526,11 +528,19 @@ user_update_menurc_over20 (const GMatchInfo *matched_value,
*/
else if (g_strcmp0 (match, "\"<Actions>/file/file-export\"") == 0)
{
- g_string_append (new_value, "\"<Actions>/file/file-export-as\"");
+ if (install->old_major == 2 && install->old_minor <= 8)
+ g_string_append (new_value, "\"<Actions>/file/file-export-as\"");
+ else
+ /* Don't change from a 2.10 config. */
+ g_string_append (new_value, match);
}
else if (g_strcmp0 (match, "\"<Actions>/file/file-export-to\"") == 0)
{
- g_string_append (new_value, "\"<Actions>/file/file-export\"");
+ if (install->old_major == 2 && install->old_minor <= 8)
+ g_string_append (new_value, "\"<Actions>/file/file-export\"");
+ else
+ /* Don't change from a 2.10 config. */
+ g_string_append (new_value, match);
}
else if (g_strcmp0 (match, "\"<Actions>/layers/layers-text-tool\"") == 0)
{
@@ -575,11 +585,23 @@ user_update_menurc_over20 (const GMatchInfo *matched_value,
{
g_string_append (new_value, "\"<Actions>/tools/tools-gradient\"");
}
- /* Should not happen. Just in case we match something unexpected by
- * mistake.
- */
+ else if (g_strcmp0 (match, "\"<Actions>/view/view-rotate-reset\"") == 0)
+ {
+ /* view-rotate-reset became view-reset and new view-rotate-reset
+ * and view-flip-reset actions were created.
+ * See commit 15fb4a7be0.
+ */
+ if (install->old_major == 2)
+ g_string_append (new_value, "\"<Actions>/view/view-reset\"");
+ else
+ /* In advance for a migration from a 3.0 config to higher ones. */
+ g_string_append (new_value, match);
+ }
else
{
+ /* Should not happen. Just in case we match something unexpected by
+ * mistake.
+ */
g_message ("(WARNING) %s: invalid match \"%s\"", G_STRFUNC, match);
g_string_append (new_value, match);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]