GnuCash  5.6-150-g038405b370+
gnc-plugin-bi-import.c
1 /*
2  * gnc-plugin-bi-import.c -- Invoice Importer Plugin
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 
30 #ifdef HAVE_CONFIG_H
31 #include <config.h>
32 #endif
33 #include <glib/gi18n.h>
34 
35 #include "dialog-utils.h"
36 
37 #include "gnc-plugin-bi-import.h"
38 #include "dialog-bi-import-gui.h"
39 #include "gnc-plugin-manager.h"
40 
41 /* This static indicates the debugging module that this .o belongs to. */
42 static QofLogModule log_module = G_LOG_DOMAIN;
43 
44 static void gnc_plugin_bi_import_finalize (GObject *object);
45 
46 /* Command callbacks */
47 static void gnc_plugin_bi_import_cmd_test (GSimpleAction *simple, GVariant *parameter, gpointer user_data);
48 
49 #define PLUGIN_ACTIONS_NAME "gnc-plugin-bi-import-actions"
50 #define PLUGIN_UI_FILENAME "gnc-plugin-bi-import.ui"
51 
52 static GActionEntry gnc_plugin_actions [] =
53 {
54  // should be "BiImportAction", but "bi_importAction" is already
55  // used externally in accelerator maps
56  { "bi_importAction", gnc_plugin_bi_import_cmd_test, NULL, NULL, NULL },
57 };
59 static guint gnc_plugin_n_actions = G_N_ELEMENTS(gnc_plugin_actions);
60 
62 static const gchar *gnc_plugin_load_ui_items [] =
63 {
64  "FilePlaceholder1",
65  NULL,
66 };
67 
68 /************************************************************
69  * Object Implementation *
70  ************************************************************/
71 
73 {
74  GncPlugin gnc_plugin;
75 };
76 
77 G_DEFINE_TYPE(GncPluginBiImport, gnc_plugin_bi_import, GNC_TYPE_PLUGIN)
78 
79 GncPlugin *
81 {
82  return GNC_PLUGIN (g_object_new (GNC_TYPE_PLUGIN_BI_IMPORT, (gchar*) NULL));
83 }
84 
85 static void
86 gnc_plugin_bi_import_class_init (GncPluginBiImportClass *klass)
87 {
88  GObjectClass *object_class = G_OBJECT_CLASS (klass);
89  GncPluginClass *plugin_class = GNC_PLUGIN_CLASS(klass);
90 
91  object_class->finalize = gnc_plugin_bi_import_finalize;
92 
93  /* plugin info */
94  plugin_class->plugin_name = GNC_PLUGIN_BI_IMPORT_NAME;
95 
96  /* widget addition/removal */
97  plugin_class->actions_name = PLUGIN_ACTIONS_NAME;
98  plugin_class->actions = gnc_plugin_actions;
99  plugin_class->n_actions = gnc_plugin_n_actions;
100  plugin_class->ui_filename = PLUGIN_UI_FILENAME;
101  plugin_class->ui_updates = gnc_plugin_load_ui_items;
102 }
103 
104 static void
105 gnc_plugin_bi_import_init (GncPluginBiImport *plugin)
106 {
107 }
108 
109 static void
110 gnc_plugin_bi_import_finalize (GObject *object)
111 {
112 }
113 
114 /************************************************************
115 * Plugin Bootstrapping *
116 ************************************************************/
117 
118 void
120 {
121  GncPlugin *plugin = gnc_plugin_bi_import_new ();
122 
124 }
125 
126 /************************************************************
127  * Command Callbacks *
128  ************************************************************/
129 
130 static void
131 gnc_plugin_bi_import_cmd_test (GSimpleAction *simple,
132  GVariant *parameter,
133  gpointer user_data)
134 {
135  GncMainWindowActionData *data = user_data;
136 
137  ENTER ("action %p, main window data %p", simple, data);
138  PINFO ("bi_import");
139 
140  gnc_plugin_bi_import_showGUI(GTK_WINDOW(data->window));
141 
142  LEAVE (" ");
143 }
GUI handling for bi-import plugin.
#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
Plugin management functions for the GnuCash UI.
void gnc_plugin_bi_import_create_plugin(void)
Create a new GncPluginbi_import object and register it.
void gnc_plugin_manager_add_plugin(GncPluginManager *manager, GncPlugin *plugin)
Add a plugin to the list maintained by the plugin manager.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
GncPlugin * gnc_plugin_bi_import_new(void)
GncPluginManager * gnc_plugin_manager_get(void)
Retrieve a pointer to the plugin manager.
Plugin registration of the bi-import module.
#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
BillImportGui * gnc_plugin_bi_import_showGUI(GtkWindow *parent)
File chooser.
#define PLUGIN_UI_FILENAME
The name of the UI description file for this plugin.