From: Benjamin Otte Date: Fri, 17 Sep 2021 02:15:40 +0000 (+0200) Subject: gtk-demo: Use textures in listbox example X-Git-Tag: archive/raspbian/4.6.5+ds-1+rpi1~1^2~19^2~5^2~340^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=3914ecbd0fdceb60d83e30de5f08124b45b2cd5b;p=gtk4.git gtk-demo: Use textures in listbox example --- diff --git a/demos/gtk-demo/listbox.c b/demos/gtk-demo/listbox.c index 750f5f480c..98a6a26611 100644 --- a/demos/gtk-demo/listbox.c +++ b/demos/gtk-demo/listbox.c @@ -8,7 +8,7 @@ #include #include -static GdkPixbuf *avatar_pixbuf_other; +static GdkTexture *avatar_texture_other; static GtkWidget *window = NULL; #define GTK_TYPE_MESSAGE (gtk_message_get_type ()) @@ -196,12 +196,9 @@ gtk_message_row_update (GtkMessageRow *row) gtk_button_set_label (GTK_BUTTON (priv->resent_by_button), priv->message->resent_by); if (strcmp (priv->message->sender_nick, "@GTKtoolkit") == 0) - { - gtk_image_set_from_icon_name (priv->avatar_image, "org.gtk.Demo4"); - gtk_image_set_icon_size (priv->avatar_image, GTK_ICON_SIZE_LARGE); - } + gtk_image_set_from_icon_name (priv->avatar_image, "org.gtk.Demo4"); else - gtk_image_set_from_pixbuf (priv->avatar_image, avatar_pixbuf_other); + gtk_image_set_from_paintable (priv->avatar_image, GDK_PAINTABLE (avatar_texture_other)); } @@ -344,7 +341,7 @@ do_listbox (GtkWidget *do_widget) if (!window) { - avatar_pixbuf_other = gdk_pixbuf_new_from_resource_at_scale ("/listbox/apple-red.png", 32, 32, FALSE, NULL); + avatar_texture_other = gdk_texture_new_from_resource ("/listbox/apple-red.png"); window = gtk_window_new (); gtk_window_set_display (GTK_WINDOW (window), diff --git a/demos/gtk-demo/listbox.ui b/demos/gtk-demo/listbox.ui index a237651d82..9b5199ef7d 100644 --- a/demos/gtk-demo/listbox.ui +++ b/demos/gtk-demo/listbox.ui @@ -25,6 +25,7 @@ 8 8 image-missing + large 0 0