GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 [email protected]
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_class_init (GncPluginexampleClass *klass);
39 static void gnc_plugin_example_init (GncPluginexample *plugin);
40 static void gnc_plugin_example_finalize (GObject *object);
41 
42 /* Command callbacks */
43 static void gnc_plugin_example_cmd_test (GtkAction *action, GncMainWindowActionData *data);
44 
45 #define PLUGIN_ACTIONS_NAME "gnc-plugin-example-actions"
46 #define PLUGIN_UI_FILENAME "gnc-plugin-example-ui.xml"
47 
48 static GtkActionEntry gnc_plugin_actions [] = {
49  /* Menu Items */
50  { "exampleAction", NULL, N_("example description..."), NULL,
51  N_("example tooltip"),
52  G_CALLBACK(gnc_plugin_example_cmd_test) },
53 };
54 static guint gnc_plugin_n_actions = G_N_ELEMENTS(gnc_plugin_actions);
55 
56 
57 /************************************************************
58  * Object Implementation *
59  ************************************************************/
60 
61 G_DEFINE_TYPE(GncPluginexample, gnc_plugin_example, GNC_TYPE_PLUGIN)
62 
63 GncPlugin *
65 {
66  return GNC_PLUGIN (g_object_new (GNC_TYPE_PLUGIN_example, (gchar*) NULL));
67 }
68 
69 static void
70 gnc_plugin_example_class_init (GncPluginexampleClass *klass)
71 {
72  GObjectClass *object_class = G_OBJECT_CLASS (klass);
73  GncPluginClass *plugin_class = GNC_PLUGIN_CLASS(klass);
74 
75  object_class->finalize = gnc_plugin_example_finalize;
76 
77  /* plugin info */
78  plugin_class->plugin_name = GNC_PLUGIN_example_NAME;
79 
80  /* widget addition/removal */
81  plugin_class->actions_name = PLUGIN_ACTIONS_NAME;
82  plugin_class->actions = gnc_plugin_actions;
83  plugin_class->n_actions = gnc_plugin_n_actions;
84  plugin_class->ui_filename = PLUGIN_UI_FILENAME;
85 }
86 
87 static void
88 gnc_plugin_example_init (GncPluginexample *plugin)
89 {
90 }
91 
92 static void
93 gnc_plugin_example_finalize (GObject *object)
94 {
95 }
96 
97 /************************************************************
98  * Command Callbacks *
99  ************************************************************/
100 
101 static void
102 gnc_plugin_example_cmd_test (GtkAction *action, GncMainWindowActionData *data)
103 {
104  ENTER ("action %p, main window data %p", action, data);
105  g_message ("example");
106  LEAVE (" ");
107 }
#define G_LOG_DOMAIN
Functions providing the SX List as a plugin page.
#define ENTER(format, args...)
Definition: qoflog.h:261
const gchar * ui_filename
Definition: gnc-plugin.h:137
GncPlugin * gnc_plugin_example_new(void)
GtkActionEntry * actions
Definition: gnc-plugin.h:122
const gchar * actions_name
Definition: gnc-plugin.h:119
const gchar * plugin_name
Definition: gnc-plugin.h:112
#define PLUGIN_ACTIONS_NAME
#define LEAVE(format, args...)
Definition: qoflog.h:271
#define PLUGIN_UI_FILENAME
const gchar * QofLogModule
Definition: qofid.h:89