GnuCash 2.4.99
gnc-plugin-bi-import.c
00001 /*
00002  * gnc-plugin-bi-import.c -- Invoice Importer Plugin
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License as
00006  * published by the Free Software Foundation; either version 2 of
00007  * the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, contact:
00016  *
00017  * Free Software Foundation           Voice:  +1-617-542-5942
00018  * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652
00019  * Boston, MA  02110-1301,  USA       gnu@gnu.org
00020  */
00021 
00030 #ifdef HAVE_CONFIG_H
00031 #include "config.h"
00032 #endif
00033 #include <glib/gi18n.h>
00034 
00035 #include "dialog-utils.h"
00036 
00037 #include "gnc-plugin-bi-import.h"
00038 #include "dialog-bi-import-gui.h"
00039 
00040 /* This static indicates the debugging module that this .o belongs to.  */
00041 static QofLogModule log_module = G_LOG_DOMAIN;
00042 
00043 static void gnc_plugin_bi_import_class_init         (GncPluginbi_importClass *klass);
00044 static void gnc_plugin_bi_import_init               (GncPluginbi_import *plugin);
00045 static void gnc_plugin_bi_import_finalize           (GObject *object);
00046 
00047 /* Command callbacks */
00048 static void gnc_plugin_bi_import_cmd_test (GtkAction *action, GncMainWindowActionData *data);
00049 
00050 #define PLUGIN_ACTIONS_NAME "gnc-plugin-bi-import-actions"
00051 #define PLUGIN_UI_FILENAME  "gnc-plugin-bi-import-ui.xml"
00052 
00053 static GtkActionEntry gnc_plugin_actions [] =
00054 {
00055     /* Menu Items */
00056     { "ImportMenuAction", NULL, N_("_Import"), NULL, NULL, NULL },
00057     { "bi_importAction", NULL, N_("Import Bills & Invoices..."), NULL, N_("Import bills and invoices from a CSV text file"),  G_CALLBACK(gnc_plugin_bi_import_cmd_test) },
00058 };
00059 static guint gnc_plugin_n_actions = G_N_ELEMENTS(gnc_plugin_actions);
00060 
00061 
00062 /************************************************************
00063  *                   Object Implementation                  *
00064  ************************************************************/
00065 
00066 G_DEFINE_TYPE(GncPluginbi_import, gnc_plugin_bi_import, GNC_TYPE_PLUGIN);
00067 
00068 GncPlugin *
00069 gnc_plugin_bi_import_new (void)
00070 {
00071     return GNC_PLUGIN (g_object_new (GNC_TYPE_PLUGIN_BI_IMPORT, (gchar*) NULL));
00072 }
00073 
00074 static void
00075 gnc_plugin_bi_import_class_init (GncPluginbi_importClass *klass)
00076 {
00077     GObjectClass *object_class = G_OBJECT_CLASS (klass);
00078     GncPluginClass *plugin_class = GNC_PLUGIN_CLASS(klass);
00079 
00080     object_class->finalize = gnc_plugin_bi_import_finalize;
00081 
00082     /* plugin info */
00083     plugin_class->plugin_name  = GNC_PLUGIN_BI_IMPORT_NAME;
00084 
00085     /* widget addition/removal */
00086     plugin_class->actions_name       = PLUGIN_ACTIONS_NAME;
00087     plugin_class->actions            = gnc_plugin_actions;
00088     plugin_class->n_actions          = gnc_plugin_n_actions;
00089     plugin_class->ui_filename        = PLUGIN_UI_FILENAME;
00090 }
00091 
00092 static void
00093 gnc_plugin_bi_import_init (GncPluginbi_import *plugin)
00094 {
00095 }
00096 
00097 static void
00098 gnc_plugin_bi_import_finalize (GObject *object)
00099 {
00100 }
00101 
00102 /************************************************************
00103  *                    Command Callbacks                     *
00104  ************************************************************/
00105 
00106 static void
00107 gnc_plugin_bi_import_cmd_test (GtkAction *action, GncMainWindowActionData *data)
00108 {
00109     ENTER ("action %p, main window data %p", action, data);
00110     g_message ("bi_import");
00111 
00112     gnc_plugin_bi_import_showGUI();
00113 
00114     LEAVE (" ");
00115 }
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines