1 /*
2 * uihello.c: sample plugin using "ui" service
3 *
4 * Author: Zbigniew Chyla (cyba@gnome.pl)
5 */
6
7 #include <gnumeric-config.h>
8 #include <wbc-gtk.h>
9 #include <gui-util.h>
10 #include <gnm-plugin.h>
11 #include <glib/gi18n-lib.h>
12
13 GNM_PLUGIN_MODULE_HEADER;
14
15 static GOPlugin *uihello_plugin;
16 G_MODULE_EXPORT void
go_plugin_init(GOPlugin * plugin,GOCmdContext * cc)17 go_plugin_init (GOPlugin *plugin, GOCmdContext *cc)
18 {
19 uihello_plugin = plugin;
20 }
21
22 G_MODULE_EXPORT void
go_plugin_shutdown(GOPlugin * plugin,GOCmdContext * cc)23 go_plugin_shutdown (GOPlugin *plugin, GOCmdContext *cc)
24 {
25 uihello_plugin = NULL;
26 }
27
28 static void
hello_message(GnmAction const * action,WorkbookControl * wbc)29 hello_message (GnmAction const *action, WorkbookControl *wbc)
30 {
31 char *msg = g_strdup_printf (
32 _("This is message from the \"%s\" plugin."),
33 go_plugin_get_name (uihello_plugin));
34 go_gtk_notice_dialog (wbcg_toplevel (WBC_GTK (wbc)), GTK_MESSAGE_INFO,
35 "%s", msg);
36 g_free (msg);
37 }
38
39 GnmModulePluginUIActions const hello_ui_actions[] = {
40 { "HelloMenu", NULL },
41 { "HelloWorld", hello_message },
42 { NULL }
43 };
44