This patch fixes a problem in gtk/gtkpreview.c that appears when the colorcube
asked for in gtk_create_8_bit() is too small, causing divide by zero exceptions
and roll-over errors when subtracting 1 from an unsigned integer that is
already 0, and causes it to complain via g_error() if any of these would
happen.

It also changes gtk_trim_cmap()'s behavior to ensure that the count of
allocated gray colors is trimmed to less than half the colors in the allocated
colorcube, this works *much* better when the count of allocatable colors is
low, previously, it was trying to allocate a 2*2*1 colorcube while it still had
15 colors left in gray.

The patch was generated against gtk+-1.0.0 as distributed on ftp://ftp.gimp.org

Enjoy
   Deon Ramsey (Draco)
-----------------------------------------------------------------------------

Deon Ramsey (general Librarygopher) may be reached as:
Work:                       Private:
dfkidok@dfki.uni-kl.de      ramsey@rhrk.uni-kl.de

WWW:
<A HREF="http://www.dfki.uni-kl.de/~ramsey/">Deon Ramsey</A>

Or via Snail-Mail:          Deon Ramsey
                            Koenigstr. 11
                            67655 Kaiserslautern
                            Germany

Program (Pro'-gram) n. A magic spell cast over a computer, causing it to
turn one's input into error messages.

There are many intelligent species in the Universe.
                                             They are all owned by cats.

Be discreet, be polite, but be yourself. -- Per Aspera