Allow a NULL marshaller. (gtk_signal_connect_by_type): Allow only

* gtk/gtksignal.c (gtk_signal_newv): Allow a NULL marshaller.
(gtk_signal_connect_by_type): Allow only no_marshal handlers to
connect to signals with a NULL marshaller.

* gtk/gtktypeutils.c (gtk_type_get_info): New.
gtk/gtktypeutils.h (gtk_type_get_info): New prototype.
This commit is contained in:
Marius Vollmer 1998-12-06 22:15:53 +00:00
parent 8abed09aea
commit 3f7c856606
3 changed files with 27 additions and 2 deletions

View File

@ -268,7 +268,6 @@ gtk_signal_newv (const gchar *r_name,
gchar *name;
g_return_val_if_fail (r_name != NULL, 0);
g_return_val_if_fail (marshaller != NULL, 0);
g_return_val_if_fail (nparams < MAX_SIGNAL_PARAMS, 0);
if (nparams)
g_return_val_if_fail (params != NULL, 0);
@ -1673,10 +1672,17 @@ gtk_signal_connect_by_type (GtkObject *object,
GtkObjectClass *class;
GtkHandler *handler;
gint found_it;
GtkSignal *signal;
g_return_val_if_fail (object != NULL, 0);
g_return_val_if_fail (object->klass != NULL, 0);
/* A signal without a default marshaller can only take no_marshal
handlers. */
signal = LOOKUP_SIGNAL_ID (signal_id);
g_return_val_if_fail (signal->marshaller || no_marshal, 0);
/* Search through the signals for this object and make
* sure the one we are adding is valid. We need to perform
* the lookup on the objects parents as well. If it isn't

View File

@ -257,6 +257,23 @@ gtk_type_unique (GtkType parent_type,
return new_type;
}
gboolean
gtk_type_get_info (GtkType type,
GtkTypeInfo *info)
{
GtkTypeNode *node;
if (info == NULL)
return FALSE;
LOOKUP_TYPE_NODE (node, type);
if (node == NULL)
return FALSE;
*info = node->type_info;
return TRUE;
}
gchar*
gtk_type_name (GtkType type)
{

View File

@ -313,6 +313,8 @@ struct _GtkEnumValue
void gtk_type_init (void);
GtkType gtk_type_unique (GtkType parent_type,
const GtkTypeInfo *type_info);
gboolean gtk_type_get_info (GtkType type,
GtkTypeInfo *info);
void gtk_type_set_chunk_alloc (GtkType type,
guint n_chunks);
gchar* gtk_type_name (guint type);