# HG changeset patch
# Node ID 938ade7a8b41
# Parent  6a1d00924a16
diff --git a/gplugin/gplugin-core.h b/gplugin/gplugin-core.h
--- a/gplugin/gplugin-core.h
+++ b/gplugin/gplugin-core.h
@@ -25,6 +25,8 @@
 #include <glib.h>
 #include <glib-object.h>
 
+#include <gplugin/gplugin-version.h>
+
 #define GPLUGIN_DOMAIN (g_quark_from_static_string("gplugin"))
 
 /* clang-format off */
@@ -37,9 +39,13 @@
 
 G_BEGIN_DECLS
 
+GPLUGIN_AVAILABLE_IN_ALL
 void gplugin_init(GPluginCoreFlags flags);
+
+GPLUGIN_AVAILABLE_IN_ALL
 void gplugin_uninit(void);
 
+GPLUGIN_AVAILABLE_IN_ALL
 GPluginCoreFlags gplugin_get_flags(void);
 
 G_END_DECLS
diff --git a/gplugin/gplugin-file-tree.h b/gplugin/gplugin-file-tree.h
--- a/gplugin/gplugin-file-tree.h
+++ b/gplugin/gplugin-file-tree.h
@@ -20,6 +20,8 @@
 
 #include <glib.h>
 
+#include <gplugin/gplugin-version.h>
+
 typedef struct {
 	gchar *filename;
 	gchar *extension;
@@ -27,7 +29,10 @@
 
 G_BEGIN_DECLS
 
+GPLUGIN_AVAILABLE_IN_ALL
 GNode *gplugin_file_tree_new(GList *paths);
+
+GPLUGIN_AVAILABLE_IN_ALL
 void gplugin_file_tree_free(GNode *root);
 
 G_END_DECLS
diff --git a/gplugin/gplugin-loader.h b/gplugin/gplugin-loader.h
--- a/gplugin/gplugin-loader.h
+++ b/gplugin/gplugin-loader.h
@@ -25,6 +25,8 @@
 #include <glib.h>
 #include <glib-object.h>
 
+#include <gplugin/gplugin-version.h>
+
 G_BEGIN_DECLS
 
 #define GPLUGIN_TYPE_LOADER (gplugin_loader_get_type())
@@ -60,19 +62,25 @@
 	gpointer reserved[4];
 };
 
+GPLUGIN_AVAILABLE_IN_ALL
 const gchar *gplugin_loader_get_id(GPluginLoader *loader);
 
+GPLUGIN_AVAILABLE_IN_ALL
 GSList *gplugin_loader_get_supported_extensions(GPluginLoader *loader);
 
+GPLUGIN_AVAILABLE_IN_ALL
 GPluginPlugin *gplugin_loader_query_plugin(
 	GPluginLoader *loader,
 	const gchar *filename,
 	GError **error);
 
+GPLUGIN_AVAILABLE_IN_ALL
 gboolean gplugin_loader_load_plugin(
 	GPluginLoader *loader,
 	GPluginPlugin *plugin,
 	GError **error);
+
+GPLUGIN_AVAILABLE_IN_ALL
 gboolean gplugin_loader_unload_plugin(
 	GPluginLoader *loader,
 	GPluginPlugin *plugin,
diff --git a/gplugin/gplugin-manager.h b/gplugin/gplugin-manager.h
--- a/gplugin/gplugin-manager.h
+++ b/gplugin/gplugin-manager.h
@@ -26,6 +26,7 @@
 #include <glib-object.h>
 
 #include <gplugin/gplugin-plugin.h>
+#include <gplugin/gplugin-version.h>
 
 G_BEGIN_DECLS
 
@@ -37,75 +38,111 @@
 	GSList *plugins,
 	gpointer data);
 
+GPLUGIN_AVAILABLE_IN_ALL
 void gplugin_manager_append_path(GPluginManager *manager, const gchar *path);
+
+GPLUGIN_AVAILABLE_IN_ALL
 void gplugin_manager_prepend_path(GPluginManager *manager, const gchar *path);
+
+GPLUGIN_AVAILABLE_IN_ALL
 void gplugin_manager_remove_path(GPluginManager *manager, const gchar *path);
