Re: My take icon icon resizing


> I seem to be getting credit here for something I did not do. It was either 
> or Brian who wrote the original patch in question.

Bill Haneman wrote the original patch.  I made the patch update the icon
sizes dynamically when the theme was changed (rather than only newly 
started applications getting the theme icon sizes).  I did this by
adding the gtk_rc_icon_changed callback to gtkrc.c and related code
in gtkiconfactory.c to process the event.

Bill's patch was also rather destructive since it simply overwrote the
height/width specified in the _IconSize structure with the new theme sizes.
This created the following problem:  if you started with a theme with no
icon size defined (and say the icons were small by default), then changed
to a theme with the icons defined to be larger, then switched back to the
original theme, the icons wouldn't go back to their original (default)
small size.

I fixed this by adding two new values to the _IconSize structure to
keep track of the theme height/width.  When the theme changed, the
values for the theme height/width would be set to -1, but then when
the theme processed a "gtk-icon-sizes" value in the gtkrc file, then
the "gtk-icon-sizes" callback function would set the the theme
height/width to non -1 values.  Therefore, gtkiconfactory would use
the theme height/width values if they were not -1, and would use the
default values otherwise.  This corrected the above problematic
scenario, and made things work much more sensibly.

I also updated the patch so that it worked for icon sizes registered with
gtk_icon_size_register (like gnome-panel uses).  

So that's who did what.  :)

I'll check out the work and let you know how it goes!  Thanks Owen!

> > 
> > Attached is my take on changing the stock icon sizes; it's
> > basically a complete rewrite from Padraig's patch in:
> > 
> >
> > 
> > Major differences include:
> > 
> >  - Since icon sizes are set from a GtkSettings setting,
> >    they have to be per-GtkSettings object. To this end,
> >    I added:
> > 
> >     gboolean gtk_icon_size_lookup_for_settings (GtkSettings *settings,
> > 					        GtkIconSize  size,
> > 					        gint        *width,
> > 					        gint        *height);
> > 
> >    And the per-settings sizes are stored attached to
> >    the GtkSettings object.
> > 
> >  - I changed the string format from "gtk-menu 30,30:gtk-dialog 40,40"
> >    to "gtk-menu=30,30:gtk-dialog=40,40", since it seemed a little
> >    clearer with an explicit delimiter character.
> > 
> >  - I changed the string parser from being heuristic to validating.
> >    (Using some string scanning utilities from Pango rather than 
> >    than strsplit()/atoi())
> > 
> >  - I organized things so as much of the logic as possible lived
> >    in gtkiconfactory rather than slopping over into gtkrc.c
> > 
> >    (I made one private API addition to gtkrc.c - _gtk_rc_reset_styles()
> >    that resets all the styles so everything resizes; I wrote
> >    the function originally for some 
> >    change-font-rendering-options-on-the-fly patches.)
> > 
> > It seems to work in testing and I think it's basically the right
> > way to go about things. There maybe a little more cleanup to
> > do, but other than that I think it's ready to go in.
> > 
> > Regards,
> >                                         Owen
> > 

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