PlacesSidebar

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_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 gtk_places_sidebar_set_location() when it changes the currently-viewed location.

class PlacesSidebar : ScrolledWindow {}

Constructors

this
this(GtkPlacesSidebar* gtkPlacesSidebar)

Sets our main struct and passes it to the parent class

this
this()

Creates a new GtkPlacesSidebar widget. The application should connect to at least the "open-location" signal to be notified when the user makes a selection in the sidebar.

Members

Functions

addOnDragActionAsk
void addOnDragActionAsk(gint delegate(gint, PlacesSidebar) dlg, ConnectFlags connectFlags)

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. Since 3.10

addOnDragActionRequested
void addOnDragActionRequested(gint delegate(DragContext, ObjectG, void*, PlacesSidebar) dlg, ConnectFlags connectFlags)

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. The application can evaluate the context for customary actions, or it can check the type of the files indicated by source_file_list against the possible actions for the destination dest_file. The drag action to use must be the return value of the signal handler. GdkDragContext with information about the drag operation GFile with the tentative location that is being hovered for a drop Since 3.10

addOnDragPerformDrop
void addOnDragPerformDrop(void delegate(ObjectG, void*, gint, PlacesSidebar) dlg, ConnectFlags connectFlags)

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. This item is in the dest_file, and the source_file_list has the list of files that are dropped into it and which should be copied/moved/etc. based on the specified action. GList of GFile that got dropped. [element-type GFile][transfer none] Since 3.10

addOnOpenLocation
void addOnOpenLocation(void delegate(ObjectG, GtkPlacesOpenFlags, PlacesSidebar) dlg, ConnectFlags connectFlags)

The places sidebar emits this signal when the user selects a location in it. The calling application should display the contents of that location; for example, a file manager should show a list of files in the specified location. GFile to which the caller should switch. Since 3.10

addOnPopulatePopup
void addOnPopulatePopup(void delegate(ObjectG, ObjectG, ObjectG, PlacesSidebar) dlg, ConnectFlags connectFlags)

The places sidebar emits this signal when the user invokes a contextual menu on one of its items. In the signal handler, the application may add extra items to the menu as appropriate. For example, a file manager may want to add a "Properties" command to the menu. It is not necessary to store the selected_item for each menu item; during their GtkMenuItem::activate callbacks, the application can use gtk_places_sidebar_get_location() to get the file to which the item refers. The selected_item argument may be NULL in case the selection refers to a volume. In this case, selected_volume will be non-NULL. In this case, the calling application will have to g_object_ref() the selected_volume and keep it around for the purposes of its menu item's "activate" callback. The menu and all its menu items are destroyed after the user dismisses the menu. The menu is re-created (and thus, this signal is emitted) every time the user activates the contextual menu. GFile with the item to which the menu should refer, or NULL in the case of a selected_volume. GVolume if the selected item is a volume, or NULL if it is a file. Since 3.10

addOnShowConnectToServer
void addOnShowConnectToServer(void delegate(PlacesSidebar) dlg, ConnectFlags connectFlags)

The places sidebar emits this signal when it needs the calling application to present an way to connect directly to a network server. For example, the application may bring up a dialog box asking for a URL like "sftp://ftp.example.com". It is up to the application to create the corresponding mount by using, for example, g_file_mount_enclosing_volume(). Since 3.10

addOnShowErrorMessage
void addOnShowErrorMessage(void delegate(string, string, PlacesSidebar) dlg, ConnectFlags connectFlags)

The places sidebar emits this signal when it needs the calling application to present an error message. Most of these messages refer to mounting or unmounting media, for example, when a drive cannot be started for some reason. Since 3.10 See Also GtkFileChooser

addShortcut
void addShortcut(File location)

Applications 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 the sidebar is being used in an "Insert Clipart" dialog box. This function adds the specified location to a special place for immutable shortcuts. The shortcuts are application-specific; they are not shared across applications, and they are not persistent. If this function is called multiple times with different locations, then they are added to the sidebar's list in the same order as the function is called.

getLocation
File getLocation()

Gets the currently-selected location in the sidebar. This can be NULL when nothing is selected, for example, when gtk_places_sidebar_set_location() has been called with a location that is not among the sidebar's list of places to show. You can use this function to get the selection in the sidebar. Also, if you connect to the "popup-menu" signal, you can use this function to get the location that is being referred to during the callbacks for your menu items.

