[libpeas/wip/chergert/symbol-versioning: 1/2] version: add version macros and use them for public API
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libpeas/wip/chergert/symbol-versioning: 1/2] version: add version macros and use them for public API
- Date: Tue, 6 Aug 2019 02:19:30 +0000 (UTC)
commit 7ad862c039ad5861ab270ac14ee59f664d7e1c32
Author: Christian Hergert <chergert redhat com>
Date: Mon Aug 5 18:12:27 2019 -0700
version: add version macros and use them for public API
This adds the necessary bits to specify what is public ABI and what
version it has been added. A followup commit will alter things so that
we limit what symbols are visibile.
libpeas-gtk/peas-gtk-configurable.h | 3 +
libpeas-gtk/peas-gtk-plugin-manager-view.h | 6 ++
libpeas-gtk/peas-gtk-plugin-manager.h | 3 +
libpeas/meson.build | 21 ++++-
libpeas/peas-activatable.c | 4 +-
libpeas/peas-activatable.h | 6 ++
libpeas/peas-engine.c | 4 +-
libpeas/peas-engine.h | 21 +++++
libpeas/peas-extension-base.c | 4 +-
libpeas/peas-extension-base.h | 4 +
libpeas/peas-extension-set.c | 4 +-
libpeas/peas-extension-set.h | 11 +++
libpeas/peas-extension.c | 4 +-
libpeas/peas-extension.h | 7 ++
libpeas/peas-object-module.c | 4 +-
libpeas/peas-object-module.h | 14 +++
libpeas/peas-plugin-info.c | 4 +-
libpeas/peas-plugin-info.h | 23 +++++
libpeas/peas-plugin-loader.c | 4 +-
libpeas/peas-plugin-loader.h | 8 ++
libpeas/peas-version-macros.h | 143 +++++++++++++++++++++++++++++
libpeas/peas-version.h.in | 93 +++++++++++++++++++
libpeas/peas.h | 2 +
23 files changed, 371 insertions(+), 26 deletions(-)
---
diff --git a/libpeas-gtk/peas-gtk-configurable.h b/libpeas-gtk/peas-gtk-configurable.h
index 95ff190..20a79b1 100644
--- a/libpeas-gtk/peas-gtk-configurable.h
+++ b/libpeas-gtk/peas-gtk-configurable.h
@@ -23,6 +23,7 @@
#define __PEAS_GTK_CONFIGURABLE_H__
#include <gtk/gtk.h>
+#include <libpeas/peas.h>
G_BEGIN_DECLS
@@ -57,7 +58,9 @@ struct _PeasGtkConfigurableInterface
GtkWidget *(*create_configure_widget) (PeasGtkConfigurable *configurable);
};
+PEAS_AVAILABLE_IN_ALL
GType peas_gtk_configurable_get_type (void) G_GNUC_CONST;
+PEAS_AVAILABLE_IN_ALL
GtkWidget *peas_gtk_configurable_create_configure_widget (PeasGtkConfigurable *configurable);
G_END_DECLS
diff --git a/libpeas-gtk/peas-gtk-plugin-manager-view.h b/libpeas-gtk/peas-gtk-plugin-manager-view.h
index 0761f04..34c50ad 100644
--- a/libpeas-gtk/peas-gtk-plugin-manager-view.h
+++ b/libpeas-gtk/peas-gtk-plugin-manager-view.h
@@ -75,17 +75,23 @@ struct _PeasGtkPluginManagerViewClass {
gpointer padding[8];
};
+PEAS_AVAILABLE_IN_ALL
GType peas_gtk_plugin_manager_view_get_type (void) G_GNUC_CONST;
+PEAS_AVAILABLE_IN_ALL
GtkWidget *peas_gtk_plugin_manager_view_new (PeasEngine *engine);
#ifndef PEAS_DISABLE_DEPRECATED
+PEAS_AVAILABLE_IN_ALL
void peas_gtk_plugin_manager_view_set_show_builtin (PeasGtkPluginManagerView *view,
gboolean show_builtin);
+PEAS_AVAILABLE_IN_ALL
gboolean peas_gtk_plugin_manager_view_get_show_builtin (PeasGtkPluginManagerView *view);
#endif
+PEAS_AVAILABLE_IN_ALL
void peas_gtk_plugin_manager_view_set_selected_plugin (PeasGtkPluginManagerView *view,
PeasPluginInfo *info);
+PEAS_AVAILABLE_IN_ALL
PeasPluginInfo *peas_gtk_plugin_manager_view_get_selected_plugin (PeasGtkPluginManagerView *view);
G_END_DECLS
diff --git a/libpeas-gtk/peas-gtk-plugin-manager.h b/libpeas-gtk/peas-gtk-plugin-manager.h
index 9b3f66b..c98385b 100644
--- a/libpeas-gtk/peas-gtk-plugin-manager.h
+++ b/libpeas-gtk/peas-gtk-plugin-manager.h
@@ -69,9 +69,12 @@ struct _PeasGtkPluginManagerClass
gpointer padding[8];
};
+PEAS_AVAILABLE_IN_ALL
GType peas_gtk_plugin_manager_get_type (void) G_GNUC_CONST;
+PEAS_AVAILABLE_IN_ALL
GtkWidget *peas_gtk_plugin_manager_new (PeasEngine *engine);
+PEAS_AVAILABLE_IN_ALL
GtkWidget *peas_gtk_plugin_manager_get_view (PeasGtkPluginManager *pm);
G_END_DECLS
diff --git a/libpeas/meson.build b/libpeas/meson.build
index 5af2016..d48d535 100644
--- a/libpeas/meson.build
+++ b/libpeas/meson.build
@@ -1,5 +1,21 @@
libpeas_srcdir = include_directories('.')
+version_data = configuration_data()
+version_data.set('PEAS_MAJOR_VERSION', version_major)
+version_data.set('PEAS_MINOR_VERSION', version_minor)
+version_data.set('PEAS_MICRO_VERSION', version_micro)
+version_data.set('PEAS_VERSION', meson.project_version())
+
+peas_version_h = configure_file(
+ input: 'peas-version.h.in',
+ output: 'peas-version.h',
+ configuration: version_data,
+ install_dir: join_paths(
+ pkgincludedir,
+ package_name,
+ ),
+)
+
libpeas_public_h = files(
'peas-activatable.h',
'peas-autocleanups.h',
@@ -9,6 +25,7 @@ libpeas_public_h = files(
'peas-extension-set.h',
'peas-object-module.h',
'peas-plugin-info.h',
+ 'peas-version-macros.h',
'peas.h',
)
@@ -72,7 +89,7 @@ libpeas_sha = library(
package_string.strip('lib'),
libpeas_sources,
version: lib_version,
- include_directories: rootdir,
+ include_directories: [rootdir, libpeas_srcdir],
dependencies: libpeas_deps,
c_args: libpeas_c_args,
link_args: libpeas_link_args,
@@ -118,7 +135,7 @@ endif
libpeas_dep = declare_dependency(
link_with: libpeas_sha,
- include_directories: rootdir,
+ include_directories: [rootdir, libpeas_srcdir],
dependencies: libpeas_deps,
sources: libpeas_dep_sources,
)
diff --git a/libpeas/peas-activatable.c b/libpeas/peas-activatable.c
index 35f25e5..acdcc2f 100644
--- a/libpeas/peas-activatable.c
+++ b/libpeas/peas-activatable.c
@@ -19,9 +19,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "config.h"
#include "peas-activatable.h"
diff --git a/libpeas/peas-activatable.h b/libpeas/peas-activatable.h
index 2c5f486..eb77e58 100644
--- a/libpeas/peas-activatable.h
+++ b/libpeas/peas-activatable.h
@@ -24,6 +24,8 @@
#include <glib-object.h>
+#include "peas-version-macros.h"
+
G_BEGIN_DECLS
/*
@@ -65,10 +67,14 @@ struct _PeasActivatableInterface {
/*
* Public methods
*/
+PEAS_AVAILABLE_IN_ALL
GType peas_activatable_get_type (void) G_GNUC_CONST;
+PEAS_AVAILABLE_IN_ALL
void peas_activatable_activate (PeasActivatable *activatable);
+PEAS_AVAILABLE_IN_ALL
void peas_activatable_deactivate (PeasActivatable *activatable);
+PEAS_AVAILABLE_IN_ALL
void peas_activatable_update_state (PeasActivatable *activatable);
G_END_DECLS
diff --git a/libpeas/peas-engine.c b/libpeas/peas-engine.c
index 10237bc..86706a0 100644
--- a/libpeas/peas-engine.c
+++ b/libpeas/peas-engine.c
@@ -21,9 +21,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "config.h"
#include <string.h>
diff --git a/libpeas/peas-engine.h b/libpeas/peas-engine.h
index 9aa9e8a..8ccab1d 100644
--- a/libpeas/peas-engine.h
+++ b/libpeas/peas-engine.h
@@ -23,8 +23,10 @@
#define __PEAS_ENGINE_H__
#include <glib.h>
+
#include "peas-plugin-info.h"
#include "peas-extension.h"
+#include "peas-version-macros.h"
G_BEGIN_DECLS
@@ -73,43 +75,60 @@ struct _PeasEngineClass {
gpointer padding[8];
};
+PEAS_AVAILABLE_IN_ALL
GType peas_engine_get_type (void) G_GNUC_CONST;
+PEAS_AVAILABLE_IN_ALL
PeasEngine *peas_engine_new (void);
+PEAS_AVAILABLE_IN_ALL
PeasEngine *peas_engine_new_with_nonglobal_loaders
(void);
+PEAS_AVAILABLE_IN_ALL
PeasEngine *peas_engine_get_default (void);
+PEAS_AVAILABLE_IN_ALL
void peas_engine_add_search_path (PeasEngine *engine,
const gchar *module_dir,
const gchar *data_dir);
+PEAS_AVAILABLE_IN_ALL
void peas_engine_prepend_search_path (PeasEngine *engine,
const gchar *module_dir,
const gchar *data_dir);
/* plugin management */
+PEAS_AVAILABLE_IN_ALL
void peas_engine_enable_loader (PeasEngine *engine,
const gchar *loader_name);
+PEAS_AVAILABLE_IN_ALL
void peas_engine_rescan_plugins (PeasEngine *engine);
+PEAS_AVAILABLE_IN_ALL
const GList *peas_engine_get_plugin_list (PeasEngine *engine);
+PEAS_AVAILABLE_IN_ALL
gchar **peas_engine_get_loaded_plugins (PeasEngine *engine);
+PEAS_AVAILABLE_IN_ALL
void peas_engine_set_loaded_plugins (PeasEngine *engine,
const gchar **plugin_names);
+PEAS_AVAILABLE_IN_ALL
PeasPluginInfo *peas_engine_get_plugin_info (PeasEngine *engine,
const gchar *plugin_name);
/* plugin loading and unloading */
+PEAS_AVAILABLE_IN_ALL
gboolean peas_engine_load_plugin (PeasEngine *engine,
PeasPluginInfo *info);
+PEAS_AVAILABLE_IN_ALL
gboolean peas_engine_unload_plugin (PeasEngine *engine,
PeasPluginInfo *info);
+PEAS_AVAILABLE_IN_ALL
void peas_engine_garbage_collect (PeasEngine *engine);
+PEAS_AVAILABLE_IN_ALL
gboolean peas_engine_provides_extension (PeasEngine *engine,
PeasPluginInfo *info,
GType extension_type);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+PEAS_AVAILABLE_IN_ALL
PeasExtension *peas_engine_create_extensionv (PeasEngine *engine,
PeasPluginInfo *info,
GType extension_type,
@@ -117,12 +136,14 @@ PeasExtension *peas_engine_create_extensionv (PeasEngine *engine,
GParameter *parameters);
G_GNUC_END_IGNORE_DEPRECATIONS
+PEAS_AVAILABLE_IN_ALL
PeasExtension *peas_engine_create_extension_valist
(PeasEngine *engine,
PeasPluginInfo *info,
GType extension_type,
const gchar *first_property,
va_list var_args);
+PEAS_AVAILABLE_IN_ALL
PeasExtension *peas_engine_create_extension (PeasEngine *engine,
PeasPluginInfo *info,
GType extension_type,
diff --git a/libpeas/peas-extension-base.c b/libpeas/peas-extension-base.c
index f9d1c25..c8ecc92 100644
--- a/libpeas/peas-extension-base.c
+++ b/libpeas/peas-extension-base.c
@@ -20,9 +20,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "config.h"
#include "peas-extension-base.h"
#include "peas-plugin-info-priv.h"
diff --git a/libpeas/peas-extension-base.h b/libpeas/peas-extension-base.h
index e58dec1..162d448 100644
--- a/libpeas/peas-extension-base.h
+++ b/libpeas/peas-extension-base.h
@@ -25,6 +25,7 @@
#include <glib-object.h>
#include "peas-plugin-info.h"
+#include "peas-version-macros.h"
G_BEGIN_DECLS
@@ -69,9 +70,12 @@ struct _PeasExtensionBaseClass {
/*
* Public methods
*/
+PEAS_AVAILABLE_IN_ALL
GType peas_extension_base_get_type (void) G_GNUC_CONST;
+PEAS_AVAILABLE_IN_ALL
PeasPluginInfo *peas_extension_base_get_plugin_info (PeasExtensionBase *extbase);
+PEAS_AVAILABLE_IN_ALL
gchar *peas_extension_base_get_data_dir (PeasExtensionBase *extbase);
G_END_DECLS
diff --git a/libpeas/peas-extension-set.c b/libpeas/peas-extension-set.c
index 9fa738a..027e9d1 100644
--- a/libpeas/peas-extension-set.c
+++ b/libpeas/peas-extension-set.c
@@ -19,9 +19,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "config.h"
#include <string.h>
diff --git a/libpeas/peas-extension-set.h b/libpeas/peas-extension-set.h
index 1fb2c44..4b35e65 100644
--- a/libpeas/peas-extension-set.h
+++ b/libpeas/peas-extension-set.h
@@ -23,7 +23,9 @@
#define __PEAS_EXTENSION_SET_H__
#include <glib-object.h>
+
#include "peas-engine.h"
+#include "peas-version-macros.h"
G_BEGIN_DECLS
@@ -110,40 +112,49 @@ typedef void (*PeasExtensionSetForeachFunc) (PeasExtensionSet *set,
/*
* Public methods
*/
+PEAS_AVAILABLE_IN_ALL
GType peas_extension_set_get_type (void) G_GNUC_CONST;
#ifndef __GI_SCANNER__
#ifndef PEAS_DISABLE_DEPRECATED
+PEAS_AVAILABLE_IN_ALL
gboolean peas_extension_set_call (PeasExtensionSet *set,
const gchar *method_name,
...);
+PEAS_AVAILABLE_IN_ALL
gboolean peas_extension_set_call_valist (PeasExtensionSet *set,
const gchar *method_name,
va_list va_args);
+PEAS_AVAILABLE_IN_ALL
gboolean peas_extension_set_callv (PeasExtensionSet *set,
const gchar *method_name,
GIArgument *args);
#endif
#endif
+PEAS_AVAILABLE_IN_ALL
void peas_extension_set_foreach (PeasExtensionSet *set,
PeasExtensionSetForeachFunc func,
gpointer data);
+PEAS_AVAILABLE_IN_ALL
PeasExtension *peas_extension_set_get_extension (PeasExtensionSet *set,
PeasPluginInfo *info);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+PEAS_AVAILABLE_IN_ALL
PeasExtensionSet *peas_extension_set_newv (PeasEngine *engine,
GType exten_type,
guint n_parameters,
GParameter *parameters);
G_GNUC_END_IGNORE_DEPRECATIONS
+PEAS_AVAILABLE_IN_ALL
PeasExtensionSet *peas_extension_set_new_valist (PeasEngine *engine,
GType exten_type,
const gchar *first_property,
va_list var_args);
+PEAS_AVAILABLE_IN_ALL
PeasExtensionSet *peas_extension_set_new (PeasEngine *engine,
GType exten_type,
const gchar *first_property,
diff --git a/libpeas/peas-extension.c b/libpeas/peas-extension.c
index 8e46920..79344d9 100644
--- a/libpeas/peas-extension.c
+++ b/libpeas/peas-extension.c
@@ -19,9 +19,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "config.h"
#include "peas-extension.h"
#include "peas-introspection.h"
diff --git a/libpeas/peas-extension.h b/libpeas/peas-extension.h
index e61a5ef..2ac80aa 100644
--- a/libpeas/peas-extension.h
+++ b/libpeas/peas-extension.h
@@ -25,6 +25,8 @@
#include <glib-object.h>
#include <girepository.h>
+#include "peas-version-macros.h"
+
G_BEGIN_DECLS
/*
@@ -48,17 +50,22 @@ typedef GObject PeasExtension;
*/
#ifndef __GI_SCANNER__
#ifndef PEAS_DISABLE_DEPRECATED
+PEAS_AVAILABLE_IN_ALL
GType peas_extension_get_type (void) G_GNUC_CONST;
+PEAS_AVAILABLE_IN_ALL
GType peas_extension_get_extension_type
(PeasExtension *exten);
+PEAS_AVAILABLE_IN_ALL
gboolean peas_extension_call (PeasExtension *exten,
const gchar *method_name,
...);
+PEAS_AVAILABLE_IN_ALL
gboolean peas_extension_call_valist (PeasExtension *exten,
const gchar *method_name,
va_list args);
+PEAS_AVAILABLE_IN_ALL
gboolean peas_extension_callv (PeasExtension *exten,
const gchar *method_name,
GIArgument *args,
diff --git a/libpeas/peas-object-module.c b/libpeas/peas-object-module.c
index bc771e6..53485b9 100644
--- a/libpeas/peas-object-module.c
+++ b/libpeas/peas-object-module.c
@@ -23,9 +23,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "config.h"
#include <string.h>
diff --git a/libpeas/peas-object-module.h b/libpeas/peas-object-module.h
index 7c84eac..986d2de 100644
--- a/libpeas/peas-object-module.h
+++ b/libpeas/peas-object-module.h
@@ -28,6 +28,8 @@
#include <glib-object.h>
#include <gmodule.h>
+#include "peas-version-macros.h"
+
G_BEGIN_DECLS
#define PEAS_TYPE_OBJECT_MODULE (peas_object_module_get_type ())
@@ -85,38 +87,50 @@ struct _PeasObjectModuleClass {
gpointer padding[8];
};
+PEAS_AVAILABLE_IN_ALL
GType peas_object_module_get_type (void) G_GNUC_CONST;
+PEAS_AVAILABLE_IN_ALL
PeasObjectModule *peas_object_module_new (const gchar *module_name,
const gchar *path,
gboolean resident);
+PEAS_AVAILABLE_IN_ALL
PeasObjectModule *peas_object_module_new_full (const gchar *module_name,
const gchar *path,
gboolean resident,
gboolean local_linkage);
+PEAS_AVAILABLE_IN_ALL
PeasObjectModule *peas_object_module_new_embedded (const gchar *module_name,
const gchar *symbol);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+PEAS_AVAILABLE_IN_ALL
GObject *peas_object_module_create_object (PeasObjectModule *module,
GType exten_type,
guint n_parameters,
GParameter *parameters);
G_GNUC_END_IGNORE_DEPRECATIONS
+PEAS_AVAILABLE_IN_ALL
gboolean peas_object_module_provides_object (PeasObjectModule *module,
GType exten_type);
+PEAS_AVAILABLE_IN_ALL
const gchar *peas_object_module_get_path (PeasObjectModule *module);
+PEAS_AVAILABLE_IN_ALL
const gchar *peas_object_module_get_module_name (PeasObjectModule *module);
+PEAS_AVAILABLE_IN_ALL
const gchar *peas_object_module_get_symbol (PeasObjectModule *module);
+PEAS_AVAILABLE_IN_ALL
GModule *peas_object_module_get_library (PeasObjectModule *module);
+PEAS_AVAILABLE_IN_ALL
void peas_object_module_register_extension_factory
(PeasObjectModule *module,
GType exten_type,
PeasFactoryFunc factory_func,
gpointer user_data,
GDestroyNotify destroy_func);
+PEAS_AVAILABLE_IN_ALL
void peas_object_module_register_extension_type
(PeasObjectModule *module,
GType exten_type,
diff --git a/libpeas/peas-plugin-info.c b/libpeas/peas-plugin-info.c
index 6fb7ce6..333e80f 100644
--- a/libpeas/peas-plugin-info.c
+++ b/libpeas/peas-plugin-info.c
@@ -20,9 +20,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "config.h"
#include <string.h>
#include <glib.h>
diff --git a/libpeas/peas-plugin-info.h b/libpeas/peas-plugin-info.h
index 556d8a5..5d8a4bc 100644
--- a/libpeas/peas-plugin-info.h
+++ b/libpeas/peas-plugin-info.h
@@ -25,6 +25,8 @@
#include <gio/gio.h>
+#include "peas-version-macros.h"
+
G_BEGIN_DECLS
#define PEAS_TYPE_PLUGIN_INFO (peas_plugin_info_get_type ())
@@ -68,33 +70,54 @@ typedef enum {
*/
typedef struct _PeasPluginInfo PeasPluginInfo;
+PEAS_AVAILABLE_IN_ALL
GType peas_plugin_info_get_type (void) G_GNUC_CONST;
+PEAS_AVAILABLE_IN_ALL
GQuark peas_plugin_info_error_quark (void);
+PEAS_AVAILABLE_IN_ALL
gboolean peas_plugin_info_is_loaded (const PeasPluginInfo *info);
+PEAS_AVAILABLE_IN_ALL
gboolean peas_plugin_info_is_available (const PeasPluginInfo *info,
GError **error);
+PEAS_AVAILABLE_IN_ALL
gboolean peas_plugin_info_is_builtin (const PeasPluginInfo *info);
+PEAS_AVAILABLE_IN_ALL
gboolean peas_plugin_info_is_hidden (const PeasPluginInfo *info);
+PEAS_AVAILABLE_IN_ALL
const gchar *peas_plugin_info_get_module_name (const PeasPluginInfo *info);
+PEAS_AVAILABLE_IN_ALL
const gchar *peas_plugin_info_get_module_dir (const PeasPluginInfo *info);
+PEAS_AVAILABLE_IN_ALL
const gchar *peas_plugin_info_get_data_dir (const PeasPluginInfo *info);
+PEAS_AVAILABLE_IN_ALL
GSettings *peas_plugin_info_get_settings (const PeasPluginInfo *info,
const gchar *schema_id);
+PEAS_AVAILABLE_IN_ALL
const gchar **peas_plugin_info_get_dependencies (const PeasPluginInfo *info);
+PEAS_AVAILABLE_IN_ALL
gboolean peas_plugin_info_has_dependency (const PeasPluginInfo *info,
const gchar *module_name);
+PEAS_AVAILABLE_IN_ALL
const gchar *peas_plugin_info_get_name (const PeasPluginInfo *info);
+PEAS_AVAILABLE_IN_ALL
const gchar *peas_plugin_info_get_description (const PeasPluginInfo *info);
+PEAS_AVAILABLE_IN_ALL
const gchar *peas_plugin_info_get_icon_name (const PeasPluginInfo *info);
+PEAS_AVAILABLE_IN_ALL
const gchar **peas_plugin_info_get_authors (const PeasPluginInfo *info);
+PEAS_AVAILABLE_IN_ALL
const gchar *peas_plugin_info_get_website (const PeasPluginInfo *info);
+PEAS_AVAILABLE_IN_ALL
const gchar *peas_plugin_info_get_copyright (const PeasPluginInfo *info);
+PEAS_AVAILABLE_IN_ALL
const gchar *peas_plugin_info_get_version (const PeasPluginInfo *info);
+PEAS_AVAILABLE_IN_ALL
const gchar *peas_plugin_info_get_help_uri (const PeasPluginInfo *info);
+PEAS_AVAILABLE_IN_ALL
const gchar *peas_plugin_info_get_external_data (const PeasPluginInfo *info,
const gchar *key);
diff --git a/libpeas/peas-plugin-loader.c b/libpeas/peas-plugin-loader.c
index 136d7c3..7c1ed4b 100644
--- a/libpeas/peas-plugin-loader.c
+++ b/libpeas/peas-plugin-loader.c
@@ -19,9 +19,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "config.h"
#include "peas-plugin-loader.h"
diff --git a/libpeas/peas-plugin-loader.h b/libpeas/peas-plugin-loader.h
index 837760e..cd11dce 100644
--- a/libpeas/peas-plugin-loader.h
+++ b/libpeas/peas-plugin-loader.h
@@ -67,26 +67,34 @@ struct _PeasPluginLoaderClass {
};
G_GNUC_END_IGNORE_DEPRECATIONS
+PEAS_AVAILABLE_IN_ALL
GType peas_plugin_loader_get_type (void) G_GNUC_CONST;
+PEAS_AVAILABLE_IN_ALL
gboolean peas_plugin_loader_initialize (PeasPluginLoader *loader);
+PEAS_AVAILABLE_IN_ALL
gboolean peas_plugin_loader_is_global (PeasPluginLoader *loader);
+PEAS_AVAILABLE_IN_ALL
gboolean peas_plugin_loader_load (PeasPluginLoader *loader,
PeasPluginInfo *info);
+PEAS_AVAILABLE_IN_ALL
void peas_plugin_loader_unload (PeasPluginLoader *loader,
PeasPluginInfo *info);
+PEAS_AVAILABLE_IN_ALL
gboolean peas_plugin_loader_provides_extension (PeasPluginLoader *loader,
PeasPluginInfo *info,
GType ext_type);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+PEAS_AVAILABLE_IN_ALL
PeasExtension *peas_plugin_loader_create_extension (PeasPluginLoader *loader,
PeasPluginInfo *info,
GType ext_type,
guint n_parameters,
GParameter *parameters);
G_GNUC_END_IGNORE_DEPRECATIONS
+PEAS_AVAILABLE_IN_ALL
void peas_plugin_loader_garbage_collect (PeasPluginLoader *loader);
G_END_DECLS
diff --git a/libpeas/peas-version-macros.h b/libpeas/peas-version-macros.h
new file mode 100644
index 0000000..4fbcbe4
--- /dev/null
+++ b/libpeas/peas-version-macros.h
@@ -0,0 +1,143 @@
+/*
+ * peas-version-macros.h
+ * This file is part of libpeas
+ *
+ * libpeas 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.1 of the License, or (at your option) any later version.
+ *
+ * libpeas 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __PEAS_VERSION_MACROS_H__
+#define __PEAS_VERSION_MACROS_H__
+
+#include <glib.h>
+
+#include "peas-version.h"
+
+#ifndef _PEAS_EXTERN
+# define _PEAS_EXTERN extern
+#endif
+
+#ifdef PEAS_DISABLE_DEPRECATION_WARNINGS
+# define PEAS_DEPRECATED _PEAS_EXTERN
+# define PEAS_DEPRECATED_FOR(f) _PEAS_EXTERN
+# define PEAS_UNAVAILABLE(maj,min) _PEAS_EXTERN
+#else
+# define PEAS_DEPRECATED G_DEPRECATED _PEAS_EXTERN
+# define PEAS_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) _PEAS_EXTERN
+# define PEAS_UNAVAILABLE(maj,min) G_UNAVAILABLE(maj,min) _PEAS_EXTERN
+#endif
+
+#define PEAS_VERSION_1_22 (G_ENCODE_VERSION (1, 22))
+#define PEAS_VERSION_1_24 (G_ENCODE_VERSION (1, 24))
+
+#if (PEAS_MINOR_VERSION == 99)
+# define PEAS_VERSION_CUR_STABLE (G_ENCODE_VERSION (PEAS_MAJOR_VERSION + 1, 0))
+#elif (PEAS_MINOR_VERSION % 2)
+# define PEAS_VERSION_CUR_STABLE (G_ENCODE_VERSION (PEAS_MAJOR_VERSION, PEAS_MINOR_VERSION + 1))
+#else
+# define PEAS_VERSION_CUR_STABLE (G_ENCODE_VERSION (PEAS_MAJOR_VERSION, PEAS_MINOR_VERSION))
+#endif
+
+#if (PEAS_MINOR_VERSION == 99)
+# define PEAS_VERSION_PREV_STABLE (G_ENCODE_VERSION (PEAS_MAJOR_VERSION + 1, 0))
+#elif (PEAS_MINOR_VERSION % 2)
+# define PEAS_VERSION_PREV_STABLE (G_ENCODE_VERSION (PEAS_MAJOR_VERSION, PEAS_MINOR_VERSION - 1))
+#else
+# define PEAS_VERSION_PREV_STABLE (G_ENCODE_VERSION (PEAS_MAJOR_VERSION, PEAS_MINOR_VERSION - 2))
+#endif
+
+/**
+ * PEAS_VERSION_MIN_REQUIRED:
+ *
+ * A macro that should be defined by the user prior to including
+ * the peas.h header.
+ *
+ * The definition should be one of the predefined PEAS version
+ * macros: %PEAS_VERSION_1_22, ...
+ *
+ * This macro defines the lower bound for the Peas API to use.
+ *
+ * If a function has been deprecated in a newer version of Peas,
+ * it is possible to use this symbol to avoid the compiler warnings
+ * without disabling warning for every deprecated function.
+ *
+ * Since: 1.24
+ */
+#ifndef PEAS_VERSION_MIN_REQUIRED
+# define PEAS_VERSION_MIN_REQUIRED (PEAS_VERSION_CUR_STABLE)
+#endif
+
+/**
+ * PEAS_VERSION_MAX_ALLOWED:
+ *
+ * A macro that should be defined by the user prior to including
+ * the peas.h header.
+
+ * The definition should be one of the predefined Peas version
+ * macros: %PEAS_VERSION_1_0, %PEAS_VERSION_1_2,...
+ *
+ * This macro defines the upper bound for the PEAS API to use.
+ *
+ * If a function has been introduced in a newer version of Peas,
+ * it is possible to use this symbol to get compiler warnings when
+ * trying to use that function.
+ *
+ * Since: 1.24
+ */
+#ifndef PEAS_VERSION_MAX_ALLOWED
+# if PEAS_VERSION_MIN_REQUIRED > PEAS_VERSION_PREV_STABLE
+# define PEAS_VERSION_MAX_ALLOWED (PEAS_VERSION_MIN_REQUIRED)
+# else
+# define PEAS_VERSION_MAX_ALLOWED (PEAS_VERSION_CUR_STABLE)
+# endif
+#endif
+
+#if PEAS_VERSION_MAX_ALLOWED < PEAS_VERSION_MIN_REQUIRED
+#error "PEAS_VERSION_MAX_ALLOWED must be >= PEAS_VERSION_MIN_REQUIRED"
+#endif
+#if PEAS_VERSION_MIN_REQUIRED < PEAS_VERSION_1_22
+#error "PEAS_VERSION_MIN_REQUIRED must be >= PEAS_VERSION_1_22"
+#endif
+
+#define PEAS_AVAILABLE_IN_ALL _PEAS_EXTERN
+
+#if PEAS_VERSION_MIN_REQUIRED >= PEAS_VERSION_1_22
+# define PEAS_DEPRECATED_IN_1_22 PEAS_DEPRECATED
+# define PEAS_DEPRECATED_IN_1_22_FOR(f) PEAS_DEPRECATED_FOR(f)
+#else
+# define PEAS_DEPRECATED_IN_1_22 _PEAS_EXTERN
+# define PEAS_DEPRECATED_IN_1_22_FOR(f) _PEAS_EXTERN
+#endif
+
+#if PEAS_VERSION_MAX_ALLOWED < PEAS_VERSION_1_22
+# define PEAS_AVAILABLE_IN_1_22 PEAS_UNAVAILABLE(1, 22)
+#else
+# define PEAS_AVAILABLE_IN_1_22 _PEAS_EXTERN
+#endif
+
+#if PEAS_VERSION_MIN_REQUIRED >= PEAS_VERSION_1_24
+# define PEAS_DEPRECATED_IN_1_24 PEAS_DEPRECATED
+# define PEAS_DEPRECATED_IN_1_24_FOR(f) PEAS_DEPRECATED_FOR(f)
+#else
+# define PEAS_DEPRECATED_IN_1_24 _PEAS_EXTERN
+# define PEAS_DEPRECATED_IN_1_24_FOR(f) _PEAS_EXTERN
+#endif
+
+#if PEAS_VERSION_MAX_ALLOWED < PEAS_VERSION_1_24
+# define PEAS_AVAILABLE_IN_1_24 PEAS_UNAVAILABLE(1, 24)
+#else
+# define PEAS_AVAILABLE_IN_1_24 _PEAS_EXTERN
+#endif
+
+#endif /* __PEAS_VERSION_MACROS_H__ */
diff --git a/libpeas/peas-version.h.in b/libpeas/peas-version.h.in
new file mode 100644
index 0000000..854b60a
--- /dev/null
+++ b/libpeas/peas-version.h.in
@@ -0,0 +1,93 @@
+/*
+ * peas-version.h
+ * This file is part of libpeas
+ *
+ * libpeas 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.1 of the License, or (at your option) any later version.
+ *
+ * libpeas 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __PEAS_VERSION_H__
+#define __PEAS_VERSION_H__
+
+/**
+ * SECTION:peas-version
+ * @short_description: Peas version checking
+ *
+ * Peas provides macros to check the version of the library at compile-time
+ */
+
+/**
+ * PEAS_MAJOR_VERSION:
+ *
+ * Peas major version component (e.g. 1 if %PEAS_VERSION is 1.2.3)
+ */
+#define PEAS_MAJOR_VERSION (@PEAS_MAJOR_VERSION@)
+
+/**
+ * PEAS_MINOR_VERSION:
+ *
+ * Peas minor version component (e.g. 2 if %PEAS_VERSION is 1.2.3)
+ */
+#define PEAS_MINOR_VERSION (@PEAS_MINOR_VERSION@)
+
+/**
+ * PEAS_MICRO_VERSION:
+ *
+ * Peas micro version component (e.g. 3 if %PEAS_VERSION is 1.2.3)
+ */
+#define PEAS_MICRO_VERSION (@PEAS_MICRO_VERSION@)
+
+/**
+ * PEAS_VERSION
+ *
+ * Peas version.
+ */
+#define PEAS_VERSION (@PEAS_VERSION@)
+
+/**
+ * PEAS_VERSION_S:
+ *
+ * Peas version, encoded as a string, useful for printing and
+ * concatenation.
+ */
+#define PEAS_VERSION_S "@PEAS_VERSION@"
+
+#define PEAS_ENCODE_VERSION(major,minor,micro) \
+ ((major) << 24 | (minor) << 16 | (micro) << 8)
+
+/**
+ * PEAS_VERSION_HEX:
+ *
+ * Peas version, encoded as an hexadecimal number, useful for
+ * integer comparisons.
+ */
+#define PEAS_VERSION_HEX \
+ (PEAS_ENCODE_VERSION (PEAS_MAJOR_VERSION, PEAS_MINOR_VERSION, PEAS_MICRO_VERSION))
+
+/**
+ * PEAS_CHECK_VERSION:
+ * @major: required major version
+ * @minor: required minor version
+ * @micro: required micro version
+ *
+ * Compile-time version checking. Evaluates to %TRUE if the version
+ * of peas is greater than the required one.
+ */
+#define PEAS_CHECK_VERSION(major,minor,micro) \
+ (PEAS_MAJOR_VERSION > (major) || \
+ (PEAS_MAJOR_VERSION == (major) && PEAS_MINOR_VERSION > (minor)) || \
+ (PEAS_MAJOR_VERSION == (major) && PEAS_MINOR_VERSION == (minor) && \
+ PEAS_MICRO_VERSION >= (micro)))
+
+#endif /* __PEAS_VERSION_H__ */
diff --git a/libpeas/peas.h b/libpeas/peas.h
index e46bbfc..c6d3633 100644
--- a/libpeas/peas.h
+++ b/libpeas/peas.h
@@ -28,5 +28,7 @@
#include "peas-extension-set.h"
#include "peas-object-module.h"
#include "peas-plugin-info.h"
+#include "peas-version.h"
+#include "peas-version-macros.h"
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]