PlacesSidebar is a widget that displays a list of frequently-used places in the file system: the user’s home
directory, the user’s bookmarks, and volumes and drives.
This widget is used as a sidebar in FileChooser and may be used by file managers
and similar programs.
The places sidebar displays drives and volumes, and will automatically mount or unmount them when the user selects them.
Applications can hook to various signals in the places sidebar to customize its behavior. For example, they can add extra commands to the
context menu of the sidebar.
While bookmarks are completely in control of the user, the places sidebar also allows individual applications to provide extra shortcut
folders that are unique to each application. For example, a Paint program may want to add a shortcut for a Clipart folder. You can do this
with add_shortcut.
To make use of the places sidebar, an application at least needs to connect to the
open_location signal. This is emitted when the user selects in the
sidebar a location to open. The application should also call set_location
when it changes the currently-viewed location.
CSS nodes
GtkPlacesSidebar uses a single CSS node with name placessidebar and style class .sidebar.
Among the children of the places sidebar, the following style classes can be used: - .sidebar-new-bookmark-row for the 'Add new bookmark'
row - .sidebar-placeholder-row for a row that is a placeholder - .has-open-popup when a popup is open for a row
- public signal int drag_action_ask (int actions)
The places sidebar emits this signal when it needs to ask the
application to pop up a menu to ask the user for which drag action to perform.
- public signal int drag_action_requested (DragContext context, File dest_file, List<File> source_file_list)
When the user starts a drag-and-drop operation and the sidebar needs
to ask the application for which drag action to perform, then the sidebar will emit this signal.
- public signal void drag_perform_drop (File dest_file, List<File> source_file_list, int action)
The places sidebar emits this signal when the user completes a
drag-and-drop operation and one of the sidebar's items is the destination.
- public signal void mount (MountOperation mount_operation)
The places sidebar emits this signal when it starts a new operation
because the user clicked on some location that needs mounting.
- public signal void on_show_connect_to_server ()
The places sidebar emits this signal when it needs the calling
application to present an way to connect directly to a network server.
- public signal void on_show_enter_location ()
The places sidebar emits this signal when it needs the calling
application to present an way to directly enter a location.
- public signal void on_show_starred_location (PlacesOpenFlags open_flags)
The places sidebar emits this signal when it needs the calling
application to present a way to show the starred files.
- public signal void open_location (File location, PlacesOpenFlags open_flags)
The places sidebar emits this signal when the user selects a location
in it.
- public signal void populate_popup (Widget container, File? selected_item, Volume? selected_volume)
The places sidebar emits this signal when the user invokes a
contextual popup on one of its items.
- public signal void show_error_message (string primary, string secondary)
The places sidebar emits this signal when it needs the calling
application to present an error message.
- public signal void show_other_locations_requested ()
The places sidebar emits this signal when it needs the calling
application to present a way to show other locations e.
- public signal void show_other_locations_with_flags (PlacesOpenFlags open_flags)
The places sidebar emits this signal when it needs the calling
application to present a way to show other locations e.
- public signal void unmount (MountOperation mount_operation)
The places sidebar emits this signal when it starts a new operation
because the user for example ejected some drive or unmounted a mount.