GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Fri Apr 18, 2014 6:13 pm

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: FileChooserButton issues
PostPosted: Sun Feb 12, 2012 5:00 pm 
Offline
Familiar Face

Joined: Thu Feb 09, 2012 9:20 pm
Posts: 5
Hellow! I have created 2 FileChooser buttons with following lines:

Code:
GtkWidget *fc_button_i, *fc_button_o; //global
fc_button_i = gtk_file_chooser_button_new ("Browse", GTK_FILE_CHOOSER_ACTION_OPEN);
gtk_box_pack_start (GTK_BOX (box1), fc_button_i, TRUE, TRUE, 0);
gtk_widget_show (fc_button_i);

fc_button_o = gtk_file_chooser_button_new ("Browse", GTK_FILE_CHOOSER_ACTION_SAVE);
gtk_box_pack_start (GTK_BOX (box2), fc_button_o, TRUE, TRUE, 0);
gtk_widget_show (fc_button_o);


First of all I do not see button's names "Browse" I have selected. How do I get them visible?

Then, as it is shown on attached image, second button does not appear and errors are printed in console when button is in GTK_FILE_CHOOSER_ACTION_SAVE mode. If I select GTK_FILE_CHOOSER_ACTION_OPEN for the same button all is ok. What could be wrong?


Attachments:
FileChooserError.png
FileChooserError.png [ 29.31 KiB | Viewed 212 times ]
Top
 Profile  
 
 Post subject: Re: FileChooserButton issues
PostPosted: Mon Feb 13, 2012 3:06 pm 
Offline
Never Seen the Sunlight

Joined: Wed Jul 23, 2008 10:31 am
Posts: 2406
Location: Slovenia
Hi.

You need to read API docs more carefully. (Here they are.)

First parameter to gtk_file_chooser_button_new() is not button label but title of the dialog that will be displayed for selecting file. Button itself holds the name of the selected file and thus cannot have label attached to it.

Second, docs clearly state this:
API docs wrote:
The GtkFileChooserButton supports the GtkFileChooserActions GTK_FILE_CHOOSER_ACTION_OPEN and GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER.
This should explain why button is not created.

Cheers,
Tadej


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group