[Glade-users] gtk_treeview



hi;

    i want to append output of gtk_file_selection_get_file_name(fs) to
tree_view list_store. when ok button of "fs" pressed file_name has to
append to the list_store.

   so in the callback of ok_sel i given code as;


    GtkListStore *store;
    GtkTreeIter iter;
    GtkWidget *treeview;
    GtkCellRenderer *renderer;
    GtkTreeViewColumn *column;
    GtkWidget *sst_file_sel;
    GtkTreeModel *model; 

sst_file_sel = create_window_tree ();   /*dev with glade to create
window*/
treeview = lookup_widget (sst_file_sel, "treeview1");

model = gtk_tree_view_get_model (GTK_TREE_VIEW (treeview));
         
gchar *data_arr =(gchar*) gtk_file_selection_get_filename
(GTK_FILE_SELECTION (fs));
    static file_entry data[1] =  {"h", "data_arr"};

store = gtk_list_store_new (NUM_COLUMNS,
      G_TYPE_STRING,
      G_TYPE_STRING);

for ( i=0; i< G_N_ELEMENTS (data); i++) 

{
      gtk_list_store_append (store, &iter);
      gtk_list_store_set (store, &iter,
  COLUMN_FILENAME, data[i].filename,
  COLUMN_FILEDESC, data[i].filedesc,
  -1);
    }

  renderer = gtk_cell_renderer_text_new ();
  column = gtk_tree_view_column_new_with_attributes ("filename",
     renderer,
     "text",
     COLUMN_FILENAME,
     NULL);
  gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
     
  renderer = gtk_cell_renderer_text_new ();
  column = gtk_tree_view_column_new_with_attributes ("Filedescription", 
renderer, "text",  COLUMN_FILEDESC, NULL);
  gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);

    
       i am not sure at how to pass file_name val to the tree_view.
any suggestions.

thanks&regards;

srinivas.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]