Revision 189 src/stock_pixmap.c

stock_pixmap.c (revision 189)
1 1
/*
2 2
 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3
 * Copyright (C) 1999-2004 Hiroyuki Yamamoto
3
 * Copyright (C) 1999-2005 Hiroyuki Yamamoto
4 4
 *
5 5
 * This program is free software; you can redistribute it and/or modify
6 6
 * it under the terms of the GNU General Public License as published by
......
80 80
	gchar **data;
81 81
	GdkPixmap *pixmap;
82 82
	GdkBitmap *mask;
83
	GdkPixbuf *pixbuf;
83 84
};
84 85

  
85 86
static StockPixmapData pixmaps[] =
......
171 172

  
172 173
	return 0;
173 174
}
175

  
176
gint stock_pixbuf_gdk(GtkWidget *window, StockPixmap icon, GdkPixbuf **pixbuf)
177
{
178
	StockPixmapData *pix_d;
179

  
180
	if (pixbuf)
181
		*pixbuf = NULL;
182

  
183
	g_return_val_if_fail(window != NULL, -1);
184
	g_return_val_if_fail(icon >= 0 && icon < N_STOCK_PIXMAPS, -1);
185

  
186
	pix_d = &pixmaps[icon];
187

  
188
	if (!pix_d->pixbuf)
189
		pix_d->pixbuf = gdk_pixbuf_new_from_xpm_data
190
			((const gchar **)pix_d->data);
191
	if (!pix_d->pixbuf)
192
		return -1;
193

  
194
	if (pixbuf)
195
		*pixbuf = pix_d->pixbuf;
196

  
197
	return 0;
198
}

Also available in: Unified diff