getNthBookmark
File getNthBookmark(int n)

This 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. shortcuts, which activate the cooresponding bookmark.

getOpenFlags
GtkPlacesOpenFlags getOpenFlags()

Gets the open flags.

getPlacesSidebarStruct
GtkPlacesSidebar* getPlacesSidebarStruct()
Undocumented in source. Be warned that the author may not have intended to support it.
getShowConnectToServer
int getShowConnectToServer()

Returns the value previously set with gtk_places_sidebar_set_show_connect_to_server()

getShowDesktop
int getShowDesktop()

Returns the value previously set with gtk_places_sidebar_set_show_desktop()

getStruct
void* getStruct()

the main Gtk struct as a void*

listShortcuts
ListSG listShortcuts()

Gets the list of shortcuts.

removeShortcut
void removeShortcut(File location)

Removes an application-specific shortcut that has been previously been inserted with gtk_places_sidebar_add_shortcut(). If the location is not a shortcut in the sidebar, then nothing is done.

setLocation
void setLocation(File location)

Sets 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 shown in the list of places, or it will unhighlight everything if the location is not among the places in the list.

setOpenFlags
void setOpenFlags(GtkPlacesOpenFlags flags)

Sets 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 may support opening locations in a new notebook tab or a new window. This function is used to tell the places sidebar about the ways in which the application can open new locations, so that the sidebar can display (or not) the "Open in new tab" and "Open in new window" menu items as appropriate. When the "open-location" signal is emitted, its flags argument will be set to one of the flags that was passed in gtk_places_sidebar_set_open_flags(). Passing 0 for flags will cause GTK_PLACES_OPEN_NORMAL to always be sent to callbacks for the "open-location" signal.

setShowConnectToServer
void setShowConnectToServer(int showConnectToServer)

Sets 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 network servers directly.

setShowDesktop
void setShowDesktop(int showDesktop)

Sets whether the sidebar should show an item for the Desktop folder; this is off by default. An application may want to turn this on if the desktop environment actually supports the notion of a desktop.

setStruct
void setStruct(GObject* obj)
Undocumented in source. Be warned that the author may not have intended to support it.

Static functions

callBackDragActionAsk
void callBackDragActionAsk(GtkPlacesSidebar* sidebarStruct, gint actions, PlacesSidebar _placesSidebar)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackDragActionRequested
void callBackDragActionRequested(GtkPlacesSidebar* sidebarStruct, GdkDragContext* context, GObject* destFile, void* sourceFileList, PlacesSidebar _placesSidebar)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackDragPerformDrop
void callBackDragPerformDrop(GtkPlacesSidebar* sidebarStruct, GObject* destFile, void* sourceFileList, gint action, PlacesSidebar _placesSidebar)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackOpenLocation
void callBackOpenLocation(GtkPlacesSidebar* sidebarStruct, GObject* location, GtkPlacesOpenFlags openFlags, PlacesSidebar _placesSidebar)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackPopulatePopup
void callBackPopulatePopup(GtkPlacesSidebar* sidebarStruct, GObject* menu, GObject* selectedItem, GObject* selectedVolume, PlacesSidebar _placesSidebar)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackShowConnectToServer
void callBackShowConnectToServer(GtkPlacesSidebar* sidebarStruct, PlacesSidebar _placesSidebar)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackShowErrorMessage
void callBackShowErrorMessage(GtkPlacesSidebar* sidebarStruct, gchar* primary, gchar* secondary, PlacesSidebar _placesSidebar)
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

connectedSignals
int[string] connectedSignals;
gtkPlacesSidebar
GtkPlacesSidebar* gtkPlacesSidebar;

the main Gtk struct

