Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

automark: use new plugin API #701

Merged
merged 2 commits into from
Apr 14, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 37 additions & 15 deletions automark/src/automark.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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, 226);
}