GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
gnc-plugin-log-replay.c
1 /*
2  * gnc-plugin-log-replay.c --
3  * Copyright (C) 2003 David Hampton <[email protected]>
4  * Author: Jan Arne Petersen <[email protected]>
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 [email protected]
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_class_init (GncPluginLogreplayClass *klass);
35 static void gnc_plugin_log_replay_init (GncPluginLogreplay *plugin);
36 static void gnc_plugin_log_replay_finalize (GObject *object);
37 
38 /* Command callbacks */
39 static void gnc_plugin_log_replay_cmd_new_log_replay (GtkAction *action, GncMainWindowActionData *data);
40 
41 
42 #define PLUGIN_ACTIONS_NAME "gnc-plugin-log-replay-actions"
43 #define PLUGIN_UI_FILENAME "gnc-plugin-log-replay-ui.xml"
44 
45 static GtkActionEntry gnc_plugin_actions [] =
46 {
47  {
48  "LogReplayAction", GTK_STOCK_CONVERT, N_("_Replay GnuCash .log file..."), NULL,
49  N_("Replay a GnuCash log file after a crash. This cannot be undone."),
50  G_CALLBACK (gnc_plugin_log_replay_cmd_new_log_replay)
51  },
52 };
53 static guint gnc_plugin_n_actions = G_N_ELEMENTS (gnc_plugin_actions);
54 
56 {
57  gpointer dummy;
59 
60 #define GNC_PLUGIN_LOG_REPLAY_GET_PRIVATE(o) \
61  (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_PLUGIN_LOG_REPLAY, GncPluginLogreplayPrivate))
62 
63 static GObjectClass *parent_class = NULL;
64 
65 GType
66 gnc_plugin_log_replay_get_type (void)
67 {
68  static GType gnc_plugin_log_replay_type = 0;
69 
70  if (gnc_plugin_log_replay_type == 0)
71  {
72  static const GTypeInfo our_info =
73  {
74  sizeof (GncPluginLogreplayClass),
75  NULL, /* base_init */
76  NULL, /* base_finalize */
77  (GClassInitFunc) gnc_plugin_log_replay_class_init,
78  NULL, /* class_finalize */
79  NULL, /* class_data */
80  sizeof (GncPluginLogreplay),
81  0, /* n_preallocs */
82  (GInstanceInitFunc) gnc_plugin_log_replay_init,
83  };
84 
85  gnc_plugin_log_replay_type = g_type_register_static (GNC_TYPE_PLUGIN,
86  "GncPluginLogreplay",
87  &our_info, 0);
88  }
89 
90  return gnc_plugin_log_replay_type;
91 }
92 
93 GncPlugin *
94 gnc_plugin_log_replay_new (void)
95 {
96  return GNC_PLUGIN (g_object_new (GNC_TYPE_PLUGIN_LOG_REPLAY, NULL));
97 }
98 
99 static void
100 gnc_plugin_log_replay_class_init (GncPluginLogreplayClass *klass)
101 {
102  GObjectClass *object_class = G_OBJECT_CLASS (klass);
103  GncPluginClass *plugin_class = GNC_PLUGIN_CLASS (klass);
104 
105  parent_class = g_type_class_peek_parent (klass);
106 
107  object_class->finalize = gnc_plugin_log_replay_finalize;
108 
109  /* plugin info */
110  plugin_class->plugin_name = GNC_PLUGIN_LOG_REPLAY_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 
118  g_type_class_add_private(klass, sizeof(GncPluginLogreplayPrivate));
119 }
120 
121 static void
122 gnc_plugin_log_replay_init (GncPluginLogreplay *plugin)
123 {
124 }
125 
126 static void
127 gnc_plugin_log_replay_finalize (GObject *object)
128 {
129  g_return_if_fail (GNC_IS_PLUGIN_LOG_REPLAY (object));
130 
131  G_OBJECT_CLASS (parent_class)->finalize (object);
132 }
133 
134 /************************************************************
135  * Plugin Function Implementation *
136  ************************************************************/
137 
138 /************************************************************
139  * Command Callbacks *
140  ************************************************************/
141 
142 static void
143 gnc_plugin_log_replay_cmd_new_log_replay (GtkAction *action,
145 {
146  gnc_suspend_gui_refresh();
148  gnc_resume_gui_refresh();
149 }
150 
151 /************************************************************
152  * Plugin Bootstrapping *
153  ************************************************************/
154 
155 void
156 gnc_plugin_log_replay_create_plugin (void)
157 {
158  GncPlugin *plugin = gnc_plugin_log_replay_new ();
159 
161 }
.log replay module interface
Plugin management functions for the GnuCash UI.
void gnc_plugin_manager_add_plugin(GncPluginManager *manager, GncPlugin *plugin)
const gchar * ui_filename
Definition: gnc-plugin.h:137
GtkActionEntry * actions
Definition: gnc-plugin.h:122
GncPluginManager * gnc_plugin_manager_get(void)
void gnc_file_log_replay(void)
const gchar * actions_name
Definition: gnc-plugin.h:119
const gchar * plugin_name
Definition: gnc-plugin.h:112
#define PLUGIN_ACTIONS_NAME
#define PLUGIN_UI_FILENAME