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_icon (icon_info, NULL);
+ return GDK_PAINTABLE (icon_info);
default:
g_warning ("Image storage type %d not handled",
gtk_image_get_storage_type (image));
GTK_ICON_LOOKUP_FORCE_SIZE | GTK_ICON_LOOKUP_GENERIC_FALLBACK);
if (icon_info == NULL)
return NULL;
- return gtk_icon_info_load_icon (icon_info, NULL);
+ return GDK_PAINTABLE (icon_info);
default:
g_warning ("Image storage type %d not handled",
gtk_image_get_storage_type (image));
GdkDevice *device;
GdkDrag *drag;
GtkIconTheme *theme;
- GdkPaintable *paintable;
+ GtkIconInfo *icon;
GdkSurface *surface;
if (!priv->in_drag)
drag = gdk_drag_begin (surface, device, content, GDK_ACTION_COPY, start_x, start_y);
theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (widget));
- paintable = gtk_icon_theme_load_icon (theme, "text-x-generic", 32, 0, NULL);
- gtk_drag_icon_set_from_paintable (drag, paintable, 0, 0);
- g_clear_object (&paintable);
+ icon = gtk_icon_theme_lookup_icon (theme, "text-x-generic", 32, 0);
+ gtk_drag_icon_set_from_paintable (drag, GDK_PAINTABLE (icon), 0, 0);
+ g_clear_object (&icon);
g_object_unref (content);
g_object_unref (drag);
if (!source->paintable)
{
GtkIconTheme *theme;
-
+
theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (widget));
- source->paintable = gtk_icon_theme_load_icon (theme, "text-x-generic", 32, 0, NULL);
+ source->paintable = GDK_PAINTABLE(gtk_icon_theme_lookup_icon (theme, "text-x-generic", 32, 0));
source->hot_x = 0;
source->hot_y = 0;
}
{
const char *name;
GtkIconInfo *info;
- GdkPaintable *paintable;
name = gtk_window_get_icon_name (window);
if (info == NULL)
return NULL;
- paintable = gtk_icon_info_load_icon (info, NULL);
- g_object_unref (info);
-
- return paintable;
+ return GDK_PAINTABLE (info);
}
static void
if (strcmp (argv[1], "display") == 0)
{
- GError *error;
- GdkPaintable *paintable;
+ GtkIconInfo *icon;
GtkWidget *window, *image;
if (argc < 4)
if (argc >= 6)
scale = atoi (argv[5]);
- error = NULL;
- paintable = gtk_icon_theme_load_icon_for_scale (icon_theme, argv[3], size, scale, flags, &error);
- if (!paintable)
+ icon = gtk_icon_theme_lookup_icon_for_scale (icon_theme, argv[3], size, scale, flags);
+ if (!icon)
{
- g_print ("%s\n", error->message);
+ g_print ("Icon '%s' not found\n", argv[3]);
return 1;
}
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
image = gtk_image_new ();
- gtk_image_set_from_paintable (GTK_IMAGE (image), paintable);
- g_object_unref (paintable);
+ gtk_image_set_from_paintable (GTK_IMAGE (image), GDK_PAINTABLE (icon));
+ g_object_unref (icon);
gtk_container_add (GTK_CONTAINER (window), image);
g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
gtk_widget_show (window);
-
+
gtk_main ();
}
else if (strcmp (argv[1], "display-async") == 0)
if (icon_info)
{
- GdkTexture *texture;
+ GdkPaintable *paintable = GDK_PAINTABLE (icon_info);
g_print ("Base size: %d, Scale: %d\n", gtk_icon_info_get_base_size (icon_info), gtk_icon_info_get_base_scale (icon_info));
-
- texture = GDK_TEXTURE (gtk_icon_info_load_icon (icon_info, NULL));
- if (texture != NULL)
- {
- g_print ("texture size: %dx%d\n", gdk_texture_get_width (texture), gdk_texture_get_height (texture));
- g_object_unref (texture);
- }
+ g_print ("texture size: %dx%d\n", gdk_paintable_get_intrinsic_width (paintable), gdk_paintable_get_intrinsic_height (paintable));
g_object_unref (icon_info);
}