{
GtkTextIter iter;
GtkTextIter start, end;
- GdkPixbuf *pixbuf;
GdkTexture *texture;
GtkIconTheme *icon_theme;
icon_theme = gtk_icon_theme_get_default ();
- pixbuf = gtk_icon_theme_load_icon (icon_theme,
- "gtk3-demo",
- 32,
- GTK_ICON_LOOKUP_GENERIC_FALLBACK,
- NULL);
- g_assert (pixbuf);
- texture = gdk_texture_new_for_pixbuf (pixbuf);
+ texture = GDK_TEXTURE (gtk_icon_theme_load_icon (icon_theme,
+ "gtk3-demo",
+ 32,
+ GTK_ICON_LOOKUP_GENERIC_FALLBACK,
+ NULL));
+ g_assert (texture);
/* get start of buffer; each insertion will revalidate the
* iterator to point to just after the inserted text.
gtk_text_buffer_get_bounds (buffer, &start, &end);
gtk_text_buffer_apply_tag_by_name (buffer, "word_wrap", &start, &end);
- g_object_unref (pixbuf);
g_object_unref (texture);
}
* gdk_pixbuf_get_rowstride (pixbuf),
g_object_unref,
g_object_ref (pixbuf));
-
texture = gdk_memory_texture_new (gdk_pixbuf_get_width (pixbuf),
gdk_pixbuf_get_height (pixbuf),
gdk_pixbuf_get_has_alpha (pixbuf)
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_PAINTABLE) ||
G_VALUE_HOLDS (value, GDK_TYPE_TEXTURE))
{
gchar *filename;
if (pixbuf == NULL)
{
GtkIconTheme *theme;
+ GdkPaintable *texture;
g_warning ("Could not load image '%s': %s",
string, tmp_error->message);
/* fall back to a missing image */
theme = gtk_icon_theme_get_default ();
- pixbuf = gtk_icon_theme_load_icon (theme,
+ texture = gtk_icon_theme_load_icon (theme,
"image-missing",
16,
GTK_ICON_LOOKUP_USE_BUILTIN,
NULL);
+ pixbuf = gdk_pixbuf_get_from_texture (GDK_TEXTURE (texture));
+ g_object_unref (texture);
}
if (pixbuf)
* you must not modify the icon. Use g_object_unref() to release
* your reference to the icon. %NULL if the icon isn’t found.
*/
-GdkPixbuf *
+GdkPaintable *
gtk_icon_theme_load_icon (GtkIconTheme *icon_theme,
const gchar *icon_name,
gint size,
* you must not modify the icon. Use g_object_unref() to release
* your reference to the icon. %NULL if the icon isn’t found.
*/
-GdkPixbuf *
+GdkPaintable *
gtk_icon_theme_load_icon_for_scale (GtkIconTheme *icon_theme,
const gchar *icon_name,
gint size,
GError **error)
{
GtkIconInfo *icon_info;
- GdkPixbuf *pixbuf = NULL;
-
+ GdkTexture *texture = NULL;
+
g_return_val_if_fail (GTK_IS_ICON_THEME (icon_theme), NULL);
g_return_val_if_fail (icon_name != NULL, NULL);
g_return_val_if_fail ((flags & GTK_ICON_LOOKUP_NO_SVG) == 0 ||
return NULL;
}
- pixbuf = gtk_icon_info_load_icon (icon_info, error);
+ texture = gtk_icon_info_load_texture (icon_info, error);
g_prefix_error (error, "Failed to load %s: ", icon_info->filename);
g_object_unref (icon_info);
- return pixbuf;
+ return GDK_PAINTABLE (texture);
}
/**
gint scale,
GtkIconLookupFlags flags);
GDK_AVAILABLE_IN_ALL
-GdkPixbuf * gtk_icon_theme_load_icon (GtkIconTheme *icon_theme,
- const gchar *icon_name,
- gint size,
- GtkIconLookupFlags flags,
- GError **error);
+GdkPaintable *gtk_icon_theme_load_icon (GtkIconTheme *icon_theme,
+ const char *icon_name,
+ int size,
+ GtkIconLookupFlags flags,
+ GError **error);
GDK_AVAILABLE_IN_ALL
-GdkPixbuf * gtk_icon_theme_load_icon_for_scale (GtkIconTheme *icon_theme,
+GdkPaintable *gtk_icon_theme_load_icon_for_scale (GtkIconTheme *icon_theme,
const gchar *icon_name,
gint size,
gint scale,
if (strcmp (argv[1], "display") == 0)
{
GError *error;
- GdkPixbuf *pixbuf;
+ GdkPaintable *paintable;
GtkWidget *window, *image;
if (argc < 4)
scale = atoi (argv[5]);
error = NULL;
- pixbuf = gtk_icon_theme_load_icon_for_scale (icon_theme, argv[3], size, scale, flags, &error);
- if (!pixbuf)
+ paintable = gtk_icon_theme_load_icon_for_scale (icon_theme, argv[3], size, scale, flags, &error);
+ if (!paintable)
{
g_print ("%s\n", error->message);
return 1;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
image = gtk_image_new ();
- gtk_image_set_from_pixbuf (GTK_IMAGE (image), pixbuf);
- g_object_unref (pixbuf);
+ gtk_image_set_from_paintable (GTK_IMAGE (image), paintable);
+ g_object_unref (paintable);
gtk_container_add (GTK_CONTAINER (window), image);
g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
gtk_widget_show (window);