Commit b9b8676c authored by Jehan's avatar Jehan

app: use GIMP_VERSION for version comparison.

GIMP_APP_VERSION does not include the micro version.
Also make version comparison with org.gimp.GIMP mandatory to force good
practice. This way, extension makers will have to advertize the version
of GIMP it works for, which will make a sane ecosystem of working
extensions only (hopefully!).
parent 9fae0859
......@@ -8,6 +8,7 @@ endif
AM_CPPFLAGS = \
-DGIMPDIR=\""$(gimpdir)"\" \
-DGIMP_VERSION=\"$(GIMP_VERSION)\" \
-DGIMP_APP_VERSION=\"$(GIMP_APP_VERSION)\" \
-DGIMP_USER_VERSION=\"$(GIMP_USER_VERSION)\" \
-DG_LOG_DOMAIN=\"Gimp-Core\" \
......
......@@ -195,7 +195,8 @@ gimp_extension_load (GimpExtension *extension,
AsRelease *release;
gchar *appdata_name;
gchar *path;
gboolean success = FALSE;
gboolean success = FALSE;
gboolean has_require = FALSE;
g_clear_object (&extension->p->app);
......@@ -284,7 +285,8 @@ gimp_extension_load (GimpExtension *extension,
if (as_require_get_kind (require) == AS_REQUIRE_KIND_ID &&
g_strcmp0 (as_require_get_value (require), "org.gimp.GIMP") == 0)
{
if (! as_require_version_compare (require, GIMP_APP_VERSION, error))
has_require = TRUE;
if (! as_require_version_compare (require, GIMP_VERSION, error))
{
success = FALSE;
break;
......@@ -305,6 +307,16 @@ gimp_extension_load (GimpExtension *extension,
}
}
}
if (! has_require)
{
success = FALSE;
if (error && *error == NULL)
{
*error = g_error_new (GIMP_EXTENSION_ERROR,
GIMP_EXTENSION_FAILED,
_("<requires><id>org.gimp.GIMP</id></requires> for version comparison is mandatory."));
}
}
if (success)
extension->p->app = app;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment