g_signal_connect (factory, setup, G_CALLBACK(on_experimental_tree_setup_factory), NULL); < comme si je n'appelais pas; < pourquoi ?
This commit is contained in:
parent
1a1b369fbb
commit
eec2ddeddb
18
display.c
18
display.c
|
@ -1,6 +1,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <gtk-4.0/gtk/gtk.h>
|
#include <gtk-4.0/gtk/gtk.h>
|
||||||
|
|
||||||
|
#include "hot.h"
|
||||||
#include "cold.h"
|
#include "cold.h"
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
#include "contain.h"
|
#include "contain.h"
|
||||||
|
@ -251,6 +252,23 @@ GtkBox *get_rules_comparator_new(){
|
||||||
return comparator;
|
return comparator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GtkBox *get_experimental_box_new(){
|
||||||
|
GtkBox *experimental_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_VERTICAL, 0));
|
||||||
|
gtk_widget_set_size_request (GTK_WIDGET (experimental_box), 0, 400);
|
||||||
|
gtk_box_append (experimental_box, GTK_WIDGET(gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
||||||
|
gtk_box_append (experimental_box, GTK_WIDGET(gtk_label_new ("\n\n")));
|
||||||
|
create_experimental_tree(experimental_box);
|
||||||
|
gtk_box_append (experimental_box, GTK_WIDGET(gtk_label_new ("\n\n")));
|
||||||
|
return experimental_box;
|
||||||
|
}
|
||||||
|
|
||||||
|
GtkBox *get_rules_user_tree_new(){
|
||||||
|
GtkBox *tree_sketch_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_VERTICAL, 0));
|
||||||
|
gtk_box_append (tree_sketch_box, GTK_WIDGET (get_experimental_box_new()));
|
||||||
|
ui_create_tree (GTK_WIDGET (tree_sketch_box));
|
||||||
|
return tree_sketch_box;
|
||||||
|
}
|
||||||
|
|
||||||
GtkWidget *get_rules_tree_hpaned_new(){
|
GtkWidget *get_rules_tree_hpaned_new(){
|
||||||
GtkPaned *H_tree_vs_comparison = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_HORIZONTAL));
|
GtkPaned *H_tree_vs_comparison = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_HORIZONTAL));
|
||||||
|
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
display.o: display.c cold.h display.h contain.h texts.h tree.h
|
display.o: display.c hot.h warm.h \
|
||||||
|
/gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib.h \
|
||||||
|
cold.h display.h contain.h texts.h tree.h
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
GtkWidget *get_text_view();
|
GtkWidget *get_text_view();
|
||||||
GtkFrame *get_frame_with_label();
|
GtkFrame *get_frame_with_label();
|
||||||
GtkWidget *get_run_rules_page_new();
|
GtkWidget *get_run_rules_page_new();
|
||||||
|
GtkBox *get_rules_user_tree_new();
|
||||||
|
|
||||||
GtkWidget *get_image_ALL_SPACE();
|
GtkWidget *get_image_ALL_SPACE();
|
||||||
GtkWidget *get_image_GLUTAMATE();
|
GtkWidget *get_image_GLUTAMATE();
|
||||||
|
|
71
hot.c
71
hot.c
|
@ -13,16 +13,28 @@
|
||||||
// GTK_ORIENTATION_VERTICAL GTK_ORIENTATION_HORIZONTAL
|
// GTK_ORIENTATION_VERTICAL GTK_ORIENTATION_HORIZONTAL
|
||||||
|
|
||||||
|
|
||||||
|
static void on_experimental_tree_bind_factory (GtkSignalListItemFactory *factory,
|
||||||
|
GObject* object,
|
||||||
|
gpointer user_data);
|
||||||
|
|
||||||
static void on_experimental_expander_toggled(GtkExpander *expander, gpointer user_data){
|
static void on_experimental_expander_toggled(GtkExpander *expander, gpointer user_data){
|
||||||
gtk_expander_set_expanded (expander, gtk_expander_get_expanded (expander));
|
gtk_expander_set_expanded (expander, gtk_expander_get_expanded (expander));
|
||||||
printf("> %s\n", gtk_expander_get_label (user_data));
|
printf("> %s\n", gtk_expander_get_label (user_data));
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkBox *get_experimental_box_new(){
|
void on_experimental_tree_setup_factory (GtkSignalListItemFactory *factory,
|
||||||
GtkBox *experimental_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_VERTICAL, 0));
|
GObject* object,
|
||||||
gtk_widget_set_size_request (GTK_WIDGET (experimental_box), 0, 400);
|
gpointer user_data)
|
||||||
gtk_box_append (experimental_box, GTK_WIDGET(gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
{
|
||||||
gtk_box_append (experimental_box, GTK_WIDGET(gtk_label_new ("\n\n")));
|
GtkWidget* expander = gtk_expander_new (NULL);
|
||||||
|
gtk_list_item_set_child (GTK_LIST_ITEM(object), expander);
|
||||||
|
printf("[on_experimental_tree_setup_factory] here is an expander\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void create_experimental_tree (GtkBox *experimental_box){
|
||||||
|
GtkSignalListItemFactory *factory = GTK_SIGNAL_LIST_ITEM_FACTORY (gtk_signal_list_item_factory_new ());
|
||||||
|
g_signal_connect (factory, "setup", G_CALLBACK(on_experimental_tree_setup_factory), NULL);
|
||||||
|
g_signal_connect (factory, "bind", G_CALLBACK(on_experimental_tree_bind_factory), NULL);
|
||||||
|
|
||||||
GtkExpander *hello = GTK_EXPANDER (gtk_expander_new ("hello !"));
|
GtkExpander *hello = GTK_EXPANDER (gtk_expander_new ("hello !"));
|
||||||
gtk_expander_set_expanded (GTK_EXPANDER (hello), TRUE);
|
gtk_expander_set_expanded (GTK_EXPANDER (hello), TRUE);
|
||||||
|
@ -35,8 +47,51 @@ GtkBox *get_experimental_box_new(){
|
||||||
gtk_widget_set_margin_start(GTK_WIDGET (it_s_me), 20);
|
gtk_widget_set_margin_start(GTK_WIDGET (it_s_me), 20);
|
||||||
g_signal_connect (it_s_me, "activate", G_CALLBACK (on_experimental_expander_toggled), it_s_me);
|
g_signal_connect (it_s_me, "activate", G_CALLBACK (on_experimental_expander_toggled), it_s_me);
|
||||||
gtk_box_append (experimental_box, GTK_WIDGET (it_s_me));
|
gtk_box_append (experimental_box, GTK_WIDGET (it_s_me));
|
||||||
|
|
||||||
gtk_box_append (experimental_box, GTK_WIDGET(gtk_label_new ("\n\n")));
|
|
||||||
return experimental_box;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void on_experimental_tree_bind_factory (GtkSignalListItemFactory *factory,
|
||||||
|
GObject* object,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
// GObject *item;
|
||||||
|
const gchar *text;
|
||||||
|
GtkTreeListRow *row;
|
||||||
|
GtkListItem *list_item;
|
||||||
|
GtkWidget *expander;
|
||||||
|
|
||||||
|
list_item= GTK_LIST_ITEM(object);
|
||||||
|
row = gtk_list_item_get_item(list_item);
|
||||||
|
if (row != NULL) {
|
||||||
|
text = gtk_string_object_get_string(GTK_STRING_OBJECT(gtk_tree_list_row_get_item(row)));
|
||||||
|
expander = gtk_list_item_get_child(list_item);
|
||||||
|
gtk_expander_set_label(GTK_EXPANDER(expander), text);
|
||||||
|
|
||||||
|
// Disconnect previous signal handlers to avoid stacking them
|
||||||
|
// TODO g_signal_handlers_disconnect_by_func(expander, G_CALLBACK(on_tree_expander_toggled), row);
|
||||||
|
|
||||||
|
// Connect the signal handler
|
||||||
|
// TODO g_signal_connect(expander, "activate", G_CALLBACK(on_tree_expander_toggled), row);
|
||||||
|
|
||||||
|
gtk_widget_set_margin_start(expander, gtk_tree_list_row_get_depth(row)*20);
|
||||||
|
gboolean is_expanded = gtk_tree_list_row_get_expanded(row);
|
||||||
|
printf("[on_experimental_tree_bind_factory] here is %s content and expander is %d\n",
|
||||||
|
text,
|
||||||
|
is_expanded);
|
||||||
|
} else {
|
||||||
|
printf("[on_tree_bind_factory] here is NON content\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
6
hot.h
6
hot.h
|
@ -12,5 +12,7 @@
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
#include "contain.h"
|
#include "contain.h"
|
||||||
|
|
||||||
|
void on_experimental_tree_setup_factory (GtkSignalListItemFactory *factory,
|
||||||
GtkBox *get_experimental_box_new();
|
GObject* object,
|
||||||
|
gpointer user_data);
|
||||||
|
void create_experimental_tree (GtkBox *experimental_box);
|
||||||
|
|
10
tree.c
10
tree.c
|
@ -188,7 +188,7 @@ GListModel* ui_tree_create_model_func(GObject *item, gpointer root)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Application activation callback
|
// Application activation callback
|
||||||
static void ui_create_tree (GtkWidget *target_widget)
|
void ui_create_tree (GtkWidget *target_widget)
|
||||||
{
|
{
|
||||||
GtkStringList *model;
|
GtkStringList *model;
|
||||||
GtkTreeListModel *tree_model;
|
GtkTreeListModel *tree_model;
|
||||||
|
@ -260,11 +260,3 @@ static void ui_create_tree (GtkWidget *target_widget)
|
||||||
gtk_widget_set_visible(GTK_WIDGET(scrolled_window), TRUE);
|
gtk_widget_set_visible(GTK_WIDGET(scrolled_window), TRUE);
|
||||||
gtk_widget_set_visible(GTK_WIDGET(list_view), TRUE);
|
gtk_widget_set_visible(GTK_WIDGET(list_view), TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkBox *get_rules_user_tree_new(){
|
|
||||||
GtkBox *tree_sketch_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_VERTICAL, 0));
|
|
||||||
gtk_box_append (tree_sketch_box, GTK_WIDGET (get_experimental_box_new()));
|
|
||||||
ui_create_tree (GTK_WIDGET (tree_sketch_box));
|
|
||||||
return tree_sketch_box;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
2
tree.h
2
tree.h
|
@ -7,4 +7,4 @@
|
||||||
/* */
|
/* */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
GtkBox *get_rules_user_tree_new();
|
void ui_create_tree (GtkWidget *target_widget);
|
||||||
|
|
Loading…
Reference in New Issue