GnuCash c935c2f+
Loading...
Searching...
No Matches
gnc-dense-cal-model.c
1/********************************************************************\
2 * gnc-dense-cal-model.c *
3 * Copyright (C) 2006 Joshua Sled <jsled@asynchronous.org> *
4 * *
5 * This program is free software; you can redistribute it and/or *
6 * modify it under the terms of the GNU General Public License as *
7 * published by the Free Software Foundation, under version 2 and *
8 * / or version 3 of the License. *
9 * *
10 * As a special exception, permission is granted to link the binary *
11 * module resultant from this code with the OpenSSL project's *
12 * "OpenSSL" library (or modified versions of it that use the same *
13 * license as the "OpenSSL" library), and distribute the linked *
14 * executable. You must obey the GNU General Public License in all *
15 * respects for all of the code used other than "OpenSSL". If you *
16 * modify this file, you may extend this exception to your version *
17 * of the file, but you are not obligated to do so. If you do not *
18 * wish to do so, delete this exception statement from your version *
19 * of this file. *
20 * *
21 * This program is distributed in the hope that it will be useful, *
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
24 * GNU General Public License for more details. *
25 * *
26 * You should have received a copy of the GNU General Public License*
27 * along with this program; if not, contact: *
28 * *
29 * Free Software Foundation Voice: +1-617-542-5942 *
30 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
31 * Boston, MA 02110-1301, USA gnu@gnu.org *
32\********************************************************************/
33
34
35#include <config.h>
36#include <glib.h>
37#include <glib-object.h>
38#include "gnc-dense-cal.h"
39#include "gnc-dense-cal-model.h"
40
41enum { GDCM_ADDED, GDCM_UPDATE, GDCM_REMOVE, LAST_SIGNAL };
42static guint gnc_dense_cal_model_signals[LAST_SIGNAL] = { 0 };
43
44static void
45gnc_dense_cal_model_default_init (GncDenseCalModelInterface *g_class)
46{
47 gnc_dense_cal_model_signals[GDCM_ADDED] = g_signal_new("added",
48 G_TYPE_FROM_CLASS(g_class),
49 G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS,
50 0 /* default offset */,
51 NULL /* accumulator */,
52 NULL /* accum. data */,
53 g_cclosure_marshal_VOID__UINT,
54 G_TYPE_NONE /* return */,
55 1 /* n_params */,
56 G_TYPE_UINT /* param types */
57 );
58
59 gnc_dense_cal_model_signals[GDCM_UPDATE] = g_signal_new("update",
60 G_TYPE_FROM_CLASS(g_class),
61 G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS,
62 0 /* default offset */,
63 NULL /* accumulator */,
64 NULL /* accum. data */,
65 g_cclosure_marshal_VOID__UINT,
66 G_TYPE_NONE /* return */,
67 1 /* n_params */,
68 G_TYPE_UINT /* param types */
69 );
70
71 gnc_dense_cal_model_signals[GDCM_REMOVE] = g_signal_new("removing",
72 G_TYPE_FROM_CLASS(g_class),
73 G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS,
74 0 /* default offset */,
75 NULL /* accumulator */,
76 NULL /* accum. data */,
77 g_cclosure_marshal_VOID__UINT,
78 G_TYPE_NONE /* return */,
79 1 /* n_params */,
80 G_TYPE_UINT /* param types */
81 );
82}
83
84G_DEFINE_INTERFACE(GncDenseCalModel, gnc_dense_cal_model, G_TYPE_OBJECT)
85
86GList*
87gnc_dense_cal_model_get_contained (GncDenseCalModel *model)
88{
89 return (*GNC_DENSE_CAL_MODEL_GET_IFACE(model)->get_contained)(model);
90}
91
92gchar*
93gnc_dense_cal_model_get_name (GncDenseCalModel *model, guint tag)
94{
95 return (*GNC_DENSE_CAL_MODEL_GET_IFACE(model)->get_name)(model, tag);
96}
97
98gchar*
99gnc_dense_cal_model_get_info (GncDenseCalModel *model, guint tag)
100{
101 return (*GNC_DENSE_CAL_MODEL_GET_IFACE(model)->get_info)(model, tag);
102}
103
104gint
105gnc_dense_cal_model_get_instance_count (GncDenseCalModel *model, guint tag)
106{
107 return (*GNC_DENSE_CAL_MODEL_GET_IFACE(model)->get_instance_count)(model, tag);
108}
109
110void
111gnc_dense_cal_model_get_instance (GncDenseCalModel *model,
112 guint tag,
113 gint instance_index,
114 GDate *date)
115{
116 (*GNC_DENSE_CAL_MODEL_GET_IFACE(model)->get_instance)(model, tag, instance_index, date);
117}