Re: PATCH: Arrows in spin button do not get redrawn if adjustment changes



[ This has been sitting in my drafts folder for a while - I don't
  think there is any reason except for inattention that I didn't send
  it. ]

Federico Mena Quintero <federico helixcode com> writes:

> Hello,
> 
> GtkSpinButton does not redraw its arrows if the adjustment emits the
> "changed" signal, for example, when it changes its valid range.  I had
> this problem in the Evolution calendar; I change the range of an
> adjustment depending on some other option, and I need the spin button
> to reflect this.  Here is a ChangeLog and a patch to fix this.  Is it
> OK to commit?

It's OK to commit; please commit to both the stable and head branch.

It looks like to me that it also doesn't redraw the arrows when the
value is changed, so that probably needs to be fixed as well.

Regards,
                                                  Owen




> 
> 2000-11-08  Federico Mena Quintero  <federico helixcode com>
> 
> 	* gtk/gtkspinbutton.c (gtk_spin_button_set_adjustment): Connect to
> 	the "changed" callback of the adjustment.  We need to redraw the
> 	spin button's arrows when the adjustment's range changes.
> 	(adjustment_changed_cb): Draw the arrows.
> 
> diff -uNr gtk+-1.2.8/gtk/gtkspinbutton.c gtk+-1.2.8-fmq0/gtk/gtkspinbutton.c
> --- gtk+-1.2.8/gtk/gtkspinbutton.c	Thu Feb 10 09:14:48 2000
> +++ gtk+-1.2.8-fmq0/gtk/gtkspinbutton.c	Wed Nov  8 12:08:13 2000
> @@ -1353,6 +1353,20 @@
>    return GTK_WIDGET (spin);
>  }
>  
> +/* Callback used when the spin button's adjustment changes.  We need to redraw
> + * the arrows when the adjustment's range changes.
> + */
> +static void
> +adjustment_changed_cb (GtkAdjustment *adjustment, gpointer data)
> +{
> +  GtkSpinButton *spin_button;
> +
> +  spin_button = GTK_SPIN_BUTTON (data);
> +
> +  gtk_spin_button_draw_arrow (spin_button, GTK_ARROW_UP);
> +  gtk_spin_button_draw_arrow (spin_button, GTK_ARROW_DOWN);
> +}
> +
>  void
>  gtk_spin_button_set_adjustment (GtkSpinButton *spin_button,
>  				GtkAdjustment *adjustment)
> @@ -1375,6 +1389,9 @@
>  	  gtk_object_sink (GTK_OBJECT (adjustment));
>            gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
>  			      (GtkSignalFunc) gtk_spin_button_value_changed,
> +			      (gpointer) spin_button);
> +	  gtk_signal_connect (GTK_OBJECT (adjustment), "changed",
> +			      (GtkSignalFunc) adjustment_changed_cb,
>  			      (gpointer) spin_button);
>          }
>      }
> 
> _______________________________________________
> gtk-devel-list mailing list
> gtk-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-devel-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]