added the sequential argument number to gtk_object_query_args.

-timj
This commit is contained in:
Tim Janik
1998-02-21 13:33:20 +00:00
parent f97dd05d5a
commit a8d6f14c2d
2 changed files with 27 additions and 19 deletions

View File

@ -54,7 +54,7 @@ struct _GtkArgInfo
char *name;
GtkType type;
GtkType class_type;
guint access_mask;
guint arg_flags;
guint arg_id;
guint seq_id;
};
@ -663,7 +663,7 @@ gtk_object_getv (GtkObject *object,
g_free (lookup_name);
continue;
}
else if (!info->access_mask & GTK_ARG_READABLE)
else if (!info->arg_flags & GTK_ARG_READABLE)
{
g_warning ("arg is not supplied for read-access: \"%s\"\n", lookup_name);
args[i].type = GTK_TYPE_INVALID;
@ -710,14 +710,17 @@ gtk_query_arg_foreach (gpointer key,
GtkArg*
gtk_object_query_args (GtkType class_type,
guint **access_masks,
guint32 **arg_flags,
guint **seq_ids,
guint *nargs)
{
GtkArg *args;
GtkQueryArgData query_data;
if (access_masks)
*access_masks = NULL;
if (arg_flags)
*arg_flags = NULL;
if (seq_ids)
*seq_ids = NULL;
g_return_val_if_fail (nargs != NULL, NULL);
*nargs = 0;
g_return_val_if_fail (gtk_type_is_a (class_type, gtk_object_get_type ()), NULL);
@ -750,8 +753,10 @@ gtk_object_query_args (GtkType class_type,
args = g_new0 (GtkArg, len);
*nargs = len;
if (access_masks)
*access_masks = g_new (guint, len);
if (arg_flags)
*arg_flags = g_new (guint32, len);
if (seq_ids)
*seq_ids = g_new (guint, len);
do
{
@ -764,8 +769,10 @@ gtk_object_query_args (GtkType class_type,
args[info->seq_id - 1].type = info->type;
args[info->seq_id - 1].name = info->name;
if (access_masks)
(*access_masks)[info->seq_id - 1] = info->access_mask;
if (arg_flags)
(*arg_flags)[info->seq_id - 1] = info->arg_flags;
if (seq_ids)
(*seq_ids)[info->seq_id - 1] = info->seq_id;
}
while (list);
@ -864,7 +871,7 @@ gtk_object_setv (GtkObject *object,
g_warning ("invalid arg for %s: \"%s\"\n", gtk_type_name (object->klass->type), lookup_name);
arg_ok = FALSE;
}
else if (!info->access_mask & GTK_ARG_WRITABLE)
else if (!info->arg_flags & GTK_ARG_WRITABLE)
{
g_warning ("arg is not supplied for write-access: \"%s\"\n", lookup_name);
arg_ok = FALSE;
@ -890,7 +897,7 @@ gtk_object_setv (GtkObject *object,
void
gtk_object_add_arg_type (const char *arg_name,
GtkType arg_type,
guint access_mask,
guint arg_flags,
guint arg_id)
{
GtkArgInfo *info;
@ -901,7 +908,7 @@ gtk_object_add_arg_type (const char *arg_name,
g_return_if_fail (arg_name != NULL);
g_return_if_fail (arg_type > GTK_TYPE_NONE);
g_return_if_fail (arg_id > 0);
g_return_if_fail ((access_mask & GTK_ARG_READWRITE) != 0);
g_return_if_fail ((arg_flags & GTK_ARG_READWRITE) != 0);
arg_part = strchr (arg_name, ':');
if (!arg_part || (arg_part[0] != ':') || (arg_part[1] != ':'))
@ -924,7 +931,7 @@ gtk_object_add_arg_type (const char *arg_name,
info->name = g_strdup (arg_name);
info->type = arg_type;
info->class_type = class_type;
info->access_mask = access_mask & (GTK_ARG_READABLE | GTK_ARG_WRITABLE);
info->arg_flags = arg_flags & (GTK_ARG_READABLE | GTK_ARG_WRITABLE);
info->arg_id = arg_id;
info->seq_id = ++((GtkObjectClass*) gtk_type_class (class_type))->n_args;

View File

@ -78,7 +78,7 @@ enum
GTK_RESERVED_2 = 1 << 3
};
/* GtkArg access bits for gtk_object_add_arg_type
/* GtkArg flag bits for gtk_object_add_arg_type
*/
enum
{
@ -246,19 +246,20 @@ void gtk_object_setv (GtkObject *object,
/* Allocate a GtkArg array of size nargs that hold the
* names and types of the args that can be used with
* gtk_object_set/gtk_object_get. if (acess_masks!=NULL),
* (*access_mask) will be set to point to a newly allocated
* guint array that holds the access masks of the args.
* gtk_object_set/gtk_object_get. if (arg_flags!=NULL),
* (*arg_flags) will be set to point to a newly allocated
* guint array that holds the flags of the args.
* It is the callers response to do a
* g_free (returned_args); g_free (*acess_masks).
*/
GtkArg* gtk_object_query_args (GtkType class_type,
guint **acess_masks,
guint32 **arg_flags,
guint **seq_ids,
guint *nargs);
void gtk_object_add_arg_type (const gchar *arg_name,
GtkType arg_type,
guint access_mask,
guint arg_flags,
guint arg_id);
GtkType gtk_object_get_arg_type (const gchar *arg_name);