GnuCash 2.4.99
gncmod-business-gnome.c
00001 /*********************************************************************
00002  * businessmod-core.c
00003  * module definition/initialization for the Business GNOME UI module
00004  *
00005  * Copyright (c) 2001 Derek Atkins <warlord@MIT.EDU>
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License as
00009  * published by the Free Software Foundation; either version 2 of
00010  * the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, contact:
00019  *
00020  * Free Software Foundation           Voice:  +1-617-542-5942
00021  * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652
00022  * Boston, MA  02110-1301,  USA       gnu@gnu.org
00023  *
00024  *********************************************************************/
00025 
00026 #ifdef HAVE_CONFIG_H
00027 #include <config.h>
00028 #endif
00029 
00030 #include <gmodule.h>
00031 #include <gtk/gtk.h>
00032 #include <glib/gi18n.h>
00033 #include <libguile.h>
00034 
00035 #include "gnc-hooks.h"
00036 #include "gnc-module.h"
00037 #include "gnc-module-api.h"
00038 
00039 #include "search-core-type.h"
00040 #include "search-owner.h"
00041 #include "gncOwner.h"
00042 #include "business-options-gnome.h"
00043 #include "business-urls.h"
00044 
00045 #include "gnc-plugin-manager.h"
00046 #include "gnc-plugin-business.h"
00047 
00048 #include "gnc-hooks.h"
00049 #include "dialog-invoice.h"
00050 #include "dialog-preferences.h"
00051 
00052 GNC_MODULE_API_DECL(libgncmod_business_gnome)
00053 
00054 /* version of the gnc module system interface we require */
00055 int libgncmod_business_gnome_gnc_module_system_interface = 0;
00056 
00057 /* module versioning uses libtool semantics. */
00058 int libgncmod_business_gnome_gnc_module_current  = 0;
00059 int libgncmod_business_gnome_gnc_module_revision = 0;
00060 int libgncmod_business_gnome_gnc_module_age      = 0;
00061 
00062 
00063 char *
00064 libgncmod_business_gnome_gnc_module_path(void)
00065 {
00066     return g_strdup("gnucash/business-gnome");
00067 }
00068 
00069 char *
00070 libgncmod_business_gnome_gnc_module_description(void)
00071 {
00072     return g_strdup("The GnuCash business module GNOME UI");
00073 }
00074 
00075 int
00076 libgncmod_business_gnome_gnc_module_init(int refcount)
00077 {
00078     /* load app-utils: we depend on it -- and it depends on the engine */
00079     if (!gnc_module_load ("gnucash/app-utils", 0))
00080     {
00081         return FALSE;
00082     }
00083     /* We also depend on gnome-utils and gnome-search modules */
00084     if (!gnc_module_load ("gnucash/gnome-utils", 0))
00085     {
00086         return FALSE;
00087     }
00088     if (!gnc_module_load ("gnucash/gnome-search", 0))
00089     {
00090         return FALSE;
00091     }
00092     if (!gnc_module_load ("gnucash/report/report-gnome", 0))
00093     {
00094         return FALSE;
00095     }
00096 
00097     scm_c_eval_string("(use-modules (gnucash business-gnome))");
00098     scm_c_eval_string("(use-modules (gnucash report business-reports))");
00099 
00100     if (refcount == 0)
00101     {
00102         /* Register the Owner search type */
00103         gnc_search_core_register_type (GNC_OWNER_MODULE_NAME,
00104                                        (GNCSearchCoreNew) gnc_search_owner_new);
00105         gnc_business_urls_initialize ();
00106         gnc_business_options_gnome_initialize ();
00107 
00108         gnc_plugin_manager_add_plugin (gnc_plugin_manager_get (),
00109                                        gnc_plugin_business_new ());
00110 
00111         gnc_hook_add_dangler(HOOK_BOOK_OPENED,
00112                              (GFunc)gnc_invoice_remind_bills_due_cb, NULL);
00113 
00114         /* Add to preferences under Business */
00115         /* The parameters are; glade file, items to add from glade file - last being the dialog, preference tab name */
00116         gnc_preferences_add_page("business-prefs.glade", "liststore_printinvoice,days_in_adj,business_prefs",
00117                                  _("Business"));
00118     }
00119 
00120     return TRUE;
00121 }
00122 
00123 int
00124 libgncmod_business_gnome_gnc_module_end(int refcount)
00125 {
00126     return TRUE;
00127 }
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines