28 #include <glib/gi18n.h> 31 #include "gnc-component-manager.h" 32 #include "gnc-plugin-register.h" 39 static void gnc_plugin_register_finalize (GObject *
object);
42 static void gnc_plugin_register_remove_from_window (
GncPlugin *plugin,
GncMainWindow *window, GQuark type);
47 #define PLUGIN_ACTIONS_NAME "gnc-plugin-register-actions" 48 #define PLUGIN_UI_FILENAME "gnc-plugin-register-ui.xml" 50 static GtkActionEntry gnc_plugin_actions [] =
53 #ifdef REGISTER2_ENABLED 54 "ToolsGeneralJournalAction", NULL, N_(
"Old St_yle General Journal"), NULL,
55 N_(
"Open an old style general journal window"),
56 G_CALLBACK (gnc_plugin_register_cmd_general_ledger)
58 "ToolsGeneralJournalAction", NULL, N_(
"_General Journal"), NULL,
59 N_(
"Open general journal window"),
60 G_CALLBACK (gnc_plugin_register_cmd_general_ledger)
64 static guint gnc_plugin_n_actions = G_N_ELEMENTS (gnc_plugin_actions);
71 G_DEFINE_TYPE_WITH_PRIVATE(
GncPluginRegister, gnc_plugin_register, GNC_TYPE_PLUGIN)
73 #define GNC_PLUGIN_REGISTER_GET_PRIVATE(o) \ 74 ((GncPluginRegisterPrivate*)gnc_plugin_register_get_instance_private((GncPluginRegister*)o)) 76 static GObjectClass *parent_class = NULL;
77 static QofLogModule log_module = GNC_MOD_GUI;
96 gnc_plugin_register_pref_changed (gpointer prefs, gchar *pref,
100 gnc_gui_refresh_all ();
109 gnc_plugin_register_new (
void)
115 GNC_TYPE_PLUGIN_PAGE_REGISTER;
117 plugin = g_object_new (GNC_TYPE_PLUGIN_REGISTER,
120 return GNC_PLUGIN (plugin);
126 GObjectClass *object_class = G_OBJECT_CLASS (klass);
129 parent_class = g_type_class_peek_parent (klass);
131 object_class->finalize = gnc_plugin_register_finalize;
134 plugin_class->
plugin_name = GNC_PLUGIN_REGISTER_NAME;
137 plugin_class->
add_to_window = gnc_plugin_register_add_to_window;
139 gnc_plugin_register_remove_from_window;
143 plugin_class->
actions = gnc_plugin_actions;
144 plugin_class->
n_actions = gnc_plugin_n_actions;
154 gnc_plugin_register_finalize (GObject *
object)
156 g_return_if_fail (GNC_IS_PLUGIN_REGISTER (
object));
158 G_OBJECT_CLASS (parent_class)->finalize (
object);
180 gnc_plugin_register_add_to_window (
GncPlugin *plugin,
185 gnc_plugin_register_pref_changed, window);
201 gnc_plugin_register_remove_from_window (
GncPlugin *plugin,
206 gnc_plugin_register_pref_changed, window);
215 gnc_plugin_register_cmd_general_ledger (GtkAction *action,
220 g_return_if_fail (data != NULL);
guint n_actions
The number of actions in the actions array.
The instance data structure for a content plugin.
gulong gnc_prefs_register_cb(const char *group, const gchar *pref_name, gpointer func, gpointer user_data)
Register a callback that gets triggered when the given preference changes.
The class data structure for a menu-only plugin.
#define ENTER(format, args...)
Print a function entry debugging message.
const gchar * ui_filename
The relative name of the XML file describing the menu/toolbar action items.
void gnc_main_window_open_page(GncMainWindow *window, GncPluginPage *page)
Display a data plugin page in a window.
GtkActionEntry * actions
An array of actions that should automatically be added to any GnuCash "main" content window that is o...
Functions providing a register page for the GnuCash UI.
void(* remove_from_window)(GncPlugin *plugin, GncMainWindow *window, GQuark type)
A callback that will be invoked when this plugin is removed from a window.
void(* add_to_window)(GncPlugin *plugin, GncMainWindow *window, GQuark type)
A callback that will be invoked when this plugin is added to a window.
const gchar * actions_name
A name for the set of actions that will be added by this plugin.
Generic api to store and retrieve preferences.
const gchar * plugin_name
The textual name of this plugin.
GncPluginPage * gnc_plugin_page_register_new_gl(void)
Create a new "register" plugin page containing a general journal.
The instance data structure for a menu-only plugin.
#define PLUGIN_ACTIONS_NAME
The label given to the main window for this plugin.
#define LEAVE(format, args...)
Print a function exit debugging message.
The instance data structure for a main window object.
#define PLUGIN_UI_FILENAME
The name of the UI description file for this plugin.
void gnc_prefs_remove_cb_by_func(const gchar *group, const gchar *pref_name, gpointer func, gpointer user_data)
Remove a function that was registered for a callback when the given preference changed.