Indentation ok!

This commit is contained in:
Adrien Bourmault 2024-02-12 12:52:38 +01:00
parent 9753e4c6e1
commit 5dffcee4a1
Signed by: neox
GPG Key ID: 2974E1D5F25DFCC8
2 changed files with 17 additions and 2 deletions

Binary file not shown.

19
main.c
View File

@ -75,12 +75,16 @@ GListModel* get_children_model (struct TreeNode_t *parent)
{
struct TreeNode_t *child;
GtkStringList *list = gtk_string_list_new(NULL);
GtkStringList *list = NULL;
if (parent) {
printf("[get_children_model] here is %s content : ", parent->text);
child = parent->child;
if (child) {
list = gtk_string_list_new(NULL);
}
while(child) {
gtk_string_list_append(list, child->text);
printf("%s ", child->text);
@ -133,8 +137,18 @@ void bind_factory (GtkListItemFactory *factory, GtkListItem *list_item, gpointer
text = gtk_string_object_get_string(GTK_STRING_OBJECT(gtk_tree_list_row_get_item(row)));
GtkWidget *expander = gtk_list_item_get_child(list_item);
gtk_expander_set_label(GTK_EXPANDER(expander), text);
printf("[bind_factory] here is %s content\n", text);
gtk_tree_list_row_set_expanded(row, !is_expanded);
if (gtk_tree_list_row_get_children(row)) {
printf("[bind_factory] here is %s content (childs)\n", text);
} else {
printf("[bind_factory] here is %s content (no childs)\n", text);
}
gtk_widget_set_margin_start(expander, gtk_tree_list_row_get_depth(row)*20);
//g_object_unref(row); // Decrease the reference count when done
} else {
printf("[bind_factory] here is NON %s content\n", text);
@ -182,6 +196,7 @@ int main (int argc, char **argv)
root = create_tree_node("Root");
add_child_node(root, create_tree_node("Child 1"));
add_child_node(root, create_tree_node("Child 2"));
GtkApplication *app = gtk_application_new("org.gtk.example", G_APPLICATION_FLAGS_NONE);
g_signal_connect(app, "activate", G_CALLBACK(app_activate), NULL);
int status = g_application_run(G_APPLICATION(app), argc, argv);