| 252 |
252 |
| 253 return vbox2; |
253 return vbox2; |
| 254 } |
254 } |
| 255 |
255 |
| 256 GdkPixbuf * |
256 GdkPixbuf * |
| 257 pidgin_create_icon_from_protocol(PurpleProtocol *protocol, PidginProtocolIconSize size, PurpleAccount *account) |
257 pidgin_create_icon_from_protocol(PurpleProtocol *protocol, |
| 258 { |
258 PidginProtocolIconSize size, |
| |
259 PurpleAccount *account) |
| |
260 { |
| |
261 GInputStream *stream = NULL; |
| |
262 GdkPixbuf *pixbuf; |
| 259 const char *protoname = NULL; |
263 const char *protoname = NULL; |
| |
264 const gchar *icon_name = NULL; |
| 260 char *tmp; |
265 char *tmp; |
| 261 char *filename = NULL; |
266 char *filename = NULL; |
| 262 GdkPixbuf *pixbuf; |
267 |
| |
268 /* If the protocol specified an icon-name try to load it from the icon |
| |
269 * theme. |
| |
270 */ |
| |
271 icon_name = purple_protocol_get_icon_name(protocol); |
| |
272 if(icon_name != NULL) { |
| |
273 GtkIconTheme *theme = gtk_icon_theme_get_default(); |
| |
274 gint dimensions = 48; |
| |
275 |
| |
276 if(size == PIDGIN_PROTOCOL_ICON_SMALL) { |
| |
277 dimensions = 16; |
| |
278 } else if(size == PIDGIN_PROTOCOL_ICON_MEDIUM) { |
| |
279 dimensions = 22; |
| |
280 } |
| |
281 |
| |
282 pixbuf = gtk_icon_theme_load_icon(theme, icon_name, dimensions, |
| |
283 GTK_ICON_LOOKUP_FORCE_SIZE, NULL); |
| |
284 |
| |
285 if(GDK_IS_PIXBUF(pixbuf)) { |
| |
286 return pixbuf; |
| |
287 } |
| |
288 |
| |
289 } |
| 263 |
290 |
| 264 protoname = purple_protocol_get_list_icon(protocol, account, NULL); |
291 protoname = purple_protocol_get_list_icon(protocol, account, NULL); |
| 265 if (protoname == NULL) |
292 if (protoname == NULL) |
| 266 return NULL; |
293 return NULL; |
| 267 |
294 |