r15804 - gnucash/branches/gobject-engine-dev-warlord - Convert FreqSpec to GObject initialization.

Derek Atkins warlord at cvs.gnucash.org
Wed Apr 4 20:23:12 EDT 2007


Author: warlord
Date: 2007-04-04 20:23:11 -0400 (Wed, 04 Apr 2007)
New Revision: 15804
Trac: http://svn.gnucash.org/trac/changeset/15804

Modified:
   gnucash/branches/gobject-engine-dev-warlord/
   gnucash/branches/gobject-engine-dev-warlord/src/engine/FreqSpec.c
   gnucash/branches/gobject-engine-dev-warlord/src/engine/FreqSpec.h
   gnucash/branches/gobject-engine-dev-warlord/src/engine/FreqSpecP.h
Log:
Convert FreqSpec to GObject initialization.



Property changes on: gnucash/branches/gobject-engine-dev-warlord
___________________________________________________________________
Name: svk:merge
   - 3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/branches/swig-redo:802
3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/trunk:1037
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/branches/gobject-engine-dev-warlord:14369
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/branches/gobject-engine-dev-warlord1:14383
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk:14282
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk2:13366
   + 3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/branches/swig-redo:802
3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/trunk:1037
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/branches/gobject-engine-dev-warlord:14369
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/branches/gobject-engine-dev-warlord1:14385
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk:14282
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk2:13366

Modified: gnucash/branches/gobject-engine-dev-warlord/src/engine/FreqSpec.c
===================================================================
--- gnucash/branches/gobject-engine-dev-warlord/src/engine/FreqSpec.c	2007-04-04 23:05:57 UTC (rev 15803)
+++ gnucash/branches/gobject-engine-dev-warlord/src/engine/FreqSpec.c	2007-04-05 00:23:11 UTC (rev 15804)
@@ -158,6 +158,19 @@
   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 @@
    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 @@
 
    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 @@
    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

Modified: gnucash/branches/gobject-engine-dev-warlord/src/engine/FreqSpec.h
===================================================================
--- gnucash/branches/gobject-engine-dev-warlord/src/engine/FreqSpec.h	2007-04-04 23:05:57 UTC (rev 15803)
+++ gnucash/branches/gobject-engine-dev-warlord/src/engine/FreqSpec.h	2007-04-05 00:23:11 UTC (rev 15804)
@@ -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,) \

Modified: gnucash/branches/gobject-engine-dev-warlord/src/engine/FreqSpecP.h
===================================================================
--- gnucash/branches/gobject-engine-dev-warlord/src/engine/FreqSpecP.h	2007-04-04 23:05:57 UTC (rev 15803)
+++ gnucash/branches/gobject-engine-dev-warlord/src/engine/FreqSpecP.h	2007-04-05 00:23:11 UTC (rev 15804)
@@ -91,4 +91,9 @@
         gint            value;
 };
 
+struct _FreqSpecClass
+{
+  QofInstanceClass	parent_class;
+};
+
 #endif /* XACC_FREQSPECP_H */



More information about the gnucash-changes mailing list