onDragActionAskListeners
gint delegate(gint, PlacesSidebar)[] onDragActionAskListeners;
Undocumented in source.
onDragActionRequestedListeners
gint delegate(DragContext, ObjectG, void*, PlacesSidebar)[] onDragActionRequestedListeners;
Undocumented in source.
onDragPerformDropListeners
void delegate(ObjectG, void*, gint, PlacesSidebar)[] onDragPerformDropListeners;
Undocumented in source.
onOpenLocationListeners
void delegate(ObjectG, GtkPlacesOpenFlags, PlacesSidebar)[] onOpenLocationListeners;
Undocumented in source.
onPopulatePopupListeners
void delegate(ObjectG, ObjectG, ObjectG, PlacesSidebar)[] onPopulatePopupListeners;
Undocumented in source.
onShowConnectToServerListeners
void delegate(PlacesSidebar)[] onShowConnectToServerListeners;
Undocumented in source.
onShowErrorMessageListeners
void delegate(string, string, PlacesSidebar)[] onShowErrorMessageListeners;
Undocumented in source.

Inherited Members

From ScrolledWindow

gtkScrolledWindow
GtkScrolledWindow* gtkScrolledWindow;

the main Gtk struct

getScrolledWindowStruct
GtkScrolledWindow* getScrolledWindowStruct()
Undocumented in source. Be warned that the author may not have intended to support it.
getStruct
void* getStruct()

the main Gtk struct as a void*

setStruct
void setStruct(GObject* obj)
Undocumented in source. Be warned that the author may not have intended to support it.
connectedSignals
int[string] connectedSignals;
onMoveFocusOutListeners
void delegate(GtkDirectionType, ScrolledWindow)[] onMoveFocusOutListeners;
Undocumented in source.
addOnMoveFocusOut
void addOnMoveFocusOut(void delegate(GtkDirectionType, ScrolledWindow) dlg, ConnectFlags connectFlags)

The ::move-focus-out signal is a keybinding signal which gets emitted when focus is moved away from the scrolled window by a keybinding. The "move-focus" signal is emitted with direction_type on this scrolled windows toplevel parent in the container hierarchy. The default bindings for this signal are Tab+Ctrl and Tab+Ctrl+Shift.

callBackMoveFocusOut
void callBackMoveFocusOut(GtkScrolledWindow* scrolledWindowStruct, GtkDirectionType directionType, ScrolledWindow _scrolledWindow)
Undocumented in source. Be warned that the author may not have intended to support it.
onScrollChildListeners
bool delegate(GtkScrollType, gboolean, ScrolledWindow)[] onScrollChildListeners;
Undocumented in source.
addOnScrollChild
void addOnScrollChild(bool delegate(GtkScrollType, gboolean, ScrolledWindow) dlg, ConnectFlags connectFlags)

The ::scroll-child signal is a keybinding signal which gets emitted when a keybinding that scrolls is pressed. The horizontal or vertical adjustment is updated which triggers a signal that the scrolled windows child may listen to and scroll itself. See Also GtkScrollable, GtkViewport, GtkAdjustment

callBackScrollChild
gboolean callBackScrollChild(GtkScrolledWindow* scrolledWindowStruct, GtkScrollType scroll, gboolean horizontal, ScrolledWindow _scrolledWindow)
Undocumented in source. Be warned that the author may not have intended to support it.
getHadjustment
Adjustment getHadjustment()

Returns the horizontal scrollbar's adjustment, used to connect the horizontal scrollbar to the child widget's horizontal scroll functionality.

getVadjustment
Adjustment getVadjustment()

Returns the vertical scrollbar's adjustment, used to connect the vertical scrollbar to the child widget's vertical scroll functionality.

getHscrollbar
Widget getHscrollbar()

Returns the horizontal scrollbar of scrolled_window. Since 2.8

getVscrollbar
Widget getVscrollbar()

Returns the vertical scrollbar of scrolled_window. Since 2.8

setPolicy
void setPolicy(GtkPolicyType hscrollbarPolicy, GtkPolicyType vscrollbarPolicy)

Sets the scrollbar policy for the horizontal and vertical scrollbars. The policy determines when the scrollbar should appear; it is a value from the GtkPolicyType enumeration. If GTK_POLICY_ALWAYS, the scrollbar is always present; if GTK_POLICY_NEVER, the scrollbar is never present; if GTK_POLICY_AUTOMATIC, the scrollbar is present only if needed (that is, if the slider part of the bar would be smaller than the trough - the display is larger than the page size).

addWithViewport
void addWithViewport(Widget child)

