[gtk/image-loading: 5/5] gtk-demo: Use textures in listbox example
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/image-loading: 5/5] gtk-demo: Use textures in listbox example
- Date: Fri, 17 Sep 2021 02:31:16 +0000 (UTC)
commit 2da2770b9c97eca5b26f56994eb7c30c6efcd5a2
Author: Benjamin Otte <otte redhat com>
Date: Fri Sep 17 04:15:40 2021 +0200
gtk-demo: Use textures in listbox example
demos/gtk-demo/listbox.c | 11 ++++-------
demos/gtk-demo/listbox.ui | 1 +
2 files changed, 5 insertions(+), 7 deletions(-)
---
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 <stdlib.h>
#include <string.h>
-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 @@
<property name="margin-start">8</property>
<property name="margin-end">8</property>
<property name="icon-name">image-missing</property>
+ <property name="icon-size">large</property>
<layout>
<property name="column">0</property>
<property name="row">0</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]