[gtk+/wip/baedert/drawing: 56/183] image: Remove gadget
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/baedert/drawing: 56/183] image: Remove gadget
- Date: Sat, 20 May 2017 13:21:11 +0000 (UTC)
commit 7b49c3d0ccb82f1658583af08d5a354bf920ef80
Author: Timm Bäder <mail baedert org>
Date: Thu May 4 10:23:38 2017 +0200
image: Remove gadget
gtk/gtkimage.c | 85 ++++++++++++-------------------------------------------
1 files changed, 19 insertions(+), 66 deletions(-)
---
diff --git a/gtk/gtkimage.c b/gtk/gtkimage.c
index 4cafb21..7632354 100644
--- a/gtk/gtkimage.c
+++ b/gtk/gtkimage.c
@@ -40,7 +40,6 @@
#include "gtkcssshadowsvalueprivate.h"
#include "gtkstylecontextprivate.h"
#include "gtkwidgetprivate.h"
-#include "gtkcsscustomgadgetprivate.h"
#include "a11y/gtkimageaccessible.h"
@@ -132,8 +131,6 @@ struct _GtkImagePrivate
GdkPixbufAnimationIter *animation_iter;
gint animation_timeout;
- GtkCssGadget *gadget;
-
float baseline_align;
gchar *filename; /* Only used with GTK_IMAGE_ANIMATION, GTK_IMAGE_PIXBUF */
@@ -155,14 +152,6 @@ static void gtk_image_measure (GtkWidget *widget,
int *natural,
int *minimum_baseline,
int *natural_baseline);
-static void gtk_image_get_content_size (GtkCssGadget *gadget,
- GtkOrientation orientation,
- gint for_size,
- gint *minimum,
- gint *natural,
- gint *minimum_baseline,
- gint *natural_baseline,
- gpointer unused);
static void gtk_image_style_updated (GtkWidget *widget);
static void gtk_image_finalize (GObject *object);
@@ -361,14 +350,6 @@ gtk_image_init (GtkImage *image)
priv->icon_helper = gtk_icon_helper_new (widget_node, GTK_WIDGET (image));
_gtk_icon_helper_set_icon_size (priv->icon_helper, DEFAULT_ICON_SIZE);
-
- priv->gadget = gtk_css_custom_gadget_new_for_node (widget_node,
- GTK_WIDGET (image),
- gtk_image_get_content_size,
- NULL,
- NULL,
- NULL, NULL);
-
}
static void
@@ -377,7 +358,6 @@ gtk_image_finalize (GObject *object)
GtkImage *image = GTK_IMAGE (object);
g_clear_object (&image->priv->icon_helper);
- g_clear_object (&image->priv->gadget);
g_free (image->priv->filename);
g_free (image->priv->resource_path);
@@ -1260,12 +1240,6 @@ gtk_image_size_allocate (GtkWidget *widget,
GtkAllocation clip;
GdkRectangle extents;
- gtk_widget_set_allocation (widget, allocation);
- gtk_css_gadget_allocate (GTK_IMAGE (widget)->priv->gadget,
- allocation,
- gtk_widget_get_allocated_baseline (widget),
- &clip);
-
_gtk_style_context_get_icon_extents (gtk_widget_get_style_context (widget),
&extents,
allocation->x,
@@ -1374,41 +1348,6 @@ gtk_image_get_baseline_align (GtkImage *image)
}
static void
-gtk_image_get_content_size (GtkCssGadget *gadget,
- GtkOrientation orientation,
- gint for_size,
- gint *minimum,
- gint *natural,
- gint *minimum_baseline,
- gint *natural_baseline,
- gpointer unused)
-{
- GtkWidget *widget;
- gint width, height;
- float baseline_align;
-
- widget = gtk_css_gadget_get_owner (gadget);
-
- _gtk_icon_helper_get_size (GTK_IMAGE (widget)->priv->icon_helper,
- &width, &height);
-
- if (orientation == GTK_ORIENTATION_HORIZONTAL)
- {
- *minimum = *natural = width;
- }
- else
- {
- baseline_align = gtk_image_get_baseline_align (GTK_IMAGE (widget));
- *minimum = *natural = height;
- if (minimum_baseline)
- *minimum_baseline = height * baseline_align;
- if (natural_baseline)
- *natural_baseline = height * baseline_align;
- }
-
-}
-
-static void
gtk_image_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
@@ -1563,11 +1502,25 @@ gtk_image_measure (GtkWidget *widget,
int *minimum_baseline,
int *natural_baseline)
{
- gtk_css_gadget_get_preferred_size (GTK_IMAGE (widget)->priv->gadget,
- orientation,
- for_size,
- minimum, natural,
- minimum_baseline, natural_baseline);
+ gint width, height;
+ float baseline_align;
+
+ _gtk_icon_helper_get_size (GTK_IMAGE (widget)->priv->icon_helper,
+ &width, &height);
+
+ if (orientation == GTK_ORIENTATION_HORIZONTAL)
+ {
+ *minimum = *natural = width;
+ }
+ else
+ {
+ baseline_align = gtk_image_get_baseline_align (GTK_IMAGE (widget));
+ *minimum = *natural = height;
+ if (minimum_baseline)
+ *minimum_baseline = height * baseline_align;
+ if (natural_baseline)
+ *natural_baseline = height * baseline_align;
+ }
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]