[libgd/wip/ernestask/gtk4: 9/33] main-icon-box-icon: use gtk_widget_measure()



commit 89167ada8d8a7af8ec034e3a9eb4e0686f011e22
Author: Ernestas Kulik <ernestask gnome org>
Date:   Mon Mar 5 19:31:20 2018 +0200

    main-icon-box-icon: use gtk_widget_measure()

 libgd/gd-main-icon-box-icon.c |   27 ++++++++++-----------------
 1 files changed, 10 insertions(+), 17 deletions(-)
---
diff --git a/libgd/gd-main-icon-box-icon.c b/libgd/gd-main-icon-box-icon.c
index 63695eb..3f3d4e5 100644
--- a/libgd/gd-main-icon-box-icon.c
+++ b/libgd/gd-main-icon-box-icon.c
@@ -88,8 +88,15 @@ gd_zoom_image_surface (cairo_surface_t *surface, gint width_zoomed, gint height_
 }
 
 static void
-gd_main_icon_box_icon_get_preferred_size (GdMainIconBoxIcon *self, gint *minimum, gint *natural)
+gd_main_icon_box_icon_measure (GtkWidget      *widget,
+                               GtkOrientation  orientation,
+                               gint            for_size,
+                               gint           *minimum,
+                               gint           *natural,
+                               gint           *minimum_baseline,
+                               gint           *natural_baseline)
 {
+  GdMainIconBoxIcon *self;
   cairo_surface_t *surface;
   cairo_surface_type_t surface_type;
   gint height_scaled;
@@ -98,6 +105,7 @@ gd_main_icon_box_icon_get_preferred_size (GdMainIconBoxIcon *self, gint *minimum
   gint size = 0;
   gint size_scaled;
 
+  self = GD_MAIN_ICON_BOX_ICON (widget);
   surface = gd_main_box_item_get_icon (self->item);
   if (surface == NULL)
     goto out;
@@ -145,20 +153,6 @@ gd_main_icon_box_icon_draw (GtkWidget *widget, cairo_t *cr)
 }
 
 static void
-gd_main_icon_box_icon_get_preferred_height (GtkWidget *widget, gint *minimum, gint *natural)
-{
-  GdMainIconBoxIcon *self = GD_MAIN_ICON_BOX_ICON (widget);
-  gd_main_icon_box_icon_get_preferred_size (self, minimum, natural);
-}
-
-static void
-gd_main_icon_box_icon_get_preferred_width (GtkWidget *widget, gint *minimum, gint *natural)
-{
-  GdMainIconBoxIcon *self = GD_MAIN_ICON_BOX_ICON (widget);
-  gd_main_icon_box_icon_get_preferred_size (self, minimum, natural);
-}
-
-static void
 gd_main_icon_box_icon_size_allocate (GtkWidget           *widget,
                                      const GtkAllocation *allocation,
                                      gint                 baseline,
@@ -311,8 +305,7 @@ gd_main_icon_box_icon_class_init (GdMainIconBoxIconClass *klass)
   oclass->get_property = gd_main_icon_box_icon_get_property;
   oclass->set_property = gd_main_icon_box_icon_set_property;
   wclass->draw = gd_main_icon_box_icon_draw;
-  wclass->get_preferred_height = gd_main_icon_box_icon_get_preferred_height;
-  wclass->get_preferred_width = gd_main_icon_box_icon_get_preferred_width;
+  wclass->measure = gd_main_icon_box_icon_measure;
   wclass->size_allocate = gd_main_icon_box_icon_size_allocate;
 
   properties[PROP_ITEM] = g_param_spec_object ("item",


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]