bug in fileselector manual



Hi !
I found an fail in the reference manual of gtk+
http://developer.gnome.org/doc/API/2.0/gtk/GtkFileSelection.html
in the example
void store_filename (GtkFileSelection *file_selector, gpointer
user_data)
but file_selector is not an GtkFileSelection but an GtkButton
Regards
Garaboncias
-----------------------------------
correctly (an example):

/* The file selection widget and the string to store the chosen filename
*/

void store_filename (GtkButton *button, gpointer user_data) {   //
CHANGED THIS LINE
   const gchar *selected_filename;

   selected_filename = gtk_file_selection_get_filename
(GTK_FILE_SELECTION (user_data));
   g_print ("Selected filename: s\n", selected_filename);
}

void create_file_selection (void) {

   GtkWidget *file_selector;

   /* Create the selector */
   
   file_selector = gtk_file_selection_new ("Please select a file for
editing.");
   
   g_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION
(file_selector)->ok_button),
                     "clicked",
                     G_CALLBACK (store_filename),
                     (gpointer) file_selector); // CHANGED THIS LINE
                          
   /* Ensure that the dialog box is destroyed when the user clicks a
button. */
   
   g_signal_connect_swapped (GTK_OBJECT (GTK_FILE_SELECTION
(file_selector)->ok_button),
                             "clicked",
                             G_CALLBACK (gtk_widget_destroy), 
                             (gpointer) file_selector); 

   g_signal_connect_swapped (GTK_OBJECT (GTK_FILE_SELECTION
(file_selector)->cancel_button),
                             "clicked",
                             G_CALLBACK (gtk_widget_destroy),
                             (gpointer) file_selector); 
   
   /* Display that dialog */
   
   gtk_widget_show (file_selector);
}




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