Commit Graph

33 Commits

Author SHA1 Message Date
Bruno Lopes 3f0532ba86 app, devel-docs: add a bit of MS Store documentation
See also: Infrastructure/gimp-web-devel!46
2024-04-21 18:18:35 -03:00
Jehan 8e7fc1d920 app: do not show the welcome dialog with the --no-interface option.
Fixes:

> (gimp-2.99:3763): GLib-CRITICAL **: 19:31:02.392: g_hash_table_size: assertion 'hash_table != NULL' failed
> GIMP-CRITICAL: gimp_translation_store_constructed: assertion 'lang_list != NULL' failed
2024-03-28 00:19:10 +01:00
Jehan df7cc3d377 app: simplify and fix the welcome dialog and update check algorithm.
To simplify the logic, I created an `is_update` variable. This makes the code
much more understandable (and also simplify the redundant or over-complicated
imbricated `if` blocks).

The fix part is that the update check would have never happened for anyone
leaving the "Show Welcome Dialog" option checked, whereas we only want to bypass
the update check for new installations or updates.
2024-02-14 15:20:10 +00:00
Alx Sa 9a745738b4 dialogs: Add configurations to Welcome Dialogue
Allows users to quickly configure themes and other
"controversial" options when first installed.
Also allows the welcome dialogue to appear on start,
depending on user preference.
2024-02-14 15:20:10 +00:00
Alx Sa ad8b47bff7 gui: Change Windows title bar based on theme
On Windows, the title bar can be set to light or dark mode via DwmSetWindowAttribute ().
This adds code to update the main title bar and dialogue title bars based on the current theme.
The main title bar uses "prefer-dark-theme", while the dialogue title bars
uses the color of the widget background to assume the correct color.
2023-10-18 16:48:25 +00:00
Lukas Oberhuber 7f257a3a33 gimp-updates: fix update checks on macOS
Update processing has to be done on the main thread to avoid
problems with GTK thread safety.
2022-09-06 21:29:18 +01:00
Jehan fbb5b40345 app, autotools, meson: new GIMP_RELEASE macro.
We were using GIMP_UNSTABLE extensively to differentiate development
from stable code. But there is actually another level of development
code. Basically GIMP_UNSTABLE tells you are on the development branch,
e.g. for current branches, that you are on 2.99.* versions (vs. 2.10).
This depends on the minor version oddness.

GIMP_RELEASE will tell you if it's a release or a in-between-releases
code. This works with the micro version which must be even on release.
Any odd number means you are basically using random git code.

There can be any combination of GIMP_RELEASE and GIMP_UNSTABLE. For
instance 2.99.12 is a release of the unstable branch, whereas 2.10.33 is
development code of the stable branch.

I use this first in the update code as we were using GIMP_UNSTABLE for
both concepts but it made it harder to test. Now:

* GIMP_DEV_VERSIONS_JSON environment variable is only available on
  development code, not on release (whether stable or unstable).
* The weekly check limitation is also only for releases (dev code just
  check at every startup to quickly detect issues and regressions).
* Whether to look on testing website or public website json file depends
  on the code being a release or not.
* Finally only whether to check "DEVELOPMENT" or "STABLE" sections in
  the json file depends on whether we are on stable or unstable
  branches.
2022-09-05 22:16:56 +02:00
Lukas Oberhuber 5735bd7fa8 check_for_updates: fixes update check macos #7325
This was not working due to a missing port in glib.

Potentially could be contributed upstream to GLib.

(cherry picked from commit b391f9f5c8)

Conflicts fixed:
	app/gimp-update.c
2022-09-05 16:33:57 +02:00
Jehan b79d26f097 app: make update detection more robust to string revision field.
The "revision" field in the json file is supposed to be int. But I just
realized that it was set as string a few times, e.g. in Windows
installer revision 1 of GIMP 2.10.32. As a consequence, the revision 0
build was not able to detect the new revision.

I have now fixed the data in gimp-web repo (commit e7690e36), yet just
in case this ever happens again, I make the parsing code more robust by
accepting string revision, then properly converted to int.
2022-06-21 22:31:36 +02:00
Jehan 9ef10c8764 app: allow to disable the new version check altogether through a key…
… in the gimp-release file.

