dialog: resize icon on linux before showing

This commit is contained in:
deepak1556 2016-05-11 22:30:10 +05:30
parent 064af6ecb2
commit 64718888dd

View file

@ -53,9 +53,16 @@ class GtkMessageBox {
// Set dialog's icon.
if (!icon.isNull()) {
GdkPixbuf* pixbuf = libgtk2ui::GdkPixbufFromSkBitmap(*icon.bitmap());
GtkWidget* image = gtk_image_new_from_pixbuf(pixbuf);
GtkIconSource* iconsource = gtk_icon_source_new();
GtkIconSet* iconset = gtk_icon_set_new();
gtk_icon_source_set_pixbuf(iconsource, pixbuf);
gtk_icon_set_add_source(iconset, iconsource);
GtkWidget* image = gtk_image_new_from_icon_set(iconset,
GTK_ICON_SIZE_DIALOG);
gtk_message_dialog_set_image(GTK_MESSAGE_DIALOG(dialog_), image);
gtk_widget_show(image);
gtk_icon_source_free(iconsource);
gtk_icon_set_unref(iconset);
g_object_unref(pixbuf);
}