00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00034 #include "config.h"
00035
00036 #include <gtk/gtk.h>
00037 #include <glib/gi18n.h>
00038 #include <string.h>
00039
00040 #include "gnc-plugin-account-tree.h"
00041 #include "gnc-plugin-page-account-tree.h"
00042
00043 static void gnc_plugin_account_tree_class_init (GncPluginAccountTreeClass *klass);
00044 static void gnc_plugin_account_tree_init (GncPluginAccountTree *plugin);
00045 static void gnc_plugin_account_tree_finalize (GObject *object);
00046
00047
00048 static void gnc_plugin_account_tree_cmd_new_account_tree (GtkAction *action, GncMainWindowActionData *data);
00049
00050
00051 #define PLUGIN_ACTIONS_NAME "gnc-plugin-account-tree-actions"
00052 #define PLUGIN_UI_FILENAME "gnc-plugin-account-tree-ui.xml"
00053
00056 static GtkActionEntry gnc_plugin_actions [] = {
00057 { "FileNewAccountTreeAction", NULL, N_("New Accounts _Page"), NULL,
00058 N_("Open a new Account Tree page"),
00059 G_CALLBACK (gnc_plugin_account_tree_cmd_new_account_tree) },
00060 };
00062 static guint gnc_plugin_n_actions = G_N_ELEMENTS (gnc_plugin_actions);
00063
00064
00066 typedef struct GncPluginAccountTreePrivate
00067 {
00068 gpointer dummy;
00069 } GncPluginAccountTreePrivate;
00070
00071 #define GNC_PLUGIN_ACCOUNT_TREE_GET_PRIVATE(o) \
00072 (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_PLUGIN_ACCOUNT_TREE, GncPluginAccountTreePrivate))
00073
00075 static GObjectClass *parent_class = NULL;
00076
00077
00078
00079 GType
00080 gnc_plugin_account_tree_get_type (void)
00081 {
00082 static GType gnc_plugin_account_tree_type = 0;
00083
00084 if (gnc_plugin_account_tree_type == 0) {
00085 static const GTypeInfo our_info = {
00086 sizeof (GncPluginAccountTreeClass),
00087 NULL,
00088 NULL,
00089 (GClassInitFunc) gnc_plugin_account_tree_class_init,
00090 NULL,
00091 NULL,
00092 sizeof (GncPluginAccountTree),
00093 0,
00094 (GInstanceInitFunc) gnc_plugin_account_tree_init
00095 };
00096
00097 gnc_plugin_account_tree_type = g_type_register_static (GNC_TYPE_PLUGIN,
00098 "GncPluginAccountTree",
00099 &our_info, 0);
00100 }
00101
00102 return gnc_plugin_account_tree_type;
00103 }
00104
00105
00106
00107 GncPlugin *
00108 gnc_plugin_account_tree_new (void)
00109 {
00110 GncPluginAccountTree *plugin;
00111
00112
00113
00114 GNC_TYPE_PLUGIN_PAGE_ACCOUNT_TREE;
00115
00116 plugin = g_object_new (GNC_TYPE_PLUGIN_ACCOUNT_TREE,
00117 NULL);
00118
00119 return GNC_PLUGIN (plugin);
00120 }
00121
00122
00130 static void
00131 gnc_plugin_account_tree_class_init (GncPluginAccountTreeClass *klass)
00132 {
00133 GObjectClass *object_class = G_OBJECT_CLASS (klass);
00134 GncPluginClass *plugin_class = GNC_PLUGIN_CLASS (klass);
00135
00136 parent_class = g_type_class_peek_parent (klass);
00137
00138 object_class->finalize = gnc_plugin_account_tree_finalize;
00139
00140
00141 plugin_class->plugin_name = GNC_PLUGIN_ACCOUNT_TREE_NAME;
00142
00143
00144 plugin_class->actions_name = PLUGIN_ACTIONS_NAME;
00145 plugin_class->actions = gnc_plugin_actions;
00146 plugin_class->n_actions = gnc_plugin_n_actions;
00147 plugin_class->ui_filename = PLUGIN_UI_FILENAME;
00148
00149 g_type_class_add_private(klass, sizeof(GncPluginAccountTreePrivate));
00150 }
00151
00152
00158 static void
00159 gnc_plugin_account_tree_init (GncPluginAccountTree *plugin)
00160 {
00161 }
00162
00163
00172 static void
00173 gnc_plugin_account_tree_finalize (GObject *object)
00174 {
00175 GncPluginAccountTree *plugin;
00176 GncPluginAccountTreePrivate *priv;
00177
00178 g_return_if_fail (GNC_IS_PLUGIN_ACCOUNT_TREE (object));
00179
00180 plugin = GNC_PLUGIN_ACCOUNT_TREE (object);
00181 priv = GNC_PLUGIN_ACCOUNT_TREE_GET_PRIVATE (object);
00182
00183 G_OBJECT_CLASS (parent_class)->finalize (object);
00184 }
00185
00186
00187
00188
00189
00190 static void
00191 gnc_plugin_account_tree_cmd_new_account_tree (GtkAction *action,
00192 GncMainWindowActionData *data)
00193 {
00194 GncPluginPage *page;
00195
00196 g_return_if_fail (data != NULL);
00197
00198 page = gnc_plugin_page_account_tree_new ();
00199 gnc_main_window_open_page (data->window, page);
00200 }
00201