Seeking assistance in obtaining a list of style
properties for a GtkWidget (GtkButton). Here is the current code I have:
#include <gtk/gtk.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main (int argc, char *argv[])
{
// Declare variables.
GtkWidget *btn = gtk_button_new();
guint *count = {0};
GParamSpec **list = NULL;
// Initialize gtk.
gtk_init(&argc, &argv);
// Obtain style properties.
list = gtk_widget_class_list_style_properties(GTK_WIDGET_CLASS(btn), count);
// Exit program.
exit(EXIT_SUCCESS);
}
The compilation is successful with:
gcc -o gtk_test gtk_test.c `pkg-config --cflags --libs gtk+-3.0`
However, upon execution, the following errors occur:
(process:72182): Gtk-CRITICAL **: 10:42:23.167: _gtk_style_provider_private_get_settings: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed
(process:72182): Gtk-CRITICAL **: 10:42:23.167: _gtk_style_provider_private_get_settings: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed
(process:72182): Gtk-CRITICAL **: 10:42:23.167: _gtk_style_provider_private_get_settings: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed
Segmentation fault
It seems like I might be missing something in my code, and the examples I find using
gtk_widget_class_list_style_properties
are not clear to me. They often mention klass
as the first argument, but I'm unsure where klass
is declared or what it represents.
If anyone could offer guidance or point me in the right direction, I would greatly appreciate it. I attempted to search for GTK_WIDGET_CLASS
on the gtk website, but unfortunately, no relevant results were retrieved.
What should I use for the argument of GTK_WIDGET_CLASS
to retrieve the style properties for a GtkButton
?