Problem with GtkList & gtk_object_set_data




  Hi all !!   and sorry for my english :)
        
        I have a problem with  recovery  of text data in GtkList. 
        I have this code :

   .....

        list_dir=CreateListDir(GTK_WIDGET(vboxDir));            

                gtk_signal_connect(GTK_OBJECT(list_dir), "select_child",
                      GTK_SIGNAL_FUNC (dir_selection), NULL );

...
void AddListDir(GtkWidget       *list, gchar    *dirname,gchar  *fullPath)
{       
        gchar                *item_data;
        GtkWidget               *item;
        
         g_return_if_fail ( list != NULL);
        g_return_if_fail ( (char        *) dirname !=NULL);
        g_return_if_fail ( (char        *) fullPath !=NULL);
        
        item=gtk_list_item_new_with_label(dirname);
        gtk_container_add(GTK_CONTAINER(list),item);
        gtk_widget_show(item);
        
        gtk_object_set_data(GTK_OBJECT(item), "datos",  (gpointer) fullPath);
        item_data=gtk_object_get_data( GTK_OBJECT(item ), "datos");             
        g_print("Saliendo de AddListDir %s\n",item_data);

}
 Now I have fullPath attached with item ...  but  i don't know how retrieve  this.
        I make ...
....
 void dir_selection(GtkList *list, gpointer user_data)
{       
        GtkObject               *item;
        gchar            *item_data;
        GList             *lista;
        
        g_return_if_fail( list !=NULL); 

        lista=GTK_LIST(item)->selection;        
        if(!lista) return;

        item=GTK_OBJECT(lista->data);
        item_data=gtk_object_get_data( GTK_OBJECT( item ), "datos");
                
        g_return_if_fail( item_data != NULL);   
        g_print("En dir_selection       : %s\n", item_data);    /*     Trash  Why ??   */

  return;
}
     
     Thanks in advance and  again sorry for my english.  :-)

        César a.k.a insallah 


   



  
  



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