GNOME File Selector Developer Documentation | ||
---|---|---|
<<< Previous | Next >>> |
The GNOME File Selector's control has a standard property bag with which it makes itself configurable by applications. This can be obtained via the Bonobo::Control::getProperties() method.
Example 5. Obtaining a Bonobo::PropertyBag
Bonobo_PropertyBag pbag; pbag = Bonobo_Control_getProperties (corba_control, ev); |
However, as the CORBA interface for properties in Bonobo 1.0 is not as elegant as the 2.0 version, it is recommended that you use the BonoboWidget versions of these functions.
Example 6. Setting Some Properties
BonoboWidget *control; bonobo_widget_set_property (control, "AcceptDirectories", FALSE, "Application", "MyApp", "DefaultFileName", get_last_file_name(), "MimeTypes", _("Text Files:text/plain"), "MultipleSelection", TRUE, NULL); |
Here is a list of properties supported by the GNOME File Selector. I don't really know docbook so well but it will hopefully eventually be a nice table.
Example 7. Listing of Properties
name type description ---------------------------------------------------------------------------- AcceptDirectories rw boolean whether to pass directories or not Application rw string name of application - for restoring state ActionButtonLabel rw string label for the button - open or save DefaultFileName rw string name of file name to default to when changing directories DefaultView rw string view mode to start out in if the user hasn't chosen one yet LocalURIsOnly rw boolean restrict uris to local files only MimeTypes rw string list of mime types calling application can accept MimeTypesSequence rw sequence<string> list of mime types calling application can accept MultipleSelection rw boolean whether to allow multiple selection or not RequestedURI rw string URI to load |
The AcceptDirectories property controls whether the GNOME File Selector will return directory files to your application. If your application can open directories, set this to TRUE, otherwise set it to FALSE.
Set the Application property to the name of your application. This is used to restore such settings as view type and directory automatically for you the next time a user uses the GNOME File Selector.
The ActionButtonLabel property sets the label of the "Ok" button. Set this to "Open" when this is an open dialog, and "Save" for a save dialog.
![]() | This property may go away or change before version 1.0 of the GNOME File Selector is released. |
Use the DefaultFileName property to set what is initially in the text entry.
You can use the DefaultView to specify which view should be used as default. Currently available views are "Details" and "Icons".
![]() | This will be overridden if the user has used the file selector from your application before. |
If your application does not use gnome-vfs, or circumstances require it, set the LocalURIsOnly property to TRUE. This will restrict the GNOME File Selector to files on the local filesystem, and not using things such as the bzip2 gnome-vfs method.
The MimeTypes is a little complicated, but is still easy to use.
![]() | This property is mostly useful when setting properties via the item moniker (see the next section, "Easier Property Setting"). If you are using the normal property bag functions, consider using the MimeTypesSequence property. |
The string you should set for this property is a colon-delimited list of string pairs. The first element of each pair is the name of the mime type, such as "Text Files". These can be obtained from the gnome_vfs_mime_get_description () function. In fact, if you leave the first part blank, the GNOME File Selector will automatically call this function for you.
The second element is a comma delimited list of mime types, such as "text/plain,text/x-c,text/xml".
The MimeTypesSequence property is similar to the MimeTypes property, except that it is a sequence of name/types pairs in the same manner as MimeTypes.
If your application can open multiple files, set the MultipleSelection property to FALSE. If it is set to FALSE, the string sequence returned in the ButtonClicked:Action event will only contain one element.
![]() | If you are using this as a save dialog, your should definitely set this property to FALSE. |
The RequestedURI property can be used to request a file or directory from the GNOME File Selector. When you set this property, the GNOME File Selector will attempt to load this directory or file.
![]() | This property might change or go away before the 1.0 version of the GNOME File Selector is released. |
<<< Previous | Home | Next >>> |
Events | Easier Property Setting |