GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
gnc-plugin-ofx.c
1 /*
2  * gnc-plugin-ofx.c --
3  * Copyright (C) 2003 David Hampton <[email protected]>
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License as
7  * published by the Free Software Foundation; either version 2 of
8  * the License, or (at your option) any later version.
9  *
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.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, contact:
17  *
18  * Free Software Foundation Voice: +1-617-542-5942
19  * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
20  * Boston, MA 02110-1301, USA [email protected]
21  */
22 
23 #include "config.h"
24 
25 #include <gtk/gtk.h>
26 #include <glib/gi18n.h>
27 
28 #include "gnc-ofx-import.h"
29 #include "gnc-plugin-ofx.h"
30 #include "gnc-plugin-manager.h"
31 
32 static void gnc_plugin_ofx_class_init (GncPluginOfxClass *klass);
33 static void gnc_plugin_ofx_init (GncPluginOfx *plugin);
34 static void gnc_plugin_ofx_finalize (GObject *object);
35 
36 /* Command callbacks */
37 static void gnc_plugin_ofx_cmd_import (GtkAction *action, GncMainWindowActionData *data);
38 
39 
40 #define PLUGIN_ACTIONS_NAME "gnc-plugin-ofx-actions"
41 #define PLUGIN_UI_FILENAME "gnc-plugin-ofx-ui.xml"
42 
43 static GtkActionEntry gnc_plugin_actions [] =
44 {
45  {
46  "OfxImportAction", GTK_STOCK_CONVERT, N_("Import _OFX/QFX..."), NULL,
47  N_("Process an OFX/QFX response file"),
48  G_CALLBACK (gnc_plugin_ofx_cmd_import)
49  },
50 };
51 static guint gnc_plugin_n_actions = G_N_ELEMENTS (gnc_plugin_actions);
52 
53 typedef struct GncPluginOfxPrivate
54 {
55  gpointer dummy;
57 
58 #define GNC_PLUGIN_OFX_GET_PRIVATE(o) \
59  (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_PLUGIN_OFX, GncPluginOfxPrivate))
60 
61 static GObjectClass *parent_class = NULL;
62 
63 GType
64 gnc_plugin_ofx_get_type (void)
65 {
66  static GType gnc_plugin_ofx_type = 0;
67 
68  if (gnc_plugin_ofx_type == 0)
69  {
70  static const GTypeInfo our_info =
71  {
72  sizeof (GncPluginOfxClass),
73  NULL, /* base_init */
74  NULL, /* base_finalize */
75  (GClassInitFunc) gnc_plugin_ofx_class_init,
76  NULL, /* class_finalize */
77  NULL, /* class_data */
78  sizeof (GncPluginOfx),
79  0, /* n_preallocs */
80  (GInstanceInitFunc) gnc_plugin_ofx_init,
81  };
82 
83  gnc_plugin_ofx_type = g_type_register_static (GNC_TYPE_PLUGIN,
84  "GncPluginOfx",
85  &our_info, 0);
86  }
87 
88  return gnc_plugin_ofx_type;
89 }
90 
91 GncPlugin *
92 gnc_plugin_ofx_new (void)
93 {
94  return GNC_PLUGIN (g_object_new (GNC_TYPE_PLUGIN_OFX, NULL));
95 }
96 
97 static void
98 gnc_plugin_ofx_class_init (GncPluginOfxClass *klass)
99 {
100  GObjectClass *object_class = G_OBJECT_CLASS (klass);
101  GncPluginClass *plugin_class = GNC_PLUGIN_CLASS (klass);
102 
103  parent_class = g_type_class_peek_parent (klass);
104 
105  object_class->finalize = gnc_plugin_ofx_finalize;
106 
107  /* plugin info */
108  plugin_class->plugin_name = GNC_PLUGIN_OFX_NAME;
109 
110  /* widget addition/removal */
111  plugin_class->actions_name = PLUGIN_ACTIONS_NAME;
112  plugin_class->actions = gnc_plugin_actions;
113  plugin_class->n_actions = gnc_plugin_n_actions;
114  plugin_class->ui_filename = PLUGIN_UI_FILENAME;
115 
116  g_type_class_add_private(klass, sizeof(GncPluginOfxPrivate));
117 }
118 
119 static void
120 gnc_plugin_ofx_init (GncPluginOfx *plugin)
121 {
122 }
123 
124 static void
125 gnc_plugin_ofx_finalize (GObject *object)
126 {
127  g_return_if_fail (GNC_IS_PLUGIN_OFX (object));
128 
129  G_OBJECT_CLASS (parent_class)->finalize (object);
130 }
131 
132 /************************************************************
133  * Plugin Function Implementation *
134  ************************************************************/
135 
136 /************************************************************
137  * Command Callbacks *
138  ************************************************************/
139 
140 static void
141 gnc_plugin_ofx_cmd_import (GtkAction *action,
143 {
145 }
146 
147 
148 /************************************************************
149  * Plugin Bootstrapping *
150  ************************************************************/
151 
152 void
153 gnc_plugin_ofx_create_plugin (void)
154 {
155  GncPlugin *plugin = gnc_plugin_ofx_new ();
156 
158 }
Plugin management functions for the GnuCash UI.
void gnc_plugin_manager_add_plugin(GncPluginManager *manager, GncPlugin *plugin)
Ofx import module interface.
const gchar * ui_filename
Definition: gnc-plugin.h:137
GtkActionEntry * actions
Definition: gnc-plugin.h:122
GncPluginManager * gnc_plugin_manager_get(void)
void gnc_file_ofx_import(void)
const gchar * actions_name
Definition: gnc-plugin.h:119
const gchar * plugin_name
Definition: gnc-plugin.h:112
#define PLUGIN_ACTIONS_NAME
#define PLUGIN_UI_FILENAME