GnuCash  5.6-150-g038405b370+
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
gnc-plugin-log-replay.c
1 /*
2  * gnc-plugin-log-replay.c --
3  * Copyright (C) 2003 David Hampton <hampton@employees.org>
4  * Author: Jan Arne Petersen <jpetersen@uni-bonn.de>
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; either version 2 of
9  * the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, contact:
18  *
19  * Free Software Foundation Voice: +1-617-542-5942
20  * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
21  * Boston, MA 02110-1301, USA gnu@gnu.org
22  */
23 
24 #include <config.h>
25 
26 #include <gtk/gtk.h>
27 #include <glib/gi18n.h>
28 
29 #include "gnc-log-replay.h"
30 #include "gnc-plugin-log-replay.h"
31 #include "gnc-plugin-manager.h"
32 #include "gnc-component-manager.h"
33 
34 static void gnc_plugin_log_replay_finalize (GObject *object);
35 
36 /* Command callbacks */
37 static void gnc_plugin_log_replay_cmd_new_log_replay (GSimpleAction *simple, GVariant *parameter, gpointer user_data);
38 
39 
40 #define PLUGIN_ACTIONS_NAME "gnc-plugin-log-replay-actions"
41 #define PLUGIN_UI_FILENAME "gnc-plugin-log-replay.ui"
42 
43 static GActionEntry gnc_plugin_actions [] =
44 {
45  { "LogReplayAction", gnc_plugin_log_replay_cmd_new_log_replay, NULL, NULL, NULL },
46 };
48 static guint gnc_plugin_n_actions = G_N_ELEMENTS(gnc_plugin_actions);
49 
51 static const gchar *gnc_plugin_load_ui_items [] =
52 {
53  "FilePlaceholder1",
54  NULL,
55 };
56 
58 {
59  GncPlugin gnc_plugin;
60 };
61 
62 G_DEFINE_TYPE(GncPluginLogReplay, gnc_plugin_log_replay, GNC_TYPE_PLUGIN)
63 
64 GncPlugin *
65 gnc_plugin_log_replay_new (void)
66 {
67  return GNC_PLUGIN (g_object_new (GNC_TYPE_PLUGIN_LOG_REPLAY, NULL));
68 }
69 
70 static void
71 gnc_plugin_log_replay_class_init (GncPluginLogReplayClass *klass)
72 {
73  GObjectClass *object_class = G_OBJECT_CLASS (klass);
74  GncPluginClass *plugin_class = GNC_PLUGIN_CLASS (klass);
75 
76  object_class->finalize = gnc_plugin_log_replay_finalize;
77 
78  /* plugin info */
79  plugin_class->plugin_name = GNC_PLUGIN_LOG_REPLAY_NAME;
80 
81  /* widget addition/removal */
82  plugin_class->actions_name = PLUGIN_ACTIONS_NAME;
83  plugin_class->actions = gnc_plugin_actions;
84  plugin_class->n_actions = gnc_plugin_n_actions;
85  plugin_class->ui_filename = PLUGIN_UI_FILENAME;
86  plugin_class->ui_updates = gnc_plugin_load_ui_items;
87 }
88 
89 static void
90 gnc_plugin_log_replay_init (GncPluginLogReplay *plugin)
91 {
92 }
93 
94 static void
95 gnc_plugin_log_replay_finalize (GObject *object)
96 {
97  g_return_if_fail (GNC_IS_PLUGIN_LOG_REPLAY (object));
98 
99  G_OBJECT_CLASS (gnc_plugin_log_replay_parent_class)->finalize (object);
100 }
101 
102 /************************************************************
103  * Plugin Function Implementation *
104  ************************************************************/
105 
106 /************************************************************
107  * Command Callbacks *
108  ************************************************************/
109 
110 static void
111 gnc_plugin_log_replay_cmd_new_log_replay (GSimpleAction *simple,
112  GVariant *parameter,
113  gpointer user_data)
114 {
115  GncMainWindowActionData *data = user_data;
116  gnc_suspend_gui_refresh();
117  gnc_file_log_replay (GTK_WINDOW (data->window));
118  gnc_resume_gui_refresh();
119 }
120 
121 /************************************************************
122  * Plugin Bootstrapping *
123  ************************************************************/
124 
125 void
126 gnc_plugin_log_replay_create_plugin (void)
127 {
128  GncPlugin *plugin = gnc_plugin_log_replay_new ();
129 
131 }
.log replay module interface
Plugin management functions for the GnuCash UI.
void gnc_plugin_manager_add_plugin(GncPluginManager *manager, GncPlugin *plugin)
Add a plugin to the list maintained by the plugin manager.
GncPluginManager * gnc_plugin_manager_get(void)
Retrieve a pointer to the plugin manager.
void gnc_file_log_replay(GtkWindow *parent)
The gnc_file_log_replay() routine will pop up a standard file selection dialogue asking the user to p...
#define PLUGIN_ACTIONS_NAME
The label given to the main window for this plugin.
#define PLUGIN_UI_FILENAME
The name of the UI description file for this plugin.