[Glade-users] gtktreeappend
- From: srinivas at comodo.com (srinivas)
- Subject: [Glade-users] gtktreeappend
- Date: Thu Jul 7 11:16:16 2005
hi;
i creeated with glade like, window with button_simp_list_get_ent,
and treeview_ent_widget, when i press button_simp_list_get_ent, another
window with entry_simp_list_entry, and button_simp_entry, will pop up.
now when i enter data and press button_simp_entry, the entered text has
to append to the treeview_ent_widget(created with glade). window
displaying but i can't able to append data. i am not getting any error.
here is the developed one:
enum
{
COL_TEXT = 0,
NUM_COLS
};
void
on_button_simp_list_get_ent_pressed (GtkButton *button,
gpointer user_data)
{
gtk_widget_show (create_window_simp_entry());/*-->displays window
with entry, button*/
}
void
on_entry_simp_list_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");
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_simp_entry_pressed), NULL);
g_signal_connect_swapped(button, "clicked",
G_CALLBACK(on_button_simp_entry_pressed), entry);
}
GtkWidget *
create_list_view (void)
{
GtkWidget *win_simp_entry, *win_simp_list, *win_simp_list1, *entry;
const gchar *txt;
GtkCellRenderer *cell, *renderer;
GtkTreeViewColumn *file_column, *col;
GtkTreeSelection *sel;
GtkListStore *tree_store;
GtkWidget *treeview, *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_ent_widget");/*-->created with glade*/
tree_store = gtk_list_store_new(1, G_TYPE_STRING);
//gtk_tree_view_set_model(GTK_TREE_VIEW(treeview), GTK_TREE_MODEL
(tree_store));
treeview = gtk_tree_view_new_with_model (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));
gtk_widget_show_all (win_simp_list);
return treeview;
}
void
on_button_simp_entry_pressed (GtkButton *button,
gpointer user_data)
{
GtkWidget *win_simp_entry, *win_simp_list, *win_simp_list1, *entry;
const gchar *txt;
GtkCellRenderer *renderer, *cell;
GtkTreeViewColumn *col, *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");
win_simp_entry = lookup_widget (GTK_WIDGET(button),"window_simp_entry");
entry = lookup_widget (win_simp_entry, "entry_simp_list_entry");
g_assert (GTK_IS_ENTRY (entry));
txt = gtk_entry_get_text (GTK_ENTRY(entry));
view = create_list_view ();
if (txt && *txt)
{
GtkTreeModel *model;
GtkTreeIter newrow;
model = gtk_tree_view_get_model (GTK_TREE_VIEW (view));
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), " ");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]