How to qualify the selection of multiples itens in tree_view? How to catch which itens had been selected in the list of tree_view?
The source code is below.
I am thankful who will be able to help me Very Obliged
#include <stdio.h> #include <gtk/gtk.h>
int main(int argc, char **argv)
{
int i;
GtkWidget *main_window;
GtkWidget *fixed_mw; GtkWidget *tree_view;
GtkWidget *scrolled_window;
GtkListStore *model;
GtkTreeIter iter;
GtkCellRenderer *cell;
GtkTreeViewColumn *column;
gtk_init(&argc, &argv);
main_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(main_window), "MyTitleMyTitleMyTitle");
gtk_widget_set_usize(main_window, 650, 350);
g_signal_connect(G_OBJECT(main_window), "destroy", G_CALLBACK(gtk_main_quit), NULL);
fixed_mw = gtk_fixed_new(); gtk_container_add(GTK_CONTAINER(main_window), fixed_mw);
model = gtk_list_store_new(1, G_TYPE_STRING);
tree_view = gtk_tree_view_new();
gtk_tree_view_set_model(GTK_TREE_VIEW(tree_view), GTK_TREE_MODEL(model));
scrolled_window = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
gtk_fixed_put(GTK_FIXED(fixed_mw), scrolled_window, 5, 50);
gtk_widget_set_usize(scrolled_window, 640, 300);
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled_window), GTK_WIDGET(tree_view));
for (i=0;i<20;i++)
{
gchar *msg = g_strdup_printf ("Item%d", i+1);
gtk_list_store_append(GTK_LIST_STORE(model), &iter);
gtk_list_store_set (GTK_LIST_STORE(model), &iter, 0, msg, -1);
g_free(msg);
}
cell = gtk_cell_renderer_text_new();
column = gtk_tree_view_column_new_with_attributes("Itens", cell, "text", 0, NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view), GTK_TREE_VIEW_COLUMN(column));
gtk_widget_show(scrolled_window);
gtk_widget_show(tree_view);
gtk_widget_show(fixed_mw);
gtk_widget_show(main_window);
gtk_main();
return 0;
}
_______________________________________________
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list