gtk3/fix-add-function-definition-of-gtk-image-set-from-pi.patch

68 lines
2.1 KiB
Diff

From 5bd8c8cfca3b435c0bf5eefb771f332fe6804c14 Mon Sep 17 00:00:00 2001
From: yangchenguang <yangchenguang@kylinsec.com.cn>
Date: Thu, 13 Apr 2023 11:13:03 +0800
Subject: [PATCH 1/4] fix(*): add function definition of gtk image set from
pixbuf
Signed-off-by: yangchenguang <yangchenguang@kylinsec.com.cn>
---
gtk/gtkimage.c | 26 ++++++++++++++++++++++++++
gtk/gtkimage.h | 4 ++++
2 files changed, 30 insertions(+)
diff --git a/gtk/gtkimage.c b/gtk/gtkimage.c
index 5d6e715..e84b821 100644
--- a/gtk/gtkimage.c
+++ b/gtk/gtkimage.c
@@ -1120,6 +1120,32 @@ gtk_image_set_from_pixbuf (GtkImage *image,
g_object_thaw_notify (G_OBJECT (image));
}
+extern void
+gtk_image_set_from_pixbuf_with_scale (GtkImage *image,
+ GdkPixbuf *pixbuf,
+ int scale)
+{
+ GtkImagePrivate *priv;
+
+ g_return_if_fail (GTK_IS_IMAGE (image));
+ g_return_if_fail (pixbuf == NULL ||
+ GDK_IS_PIXBUF (pixbuf));
+
+ priv = image->priv;
+
+ g_object_freeze_notify (G_OBJECT (image));
+
+ gtk_image_clear (image);
+
+ if (pixbuf != NULL)
+ _gtk_icon_helper_set_pixbuf (priv->icon_helper, pixbuf);
+
+ _gtk_icon_helper_set_pixbuf_scale (priv->icon_helper, scale);
+ g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_PIXBUF]);
+
+ g_object_thaw_notify (G_OBJECT (image));
+}
+
/**
* gtk_image_set_from_stock:
* @image: a #GtkImage
diff --git a/gtk/gtkimage.h b/gtk/gtkimage.h
index 68b9a6d..b679bce 100644
--- a/gtk/gtkimage.h
+++ b/gtk/gtkimage.h
@@ -144,6 +144,10 @@ GDK_AVAILABLE_IN_ALL
void gtk_image_set_from_resource (GtkImage *image,
const gchar *resource_path);
GDK_AVAILABLE_IN_ALL
+void gtk_image_set_from_pixbuf_with_scale (GtkImage *image,
+ GdkPixbuf *pixbuf,
+ int scale_factor);
+GDK_AVAILABLE_IN_ALL
void gtk_image_set_from_pixbuf (GtkImage *image,
GdkPixbuf *pixbuf);
GDK_DEPRECATED_IN_3_10_FOR(gtk_image_set_from_icon_name)
--
2.33.0