mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Convert FreqSpec to GObject initialization.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/branches/gobject-engine-dev-warlord@15804 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -158,6 +158,19 @@ get_abbrev_month_name(guint month)
|
||||
return month_name;
|
||||
}
|
||||
|
||||
/* GObject initialization */
|
||||
QOF_GOBJECT_IMPL(gnc_freqspec, FreqSpec, QOF_TYPE_INSTANCE);
|
||||
|
||||
static void
|
||||
gnc_freqspec_init(FreqSpec* fs)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_freqspec_finalize_real(GObject* fsp)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* Initializes a FreqSpec by setting it's to type INVALID.
|
||||
* Use this to initialise a stack object.
|
||||
@@ -171,7 +184,7 @@ xaccFreqSpecInit( FreqSpec *fs, QofBook *book )
|
||||
g_return_if_fail( fs );
|
||||
g_return_if_fail (book);
|
||||
|
||||
qof_instance_init (&fs->entity, QOF_ID_FREQSPEC, book);
|
||||
qof_instance_init_data (&fs->entity, QOF_ID_FREQSPEC, book);
|
||||
|
||||
fs->type = INVALID;
|
||||
fs->uift = UIFREQ_ONCE;
|
||||
@@ -186,7 +199,7 @@ xaccFreqSpecMalloc(QofBook *book)
|
||||
|
||||
g_return_val_if_fail (book, NULL);
|
||||
|
||||
fs = g_new0(FreqSpec, 1);
|
||||
fs = g_object_new(GNC_TYPE_FREQSPEC, NULL);
|
||||
xaccFreqSpecInit( fs, book );
|
||||
qof_event_gen( &fs->entity, QOF_EVENT_CREATE , NULL);
|
||||
return fs;
|
||||
@@ -222,8 +235,8 @@ xaccFreqSpecFree( FreqSpec *fs )
|
||||
qof_event_gen( &fs->entity, QOF_EVENT_DESTROY , NULL);
|
||||
xaccFreqSpecCleanUp( fs );
|
||||
|
||||
qof_instance_release (&fs->entity);
|
||||
g_free( fs );
|
||||
/* qof_instance_release (&fs->entity); */
|
||||
g_object_unref( fs );
|
||||
}
|
||||
|
||||
FreqType
|
||||
|
||||
@@ -59,10 +59,27 @@
|
||||
#ifndef XACC_FREQSPEC_H
|
||||
#define XACC_FREQSPEC_H
|
||||
|
||||
typedef struct _FreqSpecClass FreqSpecClass;
|
||||
|
||||
#include "gnc-engine.h"
|
||||
#include <glib.h>
|
||||
#include "qof.h"
|
||||
|
||||
/* --- type macros --- */
|
||||
#define GNC_TYPE_FREQSPEC (gnc_freqspec_get_type ())
|
||||
#define GNC_FREQSPEC(o) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_FREQSPEC, FreqSpec))
|
||||
#define GNC_FREQSPEC_CLASS(k) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_FREQSPEC, FreqSpecClass))
|
||||
#define GNC_IS_FREQSPEC(o) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_FREQSPEC))
|
||||
#define GNC_IS_FREQSPEC_CLASS(k) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_FREQSPEC))
|
||||
#define GNC_FREQSPEC_GET_CLASS(o) \
|
||||
(G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_FREQSPEC, FreqSpecClass))
|
||||
GType gnc_freqspec_get_type(void);
|
||||
|
||||
|
||||
#define ENUM_LIST_TYPE(_) \
|
||||
_(INVALID,) \
|
||||
_(ONCE,) \
|
||||
|
||||
@@ -91,4 +91,9 @@ struct gncp_freq_spec
|
||||
gint value;
|
||||
};
|
||||
|
||||
struct _FreqSpecClass
|
||||
{
|
||||
QofInstanceClass parent_class;
|
||||
};
|
||||
|
||||
#endif /* XACC_FREQSPECP_H */
|
||||
|
||||
Reference in New Issue
Block a user