Skip to content
  • Debarshi Ray's avatar
    GtkSpinButton: Always emit value-changed when the adjustment is changed · 1e304e6d
    Debarshi Ray authored and Matthias Clasen's avatar Matthias Clasen committed
    Changing adjustment via the property setter would not emit
    value-changed, however changing it via gtk_spin_button_configure would.
    
    This inconsistency had the following side-effects:
    
      - Setting an adjustment with a different value would not update the
        value shown by the spin button.
    
      - Creating a spin button like this (common in GtkBuilder XML) will
        not show the initial value:
          g_object_new (GTK_TYPE_SPIN_BUTTON, "adjustment", adj, NULL);
    
    Let's use the same code path (ie. gtk_spin_button_configure) for all
    public facing API for setting adjustment. The code that handled the
    details of swapping out the old adjustment with the new has been split
    into an unset_adjustment method and the rest has been folded into
    gtk_spin_button_configure.
    
    A spin button really needs an adjustment to work, so we don't need
    most of the NULL checks. However we do need to check in
    unset_adjustment because setting a new adjustment during object
    creation might try to unset a non-existent one.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=734660
    1e304e6d