From 96609dea7b4f3dba1b7e041b1521f901ece92088 Mon Sep 17 00:00:00 2001 From: LarsDW223 Date: Sat, 24 Feb 2018 15:42:31 +0100 Subject: [PATCH 1/2] defineformat: use new plugin API --- defineformat/src/defineformat.c | 47 ++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/defineformat/src/defineformat.c b/defineformat/src/defineformat.c index f4ae32c88..1f5add598 100644 --- a/defineformat/src/defineformat.c +++ b/defineformat/src/defineformat.c @@ -48,15 +48,6 @@ GeanyPlugin *geany_plugin; GeanyData *geany_data; -PLUGIN_VERSION_CHECK(224) -PLUGIN_SET_TRANSLATABLE_INFO( - LOCALEDIR, - GETTEXT_PACKAGE, - _("Define formatter"), - _("Automatically align backslash in multi-line defines"), - "0.1", - "Pavel Roschin ") - static GArray *lines_stack = NULL; static gint @@ -239,24 +230,50 @@ editor_notify_cb(GObject *object, GeanyEditor *editor, SCNotification *nt, gpoin return FALSE; } -PluginCallback plugin_callbacks[] = +static PluginCallback plugin_defineformat_callbacks[] = { { "editor-notify", (GCallback) &editor_notify_cb, FALSE, NULL }, { NULL, NULL, FALSE, NULL } }; -void plugin_init(GeanyData *data) +static gboolean plugin_defineformat_init(GeanyPlugin *plugin, G_GNUC_UNUSED gpointer pdata) { + geany_plugin = plugin; + geany_data = plugin->geany_data; lines_stack = g_array_new (TRUE, FALSE, sizeof(gint)); + return TRUE; } -void plugin_cleanup(void) +static void plugin_defineformat_cleanup(G_GNUC_UNUSED GeanyPlugin *plugin, G_GNUC_UNUSED gpointer pdata) { g_array_free(lines_stack, TRUE); } -void -plugin_help(void) +static void plugin_defineformat_help (G_GNUC_UNUSED GeanyPlugin *plugin, G_GNUC_UNUSED gpointer pdata) { - utils_open_browser("http://plugins.geany.org/defineformat.html"); + utils_open_browser("https://plugins.geany.org/defineformat.html"); +} + + +/* Load module */ +G_MODULE_EXPORT +void geany_load_module(GeanyPlugin *plugin) +{ + /* Setup translation */ + main_locale_init(LOCALEDIR, GETTEXT_PACKAGE); + + /* Set metadata */ + plugin->info->name = _("Define formatter"); + plugin->info->description = _("Automatically align backslash in multi-line defines"); + plugin->info->version = "0.1"; + plugin->info->author = "Pavel Roschin "; + + /* Set functions */ + plugin->funcs->init = plugin_defineformat_init; + plugin->funcs->cleanup = plugin_defineformat_cleanup; + plugin->funcs->help = plugin_defineformat_help; + plugin->funcs->callbacks = plugin_defineformat_callbacks; + + /* Register! */ + GEANY_PLUGIN_REGISTER(plugin, 224); } From 90bf878ddf5af17012dd535c658ad16059ca2eee Mon Sep 17 00:00:00 2001 From: Lars Paulsen Date: Mon, 18 Jun 2018 19:58:35 +0200 Subject: [PATCH 2/2] defineformat: new plugin API requires version 1.26 (226) --- defineformat/src/defineformat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/defineformat/src/defineformat.c b/defineformat/src/defineformat.c index 1f5add598..aabb36298 100644 --- a/defineformat/src/defineformat.c +++ b/defineformat/src/defineformat.c @@ -275,5 +275,5 @@ void geany_load_module(GeanyPlugin *plugin) plugin->funcs->callbacks = plugin_defineformat_callbacks; /* Register! */ - GEANY_PLUGIN_REGISTER(plugin, 224); + GEANY_PLUGIN_REGISTER(plugin, 226); }