[geany/geany-plugins] e512bf: autoclose: use new plugin API

LarsDW223 git-noreply at xxxxx
Sun Apr 14 16:25:46 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:05:57 UTC
Commit:      e512bfec2c9ee5c858586d32c2052af58e8b4a60
             https://github.com/geany/geany-plugins/commit/e512bfec2c9ee5c858586d32c2052af58e8b4a60

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


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

Modified: autoclose/src/autoclose.c
55 lines changed, 38 insertions(+), 17 deletions(-)
===================================================================
@@ -42,14 +42,6 @@
 GeanyPlugin	*geany_plugin;
 GeanyData	*geany_data;
 
-PLUGIN_VERSION_CHECK(224)
-PLUGIN_SET_TRANSLATABLE_INFO(
-	LOCALEDIR,
-	GETTEXT_PACKAGE,
-	_("Auto-close"),
-	_("Auto-close braces and brackets with lot of features"),
-	"0.3",
-	"Pavel Roschin <rpg89(at)post(dot)ru>")
 
 typedef struct {
 	/* close chars */
@@ -830,7 +822,7 @@ on_document_open(GObject *obj, GeanyDocument *doc, gpointer user_data)
 	g_object_set_data_full(G_OBJECT(sci), "autoclose-userdata", data, g_free);
 }
 
-PluginCallback plugin_callbacks[] =
+static PluginCallback plugin_autoclose_callbacks[] =
 {
 	{ "document-open",  (GCallback) &on_document_open, FALSE, NULL },
 	{ "document-new",   (GCallback) &on_document_open, FALSE, NULL },
@@ -896,11 +888,14 @@ configure_response_cb(GtkDialog *dialog, gint response, gpointer user_data)
 }
 
 /* Called by Geany to initialize the plugin */
-void
-plugin_init(G_GNUC_UNUSED GeanyData *data)
+static gboolean
+plugin_autoclose_init(GeanyPlugin *plugin, G_GNUC_UNUSED gpointer pdata)
 {
 	guint i = 0;
 
+	geany_plugin = plugin;
+	geany_data = plugin->geany_data;
+
 	foreach_document(i)
 	{
 		on_document_open(NULL, documents[i], NULL);
@@ -943,6 +938,7 @@ plugin_init(G_GNUC_UNUSED GeanyData *data)
 #undef GET_CONF_BOOL
 
 	g_key_file_free(config);
+	return TRUE;
 }
 
 #define GET_CHECKBOX_ACTIVE(name) gboolean sens = gtk_toggle_button_get_active(\
@@ -1002,8 +998,8 @@ ac_delete_pairing_brace_cb(GtkToggleButton *togglebutton, gpointer data)
 	SET_SENS(bcksp_remove_pair);
 }
 
-GtkWidget *
-plugin_configure(GtkDialog *dialog)
+static GtkWidget *
+plugin_autoclose_configure(G_GNUC_UNUSED GeanyPlugin *plugin, GtkDialog *dialog, G_GNUC_UNUSED gpointer pdata)
 {
 	GtkWidget *widget, *vbox, *frame, *container, *scrollbox;
 	vbox = gtk_vbox_new(FALSE, 0);
@@ -1134,16 +1130,41 @@ autoclose_cleanup(void)
 }
 
 /* Called by Geany before unloading the plugin. */
-void
-plugin_cleanup(void)
+static void
+plugin_autoclose_cleanup(G_GNUC_UNUSED GeanyPlugin *plugin, G_GNUC_UNUSED gpointer pdata)
 {
 	autoclose_cleanup();
 	g_free(ac_info->config_file);
 	g_free(ac_info);
 }
 
-void
-plugin_help(void)
+static void
+plugin_autoclose_help(G_GNUC_UNUSED GeanyPlugin *plugin, G_GNUC_UNUSED gpointer pdata)
 {
 	utils_open_browser("http://plugins.geany.org/autoclose.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-close");
+	plugin->info->description = _("Auto-close braces and brackets with lot of features");
+	plugin->info->version = "0.3";
+	plugin->info->author = "Pavel Roschin <rpg89(at)post(dot)ru>";
+
+	/* Set functions */
+	plugin->funcs->init = plugin_autoclose_init;
+	plugin->funcs->cleanup = plugin_autoclose_cleanup;
+	plugin->funcs->help = plugin_autoclose_help;
+	plugin->funcs->callbacks = plugin_autoclose_callbacks;
+	plugin->funcs->configure = plugin_autoclose_configure;
+
+	/* 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