F I R S T E D I T A B L E T R E E I N T H E G E M - G R A P H C L I E N T W I N D O W (to comment & clean)
This commit is contained in:
parent
8dcd4fc8be
commit
3a6ecd70c6
|
@ -322,12 +322,13 @@ GtkWidget *create_a_button(GemGraphClientWindow *my_window)
|
||||||
|
|
||||||
g_signal_connect (button, "clicked", G_CALLBACK (print_hello), NULL);
|
g_signal_connect (button, "clicked", G_CALLBACK (print_hello), NULL);
|
||||||
|
|
||||||
printf("--------------------------------------------------------- tree.c line 325\n\
|
printf("----------------------------------------------------------- tree.c line 325\n\
|
||||||
Current obstacle : invalid use of incomplete typedef 'GemGraphClientWindow'\n\
|
Current obstacle : invalid use of incomplete typedef 'GemGraphClientWindow'\n\
|
||||||
How to enable the 'tree.c' code (line 318) to create widgets in the main window ?\n\
|
How to enable the 'tree.c' code (line 318) to create widgets in the main window ?\n\
|
||||||
(In the meanwhile, you can click the 'new button' in the GtkBox.)\n\
|
- The currently displayed tree code is at the end of file : window.c -\n\
|
||||||
|
(In the meanwhile, you can click the 'new button' at the bottom of the GtkBox.)\n\n\
|
||||||
NB The speed makefile bug has been fixed in branch [devel]\n\
|
NB The speed makefile bug has been fixed in branch [devel]\n\
|
||||||
(but not here, in [origin/dev/ui-simple-tree])\n");
|
but not here, in branch [origin/dev/ui-simple-tree]\n");
|
||||||
|
|
||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,6 +128,15 @@ static void gem_graph_client_window_init(GemGraphClientWindow *self)
|
||||||
//XXX TEMP ui_setup_glarea(window->run_glarea, window->run_controls);
|
//XXX TEMP ui_setup_glarea(window->run_glarea, window->run_controls);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Est-ce que c'est encore utile ?
|
||||||
|
|
||||||
|
if (!gtk_widget_get_visible (my_window))
|
||||||
|
gtk_widget_set_visible (my_window, TRUE);
|
||||||
|
else
|
||||||
|
gtk_window_destroy (GTK_WINDOW (my_window));
|
||||||
|
*/
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static void create_my_list_model();
|
static void create_my_list_model();
|
||||||
|
@ -148,7 +157,7 @@ void ui_set_stack(const char *mode)
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
gtk_menu_button_set_icon_name(window->main_button_mode, "system-run-symbolic");
|
gtk_menu_button_set_icon_name(window->main_button_mode, "system-run-symbolic");
|
||||||
create_my_list_model();
|
create_my_list_model(window);
|
||||||
create_a_button_in_(window);
|
create_a_button_in_(window);
|
||||||
create_a_button(window); // <<< This function is in tree.c
|
create_a_button(window); // <<< This function is in tree.c
|
||||||
break;
|
break;
|
||||||
|
@ -320,7 +329,7 @@ static GListStore *create_node_recursive (GListModel *model, // GListStore* g_
|
||||||
int depth)
|
int depth)
|
||||||
{
|
{
|
||||||
if (model == NULL)
|
if (model == NULL)
|
||||||
printf("tree.c > print test() in : create_node_recursive()");
|
printf("tree.c > print test() in : create_node_recursive()\n");
|
||||||
|
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
|
|
||||||
|
@ -328,7 +337,7 @@ static GListStore *create_node_recursive (GListModel *model, // GListStore* g_
|
||||||
model = gtk_tree_store_new (NUM_COLUMNS, G_TYPE_STRING);
|
model = gtk_tree_store_new (NUM_COLUMNS, G_TYPE_STRING);
|
||||||
|
|
||||||
while (current_item->label) {
|
while (current_item->label) {
|
||||||
if (1) printf("[%d] %s, ", depth, current_item->label);
|
if (1) printf("[%d]-%s, ", depth, current_item->label);
|
||||||
gtk_tree_store_append (model, &iter, iter_parent);
|
gtk_tree_store_append (model, &iter, iter_parent);
|
||||||
gtk_tree_store_set (model, &iter, STRING_COLUMN, current_item->label, -1);
|
gtk_tree_store_set (model, &iter, STRING_COLUMN, current_item->label, -1);
|
||||||
|
|
||||||
|
@ -346,10 +355,42 @@ static GListStore *create_node_recursive (GListModel *model, // GListStore* g_
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void create_my_list_model()
|
static void create_my_list_model(GemGraphClientWindow *my_window)
|
||||||
{
|
{
|
||||||
|
GtkWidget *my_tree_box;
|
||||||
|
GtkWidget *my_scrolled_window;
|
||||||
GListStore *my_list_model = NULL;
|
GListStore *my_list_model = NULL;
|
||||||
|
GtkWidget *my_tree_view;
|
||||||
|
GtkCellRenderer *renderer;
|
||||||
|
|
||||||
my_list_model = create_node_recursive (my_list_model, O, NULL, 0);
|
my_list_model = create_node_recursive (my_list_model, O, NULL, 0);
|
||||||
printf(" << tree is OK\n");
|
printf(" << tree successfully created !\n");
|
||||||
|
|
||||||
|
my_tree_view = gtk_tree_view_new_with_model (my_list_model);
|
||||||
|
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (my_tree_view), FALSE);
|
||||||
|
gtk_tree_view_set_enable_tree_lines (GTK_TREE_VIEW (my_tree_view), TRUE);
|
||||||
|
gtk_widget_set_vexpand (my_tree_view, TRUE);
|
||||||
|
gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (my_tree_view)),
|
||||||
|
GTK_SELECTION_MULTIPLE);
|
||||||
|
gtk_tree_view_set_reorderable (GTK_TREE_VIEW (my_tree_view), TRUE);
|
||||||
|
g_object_unref (my_list_model);
|
||||||
|
|
||||||
|
renderer = gtk_cell_renderer_text_new (); g_object_set (renderer, "xalign", 0.0, NULL);
|
||||||
|
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (my_tree_view), -1,
|
||||||
|
"Col 0", renderer, "text", STRING_COLUMN, NULL);
|
||||||
|
|
||||||
|
my_scrolled_window = gtk_scrolled_window_new ();
|
||||||
|
gtk_scrolled_window_set_has_frame (GTK_SCROLLED_WINDOW (my_scrolled_window), TRUE);
|
||||||
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (my_scrolled_window),
|
||||||
|
GTK_POLICY_AUTOMATIC,
|
||||||
|
GTK_POLICY_AUTOMATIC);
|
||||||
|
gtk_box_append (GTK_BOX (my_window->runlib_objects), my_scrolled_window);
|
||||||
|
gtk_widget_show(my_tree_box);
|
||||||
|
|
||||||
|
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (my_scrolled_window), my_tree_view);
|
||||||
|
|
||||||
|
/* expand all rows after the my_tree_view widget has been realized */
|
||||||
|
g_signal_connect (my_tree_view, "realize",
|
||||||
|
G_CALLBACK (gtk_tree_view_expand_all), NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue