Re: GtkFileChooser filter problems

Hi Bert

On 21.11.2009 at 11:25 Bert Timmerman wrote:

>Hi Andreas,
>Andreas Falkenhahn wrote:
>> Hi,
>> I'm having a hard time to get filters to work with the file chooser
>dialog. It seems
>> that whenever I'm calling gtk_file_chooser_set_filename() before opening
>the dialog,
>> the file filters are not installed at all. The weird thing is that the
>filters work fine when
>> I use gtk_file_chooser_set_current_folder() instead set_filename(). But
>of course it
>> doesn't allow me to set an initially selected file. So I tried to call
>> after set_current_folder() but this doesn't work either.
>> This is giving me a real headache now. Is this a known issue or am I
>> something terribly wrong here?
>> Tks
>> Andreas
>> --
>> "Remember: It's nice to be important but it's more important to be nice!"
>I recently added filters in a gtk based app.
>One thing I learned is:
>   /* add a default filter for not filtering files */
>   no_filter = gtk_file_filter_new ();
>   gtk_file_filter_set_name (no_filter, "all");
>   gtk_file_filter_add_pattern (no_filter, "*.*");
>   gtk_file_filter_add_pattern (no_filter, "*");
>   gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), no_filter);
>To allow for "normal" behaviour.
>After that add as many filters as you like.
>Regarding your thread:
>Setting a filter and then setting a filename (making possible
>contradicting decisions beforehand) and then realizing the widget may
>indeed give the result you mentioned.
>Say I have set a filter on "*.doc" and set a filename with a ".txt"
>extension is asking for trouble.

Yes, that behaviour would be ok of course but I'm not setting a contradicting filename
at all. The filename I'm setting matches the filter perfectly. Yet, whenever I call
gtk_file_chooser_set_filename() it seems that the filter combo box is reset. My filter
still appears in the combo box in the file chooser dialog but it's impossible to make it
the default by calling gtk_file_chooser_set_filter() prior to opening the dialog because
gtk_file_chooser_set_filename() always seems to reset the active filter.

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