2007-06-26 16:17:16 +00:00
|
|
|
/*
|
|
|
|
* plugindata.h - this file is part of Geany, a fast and lightweight IDE
|
|
|
|
*
|
|
|
|
* Copyright 2007 Enrico Tröger <enrico.troeger@uvena.de>
|
|
|
|
* Copyright 2007 Nick Treleaven <nick.treleaven@btinternet.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program 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 General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|
|
|
* MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
* $Id$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PLUGIN_H
|
|
|
|
#define PLUGIN_H
|
|
|
|
|
|
|
|
/* The API version should be incremented whenever any plugin data types below are
|
|
|
|
* modified. */
|
2007-06-27 15:56:42 +00:00
|
|
|
static const gint api_version = 2;
|
2007-06-26 16:17:16 +00:00
|
|
|
|
|
|
|
/* The ABI version should be incremented whenever existing fields in the plugin
|
|
|
|
* data types below have to be changed or reordered. It should stay the same if fields
|
|
|
|
* are only appended, as this doesn't affect existing fields. */
|
2007-06-27 15:56:42 +00:00
|
|
|
static const gint abi_version = 2;
|
2007-06-26 16:17:16 +00:00
|
|
|
|
2007-06-27 15:56:42 +00:00
|
|
|
/* This performs runtime checks that try to ensure:
|
|
|
|
* 1. Geany ABI data types are compatible with this plugin.
|
|
|
|
* 2. Geany sources provide the required API for this plugin. */
|
2007-06-26 16:17:16 +00:00
|
|
|
/* TODO: if possible, the API version should be checked at compile time, not runtime. */
|
|
|
|
#define VERSION_CHECK(api_required) \
|
|
|
|
gint version_check(gint abi_ver) \
|
|
|
|
{ \
|
|
|
|
if (abi_ver != abi_version) \
|
|
|
|
return -1; \
|
|
|
|
if (api_version < (api_required)) \
|
|
|
|
return (api_required); \
|
|
|
|
else return 0; \
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-06-27 15:56:42 +00:00
|
|
|
typedef struct PluginInfo
|
2007-06-26 16:17:16 +00:00
|
|
|
{
|
|
|
|
gchar *name; // name of plugin
|
|
|
|
gchar *description; // description of plugin
|
2007-06-27 15:56:42 +00:00
|
|
|
}
|
|
|
|
PluginInfo;
|
2007-06-26 16:17:16 +00:00
|
|
|
|
2007-06-27 15:56:42 +00:00
|
|
|
/* Sets the plugin name and a brief description of what it is. */
|
|
|
|
#define PLUGIN_INFO(p_name, p_description) \
|
|
|
|
PluginInfo *info() \
|
|
|
|
{ \
|
|
|
|
static PluginInfo p_info; \
|
|
|
|
\
|
|
|
|
p_info.name = (p_name); \
|
|
|
|
p_info.description = (p_description); \
|
|
|
|
return &p_info; \
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* These are fields and functions owned by Geany.
|
|
|
|
* Fields will be appended when needed by plugin authors.
|
|
|
|
* Note: Remember to increment api_version (and abi_version if necessary) when
|
|
|
|
* making changes. */
|
|
|
|
typedef struct PluginData
|
|
|
|
{
|
2007-06-26 16:17:16 +00:00
|
|
|
MyApp *app; // Geany application data fields
|
|
|
|
|
|
|
|
/* Almost all plugins should add menu items to the Tools menu only */
|
|
|
|
GtkWidget *tools_menu;
|
2007-06-27 15:56:42 +00:00
|
|
|
}
|
|
|
|
PluginData;
|
2007-06-26 16:17:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
#endif
|