StatusIcon

open class StatusIcon : GLibObject.Object, StatusIconProtocol

The “system tray” or notification area is normally used for transient icons that indicate some special state. For example, a system tray icon might appear to tell the user that they have new mail, or have an incoming instant message, or something along those lines. The basic idea is that creating an icon in the notification area is less annoying than popping up a dialog.

A GtkStatusIcon object can be used to display an icon in a “system tray”. The icon can have a tooltip, and the user can interact with it by activating it or popping up a context menu.

It is very important to notice that status icons depend on the existence of a notification area being available to the user; you should not use status icons as the only way to convey critical information regarding your application, as the notification area may not exist on the user’s environment, or may have been removed. You should always check that a status icon has been embedded into a notification area by using gtk_status_icon_is_embedded(), and gracefully recover if the function returns false.

On X11, the implementation follows the FreeDesktop System Tray Specification. Implementations of the “tray” side of this specification can be found e.g. in the GNOME 2 and KDE panel applications.

Note that a GtkStatusIcon is not a widget, but just a GObject. Making it a widget would be impractical, since the system tray on Windows doesn’t allow to embed arbitrary widgets.

GtkStatusIcon has been deprecated in 3.14. You should consider using notifications or more modern platform-specific APIs instead. GLib provides the GNotification API which works well with GtkApplication on multiple platforms and environments, and should be the preferred mechanism to notify the users of transient status updates. See this HowDoI for code examples.

The StatusIcon type acts as a reference-counted owner of an underlying GtkStatusIcon instance. It provides the methods that can operate on this data type through StatusIconProtocol conformance. Use StatusIcon as a strong reference or owner of a GtkStatusIcon instance.

  • Designated initialiser from the underlying `C` data type.
    

    This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the StatusIcon instance.

    Declaration

    Swift

    @inlinable
    public init(_ op: UnsafeMutablePointer<GtkStatusIcon>)

    Parameters

    op

    pointer to the underlying object

  • Designated initialiser from a constant pointer to the underlying C data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the StatusIcon instance.

    Declaration

    Swift

    @inlinable
    public init(_ op: UnsafePointer<GtkStatusIcon>)

    Parameters

    op

    pointer to the underlying object

  • Optional initialiser from a non-mutating gpointer to the underlying C data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the StatusIcon instance.

    Declaration

    Swift

    @inlinable
    override public init!(gpointer op: gpointer?)

    Parameters

    op

    gpointer to the underlying object

  • Optional initialiser from a non-mutating gconstpointer to the underlying C data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the StatusIcon instance.

    Declaration

    Swift

    @inlinable
    override public init!(gconstpointer op: gconstpointer?)

    Parameters

    op

    pointer to the underlying object

  • Optional initialiser from a constant pointer to the underlying C data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the StatusIcon instance.

    Declaration

    Swift

    @inlinable
    public init!(_ op: UnsafePointer<GtkStatusIcon>?)

    Parameters

    op

    pointer to the underlying object

  • Optional initialiser from the underlying C data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the StatusIcon instance.

    Declaration

    Swift

    @inlinable
    public init!(_ op: UnsafeMutablePointer<GtkStatusIcon>?)

    Parameters

    op

    pointer to the underlying object

  • Designated initialiser from the underlying C data type. Will retain GtkStatusIcon. i.e., ownership is transferred to the StatusIcon instance.

    Declaration

    Swift

    @inlinable
    public init(retaining op: UnsafeMutablePointer<GtkStatusIcon>)

    Parameters

    op

    pointer to the underlying object

  • Reference intialiser for a related type that implements StatusIconProtocol Will retain GtkStatusIcon.

    Declaration

    Swift

    @inlinable
    public init<T>(statusIcon other: T) where T : StatusIconProtocol

    Parameters

    other

    an instance of a related type that implements StatusIconProtocol

  • Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to StatusIconProtocol.

    Declaration

    Swift

    @inlinable
    override public init<T>(cPointer p: UnsafeMutablePointer<T>)

    Parameters

    cPointer

    pointer to the underlying object

  • Unsafe typed, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to StatusIconProtocol.

    Declaration

    Swift

    @inlinable
    override public init<T>(retainingCPointer cPointer: UnsafeMutablePointer<T>)

    Parameters

    cPointer

    pointer to the underlying object

  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to StatusIconProtocol.

    Declaration

    Swift

    @inlinable
    override public init(raw p: UnsafeRawPointer)

    Parameters

    p

    raw pointer to the underlying object

  • Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to StatusIconProtocol.

    Declaration

    Swift

    @inlinable
    override public init(retainingRaw raw: UnsafeRawPointer)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to StatusIconProtocol.

    Declaration

    Swift

    @inlinable
    public required init(raw p: UnsafeMutableRawPointer)

    Parameters

    p

    mutable raw pointer to the underlying object

  • Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to StatusIconProtocol.

    Declaration

    Swift

    @inlinable
    required public init(retainingRaw raw: UnsafeMutableRawPointer)

    Parameters

    raw

    mutable raw pointer to the underlying object

  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to StatusIconProtocol.

    Declaration

    Swift

    @inlinable
    override public init(opaquePointer p: OpaquePointer)

    Parameters

    p

    opaque pointer to the underlying object

  • Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to StatusIconProtocol.

    Declaration

    Swift

    @inlinable
    override public init(retainingOpaquePointer p: OpaquePointer)

    Parameters

    p

    opaque pointer to the underlying object

  • Creates an empty status icon object.

    new is deprecated: Use #GNotification and #GtkApplication to provide status notifications

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    public init()
  • Creates a status icon displaying the file filename.

    The image will be scaled down to fit in the available space in the notification area, if necessary.

    new_from_file is deprecated: Use #GNotification and #GtkApplication to provide status notifications

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    public init(file filename: UnsafePointer<gchar>!)
  • Creates a status icon displaying a GIcon. If the icon is a themed icon, it will be updated when the theme changes.

    new_from_gicon is deprecated: Use #GNotification and #GtkApplication to provide status notifications

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    public init<IconT>(gicon icon: IconT) where IconT : IconProtocol
  • Creates a status icon displaying an icon from the current icon theme. If the current icon theme is changed, the icon will be updated appropriately.

    new_from_icon_name is deprecated: Use #GNotification and #GtkApplication to provide status notifications

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    public init(iconName: UnsafePointer<gchar>!)
  • Creates a status icon displaying pixbuf.

    The image will be scaled down to fit in the available space in the notification area, if necessary.

    new_from_pixbuf is deprecated: Use #GNotification and #GtkApplication to provide status notifications

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    public init<PixbufT>(pixbuf: PixbufT) where PixbufT : PixbufProtocol
  • Creates a status icon displaying a stock icon. Sample stock icon names are GTK_STOCK_OPEN, GTK_STOCK_QUIT. You can register your own stock icon names, see gtk_icon_factory_add_default() and gtk_icon_factory_add().

    new_from_stock is deprecated: Use #GNotification and #GtkApplication to provide status notifications

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    public init(stock stockID: UnsafePointer<gchar>!)
  • Creates a status icon displaying the file filename.

    The image will be scaled down to fit in the available space in the notification area, if necessary.

    new_from_file is deprecated: Use #GNotification and #GtkApplication to provide status notifications

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    public static func newFrom(file filename: UnsafePointer<gchar>!) -> StatusIcon!
  • Creates a status icon displaying a GIcon. If the icon is a themed icon, it will be updated when the theme changes.

    new_from_gicon is deprecated: Use #GNotification and #GtkApplication to provide status notifications

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    public static func newFromG<IconT>(gicon icon: IconT) -> StatusIcon! where IconT : IconProtocol
  • Creates a status icon displaying an icon from the current icon theme. If the current icon theme is changed, the icon will be updated appropriately.

    new_from_icon_name is deprecated: Use #GNotification and #GtkApplication to provide status notifications

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    public static func newFrom(iconName: UnsafePointer<gchar>!) -> StatusIcon!
  • Creates a status icon displaying pixbuf.

    The image will be scaled down to fit in the available space in the notification area, if necessary.

    new_from_pixbuf is deprecated: Use #GNotification and #GtkApplication to provide status notifications

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    public static func newFrom<PixbufT>(pixbuf: PixbufT) -> StatusIcon! where PixbufT : PixbufProtocol
  • Creates a status icon displaying a stock icon. Sample stock icon names are GTK_STOCK_OPEN, GTK_STOCK_QUIT. You can register your own stock icon names, see gtk_icon_factory_add_default() and gtk_icon_factory_add().

    new_from_stock is deprecated: Use #GNotification and #GtkApplication to provide status notifications

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    public static func newFrom(stock stockID: UnsafePointer<gchar>!) -> StatusIcon!