[gimp] app: rename "last-run-version" property by simpler "config-version".



commit 1f9057d4bfa6b9990a5194bcaf17e06dac25e3f3
Author: Jehan <jehan girinstud io>
Date:   Tue Feb 22 12:13:46 2022 +0100

    app: rename "last-run-version" property by simpler "config-version".
    
    Thinking again, this is simply the version of the config files, mapping
    to the application version. Even though it's not really a user-visible
    string (except in config files themselves), I find this a much more
    elegant name than the ugly "last-run-version" (which is not even true
    anymore once startup passed; it's only the last-run version info at very
    beginning of the startup process).

 app/app.c                   |  2 +-
 app/config/gimpcoreconfig.c | 34 ++++++++++++++++++++--------------
 app/config/gimpcoreconfig.h |  2 +-
 app/config/gimprc-blurbs.h  |  4 ++--
 app/gimp-update.c           |  4 ++--
 5 files changed, 26 insertions(+), 20 deletions(-)
---
diff --git a/app/app.c b/app/app.c
index b54aa28d9a..4a50d20269 100644
--- a/app/app.c
+++ b/app/app.c
@@ -325,7 +325,7 @@ app_run (const gchar         *full_prog_name,
    * next run.
    */
   g_object_set (gimp->edit_config,
-                "last-run-version", GIMP_VERSION,
+                "config-version", GIMP_VERSION,
                 NULL);
 
   loop = run_loop = g_main_loop_new (NULL, FALSE);
diff --git a/app/config/gimpcoreconfig.c b/app/config/gimpcoreconfig.c
index 32160519f3..b9230a841e 100644
--- a/app/config/gimpcoreconfig.c
+++ b/app/config/gimpcoreconfig.c
@@ -56,6 +56,7 @@ enum
 {
   PROP_0,
   PROP_LANGUAGE,
+  PROP_CONFIG_VERSION,
   PROP_INTERPOLATION_TYPE,
   PROP_DEFAULT_THRESHOLD,
   PROP_PLUG_IN_PATH,
@@ -125,7 +126,6 @@ enum
   PROP_LAST_RELEASE_COMMENT,
   PROP_LAST_REVISION,
   PROP_LAST_KNOWN_RELEASE,
-  PROP_LAST_RUN_VERSION,
 #ifdef G_OS_WIN32
   PROP_WIN32_POINTER_INPUT_API,
 #endif
@@ -183,6 +183,19 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
                            GIMP_PARAM_STATIC_STRINGS |
                            GIMP_CONFIG_PARAM_RESTART);
 
+  /* This is the version of the config files, which must map to the
+   * version of GIMP. It is used right now only to detect the last run
+   * version in order to detect an update. It could be used later also
+   * to have more fine-grained config updates (not just on minor
+   * versions as we do now, but also on changes in micro versions).
+   */
+  GIMP_CONFIG_PROP_STRING (object_class, PROP_CONFIG_VERSION,
+                           "config-version",
+                           "Version of GIMP config files",
+                           CONFIG_VERSION_BLURB,
+                           NULL,
+                           GIMP_PARAM_STATIC_STRINGS);
+
   GIMP_CONFIG_PROP_ENUM (object_class, PROP_INTERPOLATION_TYPE,
                          "interpolation-type",
                          "Interpolation",
@@ -662,13 +675,6 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
                         0, G_MAXINT, 0,
                         GIMP_PARAM_STATIC_STRINGS);
 
-  GIMP_CONFIG_PROP_STRING (object_class, PROP_LAST_RUN_VERSION,
-                           "last-run-version",
-                           "Version of GIMP run last",
-                           LAST_RUN_VERSION_BLURB,
-                           NULL,
-                           GIMP_PARAM_STATIC_STRINGS);
-
   GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_SAVE_DOCUMENT_HISTORY,
                             "save-document-history",
                             "Save document history",
@@ -873,7 +879,7 @@ gimp_core_config_finalize (GObject *object)
 
   g_clear_pointer (&core_config->last_known_release, g_free);
   g_clear_pointer (&core_config->last_release_comment, g_free);
-  g_clear_pointer (&core_config->last_run_version, g_free);
+  g_clear_pointer (&core_config->config_version, g_free);
 
   g_clear_object (&core_config->default_image);
   g_clear_object (&core_config->default_grid);
@@ -1098,9 +1104,9 @@ gimp_core_config_set_property (GObject      *object,
       g_clear_pointer (&core_config->last_known_release, g_free);
       core_config->last_known_release = g_value_dup_string (value);
       break;
-    case PROP_LAST_RUN_VERSION:
-      g_clear_pointer (&core_config->last_run_version, g_free);
-      core_config->last_run_version = g_value_dup_string (value);
+    case PROP_CONFIG_VERSION:
+      g_clear_pointer (&core_config->config_version, g_free);
+      core_config->config_version = g_value_dup_string (value);
       break;
     case PROP_SAVE_DOCUMENT_HISTORY:
       core_config->save_document_history = g_value_get_boolean (value);
@@ -1362,8 +1368,8 @@ gimp_core_config_get_property (GObject    *object,
     case PROP_LAST_KNOWN_RELEASE:
       g_value_set_string (value, core_config->last_known_release);
       break;
-    case PROP_LAST_RUN_VERSION:
-      g_value_set_string (value, core_config->last_run_version);
+    case PROP_CONFIG_VERSION:
+      g_value_set_string (value, core_config->config_version);
       break;
     case PROP_SAVE_DOCUMENT_HISTORY:
       g_value_set_boolean (value, core_config->save_document_history);
diff --git a/app/config/gimpcoreconfig.h b/app/config/gimpcoreconfig.h
index 6354ecc912..72bdcd4206 100644
--- a/app/config/gimpcoreconfig.h
+++ b/app/config/gimpcoreconfig.h
@@ -116,7 +116,7 @@ struct _GimpCoreConfig
   gchar                  *last_release_comment;
   gint                    last_revision;
 
-  gchar                  *last_run_version;
+  gchar                  *config_version;
 };
 
 struct _GimpCoreConfigClass
diff --git a/app/config/gimprc-blurbs.h b/app/config/gimprc-blurbs.h
index 183945975e..ea2017e93b 100644
--- a/app/config/gimprc-blurbs.h
+++ b/app/config/gimprc-blurbs.h
@@ -270,8 +270,8 @@ _("Specifies the language to use for the user interface.")
 #define LAST_KNOWN_RELEASE_BLURB \
 _("The last known release version of GIMP as queried from official website.")
 
-#define LAST_RUN_VERSION_BLURB \
-_("The version of GIMP which was last run.")
+#define CONFIG_VERSION_BLURB \
+_("The version of GIMP config files.")
 
 #define LAST_OPENED_SIZE_BLURB \
 _("How many recently opened image filenames to keep on the File menu.")
diff --git a/app/gimp-update.c b/app/gimp-update.c
index 5297452b10..dc3ea4b5ea 100644
--- a/app/gimp-update.c
+++ b/app/gimp-update.c
@@ -526,9 +526,9 @@ gimp_update_auto_check (GimpCoreConfig *config,
   gint64 prev_update_timestamp;
   gint64 current_timestamp;
 
-  if (config->last_run_version == NULL ||
+  if (config->config_version == NULL ||
       gimp_version_cmp (GIMP_VERSION,
-                        config->last_run_version) > 0)
+                        config->config_version) > 0)
     {
 #ifndef GIMP_CONSOLE_COMPILATION
       /* GIMP was just updated and this is the first time the new


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