heal gtk. ;)

This commit is contained in:
Tim Janik 1998-06-14 14:37:39 +00:00
parent 208057b914
commit b8368a54a2
3 changed files with 29 additions and 15 deletions

View File

@ -62,7 +62,7 @@ binding_signal_free (GtkBindingSignal *sig)
for (i = 0; i < sig->n_args; i++)
{
if (sig->args[i].arg_type == GTK_BINDING_ARG_STRING)
g_free (sig->args[i].d.pointer_data);
g_free (sig->args[i].d.string_data);
}
g_free (sig->args);
g_free (sig->signal_name);
@ -268,7 +268,7 @@ binding_compose_params (GtkBindingArg *args,
{
case GTK_BINDING_ARG_STRING:
if (params->type == GTK_TYPE_STRING)
GTK_VALUE_STRING (*params) = args->d.pointer_data;
GTK_VALUE_STRING (*params) = args->d.string_data;
else
valid = FALSE;
break;
@ -569,14 +569,14 @@ gtk_binding_entry_add_signall (GtkBindingSet *binding_set,
arg->d.double_data = tmp_arg->d.double_data;
break;
case GTK_BINDING_ARG_STRING:
if (!tmp_arg->d.pointer_data)
if (!tmp_arg->d.string_data)
{
g_warning ("gtk_binding_entry_add_signall(): value of `string' arg[%u] is `NULL'", n);
arg->d.pointer_data = NULL;
arg->d.string_data = NULL;
binding_signal_free (signal);
return;
}
arg->d.pointer_data = g_strdup (tmp_arg->d.pointer_data);
arg->d.string_data = g_strdup (tmp_arg->d.string_data);
break;
default:
g_warning ("gtk_binding_entry_add_signall(): unsupported type `%s' for arg[%u]",
@ -643,8 +643,8 @@ gtk_binding_entry_add_signal (GtkBindingSet *binding_set,
arg->d.double_data = va_arg (args, gdouble);
break;
case GTK_BINDING_ARG_STRING:
arg->d.pointer_data = va_arg (args, gchar*);
if (!arg->d.pointer_data)
arg->d.string_data = va_arg (args, gchar*);
if (!arg->d.string_data)
{
g_warning ("gtk_binding_entry_add_signal(): value of `string' arg[%u] is `NULL'", i);
i = n_args + 2;

View File

@ -19,6 +19,7 @@
#include <string.h>
#include "gtkobject.h"
#include "gtktypeutils.h"
#include "gtkcontainer.h"
#define TYPE_NODES_BLOCK_SIZE (200)
@ -523,7 +524,7 @@ gtk_arg_copy (GtkArg *src_arg,
dest_arg->d = src_arg->d;
if (src_arg->type == GTK_TYPE_STRING)
dest_arg->d.pointer_data = g_strdup (src_arg->d.pointer_data);
dest_arg->d.string_data = g_strdup (src_arg->d.string_data);
return dest_arg;
}
@ -534,23 +535,23 @@ gtk_type_class_init (GtkTypeNode *node)
if (!node->klass && node->type_info.class_size)
{
node->klass = g_malloc0 (node->type_info.class_size);
if (node->parent_type)
{
GtkTypeNode *parent;
LOOKUP_TYPE_NODE (parent, node->parent_type);
if (!parent->klass)
gtk_type_class_init (parent);
if (parent->klass)
memcpy (node->klass, parent->klass, parent->type_info.class_size);
}
if (gtk_type_is_a (node->type, GTK_TYPE_OBJECT))
{
GtkObjectClass *object_class;
/* FIXME: this initialization needs to be done through
* a function pointer someday.
*/
@ -561,8 +562,19 @@ gtk_type_class_init (GtkTypeNode *node)
object_class->signals = NULL;
object_class->nsignals = 0;
object_class->n_args = 0;
}
if (gtk_type_is_a (node->type, GTK_TYPE_CONTAINER))
{
GtkContainerClass *container_class;
container_class = (GtkContainerClass*) object_class;
g_assert (node->type_info.class_size >= sizeof (GtkContainerClass));
container_class->n_args = 0;
}
}
/* class_init_func is used as data pointer for
* class_size==0 types
*/

View File

@ -106,7 +106,9 @@ struct _GtkArg
gulong ulong_data;
gfloat float_data;
gdouble double_data;
gchar *string_data;
gpointer pointer_data;
GtkObject *object_data;
struct {
GtkCallbackMarshal marshal;
gpointer data;
@ -139,7 +141,7 @@ struct _GtkArg
#define GTK_VALUE_ULONG(a) ((a).d.ulong_data)
#define GTK_VALUE_FLOAT(a) ((a).d.float_data)
#define GTK_VALUE_DOUBLE(a) ((a).d.double_data)
#define GTK_VALUE_STRING(a) ((a).d.pointer_data)
#define GTK_VALUE_STRING(a) ((a).d.string_data)
#define GTK_VALUE_ENUM(a) ((a).d.int_data)
#define GTK_VALUE_FLAGS(a) ((a).d.int_data)
#define GTK_VALUE_BOXED(a) ((a).d.pointer_data)