Convert SchedXaction to GObject initialization.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/branches/gobject-engine-dev-warlord@15805 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Derek Atkins 2007-04-05 00:23:32 +00:00
parent 1cbf8b848c
commit f1e6425dce
2 changed files with 40 additions and 6 deletions

View File

@ -45,12 +45,25 @@
void sxprivtransactionListMapDelete( gpointer data, gpointer user_data ); void sxprivtransactionListMapDelete( gpointer data, gpointer user_data );
/* GObject initialization */
QOF_GOBJECT_IMPL(gnc_schedxaction, SchedXaction, QOF_TYPE_INSTANCE);
static void
gnc_schedxaction_init(SchedXaction* fs)
{
}
static void
gnc_schedxaction_finalize_real(GObject* fsp)
{
}
static void static void
xaccSchedXactionInit(SchedXaction *sx, QofBook *book) xaccSchedXactionInit(SchedXaction *sx, QofBook *book)
{ {
Account *ra; Account *ra;
qof_instance_init (&sx->inst, GNC_ID_SCHEDXACTION, book); qof_instance_init_data (&sx->inst, GNC_ID_SCHEDXACTION, book);
sx->schedule = NULL; sx->schedule = NULL;
sx->freq = xaccFreqSpecMalloc(book); sx->freq = xaccFreqSpecMalloc(book);
@ -89,7 +102,7 @@ xaccSchedXactionMalloc(QofBook *book)
g_return_val_if_fail (book, NULL); g_return_val_if_fail (book, NULL);
sx = g_new0( SchedXaction, 1 ); sx = g_object_new(GNC_TYPE_SCHEDXACTION, NULL);
xaccSchedXactionInit( sx, book ); xaccSchedXactionInit( sx, book );
qof_event_gen( &sx->inst, QOF_EVENT_CREATE , NULL); qof_event_gen( &sx->inst, QOF_EVENT_CREATE , NULL);
@ -187,8 +200,8 @@ xaccSchedXactionFree( SchedXaction *sx )
sx->deferredList = NULL; sx->deferredList = NULL;
} }
qof_instance_release (&sx->inst); /* qof_instance_release (&sx->inst); */
g_free( sx ); g_object_unref( sx );
} }
/* ============================================================ */ /* ============================================================ */

View File

@ -36,6 +36,8 @@
#ifndef XACC_SCHEDXACTION_H #ifndef XACC_SCHEDXACTION_H
#define XACC_SCHEDXACTION_H #define XACC_SCHEDXACTION_H
typedef struct _SchedXactionClass SchedXactionClass;
#include <time.h> #include <time.h>
#include <glib.h> #include <glib.h>
#include "qof.h" #include "qof.h"
@ -43,8 +45,22 @@
#include "Recurrence.h" #include "Recurrence.h"
#include "gnc-engine.h" #include "gnc-engine.h"
#define GNC_IS_SX(obj) (QOF_CHECK_TYPE((obj), GNC_ID_SCHEDXACTION)) /* --- type macros --- */
#define GNC_SX(obj) (QOF_CHECK_CAST((obj), GNC_ID_SCHEDXACTION, SchedXaction)) #define GNC_TYPE_SCHEDXACTION (gnc_schedxaction_get_type ())
#define GNC_SCHEDXACTION(o) \
(G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_SCHEDXACTION, SchedXaction))
#define GNC_SCHEDXACTION_CLASS(k) \
(G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_SCHEDXACTION, SchedXactionClass))
#define GNC_IS_SCHEDXACTION(o) \
(G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_SCHEDXACTION))
#define GNC_IS_SCHEDXACTION_CLASS(k) \
(G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_SCHEDXACTION))
#define GNC_SCHEDXACTION_GET_CLASS(o) \
(G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_SCHEDXACTION, SchedXactionClass))
GType gnc_schedxaction_get_type(void);
#define GNC_IS_SX(obj) GNC_IS_SCHEDXACTION(obj)
#define GNC_SX(obj) GNC_SCHEDXACTION(obj)
typedef struct _SchedXaction SchedXaction; typedef struct _SchedXaction SchedXaction;
@ -104,6 +120,11 @@ struct _SchedXaction
GList /* <temporalStateData*> */ *deferredList; GList /* <temporalStateData*> */ *deferredList;
}; };
struct _SchedXactionClass
{
QofInstanceClass parent_class;
};
/** Just the variable temporal bits from the SX structure. */ /** Just the variable temporal bits from the SX structure. */
typedef struct _temporalStateData { typedef struct _temporalStateData {
GDate last_date; GDate last_date;