tags:

views:

167

answers:

1

In my code, I have lines like this:

Builder builder = new Builder();
builder.AddFromFile(gladefile);
FileChooserDialog dialog =
    (FileChooserDialog) builder.GetObject("dialog");

FileFilter[] filters = new FileFilter[2];
filters[0] = new FileFilter();
filters[0].Name = "Some filter";
filters[0].AddPattern("*.someextension");
filters[1] = new FileFilter();
filters[1].Name = "All files";
filters[1].AddPattern("*");

foreach (FileFilter filter in filters)
    dialog.AddFilter(filter);
dialog.Filter = filters[0];
dialog.SetFilename(defaultFile);

Is there a way to set up these filters in Glade, rather than doing it manually?

+1  A: 

No. You can create a file filter object in glade (version 3.6 and up) and add it to the dialog, but since you can't actually set the name or pattern of the file filter, it's fairly useless.

ptomato
Oh well, alright. Do you know if there are any plans to allow you to set the name or pattern?
Matthew
I don't know, but it's probably not up to Glade. Glade (and GtkBuilder) let you set the properties of GObjects, but the file filter stuff isn't implemented as GObject properties. So I wouldn't count on it.
ptomato