Use the file icon in the download dialog if possible

This commit is contained in:
Christian Dywan 2009-03-27 00:40:28 +01:00
parent 2134db5ac2
commit 1e68d8fa40

View file

@ -1178,6 +1178,10 @@ webkit_web_view_mime_type_decision_cb (GtkWidget* web_view,
GtkWidget* dialog; GtkWidget* dialog;
gchar* content_type; gchar* content_type;
gchar* description; gchar* description;
#if GTK_CHECK_VERSION (2, 14, 0)
GIcon* icon;
GtkWidget* image;
#endif
gchar* title; gchar* title;
GdkScreen* screen; GdkScreen* screen;
GtkIconTheme* icon_theme; GtkIconTheme* icon_theme;
@ -1207,6 +1211,13 @@ webkit_web_view_mime_type_decision_cb (GtkWidget* web_view,
content_type = g_strdup (mime_type); content_type = g_strdup (mime_type);
#endif #endif
description = g_content_type_get_description (content_type); description = g_content_type_get_description (content_type);
#if GTK_CHECK_VERSION (2, 14, 0)
icon = g_content_type_get_icon (content_type);
image = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_DIALOG);
g_object_unref (icon);
gtk_widget_show (image);
gtk_message_dialog_set_image (GTK_MESSAGE_DIALOG (dialog), image);
#endif
g_free (content_type); g_free (content_type);
if (g_strrstr (description, mime_type)) if (g_strrstr (description, mime_type))
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),