Fix g_object_new(GTK_TYPE_SNAPSHOT)

GJS apparent likes g_object_new() over actual constructors, so make that work.
This commit is contained in:
Benjamin Otte 2022-08-01 20:08:58 +00:00
parent 9bce70ed8d
commit 09f0c96b9b

View File

@ -179,11 +179,6 @@ gtk_snapshot_class_init (GtkSnapshotClass *klass)
gobject_class->dispose = gtk_snapshot_dispose;
}
static void
gtk_snapshot_init (GtkSnapshot *self)
{
}
static GskRenderNode *
gtk_snapshot_collect_default (GtkSnapshot *snapshot,
GtkSnapshotState *state,
@ -270,6 +265,18 @@ gtk_snapshot_state_clear (GtkSnapshotState *state)
gsk_transform_unref (state->transform);
}
static void
gtk_snapshot_init (GtkSnapshot *self)
{
gtk_snapshot_states_init (&self->state_stack);
gtk_snapshot_nodes_init (&self->nodes);
gtk_snapshot_push_state (self,
NULL,
gtk_snapshot_collect_default,
NULL);
}
/**
* gtk_snapshot_new:
*
@ -280,19 +287,7 @@ gtk_snapshot_state_clear (GtkSnapshotState *state)
GtkSnapshot *
gtk_snapshot_new (void)
{
GtkSnapshot *snapshot;
snapshot = g_object_new (GTK_TYPE_SNAPSHOT, NULL);
gtk_snapshot_states_init (&snapshot->state_stack);
gtk_snapshot_nodes_init (&snapshot->nodes);
gtk_snapshot_push_state (snapshot,
NULL,
gtk_snapshot_collect_default,
NULL);
return snapshot;
return g_object_new (GTK_TYPE_SNAPSHOT, NULL);
}
/**