image: Drop the Private struct

This commit is contained in:
Matthias Clasen 2020-03-28 10:49:54 -04:00
parent 408dd37944
commit 001d076e61

View File

@ -81,16 +81,7 @@ typedef struct _GtkImageClass GtkImageClass;
struct _GtkImage struct _GtkImage
{ {
GtkWidget parent_instance; GtkWidget parent_instance;
};
struct _GtkImageClass
{
GtkWidgetClass parent_class;
};
typedef struct
{
GtkIconHelper *icon_helper; GtkIconHelper *icon_helper;
GtkIconSize icon_size; GtkIconSize icon_size;
@ -98,7 +89,13 @@ typedef struct
char *filename; char *filename;
char *resource_path; char *resource_path;
} GtkImagePrivate; };
struct _GtkImageClass
{
GtkWidgetClass parent_class;
};
static void gtk_image_snapshot (GtkWidget *widget, static void gtk_image_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot); GtkSnapshot *snapshot);
@ -141,7 +138,7 @@ enum
static GParamSpec *image_props[NUM_PROPERTIES] = { NULL, }; static GParamSpec *image_props[NUM_PROPERTIES] = { NULL, };
G_DEFINE_TYPE_WITH_PRIVATE (GtkImage, gtk_image, GTK_TYPE_WIDGET) G_DEFINE_TYPE (GtkImage, gtk_image, GTK_TYPE_WIDGET)
static void static void
gtk_image_class_init (GtkImageClass *class) gtk_image_class_init (GtkImageClass *class)
@ -269,26 +266,24 @@ gtk_image_class_init (GtkImageClass *class)
static void static void
gtk_image_init (GtkImage *image) gtk_image_init (GtkImage *image)
{ {
GtkImagePrivate *priv = gtk_image_get_instance_private (image);
GtkCssNode *widget_node; GtkCssNode *widget_node;
widget_node = gtk_widget_get_css_node (GTK_WIDGET (image)); widget_node = gtk_widget_get_css_node (GTK_WIDGET (image));
priv->icon_helper = gtk_icon_helper_new (widget_node, GTK_WIDGET (image)); image->icon_helper = gtk_icon_helper_new (widget_node, GTK_WIDGET (image));
} }
static void static void
gtk_image_finalize (GObject *object) gtk_image_finalize (GObject *object)
{ {
GtkImage *image = GTK_IMAGE (object); GtkImage *image = GTK_IMAGE (object);
GtkImagePrivate *priv = gtk_image_get_instance_private (image);
gtk_image_clear (image); gtk_image_clear (image);
g_clear_object (&priv->icon_helper); g_clear_object (&image->icon_helper);
g_free (priv->filename); g_free (image->filename);
g_free (priv->resource_path); g_free (image->resource_path);
G_OBJECT_CLASS (gtk_image_parent_class)->finalize (object); G_OBJECT_CLASS (gtk_image_parent_class)->finalize (object);
}; };
@ -300,7 +295,6 @@ gtk_image_set_property (GObject *object,
GParamSpec *pspec) GParamSpec *pspec)
{ {
GtkImage *image = GTK_IMAGE (object); GtkImage *image = GTK_IMAGE (object);
GtkImagePrivate *priv = gtk_image_get_instance_private (image);
switch (prop_id) switch (prop_id)
{ {
@ -327,7 +321,7 @@ gtk_image_set_property (GObject *object,
break; break;
case PROP_USE_FALLBACK: case PROP_USE_FALLBACK:
if (_gtk_icon_helper_set_use_fallback (priv->icon_helper, g_value_get_boolean (value))) if (_gtk_icon_helper_set_use_fallback (image->icon_helper, g_value_get_boolean (value)))
g_object_notify_by_pspec (object, pspec); g_object_notify_by_pspec (object, pspec);
break; break;
@ -344,36 +338,35 @@ gtk_image_get_property (GObject *object,
GParamSpec *pspec) GParamSpec *pspec)
{ {
GtkImage *image = GTK_IMAGE (object); GtkImage *image = GTK_IMAGE (object);
GtkImagePrivate *priv = gtk_image_get_instance_private (image);
switch (prop_id) switch (prop_id)
{ {
case PROP_PAINTABLE: case PROP_PAINTABLE:
g_value_set_object (value, _gtk_icon_helper_peek_paintable (priv->icon_helper)); g_value_set_object (value, _gtk_icon_helper_peek_paintable (image->icon_helper));
break; break;
case PROP_FILE: case PROP_FILE:
g_value_set_string (value, priv->filename); g_value_set_string (value, image->filename);
break; break;
case PROP_ICON_SIZE: case PROP_ICON_SIZE:
g_value_set_enum (value, priv->icon_size); g_value_set_enum (value, image->icon_size);
break; break;
case PROP_PIXEL_SIZE: case PROP_PIXEL_SIZE:
g_value_set_int (value, _gtk_icon_helper_get_pixel_size (priv->icon_helper)); g_value_set_int (value, _gtk_icon_helper_get_pixel_size (image->icon_helper));
break; break;
case PROP_ICON_NAME: case PROP_ICON_NAME:
g_value_set_string (value, _gtk_icon_helper_get_icon_name (priv->icon_helper)); g_value_set_string (value, _gtk_icon_helper_get_icon_name (image->icon_helper));
break; break;
case PROP_GICON: case PROP_GICON:
g_value_set_object (value, _gtk_icon_helper_peek_gicon (priv->icon_helper)); g_value_set_object (value, _gtk_icon_helper_peek_gicon (image->icon_helper));
break; break;
case PROP_RESOURCE: case PROP_RESOURCE:
g_value_set_string (value, priv->resource_path); g_value_set_string (value, image->resource_path);
break; break;
case PROP_USE_FALLBACK: case PROP_USE_FALLBACK:
g_value_set_boolean (value, _gtk_icon_helper_get_use_fallback (priv->icon_helper)); g_value_set_boolean (value, _gtk_icon_helper_get_use_fallback (image->icon_helper));
break; break;
case PROP_STORAGE_TYPE: case PROP_STORAGE_TYPE:
g_value_set_enum (value, _gtk_icon_helper_get_storage_type (priv->icon_helper)); g_value_set_enum (value, _gtk_icon_helper_get_storage_type (image->icon_helper));
break; break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@ -655,7 +648,6 @@ void
gtk_image_set_from_file (GtkImage *image, gtk_image_set_from_file (GtkImage *image,
const gchar *filename) const gchar *filename)
{ {
GtkImagePrivate *priv = gtk_image_get_instance_private (image);
GdkPixbufAnimation *anim; GdkPixbufAnimation *anim;
gint scale_factor; gint scale_factor;
GdkTexture *texture; GdkTexture *texture;
@ -669,7 +661,7 @@ gtk_image_set_from_file (GtkImage *image,
if (filename == NULL) if (filename == NULL)
{ {
priv->filename = NULL; image->filename = NULL;
g_object_thaw_notify (G_OBJECT (image)); g_object_thaw_notify (G_OBJECT (image));
return; return;
} }
@ -692,7 +684,7 @@ gtk_image_set_from_file (GtkImage *image,
g_object_unref (texture); g_object_unref (texture);
g_object_unref (anim); g_object_unref (anim);
priv->filename = g_strdup (filename); image->filename = g_strdup (filename);
g_object_thaw_notify (G_OBJECT (image)); g_object_thaw_notify (G_OBJECT (image));
} }
@ -738,7 +730,6 @@ void
gtk_image_set_from_resource (GtkImage *image, gtk_image_set_from_resource (GtkImage *image,
const gchar *resource_path) const gchar *resource_path)
{ {
GtkImagePrivate *priv = gtk_image_get_instance_private (image);
GdkPixbufAnimation *animation; GdkPixbufAnimation *animation;
gint scale_factor = 1; gint scale_factor = 1;
GdkTexture *texture; GdkTexture *texture;
@ -781,7 +772,7 @@ gtk_image_set_from_resource (GtkImage *image,
g_object_unref (scaler); g_object_unref (scaler);
g_object_unref (texture); g_object_unref (texture);
priv->resource_path = g_strdup (resource_path); image->resource_path = g_strdup (resource_path);
g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_RESOURCE]); g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_RESOURCE]);
@ -836,8 +827,6 @@ void
gtk_image_set_from_icon_name (GtkImage *image, gtk_image_set_from_icon_name (GtkImage *image,
const gchar *icon_name) const gchar *icon_name)
{ {
GtkImagePrivate *priv = gtk_image_get_instance_private (image);
g_return_if_fail (GTK_IS_IMAGE (image)); g_return_if_fail (GTK_IS_IMAGE (image));
g_object_freeze_notify (G_OBJECT (image)); g_object_freeze_notify (G_OBJECT (image));
@ -845,7 +834,7 @@ gtk_image_set_from_icon_name (GtkImage *image,
gtk_image_clear (image); gtk_image_clear (image);
if (icon_name) if (icon_name)
_gtk_icon_helper_set_icon_name (priv->icon_helper, icon_name); _gtk_icon_helper_set_icon_name (image->icon_helper, icon_name);
g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_ICON_NAME]); g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_ICON_NAME]);
@ -867,8 +856,6 @@ void
gtk_image_set_from_gicon (GtkImage *image, gtk_image_set_from_gicon (GtkImage *image,
GIcon *icon) GIcon *icon)
{ {
GtkImagePrivate *priv = gtk_image_get_instance_private (image);
g_return_if_fail (GTK_IS_IMAGE (image)); g_return_if_fail (GTK_IS_IMAGE (image));
g_object_freeze_notify (G_OBJECT (image)); g_object_freeze_notify (G_OBJECT (image));
@ -880,7 +867,7 @@ gtk_image_set_from_gicon (GtkImage *image,
if (icon) if (icon)
{ {
_gtk_icon_helper_set_gicon (priv->icon_helper, icon); _gtk_icon_helper_set_gicon (image->icon_helper, icon);
g_object_unref (icon); g_object_unref (icon);
} }
@ -900,9 +887,7 @@ static void
gtk_image_paintable_invalidate_size (GdkPaintable *paintable, gtk_image_paintable_invalidate_size (GdkPaintable *paintable,
GtkImage *image) GtkImage *image)
{ {
GtkImagePrivate *priv = gtk_image_get_instance_private (image); gtk_icon_helper_invalidate (image->icon_helper);
gtk_icon_helper_invalidate (priv->icon_helper);
} }
/** /**
@ -916,8 +901,6 @@ void
gtk_image_set_from_paintable (GtkImage *image, gtk_image_set_from_paintable (GtkImage *image,
GdkPaintable *paintable) GdkPaintable *paintable)
{ {
GtkImagePrivate *priv = gtk_image_get_instance_private (image);
g_return_if_fail (GTK_IS_IMAGE (image)); g_return_if_fail (GTK_IS_IMAGE (image));
g_return_if_fail (paintable == NULL || GDK_IS_PAINTABLE (paintable)); g_return_if_fail (paintable == NULL || GDK_IS_PAINTABLE (paintable));
@ -932,7 +915,7 @@ gtk_image_set_from_paintable (GtkImage *image,
{ {
const guint flags = gdk_paintable_get_flags (paintable); const guint flags = gdk_paintable_get_flags (paintable);
_gtk_icon_helper_set_paintable (priv->icon_helper, paintable); _gtk_icon_helper_set_paintable (image->icon_helper, paintable);
if ((flags & GDK_PAINTABLE_STATIC_CONTENTS) == 0) if ((flags & GDK_PAINTABLE_STATIC_CONTENTS) == 0)
g_signal_connect (paintable, g_signal_connect (paintable,
@ -966,11 +949,9 @@ gtk_image_set_from_paintable (GtkImage *image,
GtkImageType GtkImageType
gtk_image_get_storage_type (GtkImage *image) gtk_image_get_storage_type (GtkImage *image)
{ {
GtkImagePrivate *priv = gtk_image_get_instance_private (image);
g_return_val_if_fail (GTK_IS_IMAGE (image), GTK_IMAGE_EMPTY); g_return_val_if_fail (GTK_IS_IMAGE (image), GTK_IMAGE_EMPTY);
return _gtk_icon_helper_get_storage_type (priv->icon_helper); return _gtk_icon_helper_get_storage_type (image->icon_helper);
} }
/** /**
@ -989,11 +970,9 @@ gtk_image_get_storage_type (GtkImage *image)
GdkPaintable * GdkPaintable *
gtk_image_get_paintable (GtkImage *image) gtk_image_get_paintable (GtkImage *image)
{ {
GtkImagePrivate *priv = gtk_image_get_instance_private (image);
g_return_val_if_fail (GTK_IS_IMAGE (image), NULL); g_return_val_if_fail (GTK_IS_IMAGE (image), NULL);
return _gtk_icon_helper_peek_paintable (priv->icon_helper); return _gtk_icon_helper_peek_paintable (image->icon_helper);
} }
/** /**
@ -1015,11 +994,9 @@ gtk_image_get_paintable (GtkImage *image)
const gchar * const gchar *
gtk_image_get_icon_name (GtkImage *image) gtk_image_get_icon_name (GtkImage *image)
{ {
GtkImagePrivate *priv = gtk_image_get_instance_private (image);
g_return_val_if_fail (GTK_IS_IMAGE (image), NULL); g_return_val_if_fail (GTK_IS_IMAGE (image), NULL);
return _gtk_icon_helper_get_icon_name (priv->icon_helper); return _gtk_icon_helper_get_icon_name (image->icon_helper);
} }
/** /**
@ -1041,11 +1018,9 @@ gtk_image_get_icon_name (GtkImage *image)
GIcon * GIcon *
gtk_image_get_gicon (GtkImage *image) gtk_image_get_gicon (GtkImage *image)
{ {
GtkImagePrivate *priv = gtk_image_get_instance_private (image);
g_return_val_if_fail (GTK_IS_IMAGE (image), NULL); g_return_val_if_fail (GTK_IS_IMAGE (image), NULL);
return _gtk_icon_helper_peek_gicon (priv->icon_helper); return _gtk_icon_helper_peek_gicon (image->icon_helper);
} }
/** /**
@ -1065,9 +1040,8 @@ static void
gtk_image_unrealize (GtkWidget *widget) gtk_image_unrealize (GtkWidget *widget)
{ {
GtkImage *image = GTK_IMAGE (widget); GtkImage *image = GTK_IMAGE (widget);
GtkImagePrivate *priv = gtk_image_get_instance_private (image);
gtk_icon_helper_invalidate (priv->icon_helper); gtk_icon_helper_invalidate (image->icon_helper);
GTK_WIDGET_CLASS (gtk_image_parent_class)->unrealize (widget); GTK_WIDGET_CLASS (gtk_image_parent_class)->unrealize (widget);
} }
@ -1077,23 +1051,21 @@ gtk_image_get_baseline_align (GtkImage *image)
{ {
PangoContext *pango_context; PangoContext *pango_context;
PangoFontMetrics *metrics; PangoFontMetrics *metrics;
GtkImagePrivate *priv = gtk_image_get_instance_private (image);
if (image->baseline_align == 0.0)
if (priv->baseline_align == 0.0)
{ {
pango_context = gtk_widget_get_pango_context (GTK_WIDGET (image)); pango_context = gtk_widget_get_pango_context (GTK_WIDGET (image));
metrics = pango_context_get_metrics (pango_context, metrics = pango_context_get_metrics (pango_context,
pango_context_get_font_description (pango_context), pango_context_get_font_description (pango_context),
pango_context_get_language (pango_context)); pango_context_get_language (pango_context));
priv->baseline_align = image->baseline_align =
(float)pango_font_metrics_get_ascent (metrics) / (float)pango_font_metrics_get_ascent (metrics) /
(pango_font_metrics_get_ascent (metrics) + pango_font_metrics_get_descent (metrics)); (pango_font_metrics_get_ascent (metrics) + pango_font_metrics_get_descent (metrics));
pango_font_metrics_unref (metrics); pango_font_metrics_unref (metrics);
} }
return priv->baseline_align; return image->baseline_align;
} }
static void static void
@ -1101,18 +1073,17 @@ gtk_image_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot) GtkSnapshot *snapshot)
{ {
GtkImage *image = GTK_IMAGE (widget); GtkImage *image = GTK_IMAGE (widget);
GtkImagePrivate *priv = gtk_image_get_instance_private (image);
double ratio; double ratio;
int x, y, width, height, baseline; int x, y, width, height, baseline;
double w, h; double w, h;
width = gtk_widget_get_width (widget); width = gtk_widget_get_width (widget);
height = gtk_widget_get_height (widget); height = gtk_widget_get_height (widget);
ratio = gdk_paintable_get_intrinsic_aspect_ratio (GDK_PAINTABLE (priv->icon_helper)); ratio = gdk_paintable_get_intrinsic_aspect_ratio (GDK_PAINTABLE (image->icon_helper));
if (ratio == 0) if (ratio == 0)
{ {
gdk_paintable_snapshot (GDK_PAINTABLE (priv->icon_helper), snapshot, width, height); gdk_paintable_snapshot (GDK_PAINTABLE (image->icon_helper), snapshot, width, height);
} }
else else
{ {
@ -1141,12 +1112,12 @@ gtk_image_snapshot (GtkWidget *widget,
{ {
gtk_snapshot_save (snapshot); gtk_snapshot_save (snapshot);
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (x, y)); gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (x, y));
gdk_paintable_snapshot (GDK_PAINTABLE (priv->icon_helper), snapshot, w, h); gdk_paintable_snapshot (GDK_PAINTABLE (image->icon_helper), snapshot, w, h);
gtk_snapshot_restore (snapshot); gtk_snapshot_restore (snapshot);
} }
else else
{ {
gdk_paintable_snapshot (GDK_PAINTABLE (priv->icon_helper), snapshot, w, h); gdk_paintable_snapshot (GDK_PAINTABLE (image->icon_helper), snapshot, w, h);
} }
} }
} }
@ -1176,8 +1147,6 @@ void
gtk_image_set_from_definition (GtkImage *image, gtk_image_set_from_definition (GtkImage *image,
GtkImageDefinition *def) GtkImageDefinition *def)
{ {
GtkImagePrivate *priv = gtk_image_get_instance_private (image);
g_return_if_fail (GTK_IS_IMAGE (image)); g_return_if_fail (GTK_IS_IMAGE (image));
g_object_freeze_notify (G_OBJECT (image)); g_object_freeze_notify (G_OBJECT (image));
@ -1186,7 +1155,7 @@ gtk_image_set_from_definition (GtkImage *image,
if (def != NULL) if (def != NULL)
{ {
_gtk_icon_helper_set_definition (priv->icon_helper, def); _gtk_icon_helper_set_definition (image->icon_helper, def);
gtk_image_notify_for_storage_type (image, gtk_image_definition_get_storage_type (def)); gtk_image_notify_for_storage_type (image, gtk_image_definition_get_storage_type (def));
} }
@ -1197,9 +1166,7 @@ gtk_image_set_from_definition (GtkImage *image,
GtkImageDefinition * GtkImageDefinition *
gtk_image_get_definition (GtkImage *image) gtk_image_get_definition (GtkImage *image)
{ {
GtkImagePrivate *priv = gtk_image_get_instance_private (image); return gtk_icon_helper_get_definition (image->icon_helper);
return gtk_icon_helper_get_definition (priv->icon_helper);
} }
/** /**
@ -1211,7 +1178,6 @@ gtk_image_get_definition (GtkImage *image)
void void
gtk_image_clear (GtkImage *image) gtk_image_clear (GtkImage *image)
{ {
GtkImagePrivate *priv = gtk_image_get_instance_private (image);
GtkImageType storage_type; GtkImageType storage_type;
g_object_freeze_notify (G_OBJECT (image)); g_object_freeze_notify (G_OBJECT (image));
@ -1224,23 +1190,23 @@ gtk_image_clear (GtkImage *image)
gtk_image_notify_for_storage_type (image, storage_type); gtk_image_notify_for_storage_type (image, storage_type);
if (priv->filename) if (image->filename)
{ {
g_free (priv->filename); g_free (image->filename);
priv->filename = NULL; image->filename = NULL;
g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_FILE]); g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_FILE]);
} }
if (priv->resource_path) if (image->resource_path)
{ {
g_free (priv->resource_path); g_free (image->resource_path);
priv->resource_path = NULL; image->resource_path = NULL;
g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_RESOURCE]); g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_RESOURCE]);
} }
if (storage_type == GTK_IMAGE_PAINTABLE) if (storage_type == GTK_IMAGE_PAINTABLE)
{ {
GdkPaintable *paintable = _gtk_icon_helper_peek_paintable (priv->icon_helper); GdkPaintable *paintable = _gtk_icon_helper_peek_paintable (image->icon_helper);
const guint flags = gdk_paintable_get_flags (paintable); const guint flags = gdk_paintable_get_flags (paintable);
if ((flags & GDK_PAINTABLE_STATIC_CONTENTS) == 0) if ((flags & GDK_PAINTABLE_STATIC_CONTENTS) == 0)
@ -1254,7 +1220,7 @@ gtk_image_clear (GtkImage *image)
image); image);
} }
_gtk_icon_helper_clear (priv->icon_helper); _gtk_icon_helper_clear (image->icon_helper);
g_object_thaw_notify (G_OBJECT (image)); g_object_thaw_notify (G_OBJECT (image));
} }
@ -1268,10 +1234,10 @@ gtk_image_measure (GtkWidget *widget,
int *minimum_baseline, int *minimum_baseline,
int *natural_baseline) int *natural_baseline)
{ {
GtkImagePrivate *priv = gtk_image_get_instance_private (GTK_IMAGE (widget)); GtkImage *image = GTK_IMAGE (widget);
float baseline_align; float baseline_align;
*minimum = *natural = gtk_icon_helper_get_size (priv->icon_helper); *minimum = *natural = gtk_icon_helper_get_size (image->icon_helper);
if (orientation == GTK_ORIENTATION_VERTICAL) if (orientation == GTK_ORIENTATION_VERTICAL)
{ {
@ -1288,13 +1254,12 @@ gtk_image_css_changed (GtkWidget *widget,
GtkCssStyleChange *change) GtkCssStyleChange *change)
{ {
GtkImage *image = GTK_IMAGE (widget); GtkImage *image = GTK_IMAGE (widget);
GtkImagePrivate *priv = gtk_image_get_instance_private (image);
gtk_icon_helper_invalidate_for_change (priv->icon_helper, change); gtk_icon_helper_invalidate_for_change (image->icon_helper, change);
GTK_WIDGET_CLASS (gtk_image_parent_class)->css_changed (widget, change); GTK_WIDGET_CLASS (gtk_image_parent_class)->css_changed (widget, change);
priv->baseline_align = 0.0; image->baseline_align = 0.0;
} }
/** /**
@ -1310,11 +1275,9 @@ void
gtk_image_set_pixel_size (GtkImage *image, gtk_image_set_pixel_size (GtkImage *image,
gint pixel_size) gint pixel_size)
{ {
GtkImagePrivate *priv = gtk_image_get_instance_private (image);
g_return_if_fail (GTK_IS_IMAGE (image)); g_return_if_fail (GTK_IS_IMAGE (image));
if (_gtk_icon_helper_set_pixel_size (priv->icon_helper, pixel_size)) if (_gtk_icon_helper_set_pixel_size (image->icon_helper, pixel_size))
{ {
if (gtk_widget_get_visible (GTK_WIDGET (image))) if (gtk_widget_get_visible (GTK_WIDGET (image)))
gtk_widget_queue_resize (GTK_WIDGET (image)); gtk_widget_queue_resize (GTK_WIDGET (image));
@ -1333,11 +1296,9 @@ gtk_image_set_pixel_size (GtkImage *image,
gint gint
gtk_image_get_pixel_size (GtkImage *image) gtk_image_get_pixel_size (GtkImage *image)
{ {
GtkImagePrivate *priv = gtk_image_get_instance_private (image);
g_return_val_if_fail (GTK_IS_IMAGE (image), -1); g_return_val_if_fail (GTK_IS_IMAGE (image), -1);
return _gtk_icon_helper_get_pixel_size (priv->icon_helper); return _gtk_icon_helper_get_pixel_size (image->icon_helper);
} }
/** /**
@ -1351,14 +1312,12 @@ void
gtk_image_set_icon_size (GtkImage *image, gtk_image_set_icon_size (GtkImage *image,
GtkIconSize icon_size) GtkIconSize icon_size)
{ {
GtkImagePrivate *priv = gtk_image_get_instance_private (image);
g_return_if_fail (GTK_IS_IMAGE (image)); g_return_if_fail (GTK_IS_IMAGE (image));
if (priv->icon_size == icon_size) if (image->icon_size == icon_size)
return; return;
priv->icon_size = icon_size; image->icon_size = icon_size;
gtk_icon_size_set_style_classes (gtk_widget_get_css_node (GTK_WIDGET (image)), icon_size); gtk_icon_size_set_style_classes (gtk_widget_get_css_node (GTK_WIDGET (image)), icon_size);
g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_ICON_SIZE]); g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_ICON_SIZE]);
} }
@ -1374,11 +1333,9 @@ gtk_image_set_icon_size (GtkImage *image,
GtkIconSize GtkIconSize
gtk_image_get_icon_size (GtkImage *image) gtk_image_get_icon_size (GtkImage *image)
{ {
GtkImagePrivate *priv = gtk_image_get_instance_private (image);
g_return_val_if_fail (GTK_IS_IMAGE (image), GTK_ICON_SIZE_INHERIT); g_return_val_if_fail (GTK_IS_IMAGE (image), GTK_ICON_SIZE_INHERIT);
return priv->icon_size; return image->icon_size;
} }
void void
@ -1386,7 +1343,5 @@ gtk_image_get_image_size (GtkImage *image,
int *width, int *width,
int *height) int *height)
{ {
GtkImagePrivate *priv = gtk_image_get_instance_private (image); *width = *height = gtk_icon_helper_get_size (image->icon_helper);
*width = *height = gtk_icon_helper_get_size (priv->icon_helper);
} }