[gtk/ebassi/cell-renderer-get-size: 6/6] Remove GtkCellRendererClass.get_size()




commit 60a7830ba5c772ccb8633bffcb5bdb11ea403d58
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Sat Nov 28 19:19:27 2020 +0000

    Remove GtkCellRendererClass.get_size()
    
    The get_size() vfuncs is deprecated in GTK3, and only used as a
    fallback path for cell renderers that do not implement preferred
    size virtual functions.

 gtk/gtkcellrenderer.c | 15 ++-------------
 gtk/gtkcellrenderer.h |  8 --------
 2 files changed, 2 insertions(+), 21 deletions(-)
---
diff --git a/gtk/gtkcellrenderer.c b/gtk/gtkcellrenderer.c
index 2c48b57347..1315d8878b 100644
--- a/gtk/gtkcellrenderer.c
+++ b/gtk/gtkcellrenderer.c
@@ -86,7 +86,6 @@ static void gtk_cell_renderer_set_property  (GObject              *object,
 static void set_cell_bg_color               (GtkCellRenderer      *cell,
                                             GdkRGBA              *rgba);
 
-/* Fallback GtkCellRenderer    implementation to use remaining ->get_size() implementations */
 static GtkSizeRequestMode gtk_cell_renderer_real_get_request_mode(GtkCellRenderer         *cell);
 static void gtk_cell_renderer_real_get_preferred_width           (GtkCellRenderer         *cell,
                                                                   GtkWidget               *widget,
@@ -201,7 +200,6 @@ gtk_cell_renderer_class_init (GtkCellRendererClass *class)
   object_class->set_property = gtk_cell_renderer_set_property;
 
   class->snapshot = NULL;
-  class->get_size = NULL;
   class->get_request_mode               = gtk_cell_renderer_real_get_request_mode;
   class->get_preferred_width            = gtk_cell_renderer_real_get_preferred_width;
   class->get_preferred_height           = gtk_cell_renderer_real_get_preferred_height;
@@ -1177,15 +1175,8 @@ gtk_cell_renderer_real_get_preferred_size (GtkCellRenderer   *cell,
 {
   GtkRequisition min_req;
 
-  /* Fallback on the old API to get the size. */
-  if (GTK_CELL_RENDERER_GET_CLASS (cell)->get_size)
-    GTK_CELL_RENDERER_GET_CLASS (cell)->get_size (GTK_CELL_RENDERER (cell), widget, NULL, NULL, NULL,
-                                                 &min_req.width, &min_req.height);
-  else
-    {
-      min_req.width = 0;
-      min_req.height = 0;
-    }
+  min_req.width = 0;
+  min_req.height = 0;
 
   if (orientation == GTK_ORIENTATION_HORIZONTAL)
     {
@@ -1240,7 +1231,6 @@ gtk_cell_renderer_real_get_preferred_height_for_width (GtkCellRenderer *cell,
                                                        int             *minimum_height,
                                                        int             *natural_height)
 {
-  /* Fall back on the height reported from ->get_size() */
   gtk_cell_renderer_get_preferred_height (cell, widget, minimum_height, natural_height);
 }
 
@@ -1251,7 +1241,6 @@ gtk_cell_renderer_real_get_preferred_width_for_height (GtkCellRenderer *cell,
                                                        int             *minimum_width,
                                                        int             *natural_width)
 {
-  /* Fall back on the width reported from ->get_size() */
   gtk_cell_renderer_get_preferred_width (cell, widget, minimum_width, natural_width);
 }
 
diff --git a/gtk/gtkcellrenderer.h b/gtk/gtkcellrenderer.h
index 353ca5ac3c..6eb53587e9 100644
--- a/gtk/gtkcellrenderer.h
+++ b/gtk/gtkcellrenderer.h
@@ -99,7 +99,6 @@ struct _GtkCellRenderer
  * @get_preferred_height: Called to get a renderer’s natural height.
  * @get_preferred_width_for_height: Called to get a renderer’s natural width for height.
  * @get_aligned_area: Called to get the aligned area used by @cell inside @cell_area.
- * @get_size: Called to get the width and height needed to render the cell. Deprecated: 3.0.
  * @snapshot: Called to snapshot the content of the #GtkCellRenderer.
  * @activate: Called to activate the content of the #GtkCellRenderer.
  * @start_editing: Called to initiate editing the content of the #GtkCellRenderer.
@@ -138,13 +137,6 @@ struct _GtkCellRendererClass
                                                          GtkCellRendererState  flags,
                                                           const GdkRectangle   *cell_area,
                                                           GdkRectangle         *aligned_area);
-  void               (* get_size)                        (GtkCellRenderer      *cell,
-                                                          GtkWidget            *widget,
-                                                          const GdkRectangle   *cell_area,
-                                                          int                  *x_offset,
-                                                          int                  *y_offset,
-                                                          int                  *width,
-                                                          int                  *height);
   void               (* snapshot)                        (GtkCellRenderer      *cell,
                                                           GtkSnapshot          *snapshot,
                                                           GtkWidget            *widget,


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