summaryrefslogtreecommitdiff
path: root/gtk/gtkbuilder.c
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2007-11-11 18:06:11 +0000
committerRyan Lortie <ryanl@src.gnome.org>2007-11-11 18:06:11 +0000
commitd65049378b1db55e939bcfc6f544f9b8dcd7c51b (patch)
treeaf9f22b758293da3c5358b9532cd0c9f2555b34d /gtk/gtkbuilder.c
parent0b9863c1fc0c94025cb5c2c78d88d197baad64b3 (diff)
downloadgdk-pixbuf-d65049378b1db55e939bcfc6f544f9b8dcd7c51b.tar.gz
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
Diffstat (limited to 'gtk/gtkbuilder.c')
-rw-r--r--gtk/gtkbuilder.c47
1 files changed, 16 insertions, 31 deletions
diff --git a/gtk/gtkbuilder.c b/gtk/gtkbuilder.c
index f7dd41b50..22feceb72 100644
--- a/gtk/gtkbuilder.c
+++ b/gtk/gtkbuilder.c
@@ -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);
}
/**