GnuCash  5.6-150-g038405b370+
gnc-plugin.example.c
1 /*
2  * gnc-plugin-example.c --
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2 of
7  * the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, contact:
16  *
17  * Free Software Foundation Voice: +1-617-542-5942
18  * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
19  * Boston, MA 02110-1301, USA gnu@gnu.org
20  */
21 
29 #include <config.h>
30 
31 #include <glib/gi18n.h>
32 
33 #include "gnc-plugin-example.h"
34 
35 /* This static indicates the debugging module that this .o belongs to. */
36 static QofLogModule log_module = G_LOG_DOMAIN;
37 
38 static void gnc_plugin_example_finalize (GObject *object);
39 
40 /* Command callbacks */
41 static void gnc_plugin_example_cmd_test (GSimpleAction *simple, GVariant *parameter, gpointer user_data);
42 +{
43 
44 #define PLUGIN_ACTIONS_NAME "gnc-plugin-example-actions"
45 #define PLUGIN_UI_FILENAME "gnc-plugin-example.ui"
46 
47 static GActionEntry gnc_plugin_actions [] =
48 {
49  { "exampleAction", gnc_plugin_example_cmd_test, NULL, NULL, NULL },
50 };
52 static guint gnc_plugin_n_actions = G_N_ELEMENTS(gnc_plugin_actions);
53 
54 /************************************************************
55  * Object Implementation *
56  ************************************************************/
57 
59 {
60  GncPlugin gnc_plugin;
61 };
62 
63 G_DEFINE_TYPE(GncPluginExample, gnc_plugin_example, GNC_TYPE_PLUGIN)
64 
65 GncPlugin *
67 {
68  return GNC_PLUGIN (g_object_new (GNC_TYPE_PLUGIN_EXAMPLE, (gchar*) NULL));
69 }
70 
71 static void
72 gnc_plugin_example_class_init (GncPluginExampleClass *klass)
73 {
74  GObjectClass *object_class = G_OBJECT_CLASS(klass);
75  GncPluginClass *plugin_class = GNC_PLUGIN_CLASS(klass);
76 
77  object_class->finalize = gnc_plugin_example_finalize;
78 
79  /* plugin info */
80  plugin_class->plugin_name = GNC_PLUGIN_example_NAME;
81 
82  /* widget addition/removal */
83  plugin_class->actions_name = PLUGIN_ACTIONS_NAME;
84  plugin_class->actions = gnc_plugin_actions;
85  plugin_class->n_actions = gnc_plugin_n_actions;
86  plugin_class->ui_filename = PLUGIN_UI_FILENAME;
87 }
88 
89 static void
90 gnc_plugin_example_init (GncPluginExample *plugin)
91 {
92 }
93 
94 static void
95 gnc_plugin_example_finalize (GObject *object)
96 {
97 }
98 
99 /************************************************************
100  * Command Callbacks *
101  ************************************************************/
102 
103 static void
104 gnc_plugin_example_cmd_test (GSimpleAction *simple,
105  GVariant *parameter,
106  gpointer user_data)
107 {
108  GncMainWindowActionData *data = user_data;
109  ENTER("action %p, main window data %p", simple, data);
110  PINFO("example");
111  LEAVE(" ");
112 }
#define G_LOG_DOMAIN
Functions providing the SX List as a plugin page.
#define PINFO(format, args...)
Print an informational note.
Definition: qoflog.h:256
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
GncPlugin * gnc_plugin_example_new(void)
#define PLUGIN_ACTIONS_NAME
The label given to the main window for this plugin.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282
#define PLUGIN_UI_FILENAME
The name of the UI description file for this plugin.