Warning gtk_scrolled_window_add_with_viewport has been deprecated since version 3.8 and should not be used in newly-written code. gtk_container_add() will now automatically add a GtkViewport if the child doesn't implement GtkScrollable. Used to add children without native scrolling capabilities. This is simply a convenience function; it is equivalent to adding the unscrollable child to a viewport, then adding the viewport to the scrolled window. If a child has native scrolling, use gtk_container_add() instead of this function. The viewport scrolls the child by moving its GdkWindow, and takes the size of the child to be the size of its toplevel GdkWindow. This will be very wrong for most widgets that support native scrolling; for example, if you add a widget such as GtkTreeView with a viewport, the whole widget will scroll, including the column headings. Thus, widgets with native scrolling support should not be used with the GtkViewport proxy. A widget supports scrolling natively if it implements the GtkScrollable interface.

setPlacement
void setPlacement(GtkCornerType windowPlacement)

Sets the placement of the contents with respect to the scrollbars for the scrolled window. The default is GTK_CORNER_TOP_LEFT, meaning the child is in the top left, with the scrollbars underneath and to the right. Other values in GtkCornerType are GTK_CORNER_TOP_RIGHT, GTK_CORNER_BOTTOM_LEFT, and GTK_CORNER_BOTTOM_RIGHT. See also gtk_scrolled_window_get_placement() and gtk_scrolled_window_unset_placement().

unsetPlacement
void unsetPlacement()

Unsets the placement of the contents with respect to the scrollbars for the scrolled window. If no window placement is set for a scrolled window, it defaults to GTK_CORNER_TOP_LEFT. See also gtk_scrolled_window_set_placement() and gtk_scrolled_window_get_placement(). Since 2.10

setShadowType
void setShadowType(GtkShadowType type)

Changes the type of shadow drawn around the contents of scrolled_window.

setHadjustment
void setHadjustment(Adjustment hadjustment)

Sets the GtkAdjustment for the horizontal scrollbar.

setVadjustment
void setVadjustment(Adjustment vadjustment)

Sets the GtkAdjustment for the vertical scrollbar.

getPlacement
GtkCornerType getPlacement()

Gets the placement of the contents with respect to the scrollbars for the scrolled window. See gtk_scrolled_window_set_placement().

getPolicy
void getPolicy(GtkPolicyType hscrollbarPolicy, GtkPolicyType vscrollbarPolicy)

Retrieves the current policy values for the horizontal and vertical scrollbars. See gtk_scrolled_window_set_policy().

getShadowType
GtkShadowType getShadowType()

Gets the shadow type of the scrolled window. See gtk_scrolled_window_set_shadow_type().

getMinContentWidth
int getMinContentWidth()

Gets the minimum content width of scrolled_window, or -1 if not set.

setMinContentWidth
void setMinContentWidth(int width)

Sets the minimum width that scrolled_window should keep visible. Note that this can and (usually will) be smaller than the minimum size of the content.

getMinContentHeight
int getMinContentHeight()

Gets the minimal content height of scrolled_window, or -1 if not set.

setMinContentHeight
void setMinContentHeight(int height)

Sets the minimum height that scrolled_window should keep visible. Note that this can and (usually will) be smaller than the minimum size of the content.

setKineticScrolling
void setKineticScrolling(int kineticScrolling)

Turns kinetic scrolling on or off. Kinetic scrolling only applies to devices with source GDK_SOURCE_TOUCHSCREEN.

getKineticScrolling
int getKineticScrolling()

Returns the specified kinetic scrolling behavior.

setCaptureButtonPress
void setCaptureButtonPress(int captureButtonPress)

Changes the behaviour of scrolled_window wrt. to the initial event that possibly starts kinetic scrolling. When capture_button_press is set to TRUE, the event is captured by the scrolled window, and then later replayed if it is meant to go to the child widget. This should be enabled if any child widgets perform non-reversible actions on "button-press-event". If they don't, and handle additionally handle "grab-broken-event", it might be better to set capture_button_press to FALSE. This setting only has an effect if kinetic scrolling is enabled.

getCaptureButtonPress
int getCaptureButtonPress()

Return whether button presses are captured during kinetic scrolling. See gtk_scrolled_window_set_capture_button_press().

Meta