summaryrefslogtreecommitdiff
path: root/src/gridview.c
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-07-20 17:36:17 +0300
committerPaul Buetow <paul@buetow.org>2026-07-20 17:36:17 +0300
commitf4eea795c070e5ddca183bc6ff2e4199e39a5cd1 (patch)
tree6ade8142fd5756adf56f63311667fcfd00131699 /src/gridview.c
parent220b3806e97da745bad6f3b42fd6dfabd4e28c0b (diff)
gridview: allocate the flowbox via GtkBinLayout so the grid renders (fixes black grid)
GgazeGrid is a GtkWidget with a single child (the GtkScrolledWindow holding the GtkFlowBox) but set no layout manager and overrode no measure/size_allocate vfunc, so GTK4 never allocated the child and the grid stayed a 0x0 black area (`Trying to snapshot GtkScrolledWindow without a current allocation`). Add a GtkBinLayout in class_init so the child is sized to fill the grid and the flowbox renders.
Diffstat (limited to 'src/gridview.c')
-rw-r--r--src/gridview.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/gridview.c b/src/gridview.c
index c8336e8..56267b3 100644
--- a/src/gridview.c
+++ b/src/gridview.c
@@ -268,9 +268,14 @@ ggaze_grid_finalize(GObject *p_obj) {
static void
ggaze_grid_class_init(GgazeGridClass *p_klass) {
- GObjectClass *p_oc = G_OBJECT_CLASS(p_klass);
- p_oc->dispose = ggaze_grid_dispose;
- p_oc->finalize = ggaze_grid_finalize;
+ GObjectClass *p_oc = G_OBJECT_CLASS(p_klass);
+ GtkWidgetClass *p_wc = GTK_WIDGET_CLASS(p_klass);
+ p_oc->dispose = ggaze_grid_dispose;
+ p_oc->finalize = ggaze_grid_finalize;
+ /* GgazeGrid has a single child (the GtkScrolledWindow holding the
+ * GtkFlowBox); GtkBinLayout allocates it to fill the grid so the flowbox
+ * actually gets sized and renders instead of staying a 0x0 black area. */
+ gtk_widget_class_set_layout_manager_type(p_wc, GTK_TYPE_BIN_LAYOUT);
u_activate_signal =
g_signal_new("activate", G_TYPE_FROM_CLASS(p_klass), G_SIGNAL_RUN_LAST, 0,
NULL, NULL, g_cclosure_marshal_generic, G_TYPE_NONE, 0);