Commit df025fcb authored by Matthias Clasen's avatar Matthias Clasen
Browse files

dragicon: Provide default icons for more types

Provide default icons for paintables and files.
This is easy to do, and makes sense.

fixup drag icon
parent bbb1404b
Pipeline #341948 passed with stages
in 13 minutes and 44 seconds
......@@ -532,6 +532,15 @@ gtk_drag_icon_create_widget_for_value (const GValue *value)
{
return gtk_label_new (g_value_get_string (value));
}
else if (G_VALUE_HOLDS (value, GDK_TYPE_PAINTABLE))
{
GtkWidget *image;
image = gtk_image_new_from_paintable (g_value_get_object (value));
gtk_widget_add_css_class (image, "large-icons");
return image;
}
else if (G_VALUE_HOLDS (value, GDK_TYPE_RGBA))
{
GtkWidget *swatch;
......@@ -541,6 +550,18 @@ gtk_drag_icon_create_widget_for_value (const GValue *value)
return swatch;
}
else if (G_VALUE_HOLDS (value, G_TYPE_FILE))
{
GFileInfo *info;
GtkWidget *image;
info = g_file_query_info (G_FILE (g_value_get_object (value)), "standard::icon", 0, NULL, NULL);
image = gtk_image_new_from_gicon (g_file_info_get_icon (info));
gtk_widget_add_css_class (image, "large-icons");
g_object_unref (info);
return image;
}
else if (G_VALUE_HOLDS (value, GTK_TYPE_TEXT_BUFFER))
{
GtkTextBuffer *buffer = g_value_get_object (value);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment