[gimp] app: use GIMP_VERSION for version comparison.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: use GIMP_VERSION for version comparison.
- Date: Sat, 7 Jul 2018 14:11:42 +0000 (UTC)
commit b9b8676cb8e9bf6833a86240989ccb7281cf2b68
Author: Jehan <jehan girinstud io>
Date: Tue Jul 3 13:26:23 2018 +0200
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!).
app/core/Makefile.am | 1 +
app/core/gimpextension.c | 16 ++++++++++++++--
2 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/app/core/Makefile.am b/app/core/Makefile.am
index 7c69367e67..69f3e20f21 100644
--- a/app/core/Makefile.am
+++ b/app/core/Makefile.am
@@ -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\" \
diff --git a/app/core/gimpextension.c b/app/core/gimpextension.c
index c76d6f5efe..80771716a0 100644
--- a/app/core/gimpextension.c
+++ b/app/core/gimpextension.c
@@ -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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]