r15729 - gnucash/branches/gobject-engine-dev1/src/engine - GC's Account is a now a GObject defined, need be reviwed the initializarion and destruction methods
Daniel Espinosa
esodan at cvs.gnucash.org
Fri Mar 16 21:15:40 EDT 2007
Author: esodan
Date: 2007-03-16 21:15:37 -0400 (Fri, 16 Mar 2007)
New Revision: 15729
Trac: http://svn.gnucash.org/trac/changeset/15729
Modified:
gnucash/branches/gobject-engine-dev1/src/engine/Account.c
gnucash/branches/gobject-engine-dev1/src/engine/Account.h
gnucash/branches/gobject-engine-dev1/src/engine/AccountP.h
gnucash/branches/gobject-engine-dev1/src/engine/gnc-engine.h
Log:
GC's Account is a now a GObject defined, need be reviwed the initializarion and destruction methods
Modified: gnucash/branches/gobject-engine-dev1/src/engine/Account.c
===================================================================
--- gnucash/branches/gobject-engine-dev1/src/engine/Account.c 2007-03-16 22:16:11 UTC (rev 15728)
+++ gnucash/branches/gobject-engine-dev1/src/engine/Account.c 2007-03-17 01:15:37 UTC (rev 15729)
@@ -48,6 +48,130 @@
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 *
Modified: gnucash/branches/gobject-engine-dev1/src/engine/Account.h
===================================================================
--- gnucash/branches/gobject-engine-dev1/src/engine/Account.h 2007-03-16 22:16:11 UTC (rev 15728)
+++ gnucash/branches/gobject-engine-dev1/src/engine/Account.h 2007-03-17 01:15:37 UTC (rev 15729)
@@ -46,7 +46,33 @@
#define XACC_ACCOUNT_H
#include "qof.h"
#include "gnc-engine.h"
+#include <glib-object.h>
+/* 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 );
typedef gnc_numeric (*xaccGetBalanceInCurrencyFn) (
@@ -59,9 +85,6 @@
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,
Modified: gnucash/branches/gobject-engine-dev1/src/engine/AccountP.h
===================================================================
--- gnucash/branches/gobject-engine-dev1/src/engine/AccountP.h 2007-03-16 22:16:11 UTC (rev 15728)
+++ gnucash/branches/gobject-engine-dev1/src/engine/AccountP.h 2007-03-17 01:15:37 UTC (rev 15729)
@@ -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.
Modified: gnucash/branches/gobject-engine-dev1/src/engine/gnc-engine.h
===================================================================
--- gnucash/branches/gobject-engine-dev1/src/engine/gnc-engine.h 2007-03-16 22:16:11 UTC (rev 15728)
+++ gnucash/branches/gobject-engine-dev1/src/engine/gnc-engine.h 2007-03-17 01:15:37 UTC (rev 15729)
@@ -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
More information about the gnucash-changes
mailing list