Re: fileselection window

    G> sorry but i'm a newbie with GTK, and i have problem with
    G> fileselection.  i have a fileselection window and i put in my
    G> callbacks.c this line

    G> void
    G> on_ok_button1_clicked                  (GtkButton       *button,
    G> gpointer         user_data)
    G> {
    G> g_print("%s",gtk_file_selection_get_filename(
    G> GTK_FILE_SELECTION(user_data) ));

    G> }

    G> On my output i have this error:

    G> Gtk-WARNING **: invalid cast from (NULL) pointer to `GtkFileSelection'

    G> Gtk-CRITICAL **: file gtkfilesel.c: line 2487
    G> (gtk_file_selection_get_filename): assertion `filesel != NULL' failed.

When you call gtk_signal_connect you need to pass the file selection widget
as user_data so that Gtk will pass it to your callback function:

    file_selector = gtk_file_selection_new("Please select a file for editing.");
    gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION(file_selector)->ok_button),
                        "clicked", GTK_SIGNAL_FUNC (on_ok_button1_clicked),

It looks like you are calling gtk_signal_connect with a NULL fourth argument.

Skip Montanaro (skip pobox com)

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