GnuCash  5.6-150-g038405b370+
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 G_DECLARE_DERIVABLE_TYPE (GncPlugin, gnc_plugin, GNC, PLUGIN, GObject)
90 
91 #define GNC_PLUGIN_NAME "GncPlugin"
92 
93 /* typedefs & structures */
94 
97 {
99  GObjectClass gobject;
101  const gchar *plugin_name;
102 
103  /* Actions section */
104 
108  const gchar *actions_name;
111  GActionEntry *actions;
113  guint n_actions;
114 
116  const gchar **ui_updates;
117 
120  const gchar *ui_filename;
121 
122  /* Virtual Table */
123 
137  void (* add_to_window)
138  (GncPlugin *plugin, GncMainWindow *window, GQuark type);
139 
153  void (* remove_from_window)
154  (GncPlugin *plugin, GncMainWindow *window, GQuark type);
155 };
156 
157 /* function prototypes */
158 
169 void gnc_plugin_add_to_window (GncPlugin *plugin,
170  GncMainWindow *window,
171  GQuark type);
172 
173 
184 void gnc_plugin_remove_from_window (GncPlugin *plugin,
185  GncMainWindow *window,
186  GQuark type);
187 
188 
195 const gchar *gnc_plugin_get_name (GncPlugin *plugin);
196 
197 
204 typedef struct
205 {
207  const char *action_name;
209  const char *label;
211  const char *tooltip;
213 
214 
230 void gnc_plugin_init_short_names (GtkWidget *toolbar,
231  GncToolBarShortNames *toolbar_labels);
232 
233 
245 void gnc_plugin_set_actions_enabled (GActionMap *action_map,
246  const gchar **action_names,
247  gboolean enable);
248 
258 void gnc_plugin_add_menu_tooltip_callbacks (GtkWidget *menubar,
259  GMenuModel *menubar_model,
260  GtkWidget *statusbar);
261 
269 void gnc_plugin_add_toolbar_tooltip_callbacks (GtkWidget *toolbar,
270  GtkWidget *statusbar);
271 
272 G_END_DECLS
273 
274 #endif /* __GNC_PLUGIN_H */
275 
GObjectClass gobject
The parent class for this widget.
Definition: gnc-plugin.h:99
const char * tooltip
The tooltip for the label.
Definition: gnc-plugin.h:211
void gnc_plugin_add_toolbar_tooltip_callbacks(GtkWidget *toolbar, GtkWidget *statusbar)
This function adds the tooltip callbacks to make the tooltips appear in the status bar...
Definition: gnc-plugin.c:299
A structure for defining alternate action names for use in the toolbar.
Definition: gnc-plugin.h:204
void gnc_plugin_add_to_window(GncPlugin *plugin, GncMainWindow *window, GQuark type)
Add the specified plugin from the specified window.
Definition: gnc-plugin.c:133
const char * label
The alternate toolbar label to use.
Definition: gnc-plugin.h:209
The class data structure for a menu-only plugin.
Definition: gnc-plugin.h:96
Functions for adding content to a window.
void gnc_plugin_add_menu_tooltip_callbacks(GtkWidget *menubar, GMenuModel *menubar_model, GtkWidget *statusbar)
This function adds the tooltip callbacks to make the tooltips appear in the status bar...
Definition: gnc-plugin.c:268
const gchar * ui_filename
The relative name of the XML file describing the menu/toolbar action items.
Definition: gnc-plugin.h:120
Functions for adding plugins to a GnuCash window.
void gnc_plugin_set_actions_enabled(GActionMap *action_map, const gchar **action_names, gboolean enable)
This function sets the sensitivity of a GAction in a specific group.
Definition: gnc-plugin.c:250
void gnc_plugin_remove_from_window(GncPlugin *plugin, GncMainWindow *window, GQuark type)
Remove the specified plugin from the specified window.
Definition: gnc-plugin.c:175
const gchar * gnc_plugin_get_name(GncPlugin *plugin)
Retrieve the textual name of a plugin.
Definition: gnc-plugin.c:212
const gchar * actions_name
A name for the set of actions that will be added by this plugin.
Definition: gnc-plugin.h:108
void gnc_plugin_init_short_names(GtkWidget *toolbar, GncToolBarShortNames *toolbar_labels)
Add "short" labels to existing actions.
Definition: gnc-plugin.c:229
A structure for defining alternate action names for use in the toolbar.
const gchar ** ui_updates
An array of ui updates for the menu model.
Definition: gnc-plugin.h:116
void(* add_to_window)(GncPlugin *plugin, GncMainWindow *window, GQuark type)
A callback that will be invoked when this plugin is added to a window.
Definition: gnc-plugin.h:138
The instance data structure for a main window object.
const gchar * plugin_name
The textual name of this plugin.
Definition: gnc-plugin.h:101
void(* remove_from_window)(GncPlugin *plugin, GncMainWindow *window, GQuark type)
A callback that will be invoked when this plugin is removed from a window.
Definition: gnc-plugin.h:154
GActionEntry * actions
An array of actions that should automatically be added to any GnuCash "main" content window that is o...
Definition: gnc-plugin.h:111
const char * action_name
The name of the action.
Definition: gnc-plugin.h:207
guint n_actions
The number of actions in the actions array.
Definition: gnc-plugin.h:113