GtkTreeView: Simple application
- From: "Felipe Balbi" <felipebalbi users sourceforge net>
- To: gtk-app-devel-list gnome org
- Subject: GtkTreeView: Simple application
- Date: Sat, 26 May 2007 03:19:49 +0300
Hello all,
I'm starting an app to run Electrical Tests on the USB.
I'm not really good on GTK+ since I've always being developing on kernel-space.
my doubt regards this code:
int main(int argc, char *argv[])
{
GladeXML *openhset;
GtkWidget *main_window, *test_window;
GtkWidget *main_window_treeview1;
GtkWidget *main_window_ok;
GtkListStore *main_window_list;
GtkTreeIter iter;
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
struct usb_bus *bus;
gtk_init(&argc, &argv);
/* Open the XML File */
openhset = glade_xml_new (OPENHSET_XML, NULL, NULL);
/* Get Widgets */
main_window = glade_xml_get_widget (openhset, "main_window");
main_window_ok = glade_xml_get_widget (openhset, "main_window_ok");
main_window_treeview1 = glade_xml_get_widget (openhset,
"main_window_treeview1");
/* Connect signal handlers */
glade_xml_signal_autoconnect (openhset);
/* Create a GtkListStore */
main_window_list = gtk_list_store_new (1, G_TYPE_STRING);
/* Populate the GtkListStore */
gtk_list_store_append (main_window_list, &iter);
gtk_list_store_set (main_window_list, &iter,
0, "TESTING",
-1);
/* Add the GtkListStore to the GtkTreeView */
gtk_tree_view_set_model (GTK_TREE_VIEW (main_window_treeview1),
GTK_TREE_MODEL (main_window_list));
/* Renderer and column */
renderer = gtk_cell_renderer_text_new();
column = gtk_tree_view_column_new_with_attributes ("USB HCD", renderer,
"text", 1, NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (main_window_treeview1), column);
gtk_main();
return 0;
}
So... I can't see the result of:
gtk_list_store_set (main_window_list, &iter,
0, "TESTING",
-1);
It's not being listed in the treeview after building / running the code.
What am I doing wrong??
--
Best Regards,
Felipe Balbi
felipebalbi users sourceforge net
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]