Signal

GtkPlacesSidebar::populate-popup

since: 3.10

Declaration

void
populate_popup (
  GtkPlacesSidebar* self,
  GtkWidget* container,
  GioFile* selected_item,
  GioVolume* selected_volume,
  gpointer user_data
)

Description [src]

The places sidebar emits this signal when the user invokes a contextual popup 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 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 to use it in the callback.

The container and all its contents are destroyed after the user dismisses the popup. The popup is re-created (and thus, this signal is emitted) every time the user activates the contextual menu.

Before 3.18, the container always was a GtkMenu, and you were expected to add your items as GtkMenuItems. Since 3.18, the popup may be implemented as a GtkPopover, in which case container will be something else, e.g. a GtkBox, to which you may add GtkModelButtons or other widgets, such as GtkEntries, GtkSpinButtons, etc. If your application can deal with this situation, you can set GtkPlacesSidebar::populate-all to TRUE to request that this signal is emitted for populating popovers as well.

Default handler:

The default handler is called before the handlers added via g_signal_connect().

Available since: 3.10

Parameters

container

Type: GtkWidget

A GtkMenu or another GtkContainer.

The data is owned by the caller of the function.
selected_item

Type: GFile

GFile with the item to which the popup should refer, or NULL in the case of a selected_volume.

The argument can be NULL.
The data is owned by the caller of the function.
selected_volume

Type: GVolume

GVolume if the selected item is a volume, or NULL if it is a file.

The argument can be NULL.
The data is owned by the caller of the function.