GnuCash  5.6-150-g038405b370+
gnc-plugin-ofx.c
1 /*
2  * gnc-plugin-ofx.c --
3  * Copyright (C) 2003 David Hampton <hampton@employees.org>
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 gnu@gnu.org
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_finalize (GObject *object);
33 
34 /* Command callbacks */
35 static void gnc_plugin_ofx_cmd_import (GSimpleAction *simple, GVariant *parameter, gpointer user_data);
36 
37 
38 #define PLUGIN_ACTIONS_NAME "gnc-plugin-ofx-actions"
39 #define PLUGIN_UI_FILENAME "gnc-plugin-ofx.ui"
40 
41 static GActionEntry gnc_plugin_actions [] =
42 {
43  { "OfxImportAction", gnc_plugin_ofx_cmd_import, NULL, NULL, NULL },
44 };
46 static guint gnc_plugin_n_actions = G_N_ELEMENTS(gnc_plugin_actions);
47 
49 static const gchar *gnc_plugin_load_ui_items [] =
50 {
51  "FilePlaceholder1",
52  NULL,
53 };
54 
56 {
57  GncPlugin gnc_plugin;
58 };
59 
60 G_DEFINE_TYPE(GncPluginOfx, gnc_plugin_ofx, GNC_TYPE_PLUGIN)
61 
62 GncPlugin *
63 gnc_plugin_ofx_new (void)
64 {
65  return GNC_PLUGIN (g_object_new (GNC_TYPE_PLUGIN_OFX, NULL));
66 }
67 
68 static void
69 gnc_plugin_ofx_class_init (GncPluginOfxClass *klass)
70 {
71  GObjectClass *object_class = G_OBJECT_CLASS (klass);
72  GncPluginClass *plugin_class = GNC_PLUGIN_CLASS (klass);
73 
74  object_class->finalize = gnc_plugin_ofx_finalize;
75 
76  /* plugin info */
77  plugin_class->plugin_name = GNC_PLUGIN_OFX_NAME;
78 
79  /* widget addition/removal */
80  plugin_class->actions_name = PLUGIN_ACTIONS_NAME;
81  plugin_class->actions = gnc_plugin_actions;
82  plugin_class->n_actions = gnc_plugin_n_actions;
83  plugin_class->ui_filename = PLUGIN_UI_FILENAME;
84  plugin_class->ui_updates = gnc_plugin_load_ui_items;
85 }
86 
87 static void
88 gnc_plugin_ofx_init (GncPluginOfx *plugin)
89 {
90 }
91 
92 static void
93 gnc_plugin_ofx_finalize (GObject *object)
94 {
95  g_return_if_fail (GNC_IS_PLUGIN_OFX (object));
96 
97  G_OBJECT_CLASS (gnc_plugin_ofx_parent_class)->finalize (object);
98 }
99 
100 /************************************************************
101  * Plugin Function Implementation *
102  ************************************************************/
103 
104 /************************************************************
105  * Command Callbacks *
106  ************************************************************/
107 
108 static void
109 gnc_plugin_ofx_cmd_import (GSimpleAction *simple,
110  GVariant *parameter,
111  gpointer user_data)
112 {
113  GncMainWindowActionData *data = user_data;
114  gnc_file_ofx_import (GTK_WINDOW (data->window));
115 }
116 
117 
118 /************************************************************
119  * Plugin Bootstrapping *
120  ************************************************************/
121 
122 void
123 gnc_plugin_ofx_create_plugin (void)
124 {
125  GncPlugin *plugin = gnc_plugin_ofx_new ();
126 
128 }
Plugin management functions for the GnuCash UI.
void gnc_plugin_manager_add_plugin(GncPluginManager *manager, GncPlugin *plugin)
Add a plugin to the list maintained by the plugin manager.
Ofx import module interface.
void gnc_file_ofx_import(GtkWindow *parent)
The gnc_file_ofx_import() routine will pop up a standard file selection dialogue asking the user to p...
GncPluginManager * gnc_plugin_manager_get(void)
Retrieve a pointer to the plugin manager.
#define PLUGIN_ACTIONS_NAME
The label given to the main window for this plugin.
#define PLUGIN_UI_FILENAME
The name of the UI description file for this plugin.