gplugin/gplugin

Give GPluginGtk its own versioning macros

5 months ago, Gary Kramlich
9c9e6967bf96
Parents 468acf3b4723
Children 4ad14c2540b2
Give GPluginGtk its own versioning macros

Testing Done:
Compiled.

Bugs closed: GPLUGIN-147

Reviewed at https://reviews.imfreedom.org/r/2778/
--- a/gplugin-gtk4/gplugin-gtk-plugin-closures.h Tue Oct 17 04:34:23 2023 -0500
+++ b/gplugin-gtk4/gplugin-gtk-plugin-closures.h Mon Nov 06 01:27:01 2023 -0600
@@ -29,6 +29,8 @@
#include <gplugin.h>
+#include "gplugin-gtk-version.h"
+
G_BEGIN_DECLS
G_GNUC_INTERNAL
--- a/gplugin-gtk4/gplugin-gtk-plugin-page.h Tue Oct 17 04:34:23 2023 -0500
+++ b/gplugin-gtk4/gplugin-gtk-plugin-page.h Mon Nov 06 01:27:01 2023 -0600
@@ -30,11 +30,13 @@
#include <gplugin.h>
+#include "gplugin-gtk-version.h"
+
G_BEGIN_DECLS
#define GPLUGIN_GTK_TYPE_PLUGIN_PAGE (gplugin_gtk_plugin_page_get_type())
-GPLUGIN_AVAILABLE_IN_0_39
+GPLUGIN_GTK_AVAILABLE_IN_0_39
G_DECLARE_FINAL_TYPE(
GPluginGtkPluginPage,
gplugin_gtk_plugin_page,
@@ -42,21 +44,21 @@
PLUGIN_PAGE,
GtkBox)
-GPLUGIN_AVAILABLE_IN_0_39
+GPLUGIN_GTK_AVAILABLE_IN_0_39
GtkWidget *gplugin_gtk_plugin_page_new(void);
-GPLUGIN_AVAILABLE_IN_0_39
+GPLUGIN_GTK_AVAILABLE_IN_0_39
void gplugin_gtk_plugin_page_set_plugin(
GPluginGtkPluginPage *page,
GPluginPlugin *plugin);
-GPLUGIN_AVAILABLE_IN_0_39
+GPLUGIN_GTK_AVAILABLE_IN_0_39
GPluginPlugin *gplugin_gtk_plugin_page_get_plugin(GPluginGtkPluginPage *page);
-GPLUGIN_AVAILABLE_IN_0_40
+GPLUGIN_GTK_AVAILABLE_IN_0_40
void gplugin_gtk_plugin_page_set_settings_backend(
GPluginGtkPluginPage *page,
gpointer backend);
-GPLUGIN_AVAILABLE_IN_0_40
+GPLUGIN_GTK_AVAILABLE_IN_0_40
gpointer gplugin_gtk_plugin_page_get_settings_backend(
GPluginGtkPluginPage *page);
--- a/gplugin-gtk4/gplugin-gtk-plugin-row.h Tue Oct 17 04:34:23 2023 -0500
+++ b/gplugin-gtk4/gplugin-gtk-plugin-row.h Mon Nov 06 01:27:01 2023 -0600
@@ -30,11 +30,13 @@
#include <gplugin.h>
+#include "gplugin-gtk-version.h"
+
G_BEGIN_DECLS
#define GPLUGIN_GTK_TYPE_PLUGIN_ROW (gplugin_gtk_plugin_row_get_type())
-GPLUGIN_AVAILABLE_IN_0_38
+GPLUGIN_GTK_AVAILABLE_IN_0_38
G_DECLARE_FINAL_TYPE(
GPluginGtkPluginRow,
gplugin_gtk_plugin_row,
@@ -42,18 +44,18 @@
PLUGIN_ROW,
GtkListBoxRow)
-GPLUGIN_AVAILABLE_IN_0_38
+GPLUGIN_GTK_AVAILABLE_IN_0_38
GtkWidget *gplugin_gtk_plugin_row_new(void);
-GPLUGIN_AVAILABLE_IN_0_38
+GPLUGIN_GTK_AVAILABLE_IN_0_38
void gplugin_gtk_plugin_row_set_plugin(
GPluginGtkPluginRow *row,
GPluginPlugin *plugin);
-GPLUGIN_AVAILABLE_IN_0_38
+GPLUGIN_GTK_AVAILABLE_IN_0_38
GPluginPlugin *gplugin_gtk_plugin_row_get_plugin(GPluginGtkPluginRow *row);
-GPLUGIN_AVAILABLE_IN_0_38
+GPLUGIN_GTK_AVAILABLE_IN_0_38
gchar *gplugin_gtk_plugin_row_get_sort_key(GPluginGtkPluginRow *row);
-GPLUGIN_AVAILABLE_IN_0_38
+GPLUGIN_GTK_AVAILABLE_IN_0_38
gboolean gplugin_gtk_plugin_row_matches_search(
GPluginGtkPluginRow *row,
const gchar *text);
--- a/gplugin-gtk4/gplugin-gtk-plugin-settings-list.h Tue Oct 17 04:34:23 2023 -0500
+++ b/gplugin-gtk4/gplugin-gtk-plugin-settings-list.h Mon Nov 06 01:27:01 2023 -0600
@@ -30,12 +30,14 @@
#include <gplugin.h>
+#include "gplugin-gtk-version.h"
+
G_BEGIN_DECLS
#define GPLUGIN_GTK_TYPE_PLUGIN_SETTINGS_LIST \
(gplugin_gtk_plugin_settings_list_get_type())
-GPLUGIN_AVAILABLE_IN_0_40
+GPLUGIN_GTK_AVAILABLE_IN_0_40
G_DECLARE_FINAL_TYPE(
GPluginGtkPluginSettingsList,
gplugin_gtk_plugin_settings_list,
@@ -43,14 +45,14 @@
PLUGIN_SETTINGS_LIST,
GtkBox)
-GPLUGIN_AVAILABLE_IN_0_40
+GPLUGIN_GTK_AVAILABLE_IN_0_40
GtkWidget *gplugin_gtk_plugin_settings_list_new(void);
-GPLUGIN_AVAILABLE_IN_0_40
+GPLUGIN_GTK_AVAILABLE_IN_0_40
void gplugin_gtk_plugin_settings_list_set_settings(
GPluginGtkPluginSettingsList *list,
GSettings *settings);
-GPLUGIN_AVAILABLE_IN_0_40
+GPLUGIN_GTK_AVAILABLE_IN_0_40
GSettings *gplugin_gtk_plugin_settings_list_get_settings(
GPluginGtkPluginSettingsList *list);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gplugin-gtk4/gplugin-gtk-version-defs.h.in Mon Nov 06 01:27:01 2023 -0600
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2011-2023 Gary Kramlich <grim@reaperworld.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <https://www.gnu.org/licenses/>.
+ */
+
+#if !defined(GPLUGIN_GTK_GLOBAL_HEADER_INSIDE) && !defined(GPLUGIN_GTK_COMPILATION)
+#error "only <gplugin-gtk.h> may be included directly"
+#endif
+
+#ifndef GPLUGIN_GTK_VERSION_DEFS_H
+#define GPLUGIN_GTK_VERSION_DEFS_H
+
+#define GPLUGIN_GTK_MAJOR_VERSION (@GPLUGIN_GTK_MAJOR_VERSION@)
+#define GPLUGIN_GTK_MINOR_VERSION (@GPLUGIN_GTK_MINOR_VERSION@)
+#define GPLUGIN_GTK_MICRO_VERSION (@GPLUGIN_GTK_MICRO_VERSION@)
+#define GPLUGIN_GTK_EXTRA_VERSION "@GPLUGIN_GTK_EXTRA_VERSION@"
+
+#define GPLUGIN_GTK_VERSION "@GPLUGIN_GTK_VERSION@"
+
+#endif /* GPLUGIN_GTK_VERSION_DEFS_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gplugin-gtk4/gplugin-gtk-version.c Mon Nov 06 01:27:01 2023 -0600
@@ -0,0 +1,112 @@
+/*
+ * Copyright (C) 2011-2023 Gary Kramlich <grim@reaperworld.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <https://www.gnu.org/licenses/>.
+ */
+
+#include "gplugin-gtk-version.h"
+
+/******************************************************************************
+ * GPluginGtkVersion API
+ *****************************************************************************/
+
+/**
+ * GPLUGIN_GTK_MAJOR_VERSION:
+ *
+ * This is the major version number of GPluginGtk that was compiled against.
+ */
+
+/**
+ * GPLUGIN_GTK_MINOR_VERSION:
+ *
+ * This is the minor version number of GPluginGtk that was compiled against.
+ */
+
+/**
+ * GPLUGIN_GTK_MICRO_VERSION:
+ *
+ * This is the micro version number of GPluginGtk that was compiled against.
+ */
+
+/**
+ * GPLUGIN_GTK_EXTRA_VERSION:
+ *
+ * This is the extra version string of GPluginGtk that was compiled against.
+ */
+
+/**
+ * GPLUGIN_GTK_VERSION:
+ *
+ * This is the string version number of GPluginGtk that was compiled against.
+ */
+
+/**
+ * GPLUGIN_GTK_VERSION_CHECK:
+ * @major: The major version to compare for.
+ * @minor: The minor version to compare for.
+ * @micro: The micro version to compare for.
+ *
+ * Checks the version of the GPluginGtk library that is being compiled
+ * against.
+ *
+ * Returns: %TRUE if the version of the GPluginGtk header files is the same as
+ * or newer than the passed-in version.
+ */
+
+/**
+ * gplugin_gtk_version_check:
+ * @major: The required major version.
+ * @minor: The required minor version.
+ * @micro: The required micro version.
+ *
+ * Checks that the GPluginGtk library in use is compatible with the given
+ * version.
+ *
+ * Generally you would pass in the constants [const@MAJOR_VERSION],
+ * [const@MINOR_VERSION], [const@MICRO_VERSION] as the three arguments to this
+ * function; that produces a check that the library in use is compatible with
+ * the version of GPluginGtk the application or module was compiled against.
+ *
+ * Compatibility is defined by two things: first the version of the running
+ * library is newer than the version @major.@minor.@micro. Second the running
+ * library must be binary compatible with the version @major.@minor.@micro
+ * (same major version).
+ *
+ * Returns: %NULL if the GPluginGtk library is compatible with the given
+ * version, or a string describing the version mismatch. The returned
+ * string is owned by GPluginGtk and must not be modified or freed.
+ */
+const gchar *
+gplugin_version_check(guint major, guint minor, guint micro)
+{
+ if(major > GPLUGIN_GTK_MAJOR_VERSION) {
+ return "gplugin version too old (major mismatch)";
+ }
+
+#if GPLUGIN_GTK_VERSION_CHECK(1, 0, 0)
+ if(major < GPLUGIN_GTK_MAJOR_VERSION) {
+ return "gplugin version too new (major mismatch)";
+ }
+#endif
+
+ if(minor > GPLUGIN_GTK_MINOR_VERSION) {
+ return "gplugin version too old (minor mismatch)";
+ }
+
+ if(minor == GPLUGIN_GTK_MINOR_VERSION && micro > GPLUGIN_GTK_MICRO_VERSION) {
+ return "gplugin version too old (micro mismatch)";
+ }
+
+ return NULL;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gplugin-gtk4/gplugin-gtk-version.h Mon Nov 06 01:27:01 2023 -0600
@@ -0,0 +1,310 @@
+/*
+ * Copyright (C) 2011-2023 Gary Kramlich <grim@reaperworld.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <https://www.gnu.org/licenses/>.
+ */
+
+#if !defined(GPLUGIN_GTK_GLOBAL_HEADER_INSIDE) && !defined(GPLUGIN_GTK_COMPILATION)
+#error "only <gplugin-gtk.h> may be included directly"
+#endif
+
+#ifndef GPLUGIN_GTK_VERSION_H
+#define GPLUGIN_GTK_VERSION_H
+
+#include <glib.h>
+
+#include "gplugin-gtk-version-defs.h"
+
+/* clang-format tries to remove the space after 'if', which confuses
+ * gobject-introspection, so turn it off temporarily. */
+/* clang-format off */
+#if (defined(_WIN32) || defined(__CYGWIN__)) && \
+ !defined(GPLUGIN_STATIC_COMPILATION)
+/* clang-format on */
+#define _GPLUGIN_GTK_EXPORT __declspec(dllexport)
+#define _GPLUGIN_GTK_IMPORT __declspec(dllimport)
+#elif __GNUC__ >= 4
+#define _GPLUGIN_GTK_EXPORT __attribute__((visibility("default")))
+#define _GPLUGIN_GTK_IMPORT
+#else
+#define _GPLUGIN_GTK_EXPORT
+#define _GPLUGIN_GTK_IMPORT
+#endif
+#ifdef GPLUGIN_GTK_COMPILATION
+#define _GPLUGIN_GTK_API _GPLUGIN_GTK_EXPORT
+#else
+#define _GPLUGIN_GTK_API _GPLUGIN_GTK_IMPORT
+#endif
+
+#define _GPLUGIN_GTK_EXTERN _GPLUGIN_GTK_API extern
+
+#ifdef GPLUGIN_GTK_DISABLE_DEPRECATION_WARNINGS
+#define GPLUGIN_GTK_DEPRECATED _GPLUGIN_GTK_EXTERN
+#define GPLUGIN_GTK_DEPRECATED_FOR(f) _GPLUGIN_GTK_EXTERN
+#define GPLUGIN_GTK_UNAVAILABLE(maj, min) _GPLUGIN_GTK_EXTERN
+#define GPLUGIN_GTK_UNAVAILABLE_STATIC_INLINE(maj, min)
+#define GPLUGIN_GTK_UNAVAILABLE_TYPE(maj, min)
+#else
+#define GPLUGIN_GTK_DEPRECATED G_DEPRECATED _GPLUGIN_GTK_EXTERN
+#define GPLUGIN_GTK_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) _GPLUGIN_GTK_EXTERN
+#define GPLUGIN_GTK_UNAVAILABLE(maj, min) G_UNAVAILABLE(maj, min) _GPLUGIN_GTK_EXTERN
+#define GPLUGIN_GTK_UNAVAILABLE_STATIC_INLINE(maj, min) G_UNAVAILABLE(maj, min)
+#define GPLUGIN_GTK_UNAVAILABLE_TYPE(maj, min) G_UNAVAILABLE(maj, min)
+#endif
+
+/**
+ * GPLUGIN_GTK_VERSION_CUR_STABLE:
+ *
+ * A macro that evaluates to the current stable version of GPlugin-Gtk, in a
+ * format that can be used by the C pre-processor.
+ *
+ * Since: 0.42.0
+ */
+#define GPLUGIN_GTK_VERSION_CUR_STABLE \
+ (G_ENCODE_VERSION(GPLUGIN_GTK_MAJOR_VERSION, GPLUGIN_GTK_MINOR_VERSION))
+
+/* If the package sets GPLUGIN_GTK_VERSION_MIN_REQUIRED to some future
+ * GPLUGIN_GTK_VERSION_X_Y value that we don't know about, it will compare as 0 in
+ * preprocessor tests.
+ */
+#ifndef GPLUGIN_GTK_VERSION_MIN_REQUIRED
+#define GPLUGIN_GTK_VERSION_MIN_REQUIRED (GPLUGIN_GTK_VERSION_CUR_STABLE)
+#elif GPLUGIN_GTK_VERSION_MIN_REQUIRED == 0
+#undef GPLUGIN_GTK_VERSION_MIN_REQUIRED
+#define GPLUGIN_GTK_VERSION_MIN_REQUIRED (GPLUGIN_GTK_VERSION_CUR_STABLE + 1)
+#endif /* GPLUGIN_GTK_VERSION_MIN_REQUIRED */
+
+#if !defined(GPLUGIN_GTK_VERSION_MAX_ALLOWED) || (GPLUGIN_GTK_VERSION_MAX_ALLOWED == 0)
+#undef GPLUGIN_GTK_VERSION_MAX_ALLOWED
+#define GPLUGIN_GTK_VERSION_MAX_ALLOWED (GPLUGIN_GTK_VERSION_CUR_STABLE)
+#endif /* GPLUGIN_GTK_VERSION_MAX_ALLOWED */
+
+/* sanity checks */
+#if GPLUGIN_GTK_VERSION_MIN_REQUIRED > GPLUGIN_GTK_VERSION_CUR_STABLE
+#error "GPLUGIN_GTK_VERSION_MIN_REQUIRED must be <= GPLUGIN_GTK_VERSION_CUR_STABLE"
+#endif
+#if GPLUGIN_GTK_VERSION_MAX_ALLOWED < GPLUGIN_GTK_VERSION_MIN_REQUIRED
+#error "GPLUGIN_GTK_VERSION_MAX_ALLOWED must be >= GPLUGIN_GTK_VERSION_MIN_REQUIRED"
+#endif
+#if GPLUGIN_GTK_VERSION_MIN_REQUIRED < G_ENCODE_VERSION(0, 38)
+#error "GPLUGIN_GTK_VERSION_MIN_REQUIRED must be >= GPLUGIN_GTK_VERSION_0_38"
+#endif
+
+#define GPLUGIN_GTK_AVAILABLE_IN_ALL _GPLUGIN_GTK_EXTERN
+
+/**
+ * GPLUGIN_GTK_VERSION_0_31:
+ *
+ * A macro that evaluates to the 0.31 version of GPlugin-Gtk, in a format that
+ * can be used by the C pre-processor.
+ *
+ * Since: 0.42.0
+ */
+#define GPLUGIN_GTK_VERSION_0_31 (G_ENCODE_VERSION(0, 31))
+
+#if GPLUGIN_GTK_VERSION_MAX_ALLOWED < GPLUGIN_GTK_VERSION_0_31
+#define GPLUGIN_GTK_AVAILABLE_MACRO_IN_0_31 GPLUGIN_GTK_UNAVAILABLE_MACRO(0, 31)
+#else
+#define GPLUGIN_GTK_AVAILABLE_MACRO_IN_0_31
+#endif
+
+/**
+ * GPLUGIN_GTK_VERSION_0_32:
+ *
+ * A macro that evaluates to the 0.32 version of GPlugin-Gtk, in a format that
+ * can be used by the C pre-processor.
+ *
+ * Since: 0.42.0
+ */
+#define GPLUGIN_GTK_VERSION_0_32 (G_ENCODE_VERSION(0, 32))
+
+#if GPLUGIN_GTK_VERSION_MAX_ALLOWED < GPLUGIN_GTK_VERSION_0_32
+#define GPLUGIN_GTK_AVAILABLE_IN_0_32 GPLUGIN_GTK_UNAVAILABLE(0, 32)
+#else
+#define GPLUGIN_GTK_AVAILABLE_IN_0_32 _GPLUGIN_GTK_EXTERN
+#endif
+
+/**
+ * GPLUGIN_GTK_VERSION_0_33:
+ *
+ * A macro that evaluates to the 0.33 version of GPlugin-Gtk, in a format that
+ * can be used by the C pre-processor.
+ *
+ * Since: 0.42.0
+ */
+#define GPLUGIN_GTK_VERSION_0_33 (G_ENCODE_VERSION(0, 33))
+
+#if GPLUGIN_GTK_VERSION_MAX_ALLOWED < GPLUGIN_GTK_VERSION_0_33
+#define GPLUGIN_GTK_AVAILABLE_IN_0_33 GPLUGIN_GTK_UNAVAILABLE(0, 33)
+#else
+#define GPLUGIN_GTK_AVAILABLE_IN_0_33 _GPLUGIN_GTK_EXTERN
+#endif
+
+/**
+ * GPLUGIN_GTK_VERSION_0_34:
+ *
+ * A macro that evaluates to the 0.34 version of GPlugin-Gtk, in a format that
+ * can be used by the C pre-processor.
+ *
+ * Since: 0.42.0
+ */
+#define GPLUGIN_GTK_VERSION_0_34 (G_ENCODE_VERSION(0, 34))
+
+#if GPLUGIN_GTK_VERSION_MAX_ALLOWED < GPLUGIN_GTK_VERSION_0_34
+#define GPLUGIN_GTK_AVAILABLE_IN_0_34 GPLUGIN_GTK_UNAVAILABLE(0, 34)
+#else
+#define GPLUGIN_GTK_AVAILABLE_IN_0_34 _GPLUGIN_GTK_EXTERN
+#endif
+
+/**
+ * GPLUGIN_GTK_VERSION_0_35:
+ *
+ * A macro that evaluates to the 0.35 version of GPlugin-Gtk, in a format that
+ * can be used by the C pre-processor.
+ *
+ * Since: 0.42.0
+ */
+#define GPLUGIN_GTK_VERSION_0_35 (G_ENCODE_VERSION(0, 35))
+
+#if GPLUGIN_GTK_VERSION_MAX_ALLOWED < GPLUGIN_GTK_VERSION_0_35
+#define GPLUGIN_GTK_AVAILABLE_IN_0_35 GPLUGIN_GTK_UNAVAILABLE(0, 35)
+#else
+#define GPLUGIN_GTK_AVAILABLE_IN_0_35 _GPLUGIN_GTK_EXTERN
+#endif
+
+/**
+ * GPLUGIN_GTK_VERSION_0_36:
+ *
+ * A macro that evaluates to the 0.36 version of GPlugin-Gtk, in a format that
+ * can be used by the C pre-processor.
+ *
+ * Since: 0.42.0
+ */
+#define GPLUGIN_GTK_VERSION_0_36 (G_ENCODE_VERSION(0, 36))
+
+/**
+ * GPLUGIN_GTK_VERSION_0_37:
+ *
+ * A macro that evaluates to the 0.37 version of GPlugin-Gtk, in a format that
+ * can be used by the C pre-processor.
+ *
+ * Since: 0.42.0
+ */
+#define GPLUGIN_GTK_VERSION_0_37 (G_ENCODE_VERSION(0, 37))
+
+#if GPLUGIN_GTK_VERSION_MAX_ALLOWED < GPLUGIN_GTK_VERSION_0_37
+#define GPLUGIN_GTK_AVAILABLE_IN_0_37 GPLUGIN_GTK_UNAVAILABLE(0, 37)
+#else
+#define GPLUGIN_GTK_AVAILABLE_IN_0_37 _GPLUGIN_GTK_EXTERN
+#endif
+
+/**
+ * GPLUGIN_GTK_VERSION_0_38:
+ *
+ * A macro that evaluates to the 0.38 version of GPlugin-Gtk, in a format that
+ * can be used by the C pre-processor.
+ *
+ * Since: 0.42.0
+ */
+#define GPLUGIN_GTK_VERSION_0_38 (G_ENCODE_VERSION(0, 38))
+
+#if GPLUGIN_GTK_VERSION_MAX_ALLOWED < GPLUGIN_GTK_VERSION_0_38
+#define GPLUGIN_GTK_AVAILABLE_IN_0_38 GPLUGIN_GTK_UNAVAILABLE(0, 38)
+#else
+#define GPLUGIN_GTK_AVAILABLE_IN_0_38 _GPLUGIN_GTK_EXTERN
+#endif
+
+/**
+ * GPLUGIN_GTK_VERSION_0_39:
+ *
+ * A macro that evaluates to the 0.39 version of GPlugin-Gtk, in a format that
+ * can be used by the C pre-processor.
+ *
+ * Since: 0.42.0
+ */
+#define GPLUGIN_GTK_VERSION_0_39 (G_ENCODE_VERSION(0, 39))
+
+#if GPLUGIN_GTK_VERSION_MIN_REQUIRED >= GPLUGIN_GTK_VERSION_0_39
+#define GPLUGIN_GTK_DEPRECATED_IN_0_39_FOR(f) GPLUGIN_GTK_DEPRECATED_FOR(f)
+#else
+#define GPLUGIN_GTK_DEPRECATED_IN_0_39_FOR(f) _GPLUGIN_GTK_EXTERN
+#endif
+
+#if GPLUGIN_GTK_VERSION_MAX_ALLOWED < GPLUGIN_GTK_VERSION_0_39
+#define GPLUGIN_GTK_AVAILABLE_IN_0_39 GPLUGIN_GTK_UNAVAILABLE(0, 39)
+#else
+#define GPLUGIN_GTK_AVAILABLE_IN_0_39 _GPLUGIN_GTK_EXTERN
+#endif
+
+/**
+ * GPLUGIN_GTK_VERSION_0_40:
+ *
+ * A macro that evaluates to the 0.40 version of GPlugin-Gtk, in a format that
+ * can be used by the C pre-processor.
+ *
+ * Since: 0.42.0
+ */
+#define GPLUGIN_GTK_VERSION_0_40 (G_ENCODE_VERSION(0, 40))
+
+#if GPLUGIN_GTK_VERSION_MAX_ALLOWED < GPLUGIN_GTK_VERSION_0_40
+#define GPLUGIN_GTK_AVAILABLE_IN_0_40 GPLUGIN_GTK_UNAVAILABLE(0, 40)
+#else
+#define GPLUGIN_GTK_AVAILABLE_IN_0_40 _GPLUGIN_GTK_EXTERN
+#endif
+
+/**
+ * GPLUGIN_GTK_VERSION_0_41:
+ *
+ * A macro that evaluates to the 0.41 version of GPlugin-Gtk, in a format that
+ * can be used by the C pre-processor.
+ *
+ * Since: 0.42.0
+ */
+#define GPLUGIN_GTK_VERSION_0_41 (G_ENCODE_VERSION(0, 41))
+
+#if GPLUGIN_GTK_VERSION_MAX_ALLOWED < GPLUGIN_GTK_VERSION_0_41
+#define GPLUGIN_GTK_AVAILABLE_IN_0_41 GPLUGIN_GTK_UNAVAILABLE(0, 41)
+#else
+#define GPLUGIN_GTK_AVAILABLE_IN_0_41 _GPLUGIN_GTK_EXTERN
+#endif
+
+/**
+ * GPLUGIN_GTK_VERSION_0_42:
+ *
+ * A macro that evaluates to the 0.42 version of GPlugin-Gtk, in a format that
+ * can be used by the C pre-processor.
+ *
+ * Since: 0.42.0
+ */
+#define GPLUGIN_GTK_VERSION_0_42 (G_ENCODE_VERSION(0, 42))
+
+#if GPLUGIN_GTK_VERSION_MAX_ALLOWED < GPLUGIN_GTK_VERSION_0_42
+#define GPLUGIN_GTK_AVAILABLE_IN_0_42 GPLUGIN_GTK_UNAVAILABLE(0, 42)
+#else
+#define GPLUGIN_GTK_AVAILABLE_IN_0_42 _GPLUGIN_GTK_EXTERN
+#endif
+
+#define GPLUGIN_GTK_VERSION_CHECK(major, minor, micro) \
+ ((major) == GPLUGIN_GTK_MAJOR_VERSION && \
+ ((minor) < GPLUGIN_GTK_MINOR_VERSION || \
+ ((minor) == GPLUGIN_GTK_MINOR_VERSION && (micro) <= GPLUGIN_GTK_MICRO_VERSION)))
+
+G_BEGIN_DECLS
+
+GPLUGIN_GTK_AVAILABLE_IN_ALL
+const gchar *gplugin_gtk_version_check(guint major, guint minor, guint micro);
+
+G_END_DECLS
+
+#endif /* GPLUGIN_GTK_VERSION_H */
--- a/gplugin-gtk4/gplugin-gtk-view.h Tue Oct 17 04:34:23 2023 -0500
+++ b/gplugin-gtk4/gplugin-gtk-view.h Mon Nov 06 01:27:01 2023 -0600
@@ -30,11 +30,13 @@
#include <gplugin.h>
+#include "gplugin-gtk-version.h"
+
G_BEGIN_DECLS
#define GPLUGIN_GTK_TYPE_VIEW (gplugin_gtk_view_get_type())
-GPLUGIN_AVAILABLE_IN_ALL
+GPLUGIN_GTK_AVAILABLE_IN_ALL
G_DECLARE_FINAL_TYPE(
GPluginGtkView,
gplugin_gtk_view,
@@ -42,33 +44,33 @@
VIEW,
GtkBox)
-GPLUGIN_AVAILABLE_IN_ALL
+GPLUGIN_GTK_AVAILABLE_IN_ALL
GtkWidget *gplugin_gtk_view_new(void);
-GPLUGIN_AVAILABLE_IN_ALL
+GPLUGIN_GTK_AVAILABLE_IN_ALL
void gplugin_gtk_view_set_manager(
GPluginGtkView *view,
GPluginManager *manager);
-GPLUGIN_AVAILABLE_IN_ALL
+GPLUGIN_GTK_AVAILABLE_IN_ALL
GPluginManager *gplugin_gtk_view_get_manager(GPluginGtkView *view);
-GPLUGIN_AVAILABLE_IN_ALL
+GPLUGIN_GTK_AVAILABLE_IN_ALL
void gplugin_gtk_view_set_show_internal(
GPluginGtkView *view,
gboolean show_internal);
-GPLUGIN_AVAILABLE_IN_ALL
+GPLUGIN_GTK_AVAILABLE_IN_ALL
gboolean gplugin_gtk_view_get_show_internal(GPluginGtkView *view);
-GPLUGIN_AVAILABLE_IN_0_40
+GPLUGIN_GTK_AVAILABLE_IN_0_40
void gplugin_gtk_view_set_settings_backend(
GPluginGtkView *view,
gpointer backend);
-GPLUGIN_AVAILABLE_IN_0_40
+GPLUGIN_GTK_AVAILABLE_IN_0_40
gpointer gplugin_gtk_view_get_settings_backend(GPluginGtkView *view);
-GPLUGIN_AVAILABLE_IN_0_39
+GPLUGIN_GTK_AVAILABLE_IN_0_39
void gplugin_gtk_view_show_overview(GPluginGtkView *view);
-GPLUGIN_AVAILABLE_IN_0_39
+GPLUGIN_GTK_AVAILABLE_IN_0_39
void gplugin_gtk_view_show_plugin(GPluginGtkView *view, GPluginPlugin *plugin);
G_END_DECLS
--- a/gplugin-gtk4/meson.build Tue Oct 17 04:34:23 2023 -0500
+++ b/gplugin-gtk4/meson.build Mon Nov 06 01:27:01 2023 -0600
@@ -6,13 +6,21 @@
###############################################################################
# Build Info
###############################################################################
+GPLUGIN_GTK4_LIBRARY_VERSION = '0.1.0'
-GPLUGIN_GTK4_LIBRARY_VERSION = '0.1.0'
+gtk_version_conf = configuration_data()
+gtk_version_conf.set('GPLUGIN_GTK_MAJOR_VERSION', GPLUGIN_MAJOR_VERSION)
+gtk_version_conf.set('GPLUGIN_GTK_MINOR_VERSION', GPLUGIN_MINOR_VERSION)
+gtk_version_conf.set('GPLUGIN_GTK_MICRO_VERSION', GPLUGIN_MICRO_VERSION)
+gtk_version_conf.set('GPLUGIN_GTK_EXTRA_VERSION', GPLUGIN_EXTRA_VERSION)
+gtk_version_conf.set('GPLUGIN_GTK_VERSION', meson.project_version())
+
GPLUGIN_GTK4_SOURCES = [
'gplugin-gtk-plugin-page.c',
'gplugin-gtk-plugin-row.c',
'gplugin-gtk-plugin-settings-list.c',
+ 'gplugin-gtk-version.c',
'gplugin-gtk-view.c',
]
@@ -20,6 +28,7 @@
'gplugin-gtk-plugin-page.h',
'gplugin-gtk-plugin-row.h',
'gplugin-gtk-plugin-settings-list.h',
+ 'gplugin-gtk-version.h',
'gplugin-gtk-view.h',
]
@@ -43,8 +52,17 @@
###############################################################################
# Configure Files
###############################################################################
+gplugin_gtk4_version_h = configure_file(
+ input : 'gplugin-gtk-version-defs.h.in',
+ output : 'gplugin-gtk-version-defs.h',
+ configuration : gtk_version_conf,
+ install : true,
+ install_dir : get_option('includedir') / 'gplugin-gtk4-1.0' / 'gplugin-gtk4'
+)
+GPLUGIN_GTK4_PUBLIC_BUILT_HEADERS += [gplugin_gtk4_version_h]
+
GPLUGIN_GTK4_H_INCLUDES = []
-foreach header : GPLUGIN_GTK4_HEADERS
+foreach header : GPLUGIN_GTK4_HEADERS + ['gplugin-gtk-version-defs.h']
GPLUGIN_GTK4_H_INCLUDES += f'#include <gplugin-gtk4/@header@>'
endforeach
@@ -69,6 +87,8 @@
###############################################################################
# Library Target
###############################################################################
+gplugin_gtk4_inc = include_directories('.')
+
gplugin_gtk4 = library('gplugin-gtk4',
GPLUGIN_GTK4_SOURCES,
GPLUGIN_GTK4_HEADERS,
@@ -78,14 +98,12 @@
GPLUGIN_GTK4_PUBLIC_BUILT_HEADERS,
gplugin_gtk4_resources,
c_args : ['-DGPLUGIN_GTK_COMPILATION', '-DG_LOG_USE_STRUCTURED', '-DG_LOG_DOMAIN="GPlugin-Gtk"'],
- include_directories : toplevel_inc,
+ include_directories : [toplevel_inc, gplugin_gtk4_inc],
dependencies : [gplugin_dep, GTK4],
version : GPLUGIN_GTK4_LIBRARY_VERSION,
install : true
)
-gplugin_gtk4_inc = include_directories('.')
-
pkgconfig.generate(
gplugin_gtk4,
name : 'gplugin-gtk4',
--- a/meson.build Tue Oct 17 04:34:23 2023 -0500
+++ b/meson.build Mon Nov 06 01:27:01 2023 -0600
@@ -16,13 +16,17 @@
parts = parts[0].split('.')
GPLUGIN_MAJOR_VERSION = parts[0]
+GPLUGIN_MINOR_VERSION = parts[1]
+GPLUGIN_MICRO_VERSION = parts[2]
+GPLUGIN_EXTRA_VERSION = extra
+GPLUGIN_VERSION = meson.project_version()
version_conf = configuration_data()
version_conf.set('GPLUGIN_MAJOR_VERSION', GPLUGIN_MAJOR_VERSION)
-version_conf.set('GPLUGIN_MINOR_VERSION', parts[1])
-version_conf.set('GPLUGIN_MICRO_VERSION', parts[2])
-version_conf.set('GPLUGIN_EXTRA_VERSION', extra)
-version_conf.set('GPLUGIN_VERSION', meson.project_version())
+version_conf.set('GPLUGIN_MINOR_VERSION', GPLUGIN_MINOR_VERSION)
+version_conf.set('GPLUGIN_MICRO_VERSION', GPLUGIN_MICRO_VERSION)
+version_conf.set('GPLUGIN_EXTRA_VERSION', GPLUGIN_EXTRA_VERSION)
+version_conf.set('GPLUGIN_VERSION', GPLUGIN_VERSION)
###############################################################################
# Dependencies