diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-05-09 20:01:21 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-05-11 12:20:59 -0400 |
commit | 6d969d1026959d72f707638f86e174e7caece6ba (patch) | |
tree | 8cb95e58a78bb278df54a648248ce943d91049a7 /docs | |
parent | 177c0eb9e2601613cb7f250dc9f704a660d75860 (diff) | |
download | gtk+-6d969d1026959d72f707638f86e174e7caece6ba.tar.gz |
Update the docs
Remove various references to gtk_widget_destroy in the docs.
Diffstat (limited to 'docs')
-rw-r--r-- | docs/reference/gtk/getting_started.xml.in | 13 | ||||
-rw-r--r-- | docs/reference/gtk/question_index.xml | 15 |
2 files changed, 11 insertions, 17 deletions
diff --git a/docs/reference/gtk/getting_started.xml.in b/docs/reference/gtk/getting_started.xml.in index 758b4f0d9d..d8e638f6e1 100644 --- a/docs/reference/gtk/getting_started.xml.in +++ b/docs/reference/gtk/getting_started.xml.in @@ -194,12 +194,13 @@ a g_signal_connect() with the difference lying in how the callback function is treated. g_signal_connect_swapped() allows you to specify what the callback function should take as parameter by letting you pass it as data. In this case - the function being called back is gtk_widget_destroy() and the - <varname>window</varname> pointer is passed to it. This has the effect that when - the button is clicked, the whole GTK window is destroyed. In contrast, if a normal - g_signal_connect() were used to connect the "clicked" signal with - gtk_widget_destroy(), then the <varname>button</varname> itself would have been - destroyed, not the window. More information about creating buttons can be found + the function being called back is gtk_window_destroy() and the <varname>window</varname> + pointer is passed to it. This has the effect that when the button is clicked, + the whole GTK window is destroyed. In contrast if a normal g_signal_connect() were used + to connect the "clicked" signal with gtk_window_destroy(), then the function + would be called on <varname>button</varname> (which would not go well, since + the function expects a GtkWindow as argument). + More information about creating buttons can be found <ulink url="https://wiki.gnome.org/HowDoI/Buttons">here</ulink>. </para> diff --git a/docs/reference/gtk/question_index.xml b/docs/reference/gtk/question_index.xml index 0cd8062185..3353b754f0 100644 --- a/docs/reference/gtk/question_index.xml +++ b/docs/reference/gtk/question_index.xml @@ -123,8 +123,8 @@ after creating it ? <para> If <structname>GtkFoo</structname> isn't a toplevel window, then <informalexample><programlisting> - foo = gtk_foo_new (<!-- -->); - gtk_widget_destroy (foo); + foo = gtk_foo_new (); + g_object_unref (foo); </programlisting></informalexample> is a memory leak, because no one assumed the initial floating reference. If you are using a widget and you aren't immediately @@ -137,19 +137,12 @@ To get this, you must acquire a reference to the widget and drop the floating reference (<quote>ref and sink</quote> in GTK parlance) after creating it: <informalexample><programlisting> - foo = gtk_foo_new (<!-- -->); + foo = gtk_foo_new (); g_object_ref_sink (foo); </programlisting></informalexample> -When you want to get rid of the widget, you must call gtk_widget_destroy() -to break any external connections to the widget before dropping your -reference: -<informalexample><programlisting> - gtk_widget_destroy (foo); - g_object_unref (foo); -</programlisting></informalexample> When you immediately add a widget to a container, it takes care of assuming the initial floating reference and you don't have to worry -about reference counting at all ... just call gtk_widget_destroy() +about reference counting at all ... just call gtk_container_remove() to get rid of the widget. </para> </answer> |