Improve some sieve-related translations
[claws.git] / src / plugins / demo / demo.c
blobe19837dc747d6ecec517f252354e8883cf70ad8e
1 /*
2 * Claws Mail -- a GTK based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2012 the Claws Mail Team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #include "config.h"
22 #include <glib.h>
23 #include <glib/gi18n.h>
26 #include "version.h"
27 #include "claws.h"
28 #include "plugin.h"
29 #include "utils.h"
30 #include "hooks.h"
31 #include "log.h"
33 #define PLUGIN_NAME (_("Demo"))
35 gboolean my_log_hook(gpointer source, gpointer data)
37 LogText *logtext = (LogText *)source;
39 g_print("*** Demo Plugin log: %s\n", logtext->text);
41 return FALSE;
44 static gulong hook_id = HOOK_NONE;
46 gint plugin_init(gchar **error)
48 if (!check_plugin_version(MAKE_NUMERIC_VERSION(2,9,2,72),
49 VERSION_NUMERIC, PLUGIN_NAME, error))
50 return -1;
52 hook_id = hooks_register_hook(LOG_APPEND_TEXT_HOOKLIST, my_log_hook, NULL);
53 if (hook_id == HOOK_NONE) {
54 *error = g_strdup(_("Failed to register log text hook"));
55 return -1;
58 g_print("Demo plugin loaded\n");
60 return 0;
63 gboolean plugin_done(void)
65 hooks_unregister_hook(LOG_APPEND_TEXT_HOOKLIST, hook_id);
67 g_print("Demo plugin unloaded\n");
68 return TRUE;
71 const gchar *plugin_name(void)
73 return PLUGIN_NAME;
76 const gchar *plugin_desc(void)
78 return _("This plugin is only a demo of how to write plugins for Claws Mail. "
79 "It installs a hook for new log output and writes it to stdout."
80 "\n\n"
81 "It is not really useful.");
84 const gchar *plugin_type(void)
86 return "Common";
89 const gchar *plugin_licence(void)
91 return "GPL3+";
94 const gchar *plugin_version(void)
96 return VERSION;
99 struct PluginFeature *plugin_provides(void)
101 static struct PluginFeature features[] =
102 { {PLUGIN_OTHER, N_("Demo")},
103 {PLUGIN_NOTHING, NULL}};
104 return features;