Re: #50200: patch



Kristian Rietveld <kristian planet nl> writes:

> +static gint
> +spin_button_get_arrow_size (GtkSpinButton *spin_button)
> +{
> +  /* we return the default value if things fail */
> +  g_return_val_if_fail (GTK_IS_SPIN_BUTTON (spin_button), 11);

We don't usually use g_return_val_if_fail() in internal functions, and
we definitely don't usually put comments in explaining what we 
return in the error case. (If GTK+ is broken, we use the value 11 ;-)
You can just skip this.

> +  return PANGO_PIXELS (pango_font_description_get_size (GTK_WIDGET (spin_button)->style->font_desc));
>  }

Unfortunately, PANGO_PIXELS multiply evaluates its argument, so to avoid
calling this function multiple times, you want to do:

 gint size = pango_font_description_get_size (GTK_WIDGET (spin_button)->style->font_desc);
 return PANGO_PIXELS (size);

Other than that, looks fine to commit.

Thanks,
                                        Owen



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