GnuCash  5.6-150-g038405b370+
gnc-plugin-account-tree.c
Go to the documentation of this file.
1 /*
2  * gnc-plugin-account-tree.c --
3  *
4  * Copyright (C) 2003 Jan Arne Petersen
5  * Author: Jan Arne Petersen <jpetersen@uni-bonn.de>
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 
34 #include <config.h>
35 
36 #include <gtk/gtk.h>
37 #include <glib/gi18n.h>
38 #include <string.h>
39 
42 #include "dialog-find-account.h"
43 
44 static void gnc_plugin_account_tree_finalize (GObject *object);
45 
46 /* Command callbacks */
47 static void gnc_plugin_account_tree_cmd_new_account_tree (GSimpleAction *simple, GVariant *parameter, gpointer user_data);
48 
49 #define PLUGIN_ACTIONS_NAME "gnc-plugin-account-tree-actions"
50 #define PLUGIN_UI_FILENAME "gnc-plugin-account-tree.ui"
51 
54 static GActionEntry gnc_plugin_actions [] =
55 {
56  { "ViewAccountTreeAction", gnc_plugin_account_tree_cmd_new_account_tree, NULL, NULL, NULL },
57 };
59 static guint gnc_plugin_n_actions = G_N_ELEMENTS(gnc_plugin_actions);
60 
62 static const gchar *gnc_plugin_load_ui_items [] =
63 {
64  "ViewPlaceholder5",
65  NULL,
66 };
67 
70 {
72  GncPlugin gnc_plugin;
73 };
74 
75 G_DEFINE_TYPE(GncPluginAccountTree, gnc_plugin_account_tree, GNC_TYPE_PLUGIN)
76 
77 /* Create a new account tree menu plugin. */
78 GncPlugin *
80 {
81  GncPluginAccountTree *plugin;
82 
83  /* Reference the account tree page plugin to ensure it exists
84  * in the gtk type system. */
85  GNC_TYPE_PLUGIN_PAGE_ACCOUNT_TREE;
86 
87  plugin = g_object_new (GNC_TYPE_PLUGIN_ACCOUNT_TREE,
88  NULL);
89 
90  return GNC_PLUGIN (plugin);
91 }
92 
93 
101 static void
102 gnc_plugin_account_tree_class_init (GncPluginAccountTreeClass *klass)
103 {
104  GObjectClass *object_class = G_OBJECT_CLASS (klass);
105  GncPluginClass *plugin_class = GNC_PLUGIN_CLASS (klass);
106 
107  object_class->finalize = gnc_plugin_account_tree_finalize;
108 
109  /* plugin info */
110  plugin_class->plugin_name = GNC_PLUGIN_ACCOUNT_TREE_NAME;
111 
112  /* widget addition/removal */
113  plugin_class->actions_name = PLUGIN_ACTIONS_NAME;
114  plugin_class->actions = gnc_plugin_actions;
115  plugin_class->n_actions = gnc_plugin_n_actions;
116  plugin_class->ui_filename = PLUGIN_UI_FILENAME;
117  plugin_class->ui_updates = gnc_plugin_load_ui_items;
118 }
119 
120 
126 static void
127 gnc_plugin_account_tree_init (GncPluginAccountTree *plugin)
128 {
129 }
130 
131 
140 static void
141 gnc_plugin_account_tree_finalize (GObject *object)
142 {
143  g_return_if_fail (GNC_IS_PLUGIN_ACCOUNT_TREE (object));
144 
145  G_OBJECT_CLASS (gnc_plugin_account_tree_parent_class)->finalize (object);
146 }
147 
148 /************************************************************
149  * Command Callbacks *
150  ************************************************************/
151 
152 static void
153 gnc_plugin_account_tree_cmd_new_account_tree (GSimpleAction *simple,
154  GVariant *parameter,
155  gpointer user_data)
156 {
157  GncMainWindowActionData *data = user_data;
158  GncPluginPage *page;
159 
160  g_return_if_fail (data != NULL);
161 
163  gnc_main_window_open_page (data->window, page);
164 }
165 
GncPlugin gnc_plugin
The parent object for this widget.
The instance data structure for a content plugin.
GncPluginPage * gnc_plugin_page_account_tree_new(void)
Create a new "account tree" plugin page.
void gnc_main_window_open_page(GncMainWindow *window, GncPluginPage *page)
Display a data plugin page in a window.
Functions providing a chart of account page.
GncPlugin * gnc_plugin_account_tree_new(void)
Create a new account tree menu plugin.
Provide the menus to create a chart of account page.
#define PLUGIN_ACTIONS_NAME
The label given to the main window for this plugin.
The instance data structure for an account tree menu plugin.
#define PLUGIN_UI_FILENAME
The name of the UI description file for this plugin.