GnuCash  4.11-148-gc20d717b33+
gnc-plugin.h
Go to the documentation of this file.
1 /*
2  * gnc-plugin.h -- A module or plugin which can add more
3  * functionality to GnuCash.
4  * Copyright (C) 2003 Jan Arne Petersen <jpetersen@uni-bonn.de>
5  * Copyright (C) 2003,2005 David Hampton <hampton@employees.org>
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 gnu@gnu.org
23  */
24 
79 #ifndef __GNC_PLUGIN_H
80 #define __GNC_PLUGIN_H
81 
82 #include "gnc-main-window.h"
83 #include "gnc-plugin-page.h"
84 
85 G_BEGIN_DECLS
86 
87 /* type macros */
88 #define GNC_TYPE_PLUGIN (gnc_plugin_get_type ())
89 #define GNC_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_PLUGIN, GncPlugin))
90 #define GNC_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_PLUGIN, GncPluginClass))
91 #define GNC_IS_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_PLUGIN))
92 #define GNC_IS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_PLUGIN))
93 #define GNC_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_PLUGIN, GncPluginClass))
94 
95 #define GNC_PLUGIN_NAME "GncPlugin"
96 
97 /* typedefs & structures */
98 
100 typedef struct
101 {
103  GObject gobject;
104 } GncPlugin;
105 
107 typedef struct
108 {
110  GObjectClass gobject;
112  const gchar *plugin_name;
113 
114  /* Actions section */
115 
119  const gchar *actions_name;
122  GtkActionEntry *actions;
124  guint n_actions;
127  GtkToggleActionEntry *toggle_actions;
134  const gchar **important_actions;
137  const gchar *ui_filename;
138 
139  /* Virtual Table */
140 
154  void (* add_to_window)
155  (GncPlugin *plugin, GncMainWindow *window, GQuark type);
156 
170  void (* remove_from_window)
171  (GncPlugin *plugin, GncMainWindow *window, GQuark type);
173 
174 /* function prototypes */
175 
180 GType gnc_plugin_get_type (void);
181 
182 
193 void gnc_plugin_add_to_window (GncPlugin *plugin,
194  GncMainWindow *window,
195  GQuark type);
196 
197 
209  GncMainWindow *window,
210  GQuark type);
211 
212 
219 const gchar *gnc_plugin_get_name (GncPlugin *plugin);
220 
221 
228 typedef struct
229 {
231  const char *action_name;
233  const char *label;
235 
236 
252 void gnc_plugin_init_short_names (GtkActionGroup *action_group,
253  action_toolbar_labels *toolbar_labels);
254 
255 
267 void gnc_plugin_set_important_actions (GtkActionGroup *action_group,
268  const gchar **names);
269 
270 
289 void gnc_plugin_update_actions (GtkActionGroup *action_group,
290  const gchar **action_names,
291  const gchar *property_name,
292  gboolean value);
293 
294 
310 gint gnc_plugin_add_actions (GtkUIManager *ui_merge,
311  GtkActionGroup *action_group,
312  const gchar *filename);
313 G_END_DECLS
314 
315 #endif /* __GNC_PLUGIN_H */
316 
guint n_actions
The number of actions in the actions array.
Definition: gnc-plugin.h:124
GObject gobject
The parent object for this widget.
Definition: gnc-plugin.h:103
A structure for defining alternate action names for use in the toolbar.
Definition: gnc-plugin.h:228
void gnc_plugin_add_to_window(GncPlugin *plugin, GncMainWindow *window, GQuark type)
Add the specified plugin from the specified window.
Definition: gnc-plugin.c:128
The class data structure for a menu-only plugin.
Definition: gnc-plugin.h:107
const char * label
The alternate toolbar label to use.
Definition: gnc-plugin.h:233
guint n_toggle_actions
The number of toggle actions in the toggle actions array.
Definition: gnc-plugin.h:129
const gchar * ui_filename
The relative name of the XML file describing the menu/toolbar action items.
Definition: gnc-plugin.h:137
Functions for adding content to a window.
GType gnc_plugin_get_type(void)
Get the type of a menu-only plugin.
GtkActionEntry * actions
An array of actions that should automatically be added to any GnuCash "main" content window that is o...
Definition: gnc-plugin.h:122
gint gnc_plugin_add_actions(GtkUIManager *ui_merge, GtkActionGroup *action_group, const gchar *filename)
Load a new set of actions into an existing UI.
Definition: gnc-plugin.c:309
void gnc_plugin_init_short_names(GtkActionGroup *action_group, action_toolbar_labels *toolbar_labels)
Add "short" labels to existing actions.
Definition: gnc-plugin.c:234
Functions for adding plugins to a GnuCash window.
const gchar ** important_actions
A NULL terminated list of actions that should be considered important.
Definition: gnc-plugin.h:134
void gnc_plugin_remove_from_window(GncPlugin *plugin, GncMainWindow *window, GQuark type)
Remove the specified plugin from the specified window.
Definition: gnc-plugin.c:180
GObjectClass gobject
The parent class for this widget.
Definition: gnc-plugin.h:110
const gchar * gnc_plugin_get_name(GncPlugin *plugin)
Retrieve the textual name of a plugin.
Definition: gnc-plugin.c:217
GtkToggleActionEntry * toggle_actions
An array of toggle actions that should automatically be added to any GnuCash "main" content window th...
Definition: gnc-plugin.h:127
const gchar * actions_name
A name for the set of actions that will be added by this plugin.
Definition: gnc-plugin.h:119
const gchar * plugin_name
The textual name of this plugin.
Definition: gnc-plugin.h:112
void gnc_plugin_update_actions(GtkActionGroup *action_group, const gchar **action_names, const gchar *property_name, gboolean value)
Update a property on a set of existing GtkActions.
Definition: gnc-plugin.c:280
The instance data structure for a menu-only plugin.
Definition: gnc-plugin.h:100
The instance data structure for a main window object.
void gnc_plugin_set_important_actions(GtkActionGroup *action_group, const gchar **name)
Mark certain actions as "important".
Definition: gnc-plugin.c:256
const char * action_name
The name of the action.
Definition: gnc-plugin.h:231