[geany/geany-plugins] 5be223: Merge pull request #700 from LarsGit223/autoclose-newapi

Frank Lanitz git-noreply at xxxxx
Sun Apr 14 16:25:42 UTC 2019


Branch:      refs/heads/master
Author:      Frank Lanitz <frank at frank.uvena.de>
Committer:   GitHub <noreply at github.com>
Date:        Sun, 14 Apr 2019 16:25:42 UTC
Commit:      5be223bccd3e843e41d6702eb7d596eddbb93d37
             https://github.com/geany/geany-plugins/commit/5be223bccd3e843e41d6702eb7d596eddbb93d37

Log Message:
-----------
Merge pull request #700 from LarsGit223/autoclose-newapi

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, 226);
+}



--------------
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