StatusIconRef
public struct StatusIconRef : StatusIconProtocol, GWeakCapturing
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 StatusIconRef
type acts as a lightweight Swift reference to an underlying GtkStatusIcon
instance.
It exposes methods that can operate on this data type through StatusIconProtocol
conformance.
Use StatusIconRef
only as an unowned
reference to an existing GtkStatusIcon
instance.
-
Untyped pointer to the underlying `GtkStatusIcon` instance.
For type-safe access, use the generated, typed pointer
status_icon_ptr
property instead.Declaration
Swift
public let ptr: UnsafeMutableRawPointer!
-
Designated initialiser from the underlying
C
data typeDeclaration
Swift
@inlinable init(_ p: UnsafeMutablePointer<GtkStatusIcon>)
-
Designated initialiser from a constant pointer to the underlying
C
data typeDeclaration
Swift
@inlinable init(_ p: UnsafePointer<GtkStatusIcon>)
-
Conditional initialiser from an optional pointer to the underlying
C
data typeDeclaration
Swift
@inlinable init!(_ maybePointer: UnsafeMutablePointer<GtkStatusIcon>?)
-
Conditional initialiser from an optional, non-mutable pointer to the underlying
C
data typeDeclaration
Swift
@inlinable init!(_ maybePointer: UnsafePointer<GtkStatusIcon>?)
-
Conditional initialiser from an optional
gpointer
Declaration
Swift
@inlinable init!(gpointer g: gpointer?)
-
Conditional initialiser from an optional, non-mutable
gconstpointer
Declaration
Swift
@inlinable init!(gconstpointer g: gconstpointer?)
-
Reference intialiser for a related type that implements
StatusIconProtocol
Declaration
Swift
@inlinable init<T>(_ other: T) where T : StatusIconProtocol
-
This factory is syntactic sugar for setting weak pointers wrapped in
GWeak<T>
Declaration
Swift
@inlinable static func unowned<T>(_ other: T) -> StatusIconRef where T : StatusIconProtocol
-
Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
StatusIconProtocol
.Declaration
Swift
@inlinable init<T>(cPointer: UnsafeMutablePointer<T>)
-
Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
StatusIconProtocol
.Declaration
Swift
@inlinable init<T>(constPointer: UnsafePointer<T>)
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
StatusIconProtocol
.Declaration
Swift
@inlinable init(mutating 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 init(raw: UnsafeMutableRawPointer)
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
StatusIconProtocol
.Declaration
Swift
@inlinable init(opaquePointer: OpaquePointer)
-
Creates an empty status icon object.
new is deprecated: Use #GNotification and #GtkApplication to provide status notifications
Declaration
Swift
@available(*, deprecated) @inlinable 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 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 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 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 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, seegtk_icon_factory_add_default()
andgtk_icon_factory_add()
.new_from_stock is deprecated: Use #GNotification and #GtkApplication to provide status notifications
Declaration
Swift
@available(*, deprecated) @inlinable 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 static func newFrom(file filename: UnsafePointer<gchar>!) -> StatusIconRef!
-
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 static func newFromG<IconT>(gicon icon: IconT) -> StatusIconRef! 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 static func newFrom(iconName: UnsafePointer<gchar>!) -> StatusIconRef!
-
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 static func newFrom<PixbufT>(pixbuf: PixbufT) -> StatusIconRef! 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, seegtk_icon_factory_add_default()
andgtk_icon_factory_add()
.new_from_stock is deprecated: Use #GNotification and #GtkApplication to provide status notifications
Declaration
Swift
@available(*, deprecated) @inlinable static func newFrom(stock stockID: UnsafePointer<gchar>!) -> StatusIconRef!