[Glade-users] tree append
- From: srinivas at comodo.com (srinivas)
- Subject: [Glade-users] tree append
- Date: Thu Jul 7 09:17:43 2005
hi,
i am developing tree view with glade, i am getting error like;
(gtk_tree_view_get_model): assertion `GTK_IS_TREE_VIEW (tree_view)'
failed
file gtkliststore.c: line 1320 (gtk_list_store_append): assertion
`GTK_IS_LIST_STORE (list_store)' failed
file gtkliststore.c: line 923 (gtk_list_store_set): assertion
`GTK_IS_LIST_STORE (list_store)' failed
here i gave the code.
`on_button_pressed (GtkButton *button,
gpointer user_data)
{
gtk_widget_show (create_window_simple_entry());->displays the window
with entry, and button
}
void
on_entry_activate (GtkEntry *entry,
gpointer user_data)
{
GtkWidget *win_simp_entry, *win_simp_list, *win_simp_list1,
*button;
win_simp_list1 = create_window_simp_list ();
win_simp_list = lookup_widget (win_simp_list1,
"window_simp_list");->
to refer main window_simp_entry
|->
treeview developed with glade.
treeview = lookup_widget (win_simp_list, "treeview_simp_list");
win_simp_entry = lookup_widget(GTK_WIDGET (button),
"window_simp_entry");
button = lookup_widget (win_simp_entry, "button_simp_entry");
g_signal_connect(entry, "activate",
G_CALLBACK(on_button_entry_pressed), NULL);
g_signal_connect_swapped(button, "clicked",
G_CALLBACK(on_button_entry_pressed), entry);
}
void
on_button_entry_pressed (GtkButton *button,
gpointer user_data)
{
GtkWidget *win_simp_entry, *win_simp_list, *win_simp_list1,
*entry;
const gchar *txt;
GtkCellRenderer *cell;
GtkTreeViewColumn *file_column;
GtkTreeSelection *sel;
//GtkListStore *liststore, *tree_store;
GtkWidget *view;
win_simp_list1 = create_window_simp_list ();
win_simp_list = lookup_widget(win_simp_list1,
"window_simp_list");
//treeview = lookup_widget(win_simp_list, "treeview_simp_list");
win_simp_entry = lookup_widget
(GTK_WIDGET(button),"window_simp_entry");
entry = lookup_widget (win_simp_entry, "entry_simp_list_entry");
//button = lookup_widget(win_simp_entry, "button_simp_entry");
g_assert (GTK_IS_ENTRY (entry));
txt = gtk_entry_get_text (GTK_ENTRY(entry));
if (txt && *txt)
{
GtkTreeModel *model;
GtkTreeIter newrow;
model = gtk_tree_view_get_model (GTK_TREE_VIEW
(treeview));
gtk_list_store_append (GTK_LIST_STORE (model), &newrow);
gtk_list_store_set (GTK_LIST_STORE (model), &newrow,
COL_TEXT, txt,
-1);
gtk_entry_set_text (GTK_ENTRY (entry), " ");
}
//gtk_widget_show_all (win_simp_list);
}
static GtkWidget *
create_list_view (void)
{
GtkWidget *win_simp_entry, *win_simp_list, *win_simp_list1,
*entry;
const gchar *txt;
GtkCellRenderer *cell;
GtkTreeViewColumn *file_column;
GtkTreeSelection *sel;
GtkListStore *tree_store;
GtkWidget *view;
win_simp_list1 = create_window_simp_list ();
win_simp_list = lookup_widget(win_simp_list1,
"window_simp_list");
treeview = lookup_widget(win_simp_list, "treeview_simp_list");
tree_store = gtk_list_store_new(1, G_TYPE_STRING);
gtk_tree_view_set_model(GTK_TREE_VIEW(treeview), GTK_TREE_MODEL
(tree_store));
cell = gtk_cell_renderer_text_new();
file_column = gtk_tree_view_column_new_with_attributes
(_("File"),
cell, "text", 0, COL_TEXT);
gtk_tree_view_append_column(GTK_TREE_VIEW(treeview),
GTK_TREE_VIEW_COLUMN(file_column));
return treeview;
}
what am i doing wrong;
Thanks&Regards;
Srinivas
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]