This will be useful to disable the update check for the Windows Store
even though we use the same build as the installer. All it will take
will be to append the line `check-update=false` to the file
`share/gimp/2.10/gimp-release` and it will behave as though the update
check is disabled (even though it is actually built-in).
2022-06-06 01:09:08 +02:00
Jehan 1f9057d4bf 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).
2022-02-22 12:27:58 +01:00
Jehan 5628b9a591 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.
2022-02-22 12:23:46 +01:00
Jehan 4f7dceff15 app: fix string array leak as reported by Massimo. 2021-08-14 12:54:13 +02:00
Stanislav Grinkov f8320ce535
core: minor memleak fixes
Fix several memory leaks when uri obtained by g_file_get_uri ()
was not g_free'd ().
2021-05-23 20:57:44 +06:00
Jehan 6c26d39c8e app: unstable versions will check available development releases.
Stable versions (i.e. minor version number even, e.g. 2.10.22) will only
look for higher stable releases. But for unstable versions, we will want
to look up the development releases too. So for instance GIMP 2.99.2
will warn if the development version 2.99.4 has been released, but also
if the stable version 3.0.0 has been released (whatever is the highest,
which is the stable version in this example).
2020-10-22 16:18:31 +02:00
Jehan 5c89099f75 Issue #4777: "New version available" after update.
The About dialog refreshes the release information relatively to
currently running version before being displayed. No check of the remote
JSON file is done, it only verifies whether any stored released
version/revision is not same (or even lower) than the actually running
version. Indeed existence of a stored release means that a newer version
exists at check time only. On later run, this stored information may
have become deprecated.
2020-10-16 18:15:31 +02:00
Jehan 68a7431a10 Issue #5623: https://gimp.org/gimp_versions.json is redirected…
… to www.gimp.org.
2020-09-08 21:13:27 +02:00
Jehan cc16ec5f9f Issue #4904: GIMP startup SLOW due to failed access to…
… oscp-router0[12].gnome.org.

The file was opened asynchronously through g_file_read_async() but the
actually reading from a GFileInputStream was actually done in the
callback, in the main thread. So it may be possible that file is
accessible but connection is very slow or non-reliable and actual
reading would block the main process. I am assuming this is what may
have happened for this reporter.

Instead let's use g_file_load_contents_async() which does the file
opening, reading and closing all in the asynchronous task, hence would
not slow down anything even if the remote resource is unavailable or
connection is very slow.
2020-04-03 19:32:26 +02:00
Jehan 75a03b02f4 app: let's display the release comment in update notification…
… when there is one such comment.
2020-03-30 15:37:34 +02:00
Jehan 7f3bb72c8c app: print gimp_versions.json parsing error on stderr.
Do it even on stable builds as it can help diagnose bugs on releases.
Note that the issue we had just know with casing on the build-id would
not have been seen by such stderr output anyway. Just in case for future
issues.

