[geany/geany-plugins] 4f561c: automark: use new plugin API

LarsDW223 git-noreply at xxxxx
Sun Apr 14 16:55:33 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 12:39:04 UTC
Commit:      4f561c679b2342c3f56775c87b2b81959e737bb3
             https://github.com/geany/geany-plugins/commit/4f561c679b2342c3f56775c87b2b81959e737bb3

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


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

Modified: automark/src/automark.c
52 lines changed, 37 insertions(+), 15 deletions(-)
===================================================================
@@ -40,14 +40,6 @@
 GeanyPlugin	*geany_plugin;
 GeanyData	*geany_data;
 
-PLUGIN_VERSION_CHECK(224)
-PLUGIN_SET_TRANSLATABLE_INFO(
-	LOCALEDIR,
-	GETTEXT_PACKAGE,
-	_("Auto-mark"),
-	_("Auto-mark word under cursor"),
-	"0.1",
-	"Pavel Roschin <rpg89(at)post(dot)ru>")
 
 static gint source_id;
 
@@ -168,27 +160,57 @@ on_editor_notify(
 	return FALSE;
 }
 
-PluginCallback plugin_callbacks[] =
+static PluginCallback plugin_automark_callbacks[] =
 {
 	{ "editor-notify",  (GCallback) &on_editor_notify, FALSE, NULL },
 	{ NULL, NULL, FALSE, NULL }
 };
 
-void
-plugin_init(G_GNUC_UNUSED GeanyData *data)
+
+static gboolean
+plugin_automark_init(GeanyPlugin *plugin, G_GNUC_UNUSED gpointer pdata)
 {
+	geany_plugin = plugin;
+	geany_data = plugin->geany_data;
 	source_id = 0;
+	return TRUE;
 }
 
-void
-plugin_cleanup(void)
+
+static void
+plugin_automark_cleanup(G_GNUC_UNUSED GeanyPlugin *plugin, G_GNUC_UNUSED gpointer pdata)
 {
 	if (source_id)
 		g_source_remove(source_id);
 }
 
-void
-plugin_help(void)
+
+static void
+plugin_automark_help (G_GNUC_UNUSED GeanyPlugin *plugin, G_GNUC_UNUSED gpointer pdata)
 {
 	utils_open_browser("http://plugins.geany.org/automark.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 = _("Auto-mark");
+	plugin->info->description = _("Auto-mark word under cursor");
+	plugin->info->version = "0.1";
+	plugin->info->author = "Pavel Roschin <rpg89(at)post(dot)ru>";
+
+	/* Set functions */
+	plugin->funcs->init = plugin_automark_init;
+	plugin->funcs->cleanup = plugin_automark_cleanup;
+	plugin->funcs->help = plugin_automark_help;
+	plugin->funcs->callbacks = plugin_automark_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