forked from AuroraMiddleware/gtk
gtk_object_query_args() now returns the args in the corret order.
-timj
This commit is contained in:
parent
3942cb76af
commit
6f7faf9df2
@ -52,6 +52,7 @@ struct _GtkArgInfo
|
|||||||
GtkType type;
|
GtkType type;
|
||||||
GtkType class_type;
|
GtkType class_type;
|
||||||
guint arg_id;
|
guint arg_id;
|
||||||
|
guint seq_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -464,28 +465,33 @@ gtk_object_query_args (GtkType class_type,
|
|||||||
if (query_data.arg_list)
|
if (query_data.arg_list)
|
||||||
{
|
{
|
||||||
register GList *list;
|
register GList *list;
|
||||||
register guint i;
|
register guint len;
|
||||||
|
|
||||||
list = query_data.arg_list;
|
list = query_data.arg_list;
|
||||||
|
len = 1;
|
||||||
|
while (list->next)
|
||||||
|
{
|
||||||
|
len++;
|
||||||
|
list = list->next;
|
||||||
|
}
|
||||||
|
g_assert (len == ((GtkObjectClass*) gtk_type_class (class_type))->n_args); /* paranoid */
|
||||||
|
|
||||||
i = g_list_length (list);
|
args = g_new0 (GtkArg, len);
|
||||||
args = g_new0 (GtkArg, i);
|
*nargs = len;
|
||||||
*nargs = i;
|
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
GtkArgInfo *info;
|
GtkArgInfo *info;
|
||||||
|
|
||||||
i--;
|
|
||||||
info = list->data;
|
info = list->data;
|
||||||
list = list->next;
|
list = list->prev;
|
||||||
|
|
||||||
args[i].type = info->type;
|
g_assert (info->seq_id > 0 && info->seq_id <= len); /* paranoid */
|
||||||
args[i].name = info->name;
|
|
||||||
|
args[info->seq_id - 1].type = info->type;
|
||||||
|
args[info->seq_id - 1].name = info->name;
|
||||||
}
|
}
|
||||||
while (i > 0);
|
while (list);
|
||||||
|
|
||||||
g_assert (list == NULL); /* paranoid */
|
|
||||||
|
|
||||||
g_list_free (query_data.arg_list);
|
g_list_free (query_data.arg_list);
|
||||||
}
|
}
|
||||||
@ -634,6 +640,8 @@ gtk_object_add_arg_type (const char *arg_name,
|
|||||||
info->type = arg_type;
|
info->type = arg_type;
|
||||||
info->class_type = class_type;
|
info->class_type = class_type;
|
||||||
info->arg_id = arg_id;
|
info->arg_id = arg_id;
|
||||||
|
info->seq_id = ++((GtkObjectClass*) gtk_type_class (class_type))->n_args;
|
||||||
|
printf ("arg seq id: %d for %s\n", info->seq_id, info->name);
|
||||||
|
|
||||||
if (!arg_info_ht)
|
if (!arg_info_ht)
|
||||||
arg_info_ht = g_hash_table_new (g_str_hash, g_str_equal);
|
arg_info_ht = g_hash_table_new (g_str_hash, g_str_equal);
|
||||||
|
@ -356,6 +356,7 @@ gtk_type_class_init (GtkTypeNode *node)
|
|||||||
|
|
||||||
object_class = node->klass;
|
object_class = node->klass;
|
||||||
object_class->type = node->type;
|
object_class->type = node->type;
|
||||||
|
object_class->n_args = 0;
|
||||||
|
|
||||||
if (node->type_info.class_init_func)
|
if (node->type_info.class_init_func)
|
||||||
(* node->type_info.class_init_func) (node->klass);
|
(* node->type_info.class_init_func) (node->klass);
|
||||||
|
Loading…
Reference in New Issue
Block a user