Mercurial > pidgin.yaz
comparison src/gtkrequest.c @ 11357:f0bc5f121684
[gaim-migrate @ 13579]
Image field added to the request API.
committer: Tailor Script <tailor@pidgin.im>
author | Bartoz Oler <bartosz@pidgin.im> |
---|---|
date | Sun, 28 Aug 2005 22:16:17 +0000 |
parents | a511b77a368b |
children | 4db38b374d3f |
comparison
equal
deleted
inserted
replaced
11356:0b746a52238d | 11357:f0bc5f121684 |
---|---|
1239 | 1239 |
1240 return widget; | 1240 return widget; |
1241 } | 1241 } |
1242 | 1242 |
1243 static GtkWidget * | 1243 static GtkWidget * |
1244 create_image_field(GaimRequestField *field) | |
1245 { | |
1246 GtkWidget *widget; | |
1247 GdkPixbuf *buf, *scale; | |
1248 GdkPixbufLoader *loader; | |
1249 | |
1250 loader = gdk_pixbuf_loader_new(); | |
1251 gdk_pixbuf_loader_write(loader, | |
1252 (const guchar *)gaim_request_field_image_get_buffer(field), | |
1253 gaim_request_field_image_get_size(field), | |
1254 NULL); | |
1255 gdk_pixbuf_loader_close(loader, NULL); | |
1256 buf = gdk_pixbuf_loader_get_pixbuf(loader); | |
1257 | |
1258 scale = gdk_pixbuf_scale_simple(buf, | |
1259 gaim_request_field_image_get_scale_x(field) * gdk_pixbuf_get_width(buf), | |
1260 gaim_request_field_image_get_scale_y(field) * gdk_pixbuf_get_height(buf), | |
1261 GDK_INTERP_BILINEAR); | |
1262 widget = gtk_image_new_from_pixbuf(scale); | |
1263 g_object_unref(G_OBJECT(buf)); | |
1264 g_object_unref(G_OBJECT(scale)); | |
1265 | |
1266 return widget; | |
1267 } | |
1268 | |
1269 static GtkWidget * | |
1244 create_account_field(GaimRequestField *field) | 1270 create_account_field(GaimRequestField *field) |
1245 { | 1271 { |
1246 GtkWidget *widget; | 1272 GtkWidget *widget; |
1247 | 1273 |
1248 widget = gaim_gtk_account_option_menu_new( | 1274 widget = gaim_gtk_account_option_menu_new( |
1602 widget = create_bool_field(field); | 1628 widget = create_bool_field(field); |
1603 else if (type == GAIM_REQUEST_FIELD_CHOICE) | 1629 else if (type == GAIM_REQUEST_FIELD_CHOICE) |
1604 widget = create_choice_field(field); | 1630 widget = create_choice_field(field); |
1605 else if (type == GAIM_REQUEST_FIELD_LIST) | 1631 else if (type == GAIM_REQUEST_FIELD_LIST) |
1606 widget = create_list_field(field); | 1632 widget = create_list_field(field); |
1633 else if (type == GAIM_REQUEST_FIELD_IMAGE) | |
1634 widget = create_image_field(field); | |
1607 else if (type == GAIM_REQUEST_FIELD_ACCOUNT) | 1635 else if (type == GAIM_REQUEST_FIELD_ACCOUNT) |
1608 widget = create_account_field(field); | 1636 widget = create_account_field(field); |
1609 else | 1637 else |
1610 continue; | 1638 continue; |
1611 | 1639 |