widget: Make all code snippets compile

This commit is contained in:
Timm Bäder
2018-01-03 16:34:49 +01:00
committed by Daniel Boles
parent 6e197ffac9
commit c006c2fdbc

View File

@ -426,6 +426,12 @@
* gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), * gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass),
* FooWidget, goodbye_button); * FooWidget, goodbye_button);
* } * }
*
* static void
* foo_widget_init (FooWidget *widget)
* {
*
* }
* ]| * ]|
* *
* You can also use gtk_widget_class_bind_template_callback() to connect a signal * You can also use gtk_widget_class_bind_template_callback() to connect a signal
@ -11518,13 +11524,20 @@ gtk_widget_add_device_events (GtkWidget *widget,
* inside a #GtkSocket within the same application. * inside a #GtkSocket within the same application.
* *
* To reliably find the toplevel #GtkWindow, use * To reliably find the toplevel #GtkWindow, use
* gtk_widget_get_toplevel() and call gtk_widget_is_toplevel() * gtk_widget_get_toplevel() and call GTK_IS_WINDOW()
* on the result. * on the result. For instance, to get the title of a widget's toplevel
* window, one might use:
* |[<!-- language="C" --> * |[<!-- language="C" -->
* GtkWidget *toplevel = gtk_widget_get_toplevel (widget); * static const char *
* if (gtk_widget_is_toplevel (toplevel)) * get_widget_toplevel_title (GtkWidget *widget)
* { * {
* // Perform action on toplevel. * GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
* if (GTK_IS_WINDOW (toplevel))
* {
* return gtk_window_get_title (GTK_WINDOW (toplevel));
* }
*
* return NULL;
* } * }
* ]| * ]|
* *