| 2012 status_box->connecting = connecting; |
2012 status_box->connecting = connecting; |
| 2013 pidgin_status_box_refresh(status_box); |
2013 pidgin_status_box_refresh(status_box); |
| 2014 } |
2014 } |
| 2015 |
2015 |
| 2016 static void |
2016 static void |
| |
2017 pixbuf_size_prepared_cb(GdkPixbufLoader *loader, int width, int height, gpointer data) |
| |
2018 { |
| |
2019 #if GTK_CHECK_VERSION(2,2,0) |
| |
2020 int w, h; |
| |
2021 GtkIconSize icon_size = gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_MEDIUM); |
| |
2022 gtk_icon_size_lookup(icon_size, &w, &h); |
| |
2023 gdk_pixbuf_loader_set_size(loader, w, h); |
| |
2024 #endif |
| |
2025 } |
| |
2026 |
| |
2027 static void |
| 2017 pidgin_status_box_redisplay_buddy_icon(PidginStatusBox *status_box) |
2028 pidgin_status_box_redisplay_buddy_icon(PidginStatusBox *status_box) |
| 2018 { |
2029 { |
| 2019 |
2030 |
| 2020 /* This is sometimes called before the box is shown, and we will not have a size */ |
2031 /* This is sometimes called before the box is shown, and we will not have a size */ |
| 2021 if (status_box->icon_size <= 0) |
2032 if (status_box->icon_size <= 0) |
| 2029 status_box->buddy_icon_hover = NULL; |
2040 status_box->buddy_icon_hover = NULL; |
| 2030 |
2041 |
| 2031 if (status_box->buddy_icon_img != NULL) |
2042 if (status_box->buddy_icon_img != NULL) |
| 2032 { |
2043 { |
| 2033 GdkPixbufLoader *loader = gdk_pixbuf_loader_new(); |
2044 GdkPixbufLoader *loader = gdk_pixbuf_loader_new(); |
| |
2045 g_signal_connect(G_OBJECT(loader), "size-prepared", G_CALLBACK(pixbuf_size_prepared_cb), NULL); |
| 2034 gdk_pixbuf_loader_write(loader, purple_imgstore_get_data(status_box->buddy_icon_img), |
2046 gdk_pixbuf_loader_write(loader, purple_imgstore_get_data(status_box->buddy_icon_img), |
| 2035 purple_imgstore_get_size(status_box->buddy_icon_img), NULL); |
2047 purple_imgstore_get_size(status_box->buddy_icon_img), NULL); |
| 2036 gdk_pixbuf_loader_close(loader, NULL); |
2048 gdk_pixbuf_loader_close(loader, NULL); |
| 2037 status_box->buddy_icon = gdk_pixbuf_loader_get_pixbuf(loader); |
2049 status_box->buddy_icon = gdk_pixbuf_loader_get_pixbuf(loader); |
| 2038 } |
2050 } |
| 2045 PIDGIN_STOCK_TOOLBAR_SELECT_AVATAR, |
2057 PIDGIN_STOCK_TOOLBAR_SELECT_AVATAR, |
| 2046 icon_size, "PidginStatusBox"); |
2058 icon_size, "PidginStatusBox"); |
| 2047 } |
2059 } |
| 2048 |
2060 |
| 2049 if (status_box->buddy_icon != NULL) { |
2061 if (status_box->buddy_icon != NULL) { |
| 2050 status_box->icon_opaque = pidgin_gdk_pixbuf_is_opaque(status_box->buddy_icon); |
2062 status_box->icon_opaque = pidgin_gdk_pixbuf_is_opaque(status_box->buddy_icon); |
| 2051 gtk_image_set_from_pixbuf(GTK_IMAGE(status_box->icon), status_box->buddy_icon); |
2063 gtk_image_set_from_pixbuf(GTK_IMAGE(status_box->icon), status_box->buddy_icon); |
| 2052 status_box->buddy_icon_hover = gdk_pixbuf_copy(status_box->buddy_icon); |
2064 status_box->buddy_icon_hover = gdk_pixbuf_copy(status_box->buddy_icon); |
| 2053 do_colorshift(status_box->buddy_icon_hover, status_box->buddy_icon_hover, 32); |
2065 do_colorshift(status_box->buddy_icon_hover, status_box->buddy_icon_hover, 32); |
| 2054 gtk_widget_queue_resize(GTK_WIDGET(status_box)); |
2066 gtk_widget_queue_resize(GTK_WIDGET(status_box)); |
| 2055 } |
2067 } |