+
+GPLUGIN_AVAILABLE_IN_ALL
 void gplugin_manager_remove_paths(GPluginManager *manager);
 
+GPLUGIN_AVAILABLE_IN_ALL
 void gplugin_manager_add_default_paths(GPluginManager *manager);
+
+GPLUGIN_AVAILABLE_IN_ALL
 void gplugin_manager_add_app_paths(
 	GPluginManager *manager,
 	const gchar *prefix,
 	const gchar *appname);
+
+GPLUGIN_AVAILABLE_IN_ALL
 void gplugin_manager_append_paths_from_environment(
 	GPluginManager *manager,
 	const gchar *name);
+
+GPLUGIN_AVAILABLE_IN_ALL
 void gplugin_manager_prepend_paths_from_environment(
 	GPluginManager *manager,
 	const gchar *name);
 
+GPLUGIN_AVAILABLE_IN_ALL
 GList *gplugin_manager_get_paths(GPluginManager *manager);
 
+GPLUGIN_AVAILABLE_IN_ALL
 gboolean gplugin_manager_register_loader(
 	GPluginManager *manager,
 	GPluginLoader *loader,
 	GError **error);
+
+GPLUGIN_AVAILABLE_IN_ALL
 gboolean gplugin_manager_unregister_loader(
 	GPluginManager *manager,
 	GPluginLoader *loader,
 	GError **error);
+
+GPLUGIN_AVAILABLE_IN_ALL
 GList *gplugin_manager_get_loaders(GPluginManager *manager);
 
+GPLUGIN_AVAILABLE_IN_ALL
 void gplugin_manager_refresh(GPluginManager *manager);
 
+GPLUGIN_AVAILABLE_IN_ALL
 void gplugin_manager_foreach(
 	GPluginManager *manager,
 	GPluginManagerForeachFunc func,
 	gpointer data);
 
+GPLUGIN_AVAILABLE_IN_ALL
 GSList *gplugin_manager_find_plugins(GPluginManager *manager, const gchar *id);
+
+GPLUGIN_AVAILABLE_IN_ALL
 GSList *gplugin_manager_find_plugins_with_version(
 	GPluginManager *manager,
 	const gchar *id,
 	const gchar *op,
 	const gchar *version);
+
+GPLUGIN_AVAILABLE_IN_ALL
 GSList *gplugin_manager_find_plugins_with_state(
 	GPluginManager *manager,
 	GPluginPluginState state);
 
+GPLUGIN_AVAILABLE_IN_ALL
 GPluginPlugin *gplugin_manager_find_plugin(
 	GPluginManager *manager,
 	const gchar *id);
+
+GPLUGIN_AVAILABLE_IN_ALL
 GPluginPlugin *gplugin_manager_find_plugin_with_newest_version(
 	GPluginManager *manager,
 	const gchar *id);
 
+GPLUGIN_AVAILABLE_IN_ALL
 GSList *gplugin_manager_get_plugin_dependencies(
 	GPluginManager *manager,
 	GPluginPlugin *plugin,
 	GError **error);
 
+GPLUGIN_AVAILABLE_IN_ALL
 gboolean gplugin_manager_load_plugin(
 	GPluginManager *manager,
 	GPluginPlugin *plugin,
 	GError **error);
+
+GPLUGIN_AVAILABLE_IN_ALL
 gboolean gplugin_manager_unload_plugin(
 	GPluginManager *manager,
 	GPluginPlugin *plugin,
 	GError **error);
 
+GPLUGIN_AVAILABLE_IN_ALL
 GList *gplugin_manager_list_plugins(GPluginManager *manager);
 
+GPLUGIN_AVAILABLE_IN_ALL
 GPluginManager *gplugin_manager_get_default(void);
 
 G_END_DECLS
diff --git a/gplugin/gplugin-native-loader.h b/gplugin/gplugin-native-loader.h
--- a/gplugin/gplugin-native-loader.h
+++ b/gplugin/gplugin-native-loader.h
@@ -26,6 +26,7 @@
 #include <glib-object.h>
 
 #include <gplugin/gplugin-loader.h>
+#include <gplugin/gplugin-version.h>
 
 #define GPLUGIN_NATIVE_PLUGIN_ABI_VERSION 0x01000000
 
