mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 02:40:11 +00:00
Parse signals after <child> tags and add tests. (#468793, Benjamin Otte)
2007-10-24 Johan Dahlin <jdahlin@async.com.br> * gtk/gtkbuilder.c: (_gtk_builder_construct), (_gtk_builder_add_signals): * gtk/gtkbuilderparser.c: (end_element): * gtk/gtkbuilderprivate.h: * tests/buildertest.c: (test_connect_signals): Parse signals after <child> tags and add tests. (#468793, Benjamin Otte) svn path=/trunk/; revision=18944
This commit is contained in:
parent
1d332bbb44
commit
fa13277655
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
||||
2007-10-24 Johan Dahlin <jdahlin@async.com.br>
|
||||
|
||||
* gtk/gtkbuilder.c: (_gtk_builder_construct),
|
||||
(_gtk_builder_add_signals):
|
||||
* gtk/gtkbuilderparser.c: (end_element):
|
||||
* gtk/gtkbuilderprivate.h:
|
||||
* tests/buildertest.c: (test_connect_signals):
|
||||
|
||||
Parse signals after <child> tags and add tests.
|
||||
(#468793, Benjamin Otte)
|
||||
|
||||
2007-10-24 Johan Dahlin <jdahlin@async.com.br>
|
||||
|
||||
* gtk/gtkbuilderparser.c (end_element): Allow empty property nodes
|
||||
|
@ -497,8 +497,6 @@ _gtk_builder_construct (GtkBuilder *builder,
|
||||
}
|
||||
g_hash_table_insert (builder->priv->objects, g_strdup (info->id), obj);
|
||||
|
||||
builder->priv->signals = g_slist_concat (builder->priv->signals,
|
||||
g_slist_copy (info->signals));
|
||||
return obj;
|
||||
}
|
||||
|
||||
@ -545,6 +543,14 @@ _gtk_builder_add (GtkBuilder *builder,
|
||||
child_info->added = TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
_gtk_builder_add_signals (GtkBuilder *builder,
|
||||
GSList *signals)
|
||||
{
|
||||
builder->priv->signals = g_slist_concat (builder->priv->signals,
|
||||
g_slist_copy (signals));
|
||||
}
|
||||
|
||||
static void
|
||||
apply_delayed_properties (const gchar *window_name,
|
||||
GSList *props,
|
||||
|
@ -774,6 +774,8 @@ end_element (GMarkupParseContext *context,
|
||||
if (GTK_IS_BUILDABLE (object_info->object) &&
|
||||
GTK_BUILDABLE_GET_IFACE (object_info->object)->parser_finished)
|
||||
data->finalizers = g_slist_prepend (data->finalizers, object_info->object);
|
||||
_gtk_builder_add_signals (data->builder, object_info->signals);
|
||||
|
||||
free_object_info (object_info);
|
||||
}
|
||||
else if (strcmp (element_name, "property") == 0)
|
||||
|
@ -105,6 +105,8 @@ GObject * _gtk_builder_construct (GtkBuilder *builder,
|
||||
ObjectInfo *info);
|
||||
void _gtk_builder_add (GtkBuilder *builder,
|
||||
ChildInfo *child_info);
|
||||
void _gtk_builder_add_signals (GtkBuilder *builder,
|
||||
GSList *signals);
|
||||
void _gtk_builder_finish (GtkBuilder *builder);
|
||||
void _free_signal_info (SignalInfo *info,
|
||||
gpointer user_data);
|
||||
|
@ -189,6 +189,15 @@ gboolean test_connect_signals (void)
|
||||
" <signal name=\"notify::title\" handler=\"signal_extra2\"/>"
|
||||
" </object>"
|
||||
"</interface>";
|
||||
const gchar buffer_after_child[] =
|
||||
"<interface>"
|
||||
" <object class=\"GtkWindow\" id=\"window1\">"
|
||||
" <child>"
|
||||
" <object class=\"GtkButton\" id=\"button1\"/>"
|
||||
" </child>"
|
||||
" <signal name=\"notify::title\" handler=\"signal_normal\"/>"
|
||||
" </object>"
|
||||
"</interface>";
|
||||
|
||||
builder = builder_new_from_string (buffer, -1, NULL);
|
||||
gtk_builder_connect_signals (builder, NULL);
|
||||
@ -229,6 +238,19 @@ gboolean test_connect_signals (void)
|
||||
|
||||
g_object_unref (builder);
|
||||
|
||||
/* new test, reset globals */
|
||||
after = 0;
|
||||
normal = 0;
|
||||
|
||||
builder = builder_new_from_string (buffer_after_child, -1, NULL);
|
||||
window = gtk_builder_get_object (builder, "window1");
|
||||
gtk_builder_connect_signals (builder, NULL);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "test");
|
||||
|
||||
g_return_val_if_fail (normal == 1, FALSE);
|
||||
gtk_widget_destroy (GTK_WIDGET (window));
|
||||
g_object_unref (builder);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user