Creating a GNOME File Selector

Creating a GNOME File Selector is very easy. It is done using the OAFIID moniker.

Example 1. Creating a GNOME File Selector Control

	  
	  GtkWidget *control;

	  control = bonobo_widget_new_control ("OAFIID:GNOME_FileSelector",
	                                       CORBA_OBJECT_NIL);
	  gtk_widget_show (control);
	

You now have a BonoboWidget which you can place inside other GTK+ containers (this typically will be a GtkWindow).

Yes, it is that easy.

Note

In the transitional period where users do not have the GNOME File Selector installed, you can still fall back on a GtkFileSelector. If the bonobo_widget_new_control() call returns NULL, then just use your old GtkFileSelector code.

Note

When you place the GNOME File Selector inside your GtkWindow, you should call gtk_widget_set_usize() on the window. This is because the user may have told the window manager to place dialogs specially, and the window manager will think the window is 0x0, due to how size negotiation works with bonobo controls.