mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-13 22:10:08 +00:00
Merge branch 'matthiasc/for-main' into 'main'
dragicon: Provide default icons for paintables See merge request GNOME/gtk!4243
This commit is contained in:
commit
cd49a7f9e9
@ -386,6 +386,7 @@ gtk_drag_icon_class_init (GtkDragIconClass *klass)
|
|||||||
static void
|
static void
|
||||||
gtk_drag_icon_init (GtkDragIcon *self)
|
gtk_drag_icon_init (GtkDragIcon *self)
|
||||||
{
|
{
|
||||||
|
gtk_widget_set_can_target (GTK_WIDGET (self), FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -531,6 +532,15 @@ gtk_drag_icon_create_widget_for_value (const GValue *value)
|
|||||||
{
|
{
|
||||||
return gtk_label_new (g_value_get_string (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))
|
else if (G_VALUE_HOLDS (value, GDK_TYPE_RGBA))
|
||||||
{
|
{
|
||||||
GtkWidget *swatch;
|
GtkWidget *swatch;
|
||||||
@ -540,6 +550,18 @@ gtk_drag_icon_create_widget_for_value (const GValue *value)
|
|||||||
|
|
||||||
return swatch;
|
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))
|
else if (G_VALUE_HOLDS (value, GTK_TYPE_TEXT_BUFFER))
|
||||||
{
|
{
|
||||||
GtkTextBuffer *buffer = g_value_get_object (value);
|
GtkTextBuffer *buffer = g_value_get_object (value);
|
||||||
@ -568,7 +590,7 @@ gtk_drag_icon_create_widget_for_value (const GValue *value)
|
|||||||
node = gsk_value_get_render_node (value);
|
node = gsk_value_get_render_node (value);
|
||||||
if (node == NULL)
|
if (node == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
gsk_render_node_get_bounds (node, &bounds);
|
gsk_render_node_get_bounds (node, &bounds);
|
||||||
paintable = gtk_render_node_paintable_new (node, &bounds);
|
paintable = gtk_render_node_paintable_new (node, &bounds);
|
||||||
image = gtk_image_new_from_paintable (paintable);
|
image = gtk_image_new_from_paintable (paintable);
|
||||||
|
Loading…
Reference in New Issue
Block a user