diff --git a/src/engine/Account.c b/src/engine/Account.c index f5a0552c4b..6b38f3fffa 100644 --- a/src/engine/Account.c +++ b/src/engine/Account.c @@ -48,6 +48,130 @@ static QofLogModule log_module = GNC_MOD_ACCOUNT; static gchar account_separator[8] = "."; gunichar account_uc_separator = ':'; +/* GObject declarations */ + +static void gnc_account_class_init(GncAccountClass *klass); +static void gnc_account_init(Account *sp); +static void gnc_account_finalize(GObject *object); +static void gnc_account_set_property (GObject *object, guint param_id, const GValue *value, GParamSpec *pspec); +static void gnc_account_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); + +struct _GncAccountPrivate +{ + +}; + +typedef struct _GncAccountSignal GncAccountSignal; +typedef enum _GncAccountSignalType GncAccountSignalType; + +enum _GncAccountSignalType { + /* Signals */ + FIRST_SIGNAL, + LAST_SIGNAL +}; + +/* properties */ +enum +{ + PROP_0 +}; + +struct _GncAccountSignal { + Account *object; +}; + +static guint gnc_account_signals[LAST_SIGNAL] = { 0 }; +static GObjectClass *parent_class = NULL; + +GType +gnc_account_get_type(void) +{ + static GType type = 0; + + if(type == 0) { + static const GTypeInfo our_info = { + sizeof (GncAccountClass), + NULL, + NULL, + (GClassInitFunc)gnc_account_class_init, + NULL, + NULL, + sizeof (Account), + 0, + (GInstanceInitFunc)gnc_account_init, + }; + + type = g_type_register_static(G_TYPE_OBJECT, + "GncAccount", &our_info, 0); + } + + return type; +} + +static void +gnc_account_class_init(GncAccountClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS(klass); + + parent_class = g_type_class_peek_parent(klass); + object_class->finalize = gnc_account_finalize; + object_class->set_property = gnc_account_set_property; + object_class->get_property = gnc_account_get_property; + + /* Install properties */ + + /* Create signals here:*/ + + + +} + +static void +gnc_account_init(Account *acc) +{ + +} + +static void +gnc_account_finalize(GObject *object) +{ + +} + +static void +gnc_account_set_property (GObject *object, + guint param_id, + const GValue *value, + GParamSpec *pspec) +{ + Account *obj; + + obj = GNC_ACCOUNT (object); + switch (param_id) { + default: + /* We don't have any other property... */ + G_OBJECT_WARN_INVALID_PROPERTY_ID(object,param_id,pspec); + break; + } +} + +static void +gnc_account_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + Account *obj; + + obj = GNC_ACCOUNT(object); + + switch (property_id) { + default: + /* We don't have any other property... */ + G_OBJECT_WARN_INVALID_PROPERTY_ID(object,property_id,pspec); + break; + } +} /********************************************************************\ * Because I can't use C++ for this project, doesn't mean that I * * can't pretend to! These functions perform actions on the * diff --git a/src/engine/Account.h b/src/engine/Account.h index a5171ff63c..c8146d6db8 100644 --- a/src/engine/Account.h +++ b/src/engine/Account.h @@ -46,6 +46,32 @@ #define XACC_ACCOUNT_H #include "qof.h" #include "gnc-engine.h" +#include + +/* GObject declarations */ + +#define GNC_TYPE_ACCOUNT (gnc_account_get_type ()) +#define GNC_ACCOUNT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_ACCOUNT, Account)) +#define GNC_ACCOUNT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_ACCOUNT, AccountClass)) +#define GNC_IS_ACCOUNT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_ACCOUNT)) +#define GNC_IS_ACCOUNT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_ACCOUNT)) +#define GNC_ACCOUNT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_ACCOUNT, AccountClass)) + + +typedef struct _GncAccountClass GncAccountClass; +//typedef struct _GncAccount Account; +typedef struct _GncAccountPrivate GncAccountPrivate; + +struct _GncAccountClass { + GObjectClass parent_class; + /* virtual table */ + + /* Add Signal Functions Here */ +}; + +GType gnc_account_get_type (void); + +/*******/ typedef gnc_numeric (*xaccGetBalanceFn)( const Account *account ); @@ -59,9 +85,6 @@ typedef gnc_numeric (*xaccGetBalanceAsOfDateFn) ( typedef void (*AccountCb)(Account *a, gpointer data); typedef gpointer (*AccountCb2)(Account *a, gpointer data); -#define GNC_IS_ACCOUNT(obj) (QOF_CHECK_TYPE((obj), GNC_ID_ACCOUNT)) -#define GNC_ACCOUNT(obj) (QOF_CHECK_CAST((obj), GNC_ID_ACCOUNT, Account)) - /** The account types are used to determine how the transaction data * in the account is displayed. These values can be safely changed * from one release to the next. Note that if values are added, diff --git a/src/engine/AccountP.h b/src/engine/AccountP.h index 993fc41583..605bcb7d95 100644 --- a/src/engine/AccountP.h +++ b/src/engine/AccountP.h @@ -53,8 +53,10 @@ */ /** \struct Account */ -struct account_s +struct _GncAccount { + GObject object; + QofInstance inst; /* The accountName is an arbitrary string assigned by the user. diff --git a/src/engine/gnc-engine.h b/src/engine/gnc-engine.h index c50ee679a7..31e3b087ff 100644 --- a/src/engine/gnc-engine.h +++ b/src/engine/gnc-engine.h @@ -130,7 +130,7 @@ * defined in the private header AccountP.h, but no one outside the * engine should include that file. Instead, access that data only * through the functions in Account.h .*/ -typedef struct account_s Account; +typedef struct _GncAccount Account; /** @brief Split in Gnucash. * A "split" is more commonly refered to as a "entry" in a