Gtk.TargetList

Fields

None

Methods

class

new (targets)

add (target, flags, info)

add_image_targets (info, writable)

add_rich_text_targets (info, deserializable, buffer)

add_table (targets)

add_text_targets (info)

add_uri_targets (info)

find (target)

ref ()

remove (target)

unref ()

Details

class Gtk.TargetList

A Gtk.TargetList-struct is a reference counted list of Gtk.TargetPair and should be treated as opaque.

classmethod new(targets)[source]
Parameters:

targets ([Gtk.TargetEntry] or None) – Pointer to an array of Gtk.TargetEntry

Returns:

the new Gtk.TargetList.

Return type:

Gtk.TargetList

Creates a new Gtk.TargetList from an array of Gtk.TargetEntry.

add(target, flags, info)[source]
Parameters:
  • target (Gdk.Atom) – the interned atom representing the target

  • flags (int) – the flags for this target

  • info (int) – an ID that will be passed back to the application

Appends another target to a Gtk.TargetList.

add_image_targets(info, writable)[source]
Parameters:
  • info (int) – an ID that will be passed back to the application

  • writable (bool) – whether to add only targets for which GTK+ knows how to convert a pixbuf into the format

Appends the image targets supported by Gtk.SelectionData to the target list. All targets are added with the same info.

New in version 2.6.

add_rich_text_targets(info, deserializable, buffer)[source]
Parameters:
  • info (int) – an ID that will be passed back to the application

  • deserializable (bool) – if True, then deserializable rich text formats will be added, serializable formats otherwise.

  • buffer (Gtk.TextBuffer) – a Gtk.TextBuffer.

Appends the rich text targets registered with Gtk.TextBuffer.register_serialize_format() or Gtk.TextBuffer.register_deserialize_format() to the target list. All targets are added with the same info.

New in version 2.10.

add_table(targets)[source]
Parameters:

targets ([Gtk.TargetEntry]) – the table of Gtk.TargetEntry

Prepends a table of Gtk.TargetEntry to a target list.

add_text_targets(info)[source]
Parameters:

info (int) – an ID that will be passed back to the application

Appends the text targets supported by Gtk.SelectionData to the target list. All targets are added with the same info.

New in version 2.6.

add_uri_targets(info)[source]
Parameters:

info (int) – an ID that will be passed back to the application

Appends the URI targets supported by Gtk.SelectionData to the target list. All targets are added with the same info.

Since 3.24.37, this includes the application/vnd.portal.files target when possible, to allow sending files between sandboxed apps via the FileTransfer portal.

New in version 2.6.

find(target)[source]
Parameters:

target (Gdk.Atom) – an interned atom representing the target to search for

Returns:

True if the target was found, otherwise False

info:

a pointer to the location to store application info for target, or None

Return type:

(bool, info: int)

Looks up a given target in a Gtk.TargetList.

ref()[source]
Returns:

the passed in Gtk.TargetList.

Return type:

Gtk.TargetList

Increases the reference count of a Gtk.TargetList by one.

remove(target)[source]
Parameters:

target (Gdk.Atom) – the interned atom representing the target

Removes a target from a target list.

unref()[source]

Decreases the reference count of a Gtk.TargetList by one. If the resulting reference count is zero, frees the list.