forked from AuroraMiddleware/gtk
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
This commit is contained in:
parent
bbb1404bd3
commit
df025fcb88
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user