@@ -39,6 +40,7 @@
 	NATIVE_LOADER,
 	GPluginLoader)
 
+GPLUGIN_AVAILABLE_IN_ALL
 GPluginLoader *gplugin_native_loader_new(void);
 
 G_END_DECLS
diff --git a/gplugin/gplugin-native-plugin.h b/gplugin/gplugin-native-plugin.h
--- a/gplugin/gplugin-native-plugin.h
+++ b/gplugin/gplugin-native-plugin.h
@@ -26,6 +26,7 @@
 
 #include <gplugin/gplugin-plugin-info.h>
 #include <gplugin/gplugin-plugin.h>
+#include <gplugin/gplugin-version.h>
 
 G_BEGIN_DECLS
 
@@ -47,6 +48,7 @@
 typedef gboolean (*GPluginNativePluginUnloadFunc)(GPluginPlugin *plugin, gboolean shutdown, GError **error);
 /* clang-format on */
 
+GPLUGIN_AVAILABLE_IN_ALL
 GModule *gplugin_native_plugin_get_module(GPluginNativePlugin *plugin);
 
 #define GPLUGIN_NATIVE_PLUGIN_DECLARE(name) \
diff --git a/gplugin/gplugin-options.h b/gplugin/gplugin-options.h
--- a/gplugin/gplugin-options.h
+++ b/gplugin/gplugin-options.h
@@ -24,8 +24,11 @@
 
 #include <glib.h>
 
+#include <gplugin/gplugin-version.h>
+
 G_BEGIN_DECLS
 
+GPLUGIN_AVAILABLE_IN_ALL
 GOptionGroup *gplugin_get_option_group(void);
 
 G_END_DECLS
diff --git a/gplugin/gplugin-plugin-info.h b/gplugin/gplugin-plugin-info.h
--- a/gplugin/gplugin-plugin-info.h
+++ b/gplugin/gplugin-plugin-info.h
@@ -54,27 +54,68 @@
 		__VA_ARGS__))
 /* clang-format on */
 
+GPLUGIN_AVAILABLE_IN_ALL
 const gchar *gplugin_plugin_info_get_id(GPluginPluginInfo *info);
+
+GPLUGIN_AVAILABLE_IN_ALL
 gchar *gplugin_plugin_info_get_id_normalized(GPluginPluginInfo *info);
+
+GPLUGIN_AVAILABLE_IN_ALL
 const gchar *const *gplugin_plugin_info_get_provides(GPluginPluginInfo *info);
+
+GPLUGIN_AVAILABLE_IN_ALL
 gint gplugin_plugin_info_get_priority(GPluginPluginInfo *info);
+
+GPLUGIN_AVAILABLE_IN_ALL
 guint32 gplugin_plugin_info_get_abi_version(GPluginPluginInfo *info);
+
+GPLUGIN_AVAILABLE_IN_ALL
 gboolean gplugin_plugin_info_get_internal(GPluginPluginInfo *info);
+
+GPLUGIN_AVAILABLE_IN_ALL
 gboolean gplugin_plugin_info_get_load_on_query(GPluginPluginInfo *info);
+
+GPLUGIN_AVAILABLE_IN_ALL
 const gchar *gplugin_plugin_info_get_name(GPluginPluginInfo *info);
+
+GPLUGIN_AVAILABLE_IN_ALL
 const gchar *gplugin_plugin_info_get_version(GPluginPluginInfo *info);
+
+GPLUGIN_AVAILABLE_IN_ALL
 const gchar *gplugin_plugin_info_get_license_id(GPluginPluginInfo *info);
+
+GPLUGIN_AVAILABLE_IN_ALL
 const gchar *gplugin_plugin_info_get_license_text(GPluginPluginInfo *info);
+
+GPLUGIN_AVAILABLE_IN_ALL
 const gchar *gplugin_plugin_info_get_license_url(GPluginPluginInfo *info);
+
+GPLUGIN_AVAILABLE_IN_ALL
 const gchar *gplugin_plugin_info_get_icon_name(GPluginPluginInfo *info);
+
+GPLUGIN_AVAILABLE_IN_ALL
 const gchar *gplugin_plugin_info_get_summary(GPluginPluginInfo *info);
+
+GPLUGIN_AVAILABLE_IN_ALL
 const gchar *gplugin_plugin_info_get_description(GPluginPluginInfo *info);
+
+GPLUGIN_AVAILABLE_IN_ALL
 const gchar *gplugin_plugin_info_get_category(GPluginPluginInfo *info);
+
+GPLUGIN_AVAILABLE_IN_ALL
 const gchar *const *gplugin_plugin_info_get_authors(GPluginPluginInfo *info);
+
+GPLUGIN_AVAILABLE_IN_ALL
 const gchar *gplugin_plugin_info_get_website(GPluginPluginInfo *info);
+
+GPLUGIN_AVAILABLE_IN_ALL
 const gchar *const *gplugin_plugin_info_get_dependencies(
 	GPluginPluginInfo *info);
+
+GPLUGIN_AVAILABLE_IN_ALL
 gboolean gplugin_plugin_info_get_bind_global(GPluginPluginInfo *info);
+
+GPLUGIN_AVAILABLE_IN_ALL
 gboolean gplugin_plugin_info_get_unloadable(GPluginPluginInfo *info);
 
 G_END_DECLS
diff --git a/gplugin/gplugin-plugin.h b/gplugin/gplugin-plugin.h
--- a/gplugin/gplugin-plugin.h
+++ b/gplugin/gplugin-plugin.h
@@ -25,6 +25,8 @@
 #include <glib.h>
 #include <glib-object.h>
 
+#include <gplugin/gplugin-version.h>
+
 /* clang-format off */
 typedef enum /*< prefix=GPLUGIN_PLUGIN_STATE,underscore_name=GPLUGIN_PLUGIN_STATE >*/ {
 	GPLUGIN_PLUGIN_STATE_UNKNOWN = -1,
@@ -63,20 +65,33 @@
 	gpointer reserved[8];
 };
 
+GPLUGIN_AVAILABLE_IN_ALL
 gchar *gplugin_plugin_get_filename(GPluginPlugin *plugin);
+
+GPLUGIN_AVAILABLE_IN_ALL
 GPluginLoader *gplugin_plugin_get_loader(GPluginPlugin *plugin);
+
+GPLUGIN_AVAILABLE_IN_ALL
 GPluginPluginInfo *gplugin_plugin_get_info(GPluginPlugin *plugin);
 
+GPLUGIN_AVAILABLE_IN_ALL
 GPluginPluginState gplugin_plugin_get_state(GPluginPlugin *plugin);
+
+GPLUGIN_AVAILABLE_IN_ALL
 void gplugin_plugin_set_state(GPluginPlugin *plugin, GPluginPluginState state);
 
+GPLUGIN_AVAILABLE_IN_ALL
 GPluginPluginState gplugin_plugin_get_desired_state(GPluginPlugin *plugin);
+
+GPLUGIN_AVAILABLE_IN_ALL
 void gplugin_plugin_set_desired_state(
 	GPluginPlugin *plugin,
 	GPluginPluginState state);
 
+GPLUGIN_AVAILABLE_IN_ALL
 GError *gplugin_plugin_get_error(GPluginPlugin *plugin);
 
+GPLUGIN_AVAILABLE_IN_ALL
 const gchar *gplugin_plugin_state_to_string(GPluginPluginState state);
 
 G_END_DECLS
diff --git a/gplugin/gplugin-version.h b/gplugin/gplugin-version.h
--- a/gplugin/gplugin-version.h
+++ b/gplugin/gplugin-version.h
@@ -22,15 +22,77 @@
 #ifndef GPLUGIN_VERSION_H
 #define GPLUGIN_VERSION_H
 
+#include <glib.h>
+
 #include <gplugin/gplugin-version-defs.h>
 