(cherry picked from commit dd4cec577d)
2020-03-30 14:43:41 +02:00
Jehan a5ea6d6b9b app: use GIMP_BUILD_PLATFORM_FAMILY instead of GIMP_BUILD_PLATFORM.
I didn't realize it because the meson build was returning 'windows' for
GIMP_BUILD_PLATFORM when I cross-built with Mingw-w64. But in the
autotools, it was storing "mingw32", which would not compare with our
gimp_versions.json. Therefore in GIMP 2.10.16, the version update check
would have worked, but not the revision check.
This fixes the problem.
2020-02-22 19:54:15 +01:00
Jehan 87e9ebcfad app: store the revision number in a data file.
I realized having the revision as a build number is the wrong idea as it
implies packagers will have to rebuild GIMP for just a revision. Yet
very often revision may just be data change or dependency fix/update
without rebuild needed (i.e. no ABI change).
Instead let's keep this package information as a file 'gimp-release'
(inspired by /etc/os-release and other /etc/*-release files of
distributions).
2020-02-13 23:59:46 +01:00
Jehan 7b3f696d9d app: accept "revision" and "date" fields to be absent on a build...
... object in the gimp_versions.json file.
2020-02-06 22:15:11 +01:00
Jehan 7b5fff7861 app: now also process the build revision when checking for updates.
The idea is to be able to advertize a new revision of the same version
of GIMP. For instance, this would apply when we release a
`gimp-2-10-14-setup-3.exe` Windows installer (then we are at revision
3, provided we started at revision 0).

The revision number is obviously only relevant to a given platform and
version. Also the concept of build ID allows to differentiate various
builds for a same platform, in particular to not look at revisions of
third-party builds. The build ID can be any string. Maybe we could just
use reverse DNS build id (such as "org.gimp.GIMP_official") to identify
the official GIMP build. So in the end, we only compare revisions for an
identical (version, platform, build-id) tuple.
2020-02-06 21:47:00 +01:00
Jehan 315665592c app, configure: new --disable-check-update option at configuration.
Allows to disable the automatic update check at startup. I believe some
packagers will want such options, in particular on Linux distribution
(where they control their own release schedule and won't want GIMP to
pop new version warning up because they have been slow to update their
package).
Note that it is still possible to query version checks manually in the
about dialog, but the automatic check/popup is gone with this option.
2020-02-06 21:21:17 +01:00
Jehan 8528759834 app: better error management.
- Clear the GError when relevant.
- Check result of json_path_compile() just in case.
- Print some error on stderr when parsing of gimp_versions.json fails
  (which should never happen on releases but would help during
  development).
2020-01-26 15:13:10 +01:00
Jehan 1f75d2e34a app: update gimp-update to new gimp_versions.json format.
Instead of storing versions as objects, we now store them as arrays,
because json arrays are ordered, unlike objects (the website was using
non-standard Python extension to consider the version objects ordered
but this is not proper and even more, the lib we use for GIMP does not
have a similar extension.
This simplifies a bit the code as we don't need to order the versions by
comparing their string representations.
2020-01-26 11:26:13 +01:00
Jehan d5febf6e62 app: parse the release date for the last release.
I was mistakenly using the date of the last check, not the release date.
2020-01-02 23:09:23 +01:00
Jehan 6b237b90fd app: show the About dialog at startup when a new version is available.
This about dialog will complain an explicit message about the new
version and a link button to go to the download page.
2019-12-29 13:41:59 +01:00
Jehan 827473fd88 app: add alternative "Check for updates" button in the About dialog.
When an update is available, a big frame is visible, proposing to go to
the download page. Now a button is also available to explicitly request
for an update check in other cases (bypassing the wait delay for a
future startup).
2019-12-29 13:24:20 +01:00
Jehan b874cadfad app: make gimp_versions.json parsing easier to test.
First, let's make the check happen at each startup on unstable (still
once a week on stable).
Second, make it parse gimp.org's gimp_versions.json on stable, but
testing's one on unstable and also check environment variable
GIMP_DEV_VERSIONS_JSON (unstable only) to allow setting a local path
(allowing to tweak the file and test various cases).

Unrelated to testing, some improvements:
- save a timestamp in seconds (really no need to keep microseconds
  precision here).
- just in case, check that the saved timestamp is not in the future.
2019-12-29 10:36:12 +01:00
Jehan bb7f229b97 app: fixes int overflow warning.
This fixes the following warning when compiling with Mingw:
> warning: integer overflow in expression of type 'long int' results in '-694967296' [-Woverflow]
2019-12-25 22:01:33 +01:00
Jehan 506a0476f4 app: check last GIMP release from gimp.org/gimp_versions.json.
GIMP will now process the remote gimp_versions json file to look if one
is using the last version of GIMP. This initial code doesn't act up yet
on this information. This will come in further commits.

Here are the characteristics:
- Since this requires internet access, a new checkbox is available in
  the Preferences dialog, allowing to disable version checks. Note that
  it is enabled by default as it is an important security feature, but
  it has to be deactivatable.
- The remote access is done as an async operation because we don't want
  it to block the startup in any way (for whatever reason). Also it
  doesn't output errors if it fails to not be a bother (you don't
  technically need internet access for an image program).
- We don't check at every startup. At each successful check, we save a
  timestamp to prevent too frequent useless checks (I set it the timer
  to a week or more for now).
2019-12-13 17:51:44 +01:00