Re: Fileselect info into entry widget.
- From: Harring Figueiredo <harringf yahoo com>
- To: Tony Freeman <tony freeman insightbb com>,	gtk-app-devel-list gnome org
- Cc: 
- Subject: Re: Fileselect info into entry widget.
- Date: Thu, 25 Nov 2004 20:25:08 -0800 (PST)
static gboolean update_entry1_callback 
(GtkWidget *button, GdkEvent *event, GtkEntry *entry)
{
GtkWidget *fileselect1;
fileselect1 = lookup_widget(GTK_WIDGET(button), "fileselect1");
gtk_entry_set_text(entry, gtk_file_selection_get_filename 
                        (GTK_FILE_SELECTION (fileselect1)));
return FALSE;
}
--------------------------------------------------------------
void 
on_button1_clicked (GtkButton *button, gpointer user_data)
{
GtkWidget *fileselect1;
GtkWidget *entry1;
entry1 = lookup_widget(GTK_WIDGET(button), "entry1");
fileselect1 = gtk_file_selection_new("Select PAR/PAR2 file");
gtk_widget_set_name (fileselect1, "fileselect1");
g_signal_connect(G_OBJECT(fileselect1), "destroy", 
               G_CALLBACK(gtk_widget_hide), NULL);
g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(fileselect1)->ok_button), 
               "clicked", 
               G_CALLBACK(update_entry1_callback), 
               G_OBJECT(entry1));
g_signal_connect_swapped(G_OBJECT(GTK_FILE_SELECTION(fileselect1)->cancel_button),
                       "clicked", 
                       G_CALLBACK(gtk_widget_hide), 
                       G_OBJECT(fileselect1));
gtk_widget_show(fileselect1);
}
--------------------------------------------------------------
Here's the error messages I get after clicking the OK button in
the file selection dialog box:
** (program:4873): WARNING **: Widget not found: fileselect1
(program:4873): Gtk-CRITICAL **: file gtkfilesel.c: line 1402
(gtk_file_selection_get_filename): assertion `GTK_IS_FILE_SELECTION
(filesel)' failed
(program:4873): Gtk-CRITICAL **: file gtkentry.c: line 3642
(gtk_entry_set_text): assertion `GTK_IS_ENTRY (entry)' failed
  Your code is correct; however, you are not getting the widget you want
correctly. (It seems that you are using GLADE). 
 Read the Error:
** (program:4873): WARNING **: Widget not found: fileselect1
  Are you sure you named the widget "fileselect1" ?  Perhaps, you
mdoified/deleted things using GLADE then you added again -- this causes glade
to create another widget with another name -- watch for that !!!
  Make sure that this is the correct name for the widget.
  Hope this helps.
Harring.
__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]