+#ifndef _GPLUGIN_EXTERN
+#define _GPLUGIN_EXTERN extern
+#endif /* _GPLUGIN_EXTERN */
+
+#ifdef GPLUGIN_DISABLE_DEPRECATION_WARNINGS
+#define GPLUGIN_DEPRECATED _GPLUGIN_EXTERN
+#define GPLUGIN_DEPRECATED_FOR(f) _GPLUGIN_EXTERN
+#define GPLUGIN_UNAVAILABLE(maj, min) _GPLUGIN_EXTERN
+#else
+#define GPLUGIN_DEPRECATED G_DEPRECATED _GPLUGIN_EXTERN
+#define GPLUGIN_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) _GPLUGIN_EXTERN
+#define GPLUGIN_UNAVAILABLE(maj, min) G_UNAVAILABLE(maj, min) _GPLUGIN_EXTERN
+#endif
+
+#define GPLUGIN_VERSION_0_38 (G_ENCODE_VERSION(0, 38))
+
+#define GPLUGIN_VERSION_CUR_STABLE \
+	(G_ENCODE_VERSION(GPLUGIN_MAJOR_VERSION, GPLUGIN_MINOR_VERSION))
+
+/* If the package sets GPLUGIN_VERSION_MIN_REQUIRED to some future
+ * GPLUGIN_VERSION_X_Y value that we don't know about, it will compare as 0 in
+ * preprocessor tests.
+ */
+#ifndef GPLUGIN_VERSION_MIN_REQUIRED
+#define GPLUGIN_VERSION_MIN_REQUIRED (GPLUGIN_VERSION_CUR_STABLE)
+#elif GPLUGIN_VERSION_MIN_REQUIRED == 0
+#undef GPLUGIN_VERSION_MIN_REQUIRED
+#define GPLUGIN_VERSION_MIN_REQUIRED (GPLUGIN_VERSION_CUR_STABLE + 1)
+#endif /* GPLUGIN_VERSION_MIN_REQUIRED */
+
+#if !defined(GPLUGIN_VERSION_MAX_ALLOWED) || (GPLUGIN_VERSION_MAX_ALLOWED == 0)
+#undef GPLUGIN_VERSION_MAX_ALLOWED
+#define GPLUGIN_VERSION_MAX_ALLOWED (GPLUGIN_VERSION_CUR_STABLE)
+#endif /* GPLUGIN_VERSION_MAX_ALLOWED */
+
+/* sanity checks */
+#if GPLUGIN_VERSION_MIN_REQUIRED > GPLUGIN_VERSION_CUR_STABLE
+#error "GPLUGIN_VERSION_MIN_REQUIRED must be <= GPLUGIN_VERSION_CUR_STABLE"
+#endif
+#if GPLUGIN_VERSION_MAX_ALLOWED < GPLUGIN_VERSION_MIN_REQUIRED
+#error "GPLUGIN_VERSION_MAX_ALLOWED must be >= GPLUGIN_VERSION_MIN_REQUIRED"
+#endif
+#if GPLUGIN_VERSION_MIN_REQUIRED < GPLUGIN_VERSION_0_38
+#error "GPLUGIN_VERSION_MIN_REQUIRED must be >= GPLUGIN_VERSION_0_38"
+#endif
+
+#define GPLUGIN_AVAILABLE_IN_ALL _GPLUGIN_EXTERN
+
+#if GPLUGIN_VERSION_MIN_REQUIRED >= GPLUGIN_VERSION_0_38
+#define GPLUGIN_DEPRECATED_IN_0_38 GPLUGIN_DEPRECATED
+#define GPLUGIN_DEPRECATED_IN_0_38_FOR(f) GPLUGIN_DEPRECATED_FOR(f)
+#else
+#define GPLUGIN_DEPRECATED_IN_0_38 _GPLUGIN_EXTERN
+#define GPLUGIN_DEPRECATED_IN_0_38_FOR(f) _GPLUGIN_EXTERN
+#endif
+
+#if GPLUGIN_VERSION_MAX_ALLOWED < GPLUGIN_VERSION_0_38
+#define GPLUGIN_AVAILABLE_IN_0_38 GPLUGIN_UNAVAILABLE(0, 38)
+#else
+#define GPLUGIN_AVAILABLE_IN_0_38 _GPLUGIN_EXTERN
+#endif
+
 #define GPLUGIN_VERSION_CHECK(major, minor, micro) \
 	((major) == GPLUGIN_MAJOR_VERSION && \
 	 ((minor) < GPLUGIN_MINOR_VERSION || \
 	  ((minor) == GPLUGIN_MINOR_VERSION && (micro) <= GPLUGIN_MICRO_VERSION)))
 
-#include <glib.h>
-
 G_BEGIN_DECLS
 
 const gchar *gplugin_version_check(guint major, guint minor, guint micro);
