GtkFileSelection
- From: Axel <axel azerty netcourrier com>
- To: gtk-list <gtk-list gnome org>, gtk-app-devel-list gnome org
- Subject: GtkFileSelection
- Date: Tue, 25 Mar 2003 22:21:34 +0100
hi
I want to use a file selector
http://developer.gnome.org/doc/API/2.0/gtk/GtkFileSelection.html
describe one of the possible utilisation
but the code given in example looks strange , correct me if I am wrong
but following code can' t work :
void store_filename (GtkFileSelection *file_selector, gpointer user_data){ }
void create_file_selection (void) {
GtkWidget *file_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),
NULL);
}
the item sent to the handler is a GtkButton, and handler wait for a GtkFileSelection
so storing the filename with this method is not possible
following the log of the test program with the method from API
GLib-GObject-WARNING **: invalid cast from `GtkButton' to `GtkFileSelection'
(projet:1056): Gtk-CRITICAL **: file gtkfilesel.c: line 1242 (gtk_file_selection_get_filename): assertion `GTK_IS_FILE_SELECTION (filesel)' failed
so i don' t think being wrong.
so the handler to use shoud be
void store_filename (GtkButton *ok_button, GtkFileSelection){ }
and the connect :
g..connect(GTK_OBJECT (file_selector->ok_button),"clicked",G_CALLBACK (store_filename),file_selector);
but I don' t like that, because I d like to store filename in another variable that i can pass to create_file_selection() or in another way, not a local variable to store_filename()
How could I do?
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]