GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
gncmod-business-gnome.c
1 /*********************************************************************
2  * businessmod-core.c
3  * module definition/initialization for the Business GNOME UI module
4  *
5  * Copyright (c) 2001 Derek Atkins <[email protected]>
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License as
9  * published by the Free Software Foundation; either version 2 of
10  * the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, contact:
19  *
20  * Free Software Foundation Voice: +1-617-542-5942
21  * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
22  * Boston, MA 02110-1301, USA [email protected]
23  *
24  *********************************************************************/
25 
26 #ifdef HAVE_CONFIG_H
27 #include <config.h>
28 #endif
29 
30 #include <gmodule.h>
31 #include <gtk/gtk.h>
32 #include <glib/gi18n.h>
33 #include <libguile.h>
34 
35 #include "gnc-hooks.h"
36 #include "gnc-module.h"
37 #include "gnc-module-api.h"
38 
39 #include "search-core-type.h"
40 #include "search-owner.h"
41 #include "gncOwner.h"
42 #include "business-options-gnome.h"
43 #include "business-urls.h"
44 
45 #include "gnc-plugin-manager.h"
46 #include "gnc-plugin-business.h"
47 
48 #include "gnc-hooks.h"
49 #include "dialog-invoice.h"
50 #include "dialog-preferences.h"
51 
52 GNC_MODULE_API_DECL(libgncmod_business_gnome)
53 
54 /* version of the gnc module system interface we require */
55 int libgncmod_business_gnome_gnc_module_system_interface = 0;
56 
57 /* module versioning uses libtool semantics. */
58 int libgncmod_business_gnome_gnc_module_current = 0;
59 int libgncmod_business_gnome_gnc_module_revision = 0;
60 int libgncmod_business_gnome_gnc_module_age = 0;
61 
62 
63 char *
64 libgncmod_business_gnome_gnc_module_path(void)
65 {
66  return g_strdup("gnucash/business-gnome");
67 }
68 
69 char *
70 libgncmod_business_gnome_gnc_module_description(void)
71 {
72  return g_strdup("The GnuCash business module GNOME UI");
73 }
74 
75 int
76 libgncmod_business_gnome_gnc_module_init(int refcount)
77 {
78  /* load app-utils: we depend on it -- and it depends on the engine */
79  if (!gnc_module_load ("gnucash/app-utils", 0))
80  {
81  return FALSE;
82  }
83  /* We also depend on gnome-utils and gnome-search modules */
84  if (!gnc_module_load ("gnucash/gnome-utils", 0))
85  {
86  return FALSE;
87  }
88  if (!gnc_module_load ("gnucash/gnome-search", 0))
89  {
90  return FALSE;
91  }
92  if (!gnc_module_load ("gnucash/report/report-gnome", 0))
93  {
94  return FALSE;
95  }
96 
97  scm_c_eval_string("(use-modules (gnucash business-gnome))");
98  scm_c_eval_string("(use-modules (gnucash report business-reports))");
99 
100  if (refcount == 0)
101  {
102  /* Register the Owner search type */
103  gnc_search_core_register_type (GNC_OWNER_MODULE_NAME,
104  (GNCSearchCoreNew) gnc_search_owner_new);
105  gnc_business_urls_initialize ();
106  gnc_business_options_gnome_initialize ();
107 
109  gnc_plugin_business_new ());
110 
111  gnc_hook_add_dangler(HOOK_BOOK_OPENED,
112  (GFunc)gnc_invoice_remind_bills_due_cb, NULL);
113 
114  /* Add to preferences under Business */
115  /* The parameters are; glade file, items to add from glade file - last being the dialog, preference tab name */
116  gnc_preferences_add_page("business-prefs.glade", "liststore_printinvoice,days_in_adj,business_prefs",
117  _("Business"));
118  }
119 
120  return TRUE;
121 }
122 
123 int
124 libgncmod_business_gnome_gnc_module_end(int refcount)
125 {
126  return TRUE;
127 }
void gnc_preferences_add_page(const gchar *filename, const gchar *widgetname, const gchar *tabname)
Business Interface: Object OWNERs.
Plugin management functions for the GnuCash UI.
void gnc_plugin_manager_add_plugin(GncPluginManager *manager, GncPlugin *plugin)
GncPluginManager * gnc_plugin_manager_get(void)
Dialog for handling user preferences.