Gtk.IconPaintable

g GObject.GInterface GObject.GInterface Gdk.Paintable Gdk.Paintable GObject.GInterface->Gdk.Paintable Gtk.SymbolicPaintable Gtk.SymbolicPaintable GObject.GInterface->Gtk.SymbolicPaintable GObject.Object GObject.Object Gtk.IconPaintable Gtk.IconPaintable GObject.Object->Gtk.IconPaintable Gdk.Paintable->Gtk.IconPaintable Gtk.SymbolicPaintable->Gtk.IconPaintable

Subclasses:

None

Methods

Inherited:

GObject.Object (37), Gdk.Paintable (10), Gtk.SymbolicPaintable (1)

Structs:

GObject.ObjectClass (5)

class

new_for_file (file, size, scale)

get_file ()

get_icon_name ()

is_symbolic ()

Virtual Methods

Inherited:

GObject.Object (7), Gdk.Paintable (6), Gtk.SymbolicPaintable (1)

Properties

Name

Type

Flags

Short Description

file

Gio.File

r/w/co

icon-name

str

d/r/w/co

deprecated

is-symbolic

bool

d/r/w/en

deprecated

scale

int

r/w/en

size

int

r/w/en

Signals

Inherited:

GObject.Object (1), Gdk.Paintable (2)

Fields

Inherited:

GObject.Object (1), Gdk.Paintable (2)

Class Details

class Gtk.IconPaintable(**kwargs)
Bases:

GObject.Object, Gdk.Paintable, Gtk.SymbolicPaintable

Abstract:

No

Structure:

Gtk.IconPaintableClass

Contains information found when looking up an icon in GtkIconTheme or loading it from a file.

GtkIconPaintable implements GdkPaintable and GtkSymbolicPaintable.

classmethod new_for_file(file, size, scale)[source]
Parameters:
  • file (Gio.File) – a GFile

  • size (int) – desired icon size, in application pixels

  • scale (int) – the desired scale

Returns:

a GtkIconPaintable containing for the icon. Unref with GObject.Object.unref()

Return type:

Gtk.IconPaintable

Creates a GtkIconPaintable for a file with a given size and scale.

The icon can then be rendered by using it as a GdkPaintable.

get_file()[source]
Returns:

the GFile for the icon

Return type:

Gio.File or None

Gets the GFile that was used to load the icon.

Returns None if the icon was not loaded from a file.

get_icon_name()[source]
Returns:

the themed icon-name for the icon, or None if its not a themed icon.

Return type:

str or None

Get the icon name being used for this icon.

When an icon looked up in the icon theme was not available, the icon theme may use fallback icons - either those specified to Gtk.IconTheme.lookup_icon() or the always-available “image-missing”. The icon chosen is returned by this function.

If the icon was created without an icon theme, this function returns None.

Deprecated since version 4.20.

is_symbolic()[source]
Returns:

true if the icon is symbolic, false otherwise

Return type:

bool

Checks if the icon is symbolic or not.

This currently uses only the file name and not the file contents for determining this. This behaviour may change in the future.

Deprecated since version 4.20.

Property Details

Gtk.IconPaintable.props.file
Name:

file

Type:

Gio.File

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The file representing the icon, if any.

Gtk.IconPaintable.props.icon_name
Name:

icon-name

Type:

str

Default Value:

None

Flags:

DEPRECATED, READABLE, WRITABLE, CONSTRUCT_ONLY

The icon name that was chosen during lookup.

Deprecated since version 4.20.

Gtk.IconPaintable.props.is_symbolic
Name:

is-symbolic

Type:

bool

Default Value:

False

Flags:

DEPRECATED, READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the icon is symbolic or not.

Deprecated since version 4.20.

Gtk.IconPaintable.props.scale
Name:

scale

Type:

int

Default Value:

1

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Gtk.IconPaintable.props.size
Name:

size

Type:

int

Default Value:

16

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY