Commit da355fee authored by Tim Janik's avatar Tim Janik Committed by Tim Janik

display the current cursor name.

Tue Jul 14 06:25:46 1998  Tim Janik  <timj@gtk.org>

        * gtk/testgtk.c (create_cursors): display the current cursor name.

        * gtk/gtktypeutils.h:
        * gtk/gtktypeutils.c (gtk_type_init_builtin_types): cleanups to
        the fundamental type definition. the GtkArg union now only covers
        the required storage types for argument values. adapted the GTK_VALUE_*
        macro set. handle GTK_TYPE_UCHAR. definiton of type set bounds macros.

        * gtk/gtkargcollector.c (gtk_arg_collect_value): clean ups of the
        code, fixed int/float collection. fixed a bug in the sanity checking
        code for GtkObjects.

        * gtk/gtkbindings.c (gtk_binding_entry_add_signal): fixups of the
        argument collection code.

        * gtk/gtksignal.c (gtk_signal_collect_params): use the type set bounds
        macros when distinguishing the return type.
parent f38374c1
Tue Jul 14 06:25:46 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (create_cursors): display the current cursor name.
* gtk/gtktypeutils.h:
* gtk/gtktypeutils.c (gtk_type_init_builtin_types): cleanups to
the fundamental type definition. the GtkArg union now only covers
the required storage types for argument values. adapted the GTK_VALUE_*
macro set. handle GTK_TYPE_UCHAR. definiton of type set bounds macros.
* gtk/gtkargcollector.c (gtk_arg_collect_value): clean ups of the
code, fixed int/float collection. fixed a bug in the sanity checking
code for GtkObjects.
* gtk/gtkbindings.c (gtk_binding_entry_add_signal): fixups of the
argument collection code.
* gtk/gtksignal.c (gtk_signal_collect_params): use the type set bounds
macros when distinguishing the return type.
Mon Jul 13 12:42:51 1998 George Lebl <jirka@5z.com>
* gdk/gdkwindow.h: (gdk_window_reparent) check if old_parent_private
......
Tue Jul 14 06:25:46 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (create_cursors): display the current cursor name.
* gtk/gtktypeutils.h:
* gtk/gtktypeutils.c (gtk_type_init_builtin_types): cleanups to
the fundamental type definition. the GtkArg union now only covers
the required storage types for argument values. adapted the GTK_VALUE_*
macro set. handle GTK_TYPE_UCHAR. definiton of type set bounds macros.
* gtk/gtkargcollector.c (gtk_arg_collect_value): clean ups of the
code, fixed int/float collection. fixed a bug in the sanity checking
code for GtkObjects.
* gtk/gtkbindings.c (gtk_binding_entry_add_signal): fixups of the
argument collection code.
* gtk/gtksignal.c (gtk_signal_collect_params): use the type set bounds
macros when distinguishing the return type.
Mon Jul 13 12:42:51 1998 George Lebl <jirka@5z.com>
* gdk/gdkwindow.h: (gdk_window_reparent) check if old_parent_private
......
Tue Jul 14 06:25:46 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (create_cursors): display the current cursor name.
* gtk/gtktypeutils.h:
* gtk/gtktypeutils.c (gtk_type_init_builtin_types): cleanups to
the fundamental type definition. the GtkArg union now only covers
the required storage types for argument values. adapted the GTK_VALUE_*
macro set. handle GTK_TYPE_UCHAR. definiton of type set bounds macros.
* gtk/gtkargcollector.c (gtk_arg_collect_value): clean ups of the
code, fixed int/float collection. fixed a bug in the sanity checking
code for GtkObjects.
* gtk/gtkbindings.c (gtk_binding_entry_add_signal): fixups of the
argument collection code.
* gtk/gtksignal.c (gtk_signal_collect_params): use the type set bounds
macros when distinguishing the return type.
Mon Jul 13 12:42:51 1998 George Lebl <jirka@5z.com>
* gdk/gdkwindow.h: (gdk_window_reparent) check if old_parent_private
......
Tue Jul 14 06:25:46 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (create_cursors): display the current cursor name.
* gtk/gtktypeutils.h:
* gtk/gtktypeutils.c (gtk_type_init_builtin_types): cleanups to
the fundamental type definition. the GtkArg union now only covers
the required storage types for argument values. adapted the GTK_VALUE_*
macro set. handle GTK_TYPE_UCHAR. definiton of type set bounds macros.
* gtk/gtkargcollector.c (gtk_arg_collect_value): clean ups of the
code, fixed int/float collection. fixed a bug in the sanity checking
code for GtkObjects.
* gtk/gtkbindings.c (gtk_binding_entry_add_signal): fixups of the
argument collection code.
* gtk/gtksignal.c (gtk_signal_collect_params): use the type set bounds
macros when distinguishing the return type.
Mon Jul 13 12:42:51 1998 George Lebl <jirka@5z.com>
* gdk/gdkwindow.h: (gdk_window_reparent) check if old_parent_private
......
Tue Jul 14 06:25:46 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (create_cursors): display the current cursor name.
* gtk/gtktypeutils.h:
* gtk/gtktypeutils.c (gtk_type_init_builtin_types): cleanups to
the fundamental type definition. the GtkArg union now only covers
the required storage types for argument values. adapted the GTK_VALUE_*
macro set. handle GTK_TYPE_UCHAR. definiton of type set bounds macros.
* gtk/gtkargcollector.c (gtk_arg_collect_value): clean ups of the
code, fixed int/float collection. fixed a bug in the sanity checking
code for GtkObjects.
* gtk/gtkbindings.c (gtk_binding_entry_add_signal): fixups of the
argument collection code.
* gtk/gtksignal.c (gtk_signal_collect_params): use the type set bounds
macros when distinguishing the return type.
Mon Jul 13 12:42:51 1998 George Lebl <jirka@5z.com>
* gdk/gdkwindow.h: (gdk_window_reparent) check if old_parent_private
......
Tue Jul 14 06:25:46 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (create_cursors): display the current cursor name.
* gtk/gtktypeutils.h:
* gtk/gtktypeutils.c (gtk_type_init_builtin_types): cleanups to
the fundamental type definition. the GtkArg union now only covers
the required storage types for argument values. adapted the GTK_VALUE_*
macro set. handle GTK_TYPE_UCHAR. definiton of type set bounds macros.
* gtk/gtkargcollector.c (gtk_arg_collect_value): clean ups of the
code, fixed int/float collection. fixed a bug in the sanity checking
code for GtkObjects.
* gtk/gtkbindings.c (gtk_binding_entry_add_signal): fixups of the
argument collection code.
* gtk/gtksignal.c (gtk_signal_collect_params): use the type set bounds
macros when distinguishing the return type.
Mon Jul 13 12:42:51 1998 George Lebl <jirka@5z.com>
* gdk/gdkwindow.h: (gdk_window_reparent) check if old_parent_private
......
Tue Jul 14 06:25:46 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (create_cursors): display the current cursor name.
* gtk/gtktypeutils.h:
* gtk/gtktypeutils.c (gtk_type_init_builtin_types): cleanups to
the fundamental type definition. the GtkArg union now only covers
the required storage types for argument values. adapted the GTK_VALUE_*
macro set. handle GTK_TYPE_UCHAR. definiton of type set bounds macros.
* gtk/gtkargcollector.c (gtk_arg_collect_value): clean ups of the
code, fixed int/float collection. fixed a bug in the sanity checking
code for GtkObjects.
* gtk/gtkbindings.c (gtk_binding_entry_add_signal): fixups of the
argument collection code.
* gtk/gtksignal.c (gtk_signal_collect_params): use the type set bounds
macros when distinguishing the return type.
Mon Jul 13 12:42:51 1998 George Lebl <jirka@5z.com>
* gdk/gdkwindow.h: (gdk_window_reparent) check if old_parent_private
......
......@@ -315,6 +315,7 @@
(invalid GTK_TYPE_INVALID)
(none GTK_TYPE_NONE)
(char GTK_TYPE_CHAR)
(uchar GTK_TYPE_UCHAR)
(bool GTK_TYPE_BOOL)
(int GTK_TYPE_INT)
(uint GTK_TYPE_UINT)
......@@ -326,12 +327,12 @@
(enum GTK_TYPE_ENUM)
(flags GTK_TYPE_FLAGS)
(boxed GTK_TYPE_BOXED)
(foreign GTK_TYPE_FOREIGN)
(callback GTK_TYPE_CALLBACK)
(args GTK_TYPE_ARGS)
(pointer GTK_TYPE_POINTER)
(signal GTK_TYPE_SIGNAL)
(args GTK_TYPE_ARGS)
(callback GTK_TYPE_CALLBACK)
(c-callback GTK_TYPE_C_CALLBACK)
(foreign GTK_TYPE_FOREIGN)
(object GTK_TYPE_OBJECT))
; enumerations from "./gtkwidget.h"
......
......@@ -406,7 +406,7 @@ gtk_arg_copy (GtkArg *src_arg,
dest_arg->d = src_arg->d;
if (src_arg->type == GTK_TYPE_STRING)
dest_arg->d.string_data = g_strdup (src_arg->d.string_data);
GTK_VALUE_STRING (*dest_arg) = g_strdup (GTK_VALUE_STRING (*src_arg));
return dest_arg;
}
......
......@@ -32,14 +32,27 @@ gtk_arg_collect_value (GtkType fundamental_type,
case GTK_TYPE_INVALID:
error_msg = g_strdup ("invalid untyped argument");
break;
case GTK_TYPE_NONE:
/* error_msg = g_strdup ("invalid argument type `void'"); */
/* we just ignore this type, since it arithmetically just requires
* us to not move the var_args pointer any further. callers need to
* check for the validity of GTK_TYPE_NONE themselves.
*
* error_msg = g_strdup ("invalid argument type `void'");
*/
break;
/* everything smaller than an int is guarranteed to be
* passed as an int
*/
case GTK_TYPE_CHAR:
GTK_VALUE_CHAR (*arg) = va_arg (*var_args, gchar);
GTK_VALUE_CHAR (*arg) = va_arg (*var_args, gint);
break;
case GTK_TYPE_UCHAR:
GTK_VALUE_UCHAR (*arg) = va_arg (*var_args, guint);
break;
case GTK_TYPE_BOOL:
GTK_VALUE_BOOL (*arg) = va_arg (*var_args, gboolean);
GTK_VALUE_BOOL (*arg) = va_arg (*var_args, gint);
break;
case GTK_TYPE_INT:
GTK_VALUE_INT (*arg) = va_arg (*var_args, gint);
......@@ -51,14 +64,21 @@ gtk_arg_collect_value (GtkType fundamental_type,
GTK_VALUE_ENUM (*arg) = va_arg (*var_args, gint);
break;
case GTK_TYPE_FLAGS:
GTK_VALUE_FLAGS (*arg) = va_arg (*var_args, gint);
GTK_VALUE_FLAGS (*arg) = va_arg (*var_args, guint);
break;
/* we collect longs as glongs since they differ in size with
* integers on some platforms
*/
case GTK_TYPE_LONG:
GTK_VALUE_LONG (*arg) = va_arg (*var_args, glong);
break;
case GTK_TYPE_ULONG:
GTK_VALUE_ULONG (*arg) = va_arg (*var_args, gulong);
break;
/* floats are always passed as doubles
*/
case GTK_TYPE_FLOAT:
/* GTK_VALUE_FLOAT (*arg) = va_arg (*var_args, gfloat); */
GTK_VALUE_FLOAT (*arg) = va_arg (*var_args, gdouble);
......@@ -66,6 +86,9 @@ gtk_arg_collect_value (GtkType fundamental_type,
case GTK_TYPE_DOUBLE:
GTK_VALUE_DOUBLE (*arg) = va_arg (*var_args, gdouble);
break;
/* collect pointer values
*/
case GTK_TYPE_STRING:
GTK_VALUE_STRING (*arg) = va_arg (*var_args, gchar*);
break;
......@@ -75,10 +98,17 @@ gtk_arg_collect_value (GtkType fundamental_type,
case GTK_TYPE_BOXED:
GTK_VALUE_BOXED (*arg) = va_arg (*var_args, gpointer);
break;
/* structured types
*/
case GTK_TYPE_SIGNAL:
GTK_VALUE_SIGNAL (*arg).f = va_arg (*var_args, GtkFunction);
GTK_VALUE_SIGNAL (*arg).f = va_arg (*var_args, GtkSignalFunc);
GTK_VALUE_SIGNAL (*arg).d = va_arg (*var_args, gpointer);
break;
case GTK_TYPE_ARGS:
GTK_VALUE_ARGS (*arg).n_args = va_arg (*var_args, gint);
GTK_VALUE_ARGS (*arg).args = va_arg (*var_args, GtkArg*);
break;
case GTK_TYPE_FOREIGN:
GTK_VALUE_FOREIGN (*arg).data = va_arg (*var_args, gpointer);
GTK_VALUE_FOREIGN (*arg).notify = va_arg (*var_args, GtkDestroyNotify);
......@@ -92,18 +122,23 @@ gtk_arg_collect_value (GtkType fundamental_type,
GTK_VALUE_C_CALLBACK (*arg).func = va_arg (*var_args, GtkFunction);
GTK_VALUE_C_CALLBACK (*arg).func_data = va_arg (*var_args, gpointer);
break;
case GTK_TYPE_ARGS:
GTK_VALUE_ARGS (*arg).n_args = va_arg (*var_args, gint);
GTK_VALUE_ARGS (*arg).args = va_arg (*var_args, GtkArg*);
break;
/* we do some extra sanity checking when collecting objects,
* i.e. if the object pointer is not NULL, we check whether we
* actually got an object pointer within the desired class branch.
*/
case GTK_TYPE_OBJECT:
GTK_VALUE_OBJECT (*arg) = va_arg (*var_args, GtkObject*);
if (GTK_VALUE_OBJECT (*arg) != NULL)
{
register GtkObject *object = GTK_VALUE_OBJECT (*arg);
if (object->klass == NULL ||
!gtk_type_is_a (GTK_OBJECT_TYPE (object), arg->type))
if (object->klass == NULL)
error_msg = g_strconcat ("invalid unclassed object pointer for argument type `",
gtk_type_name (arg->type),
"'",
NULL);
else if (!gtk_type_is_a (GTK_OBJECT_TYPE (object), arg->type))
error_msg = g_strconcat ("invalid object `",
gtk_type_name (GTK_OBJECT_TYPE (object)),
"' for argument type `",
......@@ -112,6 +147,7 @@ gtk_arg_collect_value (GtkType fundamental_type,
NULL);
}
break;
default:
error_msg = g_strconcat ("unsupported argument type `",
gtk_type_name (arg->type),
......@@ -119,6 +155,6 @@ gtk_arg_collect_value (GtkType fundamental_type,
NULL);
break;
}
return error_msg;
}
......@@ -643,16 +643,16 @@ gtk_binding_entry_add_signal (GtkBindingSet *binding_set,
arg->arg_type = va_arg (args, GtkType);
switch (GTK_FUNDAMENTAL_TYPE (arg->arg_type))
{
/* for elaborated commenting about var args collection, take a look
* at gtk_arg_collect_value() in gtkargcollector.c
*/
case GTK_TYPE_CHAR:
arg->arg_type = GTK_TYPE_LONG;
arg->d.long_data = va_arg (args, gchar);
break;
case GTK_TYPE_BOOL:
arg->arg_type = GTK_TYPE_LONG;
arg->d.long_data = va_arg (args, gboolean) != 0;
break;
case GTK_TYPE_UCHAR:
case GTK_TYPE_INT:
case GTK_TYPE_UINT:
case GTK_TYPE_BOOL:
case GTK_TYPE_ENUM:
case GTK_TYPE_FLAGS:
arg->arg_type = GTK_TYPE_LONG;
arg->d.long_data = va_arg (args, gint);
break;
......@@ -662,9 +662,6 @@ gtk_binding_entry_add_signal (GtkBindingSet *binding_set,
arg->d.long_data = va_arg (args, glong);
break;
case GTK_TYPE_FLOAT:
arg->arg_type = GTK_TYPE_DOUBLE;
arg->d.double_data = va_arg (args, gfloat);
break;
case GTK_TYPE_DOUBLE:
arg->arg_type = GTK_TYPE_DOUBLE;
arg->d.double_data = va_arg (args, gdouble);
......@@ -681,11 +678,6 @@ gtk_binding_entry_add_signal (GtkBindingSet *binding_set,
i += n_args + 1;
}
break;
case GTK_TYPE_ENUM:
case GTK_TYPE_FLAGS:
arg->arg_type = GTK_TYPE_LONG;
arg->d.long_data = va_arg (args, gint);
break;
default:
g_warning ("gtk_binding_entry_add_signal(): unsupported type `%s' for arg[%u]",
gtk_type_name (arg->arg_type), i);
......
......@@ -310,7 +310,7 @@ gtk_object_set_arg (GtkObject *object,
{
gtk_signal_connect_full (object,
arg_name + n + 2,
(GtkSignalFunc) GTK_VALUE_SIGNAL (*arg).f, NULL,
GTK_VALUE_SIGNAL (*arg).f, NULL,
GTK_VALUE_SIGNAL (*arg).d,
NULL,
(arg_id == ARG_OBJECT_SIGNAL ||
......
......@@ -221,18 +221,6 @@ struct _GtkObjectClass
};
/* For the purpose of user signals we need the signal function
* and signal marshaller signatures already in this place.
*/
#define GTK_SIGNAL_FUNC(f) ((GtkSignalFunc) f)
typedef void (*GtkSignalFunc) (void);
typedef void (*GtkSignalMarshaller) (GtkObject *object,
GtkSignalFunc func,
gpointer func_data,
GtkArg *args);
/* Application-level methods */
......
......@@ -1832,9 +1832,8 @@ gtk_signal_collect_params (GtkArg *params,
return_type = GTK_FUNDAMENTAL_TYPE (return_type);
if (return_type != GTK_TYPE_NONE)
{
if ((return_type >= GTK_TYPE_CHAR &&
return_type <= GTK_TYPE_BOXED) ||
(return_type == GTK_TYPE_POINTER) ||
if ((return_type >= GTK_TYPE_FLAT_FIRST &&
return_type <= GTK_TYPE_FLAT_LAST) ||
(return_type == GTK_TYPE_OBJECT))
{
GTK_VALUE_POINTER (*params) = va_arg (var_args, gpointer);
......
......@@ -337,6 +337,7 @@ static GtkEnumValue _gtk_fundamental_type_values[] = {
{ GTK_TYPE_INVALID, "GTK_TYPE_INVALID", "invalid" },
{ GTK_TYPE_NONE, "GTK_TYPE_NONE", "none" },
{ GTK_TYPE_CHAR, "GTK_TYPE_CHAR", "char" },
{ GTK_TYPE_UCHAR, "GTK_TYPE_UCHAR", "uchar" },
{ GTK_TYPE_BOOL, "GTK_TYPE_BOOL", "bool" },
{ GTK_TYPE_INT, "GTK_TYPE_INT", "int" },
{ GTK_TYPE_UINT, "GTK_TYPE_UINT", "uint" },
......@@ -348,12 +349,12 @@ static GtkEnumValue _gtk_fundamental_type_values[] = {
{ GTK_TYPE_ENUM, "GTK_TYPE_ENUM", "enum" },
{ GTK_TYPE_FLAGS, "GTK_TYPE_FLAGS", "flags" },
{ GTK_TYPE_BOXED, "GTK_TYPE_BOXED", "boxed" },
{ GTK_TYPE_FOREIGN, "GTK_TYPE_FOREIGN", "foreign" },
{ GTK_TYPE_CALLBACK, "GTK_TYPE_CALLBACK", "callback" },
{ GTK_TYPE_ARGS, "GTK_TYPE_ARGS", "args" },
{ GTK_TYPE_POINTER, "GTK_TYPE_POINTER", "pointer" },
{ GTK_TYPE_SIGNAL, "GTK_TYPE_SIGNAL", "signal" },
{ GTK_TYPE_ARGS, "GTK_TYPE_ARGS", "args" },
{ GTK_TYPE_CALLBACK, "GTK_TYPE_CALLBACK", "callback" },
{ GTK_TYPE_C_CALLBACK, "GTK_TYPE_C_CALLBACK", "c-callback" },
{ GTK_TYPE_FOREIGN, "GTK_TYPE_FOREIGN", "foreign" },
{ GTK_TYPE_OBJECT, "GTK_TYPE_OBJECT", "object" },
{ 0, NULL, NULL }
};
......
......@@ -8,7 +8,7 @@
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
......@@ -60,20 +60,20 @@ static gint gtk_type_name_compare (const char *a,
static void gtk_type_init_builtin_types (void);
static GtkTypeNode *type_nodes = NULL;
static guint n_type_nodes = 0;
static guint n_type_nodes = 0;
static GHashTable *type_name_2_type_ht = NULL;
static GtkTypeNode*
gtk_type_node_next_and_invalidate (void)
{
static guint n_free_type_nodes = 0;
register GtkTypeNode *node;
static guint n_free_type_nodes = 0;
register GtkTypeNode *node;
register GtkType new_type;
/* don't keep *any* GtkTypeNode pointers across invokation of this function!!!
*/
if (n_free_type_nodes == 0)
{
register guint i;
......@@ -89,19 +89,19 @@ gtk_type_node_next_and_invalidate (void)
size = i;
type_nodes = g_realloc (type_nodes, size);
n_free_type_nodes = size / sizeof (GtkTypeNode) - n_type_nodes;
memset (type_nodes + n_type_nodes, 0, n_free_type_nodes * sizeof (GtkTypeNode));
}
new_type = n_type_nodes++;
n_free_type_nodes--;
LOOKUP_TYPE_NODE (node, new_type);
if (node)
node->type = new_type;
return node;
}
......@@ -111,35 +111,35 @@ gtk_type_init (void)
if (n_type_nodes == 0)
{
GtkTypeNode *zero;
g_assert (sizeof (GtkType) >= 4);
zero = gtk_type_node_next_and_invalidate ();
g_assert (zero == NULL);
type_name_2_type_ht = g_hash_table_new ((GHashFunc) gtk_type_name_hash,
(GCompareFunc) gtk_type_name_compare);
gtk_type_init_builtin_types ();
}
}
void
gtk_type_set_chunk_alloc (GtkType type,
guint n_chunks)
guint n_chunks)
{
GtkTypeNode *node;
LOOKUP_TYPE_NODE (node, type);
g_return_if_fail (node != NULL);
g_return_if_fail (node->chunk_alloc_locked == FALSE);
if (node->mem_chunk)
{
g_mem_chunk_destroy (node->mem_chunk);
node->mem_chunk = NULL;
}
if (n_chunks)
node->mem_chunk = g_mem_chunk_new (node->type_info.type_name,
node->type_info.object_size,
......@@ -155,7 +155,7 @@ gtk_type_create (GtkType parent_type,
GtkTypeNode *new_node;
GtkTypeNode *parent;
guint i;
if (g_hash_table_lookup (type_name_2_type_ht, type_name))
{
g_warning ("gtk_type_create(): type `%s' already exists.", type_name);
......@@ -173,11 +173,11 @@ gtk_type_create (GtkType parent_type,
return 0;
}
}
/* relookup pointers afterwards.
*/
new_node = gtk_type_node_next_and_invalidate ();
if (parent_type)
{
new_node->type = GTK_TYPE_MAKE (parent_type, new_node->type);
......@@ -188,7 +188,7 @@ gtk_type_create (GtkType parent_type,
g_assert (new_node->type <= 0xff);
parent = NULL;
}
new_node->type_info = *type_info;
new_node->type_info.type_name = type_name;
/* new_node->type_info.reserved_1 = NULL; */
......@@ -200,19 +200,19 @@ gtk_type_create (GtkType parent_type,
new_node->klass = NULL;
new_node->children_types = NULL;
new_node->mem_chunk = NULL;
if (parent)
parent->children_types = g_list_append (parent->children_types, GUINT_TO_POINTER (new_node->type));
parent = new_node;
for (i = 0; i < new_node->n_supers + 1; i++)
{
new_node->supers[i] = parent->type;
LOOKUP_TYPE_NODE (parent, parent->parent_type);
}
g_hash_table_insert (type_name_2_type_ht, new_node->type_info.type_name, GUINT_TO_POINTER (new_node->type));
return new_node->type;
}
......@@ -222,22 +222,22 @@ gtk_type_unique (GtkType parent_type,
{
GtkType new_type;
gchar *type_name;
g_return_val_if_fail (type_info != NULL, 0);
g_return_val_if_fail (type_info->type_name != NULL, 0);
if (n_type_nodes == 0)
gtk_type_init ();
type_name = g_strdup (type_info->type_name);
/* relookup pointers afterwards.
*/
new_type = gtk_type_create (parent_type, type_name, type_info);
if (!new_type)
g_free (type_name);
return new_type;
}
......@@ -245,12 +245,12 @@ gchar*
gtk_type_name (GtkType type)
{
GtkTypeNode *node;
LOOKUP_TYPE_NODE (node, type);
if (node)
return node->type_info.type_name;
return NULL;
}
......@@ -262,10 +262,10 @@ gtk_type_from_name (const gchar *name)
GtkType type;
type = GPOINTER_TO_UINT (g_hash_table_lookup (type_name_2_type_ht, (gpointer) name));
return type;
}
return 0;
}
......@@ -273,11 +273,11 @@ GtkType
gtk_type_parent (GtkType type)
{
GtkTypeNode *node;
LOOKUP_TYPE_NODE (node, type);
if (node)
return node->parent_type;
return 0;
}
......@@ -285,23 +285,23 @@ gpointer
gtk_type_parent_class (GtkType type)
{
GtkTypeNode *node;
LOOKUP_TYPE_NODE (node, type);
g_return_val_if_fail (node != NULL, NULL);
if (node)
{
LOOKUP_TYPE_NODE (node, node->parent_type);
if (node)
{
if (!node->klass)
gtk_type_class_init (node);
return node->klass;
}
}
return NULL;
}
......@@ -309,13 +309,13 @@ gpointer
gtk_type_class (GtkType type)
{
GtkTypeNode *node;
LOOKUP_TYPE_NODE (node, type);
g_return_val_if_fail (node != NULL, NULL);
if (!node->klass)
gtk_type_class_init (node);
return node->klass;
}
......@@ -326,10 +326,10 @@ gtk_type_new (GtkType type)
GtkObject *object;
gpointer klass;
guint i;
LOOKUP_TYPE_NODE (node, type);
g_return_val_if_fail (node != NULL, NULL);
klass = gtk_type_class (type);
node->chunk_alloc_locked = TRUE;
if (node->mem_chunk)
......@@ -339,7 +339,7 @@ gtk_type_new (GtkType type)
}
else
object = g_malloc0 (node->type_info.object_size);
/* we need to call the base classes' object_init_func for derived
* objects with the object's ->klass field still pointing to the
* corresponding base class, otherwise overridden class functions
......@@ -348,7 +348,7 @@ gtk_type_new (GtkType type)
for (i = node->n_supers; i > 0; i--)
{
GtkTypeNode *pnode;
LOOKUP_TYPE_NODE (pnode, node->supers[i]);
if (pnode->type_info.object_init_func)
{
......@@ -359,20 +359,20 @@ gtk_type_new (GtkType type)
object->klass = klass;
if (node->type_info.object_init_func)
node->type_info.object_init_func (object);
return object;
}
void
gtk_type_free (GtkType type,
gpointer mem)
gtk_type_free (GtkType type,
gpointer mem)
{
GtkTypeNode *node;
g_return_if_fail (mem != NULL);
LOOKUP_TYPE_NODE (node, type);
g_return_if_fail (node != NULL);