When should I use g_object_unref()

This means that, when I see something like:

Returns

The newly created [GtkButton](https://developer.gnome.org/gtk3/stable/GtkButton.html) widget.

or

a new [GtkButton](https://developer.gnome.org/gtk3/stable/GtkButton.html)

or from properties:

Owner: GtkButton

I need to handle the reference my self.

And if I understand right, if I add it to a container as a child, then I do not need to drop its reference anymore because for the release process takes care the container now?

This means that, if I create a button has a floating point ( somewhere between 0 and 1).
If I add that button to a container ( window in this case) the reference grows to 1 and this happens because the container ( window) own it now.

Am I right?

EDIT:
This code when I click the Button:

#include <gtk/gtk.h>

static void btn_clbk ( GtkButton *button, gpointer data )
{
    ( void ) data;
    g_print ( "ref = %u\n", G_OBJECT ( button )->ref_count );

    g_object_ref ( button );
    g_print ( "ref = %d\n", G_OBJECT ( button )->ref_count );

    g_object_unref ( button );
    g_print ( "ref = %d\n", G_OBJECT ( button )->ref_count );

}

int main ( void )
{
    GtkWidget *window;
    GtkWidget *button;

    gtk_init ( NULL, NULL );

    window = gtk_window_new ( GTK_WINDOW_TOPLEVEL );
    g_signal_connect ( window, "delete-event", gtk_main_quit, NULL );
    g_signal_connect ( window, "destroy",      gtk_main_quit, NULL );

    button = gtk_button_new();
    gtk_container_add( GTK_CONTAINER( window ), button );
    g_signal_connect ( button, "clicked", G_CALLBACK ( btn_clbk ), NULL );

    gtk_widget_show_all ( window );
    gtk_main ();
}

returns:

ref = 8
ref = 9
ref = 8

But I was expected to be:

ref = 1
ref = 2
ref = 1