From 790c00fa27ac1ff7ae72447cb679dc21403f62e0 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Wed, 19 Mar 2003 19:02:14 +0000 Subject: Fix ESExpClass to never be an empty struct. Also make ESExp optionally a 2003-03-19 Jeffrey Stedfast * 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 * e-trie.c (trie_utf8_getc): Don't use __inline__ as it is not always defined. svn path=/trunk/; revision=20360 --- e-util/e-sexp.c | 54 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 23 deletions(-) (limited to 'e-util/e-sexp.c') 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 +#endif #include #include #include #include -#include +#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) { -- cgit v1.2.3