[evolution-data-server/wip/mcrha/gtk4] Fix ECellRendererColor



commit cccad5c173bd3b923ae64653d1cf3ed9820786d3
Author: Milan Crha <mcrha redhat com>
Date:   Tue Oct 19 14:12:35 2021 +0200

    Fix ECellRendererColor

 src/libedataserverui/e-cell-renderer-color.c | 36 ++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
---
diff --git a/src/libedataserverui/e-cell-renderer-color.c b/src/libedataserverui/e-cell-renderer-color.c
index 9e2191e0c..dc3d7d16b 100644
--- a/src/libedataserverui/e-cell-renderer-color.c
+++ b/src/libedataserverui/e-cell-renderer-color.c
@@ -168,6 +168,40 @@ cell_renderer_color_render (GtkCellRenderer *cell,
 #endif
 }
 
+#if GTK_CHECK_VERSION(4, 0, 0)
+static void
+cell_renderer_color_get_preferred_width (GtkCellRenderer *cell,
+                                        GtkWidget *widget,
+                                        gint *minimum_size,
+                                        gint *natural_size)
+{
+       gint xpad = 0, ypad = 0;
+
+       gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
+
+       if (minimum_size)
+               *minimum_size = 16 + xpad;
+       if (natural_size)
+               *natural_size = 16 + xpad;
+}
+
+static void
+cell_renderer_color_get_preferred_height (GtkCellRenderer *cell,
+                                         GtkWidget *widget,
+                                         gint *minimum_size,
+                                         gint *natural_size)
+{
+       gint xpad = 0, ypad = 0;
+
+       gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
+
+       if (minimum_size)
+               *minimum_size = 16 + ypad;
+       if (natural_size)
+               *natural_size = 16 + ypad;
+}
+#endif
+
 static void
 cell_renderer_color_set_property (GObject *object,
                                   guint property_id,
@@ -230,6 +264,8 @@ e_cell_renderer_color_class_init (ECellRendererColorClass *class)
 #if GTK_CHECK_VERSION(4, 0, 0)
        cell_class->get_aligned_area = cell_renderer_color_get_aligned_area;
        cell_class->snapshot = cell_renderer_color_snapshot;
+       cell_class->get_preferred_width = cell_renderer_color_get_preferred_width;
+       cell_class->get_preferred_height = cell_renderer_color_get_preferred_height;
 #else
        cell_class->get_size = cell_renderer_color_get_size;
        cell_class->render = cell_renderer_color_render;


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