GnuCash 2.4.99
gnc-plugin.h
Go to the documentation of this file.
00001 /*
00002  * gnc-plugin.h -- A module or plugin which can add more
00003  *      functionality to GnuCash.
00004  * Copyright (C) 2003 Jan Arne Petersen <jpetersen@uni-bonn.de>
00005  * Copyright (C) 2003,2005 David Hampton <hampton@employees.org>
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 
00079 #ifndef __GNC_PLUGIN_H
00080 #define __GNC_PLUGIN_H
00081 
00082 #include "gnc-main-window.h"
00083 #include "gnc-plugin-page.h"
00084 #include <gconf/gconf-client.h>
00085 
00086 G_BEGIN_DECLS
00087 
00088 /* type macros */
00089 #define GNC_TYPE_PLUGIN            (gnc_plugin_get_type ())
00090 #define GNC_PLUGIN(o)              (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_PLUGIN, GncPlugin))
00091 #define GNC_PLUGIN_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_PLUGIN, GncPluginClass))
00092 #define GNC_IS_PLUGIN(o)           (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_PLUGIN))
00093 #define GNC_IS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_PLUGIN))
00094 #define GNC_PLUGIN_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_PLUGIN, GncPluginClass))
00095 
00096 #define GNC_PLUGIN_NAME "GncPlugin"
00097 
00098 /* typedefs & structures */
00099 
00101 typedef struct
00102 {
00104     GObject gobject;
00105 } GncPlugin;
00106 
00108 typedef struct
00109 {
00111     GObjectClass gobject;
00113     const gchar *plugin_name;
00114 
00115     /*  Actions section */
00116 
00120     const gchar *actions_name;
00123     GtkActionEntry *actions;
00125     guint n_actions;
00128     GtkToggleActionEntry *toggle_actions;
00130     guint n_toggle_actions;
00135     const gchar **important_actions;
00138     const gchar *ui_filename;
00139 
00140     /*  GConf section */
00141 
00147     const gchar* gconf_section;
00159     void (* gconf_notifications)
00160     (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data);
00161 
00162     /*  Virtual Table */
00163 
00177     void (* add_to_window)
00178     (GncPlugin *plugin, GncMainWindow *window, GQuark type);
00179 
00193     void (* remove_from_window)
00194     (GncPlugin *plugin, GncMainWindow *window, GQuark type);
00195 } GncPluginClass;
00196 
00197 /* function prototypes */
00198 
00203 GType gnc_plugin_get_type (void);
00204 
00205 
00217 void gnc_plugin_add_to_window (GncPlugin *plugin,
00218                                GncMainWindow *window,
00219                                GQuark type);
00220 
00221 
00233 void gnc_plugin_remove_from_window (GncPlugin *plugin,
00234                                     GncMainWindow *window,
00235                                     GQuark type);
00236 
00237 
00244 const gchar *gnc_plugin_get_name (GncPlugin *plugin);
00245 
00246 
00253 typedef struct
00254 {
00256     const char *action_name;
00258     const char *label;
00259 } action_toolbar_labels;
00260 
00261 
00277 void gnc_plugin_init_short_names (GtkActionGroup *action_group,
00278                                   action_toolbar_labels *toolbar_labels);
00279 
00280 
00292 void gnc_plugin_set_important_actions (GtkActionGroup *action_group,
00293                                        const gchar **names);
00294 
00295 
00314 void gnc_plugin_update_actions (GtkActionGroup *action_group,
00315                                 const gchar **action_names,
00316                                 const gchar *property_name,
00317                                 gboolean value);
00318 
00319 
00335 gint gnc_plugin_add_actions (GtkUIManager *ui_merge,
00336                              GtkActionGroup *action_group,
00337                              const gchar *filename);
00338 G_END_DECLS
00339 
00340 #endif /* __GNC_PLUGIN_H */
00341 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines