gtk_image_get_paintable() is a perfect replacement, so use that one.
gdk_clipboard_read_text_async (clipboard, NULL, paste_received, entry);
}
-static GdkTexture *
-get_image_texture (GtkImage *image)
+static GdkPaintable *
+get_image_paintable (GtkImage *image)
{
const gchar *icon_name;
GtkIconTheme *icon_theme;
switch (gtk_image_get_storage_type (image))
{
- case GTK_IMAGE_TEXTURE:
- return g_object_ref (gtk_image_get_texture (image));
+ case GTK_IMAGE_PAINTABLE:
+ return g_object_ref (gtk_image_get_paintable (image));
case GTK_IMAGE_ICON_NAME:
icon_name = gtk_image_get_icon_name (image);
icon_theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (GTK_WIDGET (image)));
icon_info = gtk_icon_theme_lookup_icon (icon_theme, icon_name, 48, GTK_ICON_LOOKUP_GENERIC_FALLBACK);
if (icon_info == NULL)
return NULL;
- return gtk_icon_info_load_texture (icon_info);
+ return GDK_PAINTABLE (gtk_icon_info_load_texture (icon_info));
default:
g_warning ("Image storage type %d not handled",
gtk_image_get_storage_type (image));
GdkDragContext *context,
gpointer data)
{
- GdkTexture *texture;
+ GdkPaintable *paintable;
- texture = get_image_texture (GTK_IMAGE (widget));
- if (texture)
+ paintable = get_image_paintable (GTK_IMAGE (widget));
+ if (paintable)
{
- gtk_drag_set_icon_paintable (context, GDK_PAINTABLE (texture), -2, -2);
- g_object_unref (texture);
+ gtk_drag_set_icon_paintable (context, paintable, -2, -2);
+ g_object_unref (paintable);
}
}
guint time,
gpointer data)
{
- GdkTexture *texture;
+ GdkPaintable *paintable;
- texture = get_image_texture (GTK_IMAGE (widget));
- if (texture)
- gtk_selection_data_set_texture (selection_data, texture);
+ paintable = get_image_paintable (GTK_IMAGE (widget));
+ if (GDK_IS_TEXTURE (paintable))
+ gtk_selection_data_set_texture (selection_data, GDK_TEXTURE (paintable));
}
static void
GdkTexture *texture;
texture = gtk_selection_data_get_texture (selection_data);
- gtk_image_set_from_texture (GTK_IMAGE (data), texture);
+ gtk_image_set_from_paintable (GTK_IMAGE (data), GDK_PAINTABLE (texture));
g_object_unref (texture);
}
}
gpointer data)
{
GdkClipboard *clipboard;
- GdkTexture *texture;
+ GdkPaintable *paintable;
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (data));
- texture = get_image_texture (GTK_IMAGE (data));
+ paintable = get_image_paintable (GTK_IMAGE (data));
- if (texture)
- {
- gdk_clipboard_set_texture (clipboard, texture);
- g_object_unref (texture);
- }
+ if (GDK_IS_TEXTURE (paintable))
+ gdk_clipboard_set_texture (clipboard, GDK_TEXTURE (paintable));
+
+ if (paintable)
+ g_object_unref (paintable);
}
static void
if (texture == NULL)
return;
- gtk_image_set_from_texture (GTK_IMAGE (data), texture);
+ gtk_image_set_from_paintable (GTK_IMAGE (data), GDK_PAINTABLE (texture));
g_object_unref (texture);
}
<property name="spacing">10</property>
<child>
<object class="GtkImage">
- <property name="texture">resource:///cursors/default_cursor.png</property>
+ <property name="paintable">resource:///cursors/default_cursor.png</property>
</object>
</child>
<child>
<property name="spacing">10</property>
<child>
<object class="GtkImage">
- <property name="texture">resource:///cursors/none_cursor.png</property>
+ <property name="paintable">resource:///cursors/none_cursor.png</property>
</object>
</child>
<child>
<property name="spacing">10</property>
<child>
<object class="GtkImage">
- <property name="texture">resource:///cursors/gtk_logo_cursor.png</property>
+ <property name="paintable">resource:///cursors/gtk_logo_cursor.png</property>
</object>
</child>
<child>
<property name="spacing">10</property>
<child>
<object class="GtkImage">
- <property name="texture">resource:///cursors/context_menu_cursor.png</property>
+ <property name="paintable">resource:///cursors/context_menu_cursor.png</property>
</object>
</child>
<child>
<property name="spacing">10</property>
<child>
<object class="GtkImage">
- <property name="texture">resource:///cursors/help_cursor.png</property>
+ <property name="paintable">resource:///cursors/help_cursor.png</property>
</object>
</child>
<child>
<property name="spacing">10</property>
<child>
<object class="GtkImage">
- <property name="texture">resource:///cursors/pointer_cursor.png</property>
+ <property name="paintable">resource:///cursors/pointer_cursor.png</property>
</object>
</child>
<child>
<property name="spacing">10</property>
<child>
<object class="GtkImage">
- <property name="texture">resource:///cursors/progress_cursor.png</property>
+ <property name="paintable">resource:///cursors/progress_cursor.png</property>
</object>
</child>
<child>
<property name="spacing">10</property>
<child>
<object class="GtkImage">
- <property name="texture">resource:///cursors/wait_cursor.png</property>
+ <property name="paintable">resource:///cursors/wait_cursor.png</property>
</object>
</child>
<child>
<property name="spacing">10</property>
<child>
<object class="GtkImage">
- <property name="texture">resource:///cursors/cell_cursor.png</property>
+ <property name="paintable">resource:///cursors/cell_cursor.png</property>
</object>
</child>
<child>
<property name="spacing">10</property>
<child>
<object class="GtkImage">
- <property name="texture">resource:///cursors/crosshair_cursor.png</property>
+ <property name="paintable">resource:///cursors/crosshair_cursor.png</property>
</object>
</child>
<child>
<property name="spacing">10</property>
<child>
<object class="GtkImage">
- <property name="texture">resource:///cursors/text_cursor.png</property>
+ <property name="paintable">resource:///cursors/text_cursor.png</property>
</object>
</child>
<child>
<property name="spacing">10</property>
<child>
<object class="GtkImage">
- <property name="texture">resource:///cursors/vertical_text_cursor.png</property>
+ <property name="paintable">resource:///cursors/vertical_text_cursor.png</property>
</object>
</child>
<child>
<property name="spacing">10</property>
<child>
<object class="GtkImage">
- <property name="texture">resource:///cursors/alias_cursor.png</property>
+ <property name="paintable">resource:///cursors/alias_cursor.png</property>
</object>
</child>
<child>
<property name="spacing">10</property>
<child>
<object class="GtkImage">
- <property name="texture">resource:///cursors/copy_cursor.png</property>
+ <property name="paintable">resource:///cursors/copy_cursor.png</property>
</object>
</child>
<child>
<property name="spacing">10</property>
<child>
<object class="GtkImage">
- <property name="texture">resource:///cursors/move_cursor.png</property>
+ <property name="paintable">resource:///cursors/move_cursor.png</property>
</object>
</child>
<child>
<property name="spacing">10</property>
<child>
<object class="GtkImage">
- <property name="texture">resource:///cursors/no_drop_cursor.png</property>
+ <property name="paintable">resource:///cursors/no_drop_cursor.png</property>
</object>
</child>
<child>
<property name="spacing">10</property>
<child>
<object class="GtkImage">
- <property name="texture">resource:///cursors/not_allowed_cursor.png</property>
+ <property name="paintable">resource:///cursors/not_allowed_cursor.png</property>
</object>
</child>
<child>
<property name="spacing">10</property>
<child>
<object class="GtkImage">
- <property name="texture">resource:///cursors/grab_cursor.png</property>
+ <property name="paintable">resource:///cursors/grab_cursor.png</property>
</object>
</child>
<child>
<property name="spacing">10</property>
<child>
<object class="GtkImage">
- <property name="texture">resource:///cursors/grabbing_cursor.png</property>
+ <property name="paintable">resource:///cursors/grabbing_cursor.png</property>
</object>
</child>
<child>
<property name="spacing">10</property>
<child>
<object class="GtkImage">
- <property name="texture">resource:///cursors/all_scroll_cursor.png</property>
+ <property name="paintable">resource:///cursors/all_scroll_cursor.png</property>
</object>
</child>
<child>
<property name="spacing">10</property>
<child>
<object class="GtkImage">
- <property name="texture">resource:///cursors/col_resize_cursor.png</property>
+ <property name="paintable">resource:///cursors/col_resize_cursor.png</property>
</object>
</child>
<child>
<property name="spacing">10</property>
<child>
<object class="GtkImage">
- <property name="texture">resource:///cursors/row_resize_cursor.png</property>
+ <property name="paintable">resource:///cursors/row_resize_cursor.png</property>
</object>
</child>
<child>
<property name="spacing">10</property>
<child>
<object class="GtkImage">
- <property name="texture">resource:///cursors/n_resize_cursor.png</property>
+ <property name="paintable">resource:///cursors/n_resize_cursor.png</property>
</object>
</child>
<child>
<property name="spacing">10</property>
<child>
<object class="GtkImage">
- <property name="texture">resource:///cursors/e_resize_cursor.png</property>
+ <property name="paintable">resource:///cursors/e_resize_cursor.png</property>
</object>
</child>
<child>
<property name="spacing">10</property>
<child>
<object class="GtkImage">
- <property name="texture">resource:///cursors/s_resize_cursor.png</property>
+ <property name="paintable">resource:///cursors/s_resize_cursor.png</property>
</object>
</child>
<child>
<property name="spacing">10</property>
<child>
<object class="GtkImage">
- <property name="texture">resource:///cursors/w_resize_cursor.png</property>
+ <property name="paintable">resource:///cursors/w_resize_cursor.png</property>
</object>
</child>
<child>
<property name="spacing">10</property>
<child>
<object class="GtkImage">
- <property name="texture">resource:///cursors/ne_resize_cursor.png</property>
+ <property name="paintable">resource:///cursors/ne_resize_cursor.png</property>
</object>
</child>
<child>
<property name="spacing">10</property>
<child>
<object class="GtkImage">
- <property name="texture">resource:///cursors/nw_resize_cursor.png</property>
+ <property name="paintable">resource:///cursors/nw_resize_cursor.png</property>
</object>
</child>
<child>
<property name="spacing">10</property>
<child>
<object class="GtkImage">
- <property name="texture">resource:///cursors/sw_resize_cursor.png</property>
+ <property name="paintable">resource:///cursors/sw_resize_cursor.png</property>
</object>
</child>
<child>
<property name="spacing">10</property>
<child>
<object class="GtkImage">
- <property name="texture">resource:///cursors/se_resize_cursor.png</property>
+ <property name="paintable">resource:///cursors/se_resize_cursor.png</property>
</object>
</child>
<child>
<property name="spacing">10</property>
<child>
<object class="GtkImage">
- <property name="texture">resource:///cursors/ew_resize_cursor.png</property>
+ <property name="paintable">resource:///cursors/ew_resize_cursor.png</property>
</object>
</child>
<child>
<property name="spacing">10</property>
<child>
<object class="GtkImage">
- <property name="texture">resource:///cursors/ns_resize_cursor.png</property>
+ <property name="paintable">resource:///cursors/ns_resize_cursor.png</property>
</object>
</child>
<child>
<property name="spacing">10</property>
<child>
<object class="GtkImage">
- <property name="texture">resource:///cursors/nesw_resize_cursor.png</property>
+ <property name="paintable">resource:///cursors/nesw_resize_cursor.png</property>
</object>
</child>
<child>
<property name="spacing">10</property>
<child>
<object class="GtkImage">
- <property name="texture">resource:///cursors/nwse_resize_cursor.png</property>
+ <property name="paintable">resource:///cursors/nwse_resize_cursor.png</property>
</object>
</child>
<child>
<property name="spacing">10</property>
<child>
<object class="GtkImage">
- <property name="texture">resource:///cursors/zoom_in_cursor.png</property>
+ <property name="paintable">resource:///cursors/zoom_in_cursor.png</property>
</object>
</child>
<child>
<property name="spacing">10</property>
<child>
<object class="GtkImage">
- <property name="texture">resource:///cursors/zoom_out_cursor.png</property>
+ <property name="paintable">resource:///cursors/zoom_out_cursor.png</property>
</object>
</child>
<child>
resource_name = g_strconcat (resource_dir, "/", resources[i], NULL);
widget = gtk_image_new_from_resource (resource_name);
- if (gtk_image_get_texture (GTK_IMAGE (widget)) == NULL)
+ if (gtk_image_get_paintable (GTK_IMAGE (widget)) == NULL)
{
GBytes *bytes;
}
else if ((icons = gtk_window_get_default_icon_list ()))
{
- gtk_image_set_from_texture (GTK_IMAGE (priv->logo_image), icons->data);
+ gtk_image_set_from_paintable (GTK_IMAGE (priv->logo_image), icons->data);
g_list_free (icons);
}
else
if (G_IS_PARAM_SPEC_OBJECT (prop->pspec) &&
(G_PARAM_SPEC_VALUE_TYPE (prop->pspec) != GDK_TYPE_PIXBUF) &&
(G_PARAM_SPEC_VALUE_TYPE (prop->pspec) != GDK_TYPE_TEXTURE) &&
+ (G_PARAM_SPEC_VALUE_TYPE (prop->pspec) != GDK_TYPE_PAINTABLE) &&
(G_PARAM_SPEC_VALUE_TYPE (prop->pspec) != G_TYPE_FILE))
{
GObject *object = g_hash_table_lookup (builder->priv->objects,
case G_TYPE_OBJECT:
case G_TYPE_INTERFACE:
if (G_VALUE_HOLDS (value, GDK_TYPE_PIXBUF) ||
+ G_VALUE_HOLDS (value, GDK_TYPE_PAINTABLE) ||
G_VALUE_HOLDS (value, GDK_TYPE_TEXTURE))
{
gchar *filename;
if (pixbuf)
{
- if (G_VALUE_HOLDS (value, GDK_TYPE_TEXTURE))
+ if (G_VALUE_HOLDS (value, GDK_TYPE_TEXTURE) ||
+ G_VALUE_HOLDS (value, GDK_TYPE_PAINTABLE))
{
GdkTexture *texture = gdk_texture_new_for_pixbuf (pixbuf);
g_value_set_object (value, texture);
cairo_surface_set_device_offset (surface, 0, 0);
texture = gdk_texture_new_for_surface (surface);
- widget = gtk_image_new_from_texture (texture);
+ widget = gtk_image_new_from_paintable (GDK_PAINTABLE (texture));
g_object_unref (texture);
gtk_drag_set_icon_widget_internal (context, widget, (int)hot_x, (int)hot_y, TRUE);
if (texture)
{
- gtk_image_set_from_texture (GTK_IMAGE (priv->titlebar_icon), texture);
+ gtk_image_set_from_paintable (GTK_IMAGE (priv->titlebar_icon),
+ GDK_PAINTABLE (texture));
g_object_unref (texture);
gtk_widget_show (priv->titlebar_icon);
* If you want to handle errors in loading the file yourself,
* for example by displaying an error message, then load the image with
* gdk_texture_new_from_file(), then create the #GtkImage with
- * gtk_image_new_from_texture().
+ * gtk_image_new_from_paintable().
*
* Sometimes an application will want to avoid depending on external data
* files, such as image files. See the documentation of #GResource for details.
{
PROP_0,
PROP_PAINTABLE,
- PROP_TEXTURE,
PROP_FILE,
PROP_ICON_SIZE,
PROP_PIXEL_SIZE,
GDK_TYPE_PAINTABLE,
GTK_PARAM_READWRITE);
- image_props[PROP_TEXTURE] =
- g_param_spec_object ("texture",
- P_("Texture"),
- P_("A GdkTexture to display"),
- GDK_TYPE_TEXTURE,
- GTK_PARAM_READWRITE);
-
image_props[PROP_FILE] =
g_param_spec_string ("file",
P_("Filename"),
case PROP_PAINTABLE:
gtk_image_set_from_paintable (image, g_value_get_object (value));
break;
- case PROP_TEXTURE:
- gtk_image_set_from_texture (image, g_value_get_object (value));
- break;
case PROP_FILE:
gtk_image_set_from_file (image, g_value_get_string (value));
break;
case PROP_PAINTABLE:
g_value_set_object (value, _gtk_icon_helper_peek_paintable (priv->icon_helper));
break;
- case PROP_TEXTURE:
- g_value_set_object (value, _gtk_icon_helper_peek_texture (priv->icon_helper));
- break;
case PROP_FILE:
g_value_set_string (value, priv->filename);
break;
return GTK_WIDGET (image);
}
-/**
- * gtk_image_new_from_texture:
- * @texture: (allow-none): a #GdkTexture, or %NULL
- *
- * Creates a new #GtkImage displaying @texture.
- * The #GtkImage does not assume a reference to the
- * texture; you still need to unref it if you own references.
- * #GtkImage will add its own reference rather than adopting yours.
- *
- * Note that this function just creates an #GtkImage from the texture. The
- * #GtkImage created will not react to state changes. Should you want that,
- * you should use gtk_image_new_from_icon_name().
- *
- * Returns: a new #GtkImage
- **/
-GtkWidget*
-gtk_image_new_from_texture (GdkTexture *texture)
-{
- GtkImage *image;
-
- image = g_object_new (GTK_TYPE_IMAGE, NULL);
-
- gtk_image_set_from_texture (image, texture);
-
- return GTK_WIDGET (image);
-}
-
/**
* gtk_image_new_from_icon_name:
* @icon_name: (nullable): an icon name or %NULL
*
* See gtk_image_new_from_pixbuf() for details.
*
- * Note: This is a helper for gtk_image_set_from_texture(), and you can't
- * get back the exact pixbuf once this is called, only a texture.
- *
+ * Note: This is a helper for gtk_image_set_from_paintable(), and you can't
+ * get back the exact pixbuf once this is called, only a paintable.
**/
void
gtk_image_set_from_pixbuf (GtkImage *image,
else
texture = NULL;
- gtk_image_set_from_texture (image, texture);
+ gtk_image_set_from_paintable (image, GDK_PAINTABLE (texture));
if (texture)
g_object_unref (texture);
g_object_thaw_notify (G_OBJECT (image));
}
-/**
- * gtk_image_set_from_texture:
- * @image: a #GtkImage
- * @texture: (nullable): a #GdkTexture or %NULL
- *
- * See gtk_image_new_from_texture() for details.
- **/
-void
-gtk_image_set_from_texture (GtkImage *image,
- GdkTexture *texture)
-{
- GtkImagePrivate *priv = gtk_image_get_instance_private (image);
-
- g_return_if_fail (GTK_IS_IMAGE (image));
- g_return_if_fail (texture == NULL || GDK_IS_TEXTURE (texture));
-
- g_object_freeze_notify (G_OBJECT (image));
-
- if (texture)
- g_object_ref (texture);
-
- gtk_image_clear (image);
-
- if (texture)
- {
- _gtk_icon_helper_set_texture (priv->icon_helper, texture);
- g_object_unref (texture);
- }
-
- g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_TEXTURE]);
-
- g_object_thaw_notify (G_OBJECT (image));
-}
-
/**
* gtk_image_get_storage_type:
* @image: a #GtkImage
return _gtk_icon_helper_peek_paintable (priv->icon_helper);
}
-/**
- * gtk_image_get_texture:
- * @image: a #GtkImage
- *
- * Gets the image #GdkTexture being displayed by the #GtkImage.
- * The storage type of the image must be %GTK_IMAGE_EMPTY or
- * %GTK_IMAGE_TEXTURE (see gtk_image_get_storage_type()).
- * The caller of this function does not own a reference to the
- * returned texture.
- *
- * Returns: (nullable) (transfer none): the displayed texture, or %NULL if
- * the image is empty
- **/
-GdkTexture *
-gtk_image_get_texture (GtkImage *image)
-{
- GtkImagePrivate *priv = gtk_image_get_instance_private (image);
-
- g_return_val_if_fail (GTK_IS_IMAGE (image), NULL);
-
- return _gtk_icon_helper_peek_texture (priv->icon_helper);
-}
-
/**
* gtk_image_get_icon_name:
* @image: a #GtkImage
case GTK_IMAGE_GICON:
g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_GICON]);
break;
- case GTK_IMAGE_TEXTURE:
- g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_TEXTURE]);
- break;
case GTK_IMAGE_PAINTABLE:
g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_PAINTABLE]);
break;
+ case GTK_IMAGE_TEXTURE:
case GTK_IMAGE_EMPTY:
default:
break;
GDK_AVAILABLE_IN_ALL
GtkWidget* gtk_image_new_from_pixbuf (GdkPixbuf *pixbuf);
GDK_AVAILABLE_IN_ALL
-GtkWidget* gtk_image_new_from_texture (GdkTexture *texture);
-GDK_AVAILABLE_IN_ALL
GtkWidget* gtk_image_new_from_paintable (GdkPaintable *paintable);
GDK_AVAILABLE_IN_ALL
GtkWidget* gtk_image_new_from_icon_name (const gchar *icon_name);
void gtk_image_set_from_pixbuf (GtkImage *image,
GdkPixbuf *pixbuf);
GDK_AVAILABLE_IN_ALL
-void gtk_image_set_from_texture (GtkImage *image,
- GdkTexture *texture);
-GDK_AVAILABLE_IN_ALL
void gtk_image_set_from_paintable (GtkImage *image,
GdkPaintable *paintable);
GDK_AVAILABLE_IN_ALL
GDK_AVAILABLE_IN_ALL
GtkImageType gtk_image_get_storage_type (GtkImage *image);
-GDK_AVAILABLE_IN_ALL
-GdkTexture *gtk_image_get_texture (GtkImage *image);
GDK_AVAILABLE_IN_ALL
GdkPaintable *gtk_image_get_paintable (GtkImage *image);
popover = gtk_popover_new (GTK_WIDGET (tv));
gtk_popover_set_pointing_to (GTK_POPOVER (popover), &rect);
- image = gtk_image_new_from_texture (texture);
+ image = gtk_image_new_from_paintable (GDK_PAINTABLE (texture));
g_object_set (image, "margin", 20, NULL);
gtk_container_add (GTK_CONTAINER (popover), image);
gtk_popover_popup (GTK_POPOVER (popover));
GdkWindow *gdk_window = gdk_window_new_toplevel (gdk_display_get_default(), 10 , 10);
GskRenderer *renderer = gsk_renderer_new_for_window (gdk_window);
GdkTexture *texture = gsk_renderer_render_texture (renderer, GTK_NODE_VIEW (nodeview)->node, NULL);
- GtkWidget *image = gtk_image_new_from_texture (texture);
+ GtkWidget *image = gtk_image_new_from_paintable (GDK_PAINTABLE (texture));
gtk_container_add (GTK_CONTAINER (box), nodeview);
gtk_container_add (GTK_CONTAINER (box), image);
return;
}
- gtk_image_set_from_texture (data, texture);
+ gtk_image_set_from_paintable (data, GDK_PAINTABLE (texture));
g_object_unref (texture);
}
#include <gtk/gtk.h>
-static GdkTexture *
-get_image_texture (GtkImage *image,
- int *out_size)
+static GdkPaintable *
+get_image_paintable (GtkImage *image,
+ int *out_size)
{
GtkIconTheme *icon_theme;
const char *icon_name;
int width = 48;
- GdkTexture *texture;
+ GdkPaintable *paintable;
GtkIconInfo *icon_info;
switch (gtk_image_get_storage_type (image))
icon_theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (GTK_WIDGET (image)));
*out_size = width;
icon_info = gtk_icon_theme_lookup_icon (icon_theme, icon_name, width, GTK_ICON_LOOKUP_GENERIC_FALLBACK);
- texture = gtk_icon_info_load_texture (icon_info);
+ paintable = GDK_PAINTABLE (gtk_icon_info_load_texture (icon_info));
g_object_unref (icon_info);
- return texture;
+ return paintable;
default:
g_warning ("Image storage type %d not handled",
gtk_image_get_storage_type (image));
GdkDragContext *context,
gpointer data)
{
- GdkTexture *texture;
+ GdkPaintable *paintable;
gint hotspot;
gint hot_x, hot_y;
gint size;
- texture = get_image_texture (GTK_IMAGE (data), &size);
+ paintable = get_image_paintable (GTK_IMAGE (data), &size);
hotspot = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (data), "hotspot"));
switch (hotspot)
{
hot_y = size;
break;
}
- gtk_drag_set_icon_paintable (context, GDK_PAINTABLE (texture), hot_x, hot_y);
- g_object_unref (texture);
+ gtk_drag_set_icon_paintable (context, paintable, hot_x, hot_y);
+ g_object_unref (paintable);
}
static void
GdkDragContext *context,
gpointer data)
{
- GdkTexture *texture;
+ GdkPaintable *paintable;
GtkWidget *image;
int hotspot;
int size;
if (image == NULL)
{
g_print ("creating new drag widget\n");
- texture = get_image_texture (GTK_IMAGE (data), &size);
- image = gtk_image_new_from_texture (texture);
- g_object_unref (texture);
+ paintable = get_image_paintable (GTK_IMAGE (data), &size);
+ image = gtk_image_new_from_paintable (paintable);
+ g_object_unref (paintable);
g_object_ref (image);
g_object_set_data (G_OBJECT (widget), "drag widget", image);
g_signal_connect (image, "destroy", G_CALLBACK (drag_widget_destroyed), widget);
guint time,
gpointer data)
{
- GdkTexture *texture;
+ GdkPaintable *paintable;
const gchar *name;
int size;
if (gtk_selection_data_targets_include_image (selection_data, TRUE))
{
- texture = get_image_texture (GTK_IMAGE (data), &size);
- gtk_selection_data_set_texture (selection_data, texture);
- g_object_unref (texture);
+ paintable = get_image_paintable (GTK_IMAGE (data), &size);
+ if (GDK_IS_TEXTURE (paintable))
+ gtk_selection_data_set_texture (selection_data, GDK_TEXTURE (paintable));
+ if (paintable)
+ g_object_unref (paintable);
}
else if (gtk_selection_data_targets_include_text (selection_data))
{
GdkTexture *texture;
texture = gtk_selection_data_get_texture (selection_data);
- gtk_image_set_from_texture (GTK_IMAGE (data), texture);
+ gtk_image_set_from_paintable (GTK_IMAGE (data), GDK_PAINTABLE (texture));
g_object_unref (texture);
}
gpointer data)
{
GtkWidget *image = GTK_WIDGET (data);
- GdkTexture *texture;
+ GdkPaintable *paintable;
- texture = gtk_image_get_texture (GTK_IMAGE (image));
- gtk_drag_set_icon_paintable (context, GDK_PAINTABLE (texture), -2, -2);
+ paintable = gtk_image_get_paintable (GTK_IMAGE (image));
+ gtk_drag_set_icon_paintable (context, paintable, -2, -2);
}
void
gpointer data)
{
GtkWidget *image = GTK_WIDGET (data);
- GdkTexture *texture;
+ GdkPaintable *paintable;
- texture = gtk_image_get_texture (GTK_IMAGE (image));
- gtk_selection_data_set_texture (selection_data, texture);
- g_object_unref (texture);
+ paintable = gtk_image_get_paintable (GTK_IMAGE (image));
+ if (GDK_IS_TEXTURE (paintable))
+ gtk_selection_data_set_texture (selection_data, GDK_TEXTURE (paintable));
}
static void
return;
texture = gtk_selection_data_get_texture (selection_data);
- gtk_image_set_from_texture (GTK_IMAGE (image), texture);
+ gtk_image_set_from_paintable (GTK_IMAGE (image), GDK_PAINTABLE (texture));
g_object_unref (texture);
}
icon_info = gtk_icon_theme_lookup_icon_for_scale (theme, icon_name, 48, gtk_widget_get_scale_factor (window), GTK_ICON_LOOKUP_GENERIC_FALLBACK);
texture = gtk_icon_info_load_texture (icon_info);
g_object_unref (icon_info);
- image = gtk_image_new_from_texture (texture);
+ image = gtk_image_new_from_paintable (GDK_PAINTABLE (texture));
g_object_unref (texture);
gtk_grid_attach (GTK_GRID (grid), image, 2, 1, 1, 1);