gtk.places_sidebar

Module for [PlacesSidebar] class

Types 3

#GtkPlacesSidebar 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 #GtkFileChooser 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 gtk.places_sidebar.PlacesSidebar.addShortcut.

To make use of the places sidebar, an application at least needs to connect to the #GtkPlacesSidebar::open-location signal. This is emitted when the user selects in the sidebar a location to open. The application should also call gtk.places_sidebar.PlacesSidebar.setLocation 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
Methods
GType _getGType() static nothrow
GType _gType() @property nothrow
PlacesSidebar self() nothrowReturns `this`, for use in `with` statements.
PlacesSidebarGidBuilder builder() static nothrowGet builder for [gtk.places_sidebar.PlacesSidebar] Returns: New builder object
bool localOnly() @property nothrow
void localOnly(bool propval) @property nothrow
gio.file.File location() @property nothrow
void location(gio.file.File propval) @property nothrow
void openFlags(gtk.types.PlacesOpenFlags propval) @property nothrow
bool populateAll() @property nothrowGet `populateAll` property. Returns: If :populate-all is true, the #GtkPlacesSidebar::populate-popup signal is also emitted for popovers.
void populateAll(bool propval) @property nothrowSet `populateAll` property. Params: propval = If :populate-all is true, the #GtkPlacesSidebar::populate-popup signal is also emitted for popovers.
bool showConnectToServer() @property nothrow
void showConnectToServer(bool propval) @property nothrow
bool showDesktop() @property nothrow
void showDesktop(bool propval) @property nothrow
bool showEnterLocation() @property nothrow
void showEnterLocation(bool propval) @property nothrow
bool showOtherLocations() @property nothrow
void showOtherLocations(bool propval) @property nothrow
bool showRecent() @property nothrow
void showRecent(bool propval) @property nothrow
bool showStarredLocation() @property nothrow
void showStarredLocation(bool propval) @property nothrow
bool showTrash() @property nothrow
void showTrash(bool propval) @property nothrow
void addShortcut(gio.file.File location) nothrowApplications may want to present some folders in the places sidebar if they could be immediately useful to users. For example, a drawing program could add a “/usr/share/clipart” location when ...
bool getLocalOnly() nothrowReturns the value previously set with [gtk.places_sidebar.PlacesSidebar.setLocalOnly]. Returns: true if the sidebar will only show local files.
gio.file.File getLocation() nothrowGets the currently selected location in the sidebar. This can be null when nothing is selected, for example, when [gtk.places_sidebar.PlacesSidebar.setLocation] has been called with a location that...
gio.file.File getNthBookmark(int n) nothrowThis function queries the bookmarks added by the user to the places sidebar, and returns one of them. This function is used by #GtkFileChooser to implement the “Alt-1”, “Alt-2”, etc. short...
gtk.types.PlacesOpenFlags getOpenFlags() nothrowGets the open flags. Returns: the #GtkPlacesOpenFlags of sidebar
bool getShowConnectToServer() nothrowReturns the value previously set with [gtk.places_sidebar.PlacesSidebar.setShowConnectToServer] Returns: true if the sidebar will display a “Connect to Server” item.
bool getShowDesktop() nothrowReturns the value previously set with [gtk.places_sidebar.PlacesSidebar.setShowDesktop] Returns: true if the sidebar will display a builtin shortcut to the desktop folder.
bool getShowEnterLocation() nothrowReturns the value previously set with [gtk.places_sidebar.PlacesSidebar.setShowEnterLocation] Returns: true if the sidebar will display an “Enter Location” item.
bool getShowOtherLocations() nothrowReturns the value previously set with [gtk.places_sidebar.PlacesSidebar.setShowOtherLocations] Returns: true if the sidebar will display an “Other Locations” item.
bool getShowRecent() nothrowReturns the value previously set with [gtk.places_sidebar.PlacesSidebar.setShowRecent] Returns: true if the sidebar will display a builtin shortcut for recent files
bool getShowStarredLocation() nothrowReturns the value previously set with [gtk.places_sidebar.PlacesSidebar.setShowStarredLocation] Returns: true if the sidebar will display a Starred item.
bool getShowTrash() nothrowReturns the value previously set with [gtk.places_sidebar.PlacesSidebar.setShowTrash] Returns: true if the sidebar will display a “Trash” item.
gio.file.File[] listShortcuts() nothrowGets the list of shortcuts. Returns: A #GSList of #GFile of the locations that have been added as application-specific shortcuts with [gtk.places_sidebar.PlacesSidebar.addShortcut]. To free this li...
void removeShortcut(gio.file.File location) nothrowRemoves an application-specific shortcut that has been previously been inserted with [gtk.places_sidebar.PlacesSidebar.addShortcut]. If the location is not a shortcut in the sidebar, then nothing ...
void setDropTargetsVisible(bool visible, gdk.drag_context.DragContext context) nothrowMake the GtkPlacesSidebar show drop targets, so it can show the available drop targets and a "new bookmark" row. This improves the Drag-and-Drop experience of the user and allows applications to sh...
void setLocalOnly(bool localOnly) nothrowSets whether the sidebar should only show local files.
void setLocation(gio.file.File location = null) nothrowSets the location that is being shown in the widgets surrounding the sidebar, for example, in a folder view in a file manager. In turn, the sidebar will highlight that location if it is being show...
void setOpenFlags(gtk.types.PlacesOpenFlags flags) nothrowSets the way in which the calling application can open new locations from the places sidebar. For example, some applications only open locations “directly” into their main view, while others m...
void setShowConnectToServer(bool showConnectToServer) nothrowSets whether the sidebar should show an item for connecting to a network server; this is off by default. An application may want to turn this on if it implements a way for the user to connect to ne...
void setShowDesktop(bool showDesktop) nothrowSets whether the sidebar should show an item for the Desktop folder. The default value for this option is determined by the desktop environment and the user’s configuration, but this function can...
void setShowEnterLocation(bool showEnterLocation) nothrowSets whether the sidebar should show an item for entering a location; this is off by default. An application may want to turn this on if manually entering URLs is an expected user action.
void setShowOtherLocations(bool showOtherLocations) nothrowSets whether the sidebar should show an item for the application to show an Other Locations view; this is off by default. When set to true, persistent devices such as hard drives are hidden, otherw...
void setShowRecent(bool showRecent) nothrowSets whether the sidebar should show an item for recent files. The default value for this option is determined by the desktop environment, but this function can be used to override it on a per-appl...
void setShowStarredLocation(bool showStarredLocation) nothrowIf you enable this, you should connect to the #GtkPlacesSidebar::show-starred-location signal.
void setShowTrash(bool showTrash) nothrowSets whether the sidebar should show an item for the Trash location.
gulong connectDragActionAsk(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == int) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] == int))) && (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gtk.places_sidebar.PlacesSidebar))) && Parameters!T.length < 3) nothrowConnect to `DragActionAsk` signal.
gulong connectDragActionRequested(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == int) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gdk.drag_context.DragContext))) && (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gio.file.File))) && (Parameters!T.length < 3 || (ParameterStorageClassTuple!T[2] == ParameterStorageClass.none && is(Parameters!T[2] == gio.file.File[]))) && (Parameters!T.length < 4 || (ParameterStorageClassTuple!T[3] == ParameterStorageClass.none && is(Parameters!T[3] : gtk.places_sidebar.PlacesSidebar))) && Parameters!T.length < 5) nothrowConnect to `DragActionRequested` signal.
gulong connectDragPerformDrop(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gio.file.File))) && (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] == gio.file.File[]))) && (Parameters!T.length < 3 || (ParameterStorageClassTuple!T[2] == ParameterStorageClass.none && is(Parameters!T[2] == int))) && (Parameters!T.length < 4 || (ParameterStorageClassTuple!T[3] == ParameterStorageClass.none && is(Parameters!T[3] : gtk.places_sidebar.PlacesSidebar))) && Parameters!T.length < 5) nothrowConnect to `DragPerformDrop` signal.
gulong connectMount(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gio.mount_operation.MountOperation))) && (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gtk.places_sidebar.PlacesSidebar))) && Parameters!T.length < 3) nothrowConnect to `Mount` signal.
gulong connectOpenLocation(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gio.file.File))) && (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] == gtk.types.PlacesOpenFlags))) && (Parameters!T.length < 3 || (ParameterStorageClassTuple!T[2] == ParameterStorageClass.none && is(Parameters!T[2] : gtk.places_sidebar.PlacesSidebar))) && Parameters!T.length < 4) nothrowConnect to `OpenLocation` signal.
gulong connectPopulatePopup(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.widget.Widget))) && (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gio.file.File))) && (Parameters!T.length < 3 || (ParameterStorageClassTuple!T[2] == ParameterStorageClass.none && is(Parameters!T[2] : gio.volume.Volume))) && (Parameters!T.length < 4 || (ParameterStorageClassTuple!T[3] == ParameterStorageClass.none && is(Parameters!T[3] : gtk.places_sidebar.PlacesSidebar))) && Parameters!T.length < 5) nothrowConnect to `PopulatePopup` signal.
gulong connectShowConnectToServer(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.places_sidebar.PlacesSidebar))) && Parameters!T.length < 2) nothrowConnect to `ShowConnectToServer` signal.
gulong connectShowEnterLocation(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.places_sidebar.PlacesSidebar))) && Parameters!T.length < 2) nothrowConnect to `ShowEnterLocation` signal.
gulong connectShowErrorMessage(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] == string))) && (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] == string))) && (Parameters!T.length < 3 || (ParameterStorageClassTuple!T[2] == ParameterStorageClass.none && is(Parameters!T[2] : gtk.places_sidebar.PlacesSidebar))) && Parameters!T.length < 4) nothrowConnect to `ShowErrorMessage` signal.
gulong connectShowOtherLocations(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.places_sidebar.PlacesSidebar))) && Parameters!T.length < 2) nothrowConnect to `ShowOtherLocations` signal.
gulong connectShowOtherLocationsWithFlags(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] == gtk.types.PlacesOpenFlags))) && (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gtk.places_sidebar.PlacesSidebar))) && Parameters!T.length < 3) nothrowConnect to `ShowOtherLocationsWithFlags` signal.
gulong connectShowStarredLocation(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] == gtk.types.PlacesOpenFlags))) && (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gtk.places_sidebar.PlacesSidebar))) && Parameters!T.length < 3) nothrowConnect to `ShowStarredLocation` signal.
gulong connectUnmount(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gio.mount_operation.MountOperation))) && (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gtk.places_sidebar.PlacesSidebar))) && Parameters!T.length < 3) nothrowConnect to `Unmount` signal.
Constructors
this(void * ptr, Flag!"Take" take)
this()Creates a new #GtkPlacesSidebar widget.

Fluent builder implementation template for gtk.places_sidebar.PlacesSidebar

Methods
T localOnly(bool propval) nothrow
T location(gio.file.File propval) nothrow
T populateAll(bool propval) nothrowSet `populateAll` property. Params: propval = If :populate-all is true, the #GtkPlacesSidebar::populate-popup signal is also emitted for popovers. Returns: Builder instance for fluent chaining
T showConnectToServer(bool propval) nothrow
T showDesktop(bool propval) nothrow
T showEnterLocation(bool propval) nothrow
T showOtherLocations(bool propval) nothrow
T showRecent(bool propval) nothrow
T showStarredLocation(bool propval) nothrow
T showTrash(bool propval) nothrow
Methods
PlacesSidebar build() nothrowCreate object from builder. Returns: New object