GnuCash  5.6-150-g038405b370+
gnc-hooks.h
1 /*
2  * gnc-hooks.h -- helpers for using Glib hook functions
3  * Copyright (C) 2005 David Hampton <hampton@employees.org>
4  * Derek Atkins <derek@ihtfp.com>
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; either version 2 of
9  * the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, contact:
18  *
19  * Free Software Foundation Voice: +1-617-542-5942
20  * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
21  * Boston, MA 02110-1301, USA gnu@gnu.org
22  *
23  */
24 
25 #ifndef GNC_HOOKS_H
26 #define GNC_HOOKS_H
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
37 gchar * gnc_hook_create(const gchar *name, gint num_args, const gchar *desc);
38 
43 void gnc_hook_add_dangler(const gchar *name, GFunc callback,
44  GDestroyNotify destroy, gpointer cb_data);
45 void gnc_hook_remove_dangler(const gchar *name, GFunc callback);
46 
51 int gnc_hook_num_args (const gchar *name);
52 
56 void gnc_hook_run(const gchar *name, gpointer data);
57 
61 void gnc_hooks_init(void);
62 
63 /* Common hook names */
64 #define HOOK_STARTUP "hook_startup"
65 #define HOOK_SHUTDOWN "hook_shutdown"
66 #define HOOK_UI_STARTUP "hook_ui_startup"
67 #define HOOK_UI_POST_STARTUP "hook_ui_post_startup"
68 #define HOOK_UI_SHUTDOWN "hook_ui_shutdown"
69 #define HOOK_NEW_BOOK "hook_new_book"
70 #define HOOK_REPORT "hook_report"
71 #define HOOK_CURRENCY_CHANGED "hook_currency_changed"
72 #define HOOK_SAVE_OPTIONS "hook_save_options"
73 #define HOOK_ADD_EXTENSION "hook_add_extension"
74 
75 /* Common session hook names */
76 #define HOOK_BOOK_OPENED "hook_book_opened"
77 #define HOOK_BOOK_CLOSED "hook_book_closed"
78 #define HOOK_BOOK_SAVED "hook_book_saved"
79 
80 #ifdef __cplusplus
81 }
82 #endif
83 
84 #endif /* GNC_HOOKS_H */