[gimp] app: migrate configuration files for s/Blend/Gradient/ tool renaming.



commit 063a83c1ec677d1ce2888e3699582624aff5adbe
Author: Jehan <jehan girinstud io>
Date:   Sat Apr 14 03:57:11 2018 +0200

    app: migrate configuration files for s/Blend/Gradient/ tool renaming.
    
    This includes migrating properly any custom shortcut (menurc), as well
    as a few strings in tool-presets/, and finally "gimp-blend-tool" in
    contextrc and devicerc.
    File toolrc also has some occurrences, but we are already skipping it
    anyway, same as whatever is under tool-options/.
    Hopefully I missed nothing.

 app/core/gimp-user-install.c |   58 ++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 56 insertions(+), 2 deletions(-)
---
diff --git a/app/core/gimp-user-install.c b/app/core/gimp-user-install.c
index 1c2728f..f5077c8 100644
--- a/app/core/gimp-user-install.c
+++ b/app/core/gimp-user-install.c
@@ -492,7 +492,8 @@ user_install_mkdir_with_parents (GimpUserInstall *install,
   "\"<Actions>/layers/layers-text-tool\""       "|" \
   "\"<Actions>/plug-in/plug-in-gauss\""         "|" \
   "\"<Actions>/tools/tools-value-[1-4]-.*\""    "|" \
-  "\"<Actions>/vectors/vectors-path-tool\""
+  "\"<Actions>/vectors/vectors-path-tool\""     "|" \
+  "\"<Actions>/tools/tools-blend\""
 
 /**
  * callback to use for updating a menurc from GIMP over 2.0.
@@ -566,6 +567,10 @@ user_update_menurc_over20 (const GMatchInfo *matched_value,
     {
       g_string_append (new_value, "\"<Actions>/vectors/vectors-edit\"");
     }
+  else if (g_strcmp0 (match, "\"<Actions>/tools/tools-blend\"") == 0)
+    {
+      g_string_append (new_value, "\"<Actions>/tools/tools-gradient\"");
+    }
   /* Should not happen. Just in case we match something unexpected by
    * mistake.
    */
@@ -646,7 +651,11 @@ user_update_gimpressionist (const GMatchInfo *matched_value,
   return FALSE;
 }
 
-#define TOOL_PRESETS_UPDATE_PATTERN "GimpImageMapOptions"
+#define TOOL_PRESETS_UPDATE_PATTERN \
+  "GimpImageMapOptions"  "|" \
+  "GimpBlendOptions"     "|" \
+  "gimp-blend-tool"      "|" \
+  "gimp-tool-blend"
 
 static gboolean
 user_update_tool_presets (const GMatchInfo *matched_value,
@@ -659,6 +668,45 @@ user_update_tool_presets (const GMatchInfo *matched_value,
     {
       g_string_append (new_value, "GimpFilterOptions");
     }
+  else if (g_strcmp0 (match, "GimpBlendOptions") == 0)
+    {
+      g_string_append (new_value, "GimpGradientOptions");
+    }
+  else if (g_strcmp0 (match, "gimp-blend-tool") == 0)
+    {
+      g_string_append (new_value, "gimp-gradient-tool");
+    }
+  else if (g_strcmp0 (match, "gimp-tool-blend") == 0)
+    {
+      g_string_append (new_value, "gimp-tool-gradient");
+    }
+  else
+    {
+      g_message ("(WARNING) %s: invalid match \"%s\"", G_STRFUNC, match);
+      g_string_append (new_value, match);
+    }
+
+  g_free (match);
+  return FALSE;
+}
+
+/* Actually not only for contextrc, but all other files where
+ * gimp-blend-tool may appear. Apparently that is also "devicerc", as
+ * well as "toolrc" (but this one is skipped anyway).
+ */
+#define CONTEXTRC_UPDATE_PATTERN "gimp-blend-tool"
+
+static gboolean
+user_update_contextrc_over20 (const GMatchInfo *matched_value,
+                              GString          *new_value,
+                              gpointer          data)
+{
+  gchar *match = g_match_info_fetch (matched_value, 0);
+
+  if (g_strcmp0 (match, "gimp-blend-tool") == 0)
+    {
+      g_string_append (new_value, "gimp-gradient-tool");
+    }
   else
     {
       g_message ("(WARNING) %s: invalid match \"%s\"", G_STRFUNC, match);
@@ -867,6 +915,12 @@ user_install_migrate_files (GimpUserInstall *install)
               update_pattern  = GIMPRC_UPDATE_PATTERN;
               update_callback = user_update_gimprc;
             }
+          else if (strcmp (basename, "contextrc") == 0      ||
+                   strcmp (basename, "devicerc") == 0)
+            {
+              update_pattern  = CONTEXTRC_UPDATE_PATTERN;
+              update_callback = user_update_contextrc_over20;
+            }
 
           g_snprintf (dest, sizeof (dest), "%s%c%s",
                       gimp_directory (), G_DIR_SEPARATOR, basename);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]