[geany/geany-plugins] 96609d: defineformat: use new plugin API

LarsDW223 git-noreply at xxxxx
Sun Apr 14 16:33:57 UTC 2019


Branch:      refs/heads/master
Author:      LarsDW223 <lars_paulsen at web.de>
Committer:   LarsDW223 <lars_paulsen at web.de>
Date:        Sat, 24 Feb 2018 14:42:31 UTC
Commit:      96609dea7b4f3dba1b7e041b1521f901ece92088
             https://github.com/geany/geany-plugins/commit/96609dea7b4f3dba1b7e041b1521f901ece92088

Log Message:
-----------
defineformat: use new plugin API


Modified Paths:
--------------
    defineformat/src/defineformat.c

Modified: defineformat/src/defineformat.c
47 lines changed, 32 insertions(+), 15 deletions(-)
===================================================================
@@ -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 <rpg89(at)post(dot)ru>")
-
 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 <rpg89(at)post(dot)ru>";
+
+	/* 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);
 }



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Plugins-Commits mailing list