comparison src/gtkutils.c @ 13091:7aea8de78463

[gaim-migrate @ 15453] Set a minimum size for the icons overlayed onto stuff committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Thu, 02 Feb 2006 00:33:30 +0000
parents 0aa231ebbfd5
children 913e06e4155c
comparison
equal deleted inserted replaced
13090:0aa231ebbfd5 13091:7aea8de78463
1600 "default", basename, NULL); 1600 "default", basename, NULL);
1601 emblem = gdk_pixbuf_new_from_file(filename, NULL); 1601 emblem = gdk_pixbuf_new_from_file(filename, NULL);
1602 g_free(filename); 1602 g_free(filename);
1603 1603
1604 if (emblem != NULL) { 1604 if (emblem != NULL) {
1605 int width, height, emblem_width, emblem_height, new_emblem_width, new_emblem_height; 1605 int width, height, emblem_width, emblem_height;
1606 int new_emblem_width, new_emblem_height;
1607
1606 width = gdk_pixbuf_get_width(pixbuf); 1608 width = gdk_pixbuf_get_width(pixbuf);
1607 height = gdk_pixbuf_get_height(pixbuf); 1609 height = gdk_pixbuf_get_height(pixbuf);
1608 emblem_width = gdk_pixbuf_get_width(emblem); 1610 emblem_width = gdk_pixbuf_get_width(emblem);
1609 emblem_height = gdk_pixbuf_get_height(emblem); 1611 emblem_height = gdk_pixbuf_get_height(emblem);
1610 new_emblem_width = width / 2; 1612
1611 new_emblem_height = height / 2; 1613 /*
1614 * Figure out how big to make the emblem. Normally the emblem
1615 * will have half the width of the pixbuf. But we don't make
1616 * an emblem any smaller than 10 pixels because it becomes
1617 * unrecognizable, unless the width of the pixbuf is less than
1618 * 10 pixels, in which case we make the emblem width the same
1619 * as the pixbuf width.
1620 */
1621 new_emblem_width = MAX(width / 2, MIN(width, 10));
1622 new_emblem_height = MAX(height / 2, MIN(height, 10));
1623
1612 /* Overlay emblem onto the bottom right corner of pixbuf */ 1624 /* Overlay emblem onto the bottom right corner of pixbuf */
1613 gdk_pixbuf_composite(emblem, pixbuf, 1625 gdk_pixbuf_composite(emblem, pixbuf,
1614 width - new_emblem_width, height - new_emblem_height, 1626 width - new_emblem_width, height - new_emblem_height,
1615 new_emblem_width, new_emblem_height, 1627 new_emblem_width, new_emblem_height,
1616 width - new_emblem_width, height - new_emblem_height, 1628 width - new_emblem_width, height - new_emblem_height,