Re: #50200: patch



Kristian Rietveld <kristian planet nl> writes:

> On Sat, 13 Oct 2001, Tim Janik wrote:
> >
> > On Fri, 5 Oct 2001, Kristian Rietveld wrote:
> >
> > [snip]
> >
> 
> Okay, below is the updated patch.
> 
> 
> Ok to commit this one?


> @@ -413,6 +415,8 @@
>  static void
>  gtk_spin_button_init (GtkSpinButton *spin_button)
>  {
> +  PangoFontMask mask;
> +
>    spin_button->adjustment = NULL;
>    spin_button->panel = NULL;
>    spin_button->timer = 0;
> @@ -431,6 +435,13 @@
>    spin_button->snap_to_ticks = FALSE;
>    gtk_spin_button_set_adjustment (spin_button,
>  	  (GtkAdjustment*) gtk_adjustment_new (0, 0, 0, 0, 0, 0));
> +
> +  mask = pango_font_description_get_set_fields (GTK_WIDGET (spin_button)->style->font_desc);
> +  if (mask & PANGO_FONT_MASK_SIZE)
> +    spin_button->arrow_size = PANGO_PIXELS (pango_font_description_get_size (GTK_WIDGET (spin_button)->style->font_desc));
> +  else
> +    /* old default value */
> +    spin_button->arrow_size = 11;
>  }

The font description in the style should always have a filled in
size. If it doesn't pango_font_description_get_size() will return\
10 * PANGO_SCALE or something, so it will basically work. So,
I think you can remove the complication.

Also, there is no point in doing this now; you will get 
style_set before you get a ::size_request or ::expose. In
fact, I don't think I'd add a field to the structure at all -
I'd just have a static function "spin_button_get_arrow_size".
Then at top of the functions where you need the arrow size
repeatedly, you might want to do:

 gint arrow_size = spin_button_get_arrow_size (spin_button).

Other than that, the patch looks reasonable.

Regards,
                                        Owen



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