mirror of https://github.com/GNOME/gimp.git
app: now store the last run version in the core config.
This will be used by the update check to verify you are running a new version since last time. In the future, it might even allow to handle some types of config migrations if ever we update some things in-between micro releases. Until now, we could only detect minor updates through the config folder name (and even this was limited as the config folder can be specified, in which case we would not even know what version the files were for). Maybe we could start also warning in cases of downgrading too, which can break some configuration files (though there is not much we can do about it other than warn as there is no time machine!). Last point: if the new config value "last-run-version" doesn't exist, it simply means the config folder was run for a GIMP before this point in time/commit. So we just show the welcome dialog.
This commit is contained in:
parent
62a76d7856
commit
5628b9a591
|
@ -319,7 +319,14 @@ app_run (const gchar *full_prog_name,
|
|||
/* check for updates *after* enabling config autosave, so that the timestamp
|
||||
* is saved
|
||||
*/
|
||||
gimp_update_auto_check (gimp->edit_config);
|
||||
gimp_update_auto_check (gimp->edit_config, gimp);
|
||||
|
||||
/* Set this after gimp_update_auto_check(). This will be used for the
|
||||
* next run.
|
||||
*/
|
||||
g_object_set (gimp->edit_config,
|
||||
"last-run-version", GIMP_VERSION,
|
||||
NULL);
|
||||
|
||||
loop = run_loop = g_main_loop_new (NULL, FALSE);
|
||||
|
||||
|
|
|
@ -125,6 +125,7 @@ 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
|
||||
|
@ -661,6 +662,13 @@ 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",
|
||||
|
@ -865,6 +873,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_object (&core_config->default_image);
|
||||
g_clear_object (&core_config->default_grid);
|
||||
|
@ -1089,6 +1098,10 @@ 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);
|
||||
break;
|
||||
case PROP_SAVE_DOCUMENT_HISTORY:
|
||||
core_config->save_document_history = g_value_get_boolean (value);
|
||||
break;
|
||||
|
@ -1349,6 +1362,9 @@ 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);
|
||||
break;
|
||||
case PROP_SAVE_DOCUMENT_HISTORY:
|
||||
g_value_set_boolean (value, core_config->save_document_history);
|
||||
break;
|
||||
|
|
|
@ -115,6 +115,8 @@ struct _GimpCoreConfig
|
|||
gint64 last_release_timestamp;
|
||||
gchar *last_release_comment;
|
||||
gint last_revision;
|
||||
|
||||
gchar *last_run_version;
|
||||
};
|
||||
|
||||
struct _GimpCoreConfigClass
|
||||
|
|
|
@ -270,6 +270,9 @@ _("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 LAST_OPENED_SIZE_BLURB \
|
||||
_("How many recently opened image filenames to keep on the File menu.")
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
|
||||
#ifndef GIMP_CONSOLE_COMPILATION
|
||||
#include "dialogs/about-dialog.h"
|
||||
#include "dialogs/welcome-dialog.h"
|
||||
#endif
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
@ -415,9 +416,9 @@ gimp_update_about_dialog (GimpCoreConfig *config,
|
|||
#ifndef GIMP_CONSOLE_COMPILATION
|
||||
gtk_widget_show (about_dialog_create (config));
|
||||
#else
|
||||
g_warning (_("A new version of GIMP (%s) was released.\n"
|
||||
"It is recommended to update."),
|
||||
config->last_known_release);
|
||||
g_printerr (_("A new version of GIMP (%s) was released.\n"
|
||||
"It is recommended to update."),
|
||||
config->last_known_release);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -512,17 +513,36 @@ gimp_version_cmp (const gchar *v1,
|
|||
/*
|
||||
* gimp_update_auto_check:
|
||||
* @config:
|
||||
* @gimp:
|
||||
*
|
||||
* Run the check for newer versions of GIMP if conditions are right.
|
||||
*
|
||||
* Returns: %TRUE if a check was actually run.
|
||||
*/
|
||||
gboolean
|
||||
gimp_update_auto_check (GimpCoreConfig *config)
|
||||
gimp_update_auto_check (GimpCoreConfig *config,
|
||||
Gimp *gimp)
|
||||
{
|
||||
gint64 prev_update_timestamp;
|
||||
gint64 current_timestamp;
|
||||
|
||||
if (config->last_run_version == NULL ||
|
||||
gimp_version_cmp (GIMP_VERSION,
|
||||
config->last_run_version) > 0)
|
||||
{
|
||||
#ifndef GIMP_CONSOLE_COMPILATION
|
||||
/* GIMP was just updated and this is the first time the new
|
||||
* version is run. Display a welcome dialog, and do not check for
|
||||
* updates right now. */
|
||||
gtk_widget_show (welcome_dialog_create (gimp));
|
||||
|
||||
return FALSE;
|
||||
#else
|
||||
g_log (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE,
|
||||
"Welcome to GIMP %s!", GIMP_VERSION);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Builds with update check deactivated just always return FALSE. */
|
||||
#ifdef CHECK_UPDATE
|
||||
if (! config->check_updates)
|
||||
|
|
|
@ -22,7 +22,9 @@
|
|||
#define __APP_GIMP_UPDATE_H__
|
||||
|
||||
|
||||
gboolean gimp_update_auto_check (GimpCoreConfig *config);
|
||||
gboolean gimp_update_auto_check (GimpCoreConfig *config,
|
||||
Gimp *gimp);
|
||||
|
||||
void gimp_update_check (GimpCoreConfig *config);
|
||||
void gimp_update_refresh (GimpCoreConfig *config);
|
||||
|
||||
|
|
Loading…
Reference in New Issue