aboutsummaryrefslogtreecommitdiffstats
path: root/e-util/e-sexp.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2003-03-20 03:02:14 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2003-03-20 03:02:14 +0800
commit790c00fa27ac1ff7ae72447cb679dc21403f62e0 (patch)
treee5f1a88517d27d87b5722d898760fe1368cba67e /e-util/e-sexp.c
parentec3cf6dfcd221bbce0a79df5431c4a737a2a7161 (diff)
downloadgsoc2013-evolution-790c00fa27ac1ff7ae72447cb679dc21403f62e0.tar.gz
gsoc2013-evolution-790c00fa27ac1ff7ae72447cb679dc21403f62e0.tar.zst
gsoc2013-evolution-790c00fa27ac1ff7ae72447cb679dc21403f62e0.zip
Fix ESExpClass to never be an empty struct. Also make ESExp optionally a
2003-03-19 Jeffrey Stedfast <fejj@ximian.com> * e-sexp.h: Fix ESExpClass to never be an empty struct. Also make ESExp optionally a subclass of GObject rather than GtkObject (not that we'll probably ever make it so, but for completeness sake?). 2003-03-18 Jeffrey Stedfast <fejj@ximian.com> * e-trie.c (trie_utf8_getc): Don't use __inline__ as it is not always defined. svn path=/trunk/; revision=20360
Diffstat (limited to 'e-util/e-sexp.c')
-rw-r--r--e-util/e-sexp.c54
1 files changed, 31 insertions, 23 deletions
diff --git a/e-util/e-sexp.c b/e-util/e-sexp.c
index 6487b1e024..33fecc18ce 100644
--- a/e-util/e-sexp.c
+++ b/e-util/e-sexp.c
@@ -82,15 +82,19 @@
Execute a sequence. The last function return is the return type.
*/
-#include "e-sexp.h"
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
-#include <glib.h>
+#include "e-sexp.h"
#include "e-memory.h"
+
#define p(x) /* parse debug */
#define r(x) /* run debug */
#define d(x) /* general debug */
@@ -102,7 +106,7 @@ static struct _ESExpTerm * parse_value(ESExp *f);
static void parse_dump_term(struct _ESExpTerm *t, int depth);
#ifdef E_SEXP_IS_GTK_OBJECT
-static GtkObjectClass *parent_class;
+static GObjectClass *parent_class;
#endif
static GScannerConfig scanner_config =
@@ -1107,29 +1111,31 @@ e_sexp_init (ESExp *s)
}
}
-#ifndef E_SEXP_IS_GTK_OBJECT
+#ifndef E_SEXP_IS_G_OBJECT
s->refcount = 1;
#endif
}
-#ifdef E_SEXP_IS_GTK_OBJECT
-guint
+#ifdef E_SEXP_IS_G_OBJECT
+GType
e_sexp_get_type (void)
{
- static guint type = 0;
+ static GType type = 0;
if (!type) {
- GtkTypeInfo type_info = {
- "ESExp",
- sizeof (ESExp),
+ static const GTypeInfo info = {
sizeof (ESExpClass),
- (GtkClassInitFunc) e_sexp_class_init,
- (GtkObjectInitFunc) e_sexp_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
+ NULL, /* base_class_init */
+ NULL, /* base_class_finalize */
+ (GClassInitFunc) e_sexp_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (ESExp),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) e_sexp_init,
};
- type = gtk_type_unique (gtk_object_get_type (), &type_info);
+ type = g_type_register_static (G_TYPE_OBJECT, "ESExp", &info, 0);
}
return type;
@@ -1139,23 +1145,25 @@ e_sexp_get_type (void)
ESExp *
e_sexp_new (void)
{
-#ifdef E_SEXP_IS_GTK_OBJECT
- ESExp *f = E_SEXP ( gtk_type_new (e_sexp_get_type ()));
+#ifdef E_SEXP_IS_G_OBJECT
+ ESExp *f = (ESexp *) g_object_new (E_TYPE_SEXP, NULL);
#else
- ESExp *f = g_malloc0(sizeof(*f));
- e_sexp_init(f);
+ ESExp *f = g_malloc0 (sizeof (ESExp));
+ e_sexp_init (f);
#endif
-
+
return f;
}
-#ifndef E_SEXP_IS_GTK_OBJECT
-void e_sexp_ref (ESExp *f)
+#ifndef E_SEXP_IS_G_OBJECT
+void
+e_sexp_ref (ESExp *f)
{
f->refcount++;
}
-void e_sexp_unref (ESExp *f)
+void
+e_sexp_unref (ESExp *f)
{
f->refcount--;
if (f->refcount == 0) {