forked from AuroraMiddleware/gtk
Convert delayed_properties hashtable to linked list. Fixes #495769.
2007-11-10 Ryan Lortie <desrt@desrt.ca> * gtk/gtkbuilder.c: Convert delayed_properties hashtable to linked list. Fixes #495769. svn path=/trunk/; revision=18983
This commit is contained in:
parent
0b9863c1fc
commit
d65049378b
@ -1,3 +1,8 @@
|
||||
2007-11-10 Ryan Lortie <desrt@desrt.ca>
|
||||
|
||||
* gtk/gtkbuilder.c: Convert delayed_properties hashtable to linked
|
||||
list. Fixes #495769.
|
||||
|
||||
2007-11-10 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* tests/buildertest.c: Parse a file given on the cmdline.
|
||||
|
@ -65,9 +65,8 @@ struct _GtkBuilderPrivate
|
||||
{
|
||||
gchar *domain;
|
||||
GHashTable *objects;
|
||||
GHashTable *delayed_properties;
|
||||
GSList *delayed_properties;
|
||||
GSList *signals;
|
||||
gchar *current_root;
|
||||
GSList *root_objects;
|
||||
gchar *filename;
|
||||
};
|
||||
@ -116,9 +115,6 @@ gtk_builder_init (GtkBuilder *builder)
|
||||
builder->priv->domain = NULL;
|
||||
builder->priv->objects = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||
g_free, NULL);
|
||||
builder->priv->delayed_properties = g_hash_table_new_full (g_str_hash,
|
||||
g_str_equal,
|
||||
g_free, NULL);
|
||||
}
|
||||
|
||||
|
||||
@ -132,11 +128,9 @@ gtk_builder_finalize (GObject *object)
|
||||
GtkBuilderPrivate *priv = GTK_BUILDER (object)->priv;
|
||||
|
||||
g_free (priv->domain);
|
||||
g_free (priv->current_root);
|
||||
g_free (priv->filename);
|
||||
|
||||
g_hash_table_destroy (priv->objects);
|
||||
g_hash_table_destroy (priv->delayed_properties);
|
||||
|
||||
g_slist_foreach (priv->signals, (GFunc) _free_signal_info, NULL);
|
||||
g_slist_free (priv->signals);
|
||||
@ -311,18 +305,13 @@ gtk_builder_get_parameters (GtkBuilder *builder,
|
||||
}
|
||||
else
|
||||
{
|
||||
GSList *delayed_properties;
|
||||
|
||||
delayed_properties = g_hash_table_lookup (builder->priv->delayed_properties,
|
||||
builder->priv->current_root);
|
||||
property = g_slice_new (DelayedProperty);
|
||||
property->object = g_strdup (object_name);
|
||||
property->name = g_strdup (prop->name);
|
||||
property->value = g_strdup (prop->data);
|
||||
delayed_properties = g_slist_prepend (delayed_properties, property);
|
||||
g_hash_table_insert (builder->priv->delayed_properties,
|
||||
g_strdup (builder->priv->current_root),
|
||||
delayed_properties);
|
||||
builder->priv->delayed_properties =
|
||||
g_slist_prepend (builder->priv->delayed_properties, property);
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -396,12 +385,6 @@ _gtk_builder_construct (GtkBuilder *builder,
|
||||
if (object_type == G_TYPE_INVALID)
|
||||
g_error ("Invalid type: %s", info->class_name);
|
||||
|
||||
if (!info->parent)
|
||||
{
|
||||
g_free (builder->priv->current_root);
|
||||
builder->priv->current_root = g_strdup (info->id);
|
||||
}
|
||||
|
||||
gtk_builder_get_parameters (builder, object_type,
|
||||
info->id,
|
||||
info->properties,
|
||||
@ -555,19 +538,23 @@ _gtk_builder_add_signals (GtkBuilder *builder,
|
||||
}
|
||||
|
||||
static void
|
||||
apply_delayed_properties (const gchar *window_name,
|
||||
GSList *props,
|
||||
GtkBuilder *builder)
|
||||
gtk_builder_apply_delayed_properties (GtkBuilder *builder)
|
||||
{
|
||||
GSList *l;
|
||||
GSList *l, *props;
|
||||
DelayedProperty *property;
|
||||
GObject *object;
|
||||
GType object_type;
|
||||
GObjectClass *oclass;
|
||||
GParamSpec *pspec;
|
||||
|
||||
g_assert (props != NULL);
|
||||
props = g_slist_reverse (props);
|
||||
/* take the list over from the builder->priv.
|
||||
*
|
||||
* g_slist_reverse does not copy the list, so the list now
|
||||
* belongs to us (and we free it at the end of this function).
|
||||
*/
|
||||
props = g_slist_reverse (builder->priv->delayed_properties);
|
||||
builder->priv->delayed_properties = NULL;
|
||||
|
||||
for (l = props; l; l = l->next)
|
||||
{
|
||||
property = (DelayedProperty*)l->data;
|
||||
@ -605,11 +592,9 @@ apply_delayed_properties (const gchar *window_name,
|
||||
}
|
||||
|
||||
void
|
||||
_gtk_builder_finish (GtkBuilder *builder)
|
||||
_gtk_builder_finish (GtkBuilder *builder)
|
||||
{
|
||||
if (builder->priv->delayed_properties)
|
||||
g_hash_table_foreach (builder->priv->delayed_properties,
|
||||
(GHFunc)apply_delayed_properties, builder);
|
||||
gtk_builder_apply_delayed_properties (builder);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user