AC_INIT([modest],[1.0],[http://maemo.org])
AC_CONFIG_HEADERS([config.h])
+m4_define([modest_api_major_version], [1])
+m4_define([modest_api_minor_version], [0])
+m4_define([modest_api_micro_version], [0])
+m4_define([modest_api_version], [modest_api_major_version.modest_api_minor_version.modest_api_micro_version])
+
+
AC_CONFIG_SRCDIR(src/modest-main.c)
AM_INIT_AUTOMAKE([dist-bzip2])
+MODEST_API_MAJOR_VERSION=modest_api_major_version
+MODEST_API_MINOR_VERSION=modest_api_minor_version
+MODEST_API_MICRO_VERSION=modest_api_micro_version
+MODEST_API_VERSION=modest_api_version
+AC_SUBST(MODEST_API_MAJOR_VERSION)
+AC_SUBST(MODEST_API_MINOR_VERSION)
+AC_SUBST(MODEST_API_MICRO_VERSION)
+AC_SUBST(MODEST_API_VERSION)
+
ALL_LINGUAS="en_GB"
MODEST_LOCALE_DIR='$prefix/${DATADIRNAME}/locale'
fi
if test "$with_platform" = "maemo"; then
- MODEST_PLUGIN_DEFINES=" -DMODEST_PLATFORM_MAEMO"
+ MODEST_PLUGIN_DEFINES=" -DMODEST_PLATFORM_MAEMO -DMODEST_API_VERSION=${MODEST_API_VERSION}"
elif test "$with_platform" = "gnome"; then
- MODEST_PLUGIN_DEFINES=" -DMODEST_PLATFORM_GNOME"
+ MODEST_PLUGIN_DEFINES=" -DMODEST_PLATFORM_GNOME -DMODEST_API_VERSION=${MODEST_API_VERSION}"
fi
AC_SUBST(MODEST_PLUGIN_DEFINES)
g_free (dir);
/* plugin = g_module_open (path, G_MODULE_BIND_LAZY); */
- g_message ("PLUGIN TYPE IS %d", (gint) modest_plugin_get_type ());
type_module = G_TYPE_MODULE (modest_module_new (path));
if (type_module) {
g_type_module_use (type_module);
plugin = MODEST_PLUGIN (modest_module_new_object (MODEST_MODULE (type_module)));
+ if (plugin)
+ g_message ("Plugin %s API version %s", plugin_name, modest_plugin_get_api_version (plugin));
}
g_free (path);
/* This is for avoiding including modest runtime itself */
return modest_runtime_get_protocol_registry ();
}
+
+const gchar *
+modest_plugin_get_api_version (ModestPlugin *plugin)
+{
+ ModestPluginClass *plugin_class;
+
+ plugin_class = MODEST_PLUGIN_GET_CLASS (plugin);
+ if (plugin_class->get_version)
+ return plugin_class->get_version ();
+ else
+ return NULL;
+}
#include <modest-account-mgr.h>
#include <modest-protocol-registry.h>
+#define MODEST_API_VERSION_STR2_HELPER(x) #x
+#define MODEST_API_VERSION_STR_HELPER(x) MODEST_API_VERSION_STR2_HELPER(x)
+#define MODEST_API_VERSION_STR MODEST_API_VERSION_STR_HELPER(MODEST_API_VERSION)
+
G_BEGIN_DECLS
/* convenience macros */
struct _ModestPluginClass {
GObjectClass parent_class;
+ const gchar * (*get_version) (void);
};
/**
static void plugin_name##_init (PluginName *self); \
static void plugin_name##_class_init (PluginName##Class *klass); \
static gpointer plugin_name##_parent_class = NULL; \
+static const gchar *plugin_name##_internal_get_version (void) \
+{ \
+ return MODEST_API_VERSION_STR; \
+} \
static void plugin_name##_class_intern_init (gpointer klass) \
{ \
plugin_name##_parent_class = g_type_class_peek_parent (klass); \
plugin_name##_class_init ((PluginName##Class *) klass); \
+ ((ModestPluginClass *)klass)->get_version = plugin_name##_internal_get_version; \
} \
\
G_MODULE_EXPORT GType \
/* Global methods providing access to singletons without using modest runtime */
ModestAccountMgr *modest_plugin_get_account_mgr (void);
ModestProtocolRegistry *modest_plugin_get_protocol_registry (void);
+const gchar *modest_plugin_get_api_version (ModestPlugin *plugin);
G_END_DECLS