-
Notifications
You must be signed in to change notification settings - Fork 0
/
plugin.c
44 lines (37 loc) · 1.22 KB
/
plugin.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <geanyplugin.h>
#include "include/discord_rpc.h"
#include "discord.h"
static void on_document_activate(GObject *obj, GeanyDocument *doc, gpointer user_data)
{
/* Update presence */
updPresence(doc);
}
static gboolean drpc_init(GeanyPlugin *plugin, gpointer pdata)
{
/* Initiate discord rpc */
discordInit();
plugin_signal_connect(plugin, NULL, "document-activate",
TRUE, G_CALLBACK(on_document_activate), NULL); // listen for active document changes
printf("Discord Presence Plugin: Starting Plugin\n");
return TRUE;
}
static void drpc_cleanup(GeanyPlugin *plugin, gpointer pdata)
{
/* Cleanup discord rpc */
Discord_Shutdown();
printf("Discord Presence Plugin: Stopping Plugin\n");
}
G_MODULE_EXPORT
void geany_load_module(GeanyPlugin *plugin)
{
/* Set metadata */
plugin->info->name = "Discord Presence";
plugin->info->description = "Update your discord status with a rich presence.";
plugin->info->version = "0.1";
plugin->info->author = "Sayan Medya <sayanmedya@gmail.com>";
/* Set functions */
plugin->funcs->init = drpc_init;
plugin->funcs->cleanup = drpc_cleanup;
/* Register! */
GEANY_PLUGIN_REGISTER(plugin, 225);
}