StatusIcon
Object Hierarchy:
Gtk.StatusIcon
Gtk.StatusIcon
Gtk.StatusIcon
GLib.Object
GLib.Object
GLib.Object->Gtk.StatusIcon
Description:
[ CCode ( type_id = "gtk_status_icon_get_type ()" ) ] [ Version ( deprecated = true , deprecated_since = "3.14" ) ]public class StatusIcon : Object
Warning: StatusIcon is deprecated since 3.14.
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 StatusIcon 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 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 Object . 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 Notification API which works well with Application
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.
Content:
Properties:
public bool embedded { get ; }
true if the statusicon is embedded
in a notification area.
public string file { set ; }
public Icon gicon { owned get ; set ; }
The Icon displayed in the
StatusIcon .
public bool has_tooltip { get ; set ; }
Enables or disables the emission of
query_tooltip on status_icon
.
public string icon_name { owned get ; set ; }
public Orientation orientation { get ; }
The orientation of the tray in which the statusicon is embedded.
public Pixbuf pixbuf { owned get ; set ; }
public Screen screen { get ; set ; }
public int size { get ; }
public string stock { owned get ; set ; }
public ImageType storage_type { get ; }
public string title { get ; set ; }
The title of this tray icon.
public string tooltip_markup { owned get ; set ; }
Sets the text of tooltip to be the given string, which is marked up
with the Pango text markup language .
public string tooltip_text { owned get ; set ; }
Sets the text of tooltip to be the given string.
public bool visible { get ; set ; }
Creation methods:
Methods:
public bool get_geometry (out unowned Screen screen, out Rectangle area, out Orientation orientation)
Obtains information about the location of the status icon on screen.
public unowned Icon ? get_gicon ()
Retrieves the Icon being displayed by
the StatusIcon .
public bool get_has_tooltip ()
Returns the current value of the has-tooltip property.
public unowned string ? get_icon_name ()
Gets the name of the icon being displayed by the
StatusIcon .
public unowned Pixbuf ? get_pixbuf ()
Gets the Pixbuf being displayed by the
StatusIcon .
public unowned Screen get_screen ()
Returns the Screen associated with
this .
public int get_size ()
Gets the size in pixels that is available for the image.
public unowned string ? get_stock ()
Gets the id of the stock icon being displayed by the
StatusIcon .
public ImageType get_storage_type ()
Gets the type of representation being used by the
StatusIcon to store image data.
public unowned string get_title ()
Gets the title of this tray icon.
public string ? get_tooltip_markup ()
Gets the contents of the tooltip for this
.
public string ? get_tooltip_text ()
Gets the contents of the tooltip for this
.
public bool get_visible ()
Returns whether the status icon is visible or not.
public uint32 get_x11_window_id ()
This function is only useful on the X11/freedesktop.
public bool is_embedded ()
Returns whether the status icon is embedded in a notification area.
public void position_menu (Menu menu, ref int x, ref int y, out bool push_in)
Menu positioning function to use with
popup to position menu
aligned to the status icon user_data
.
public void set_from_file (string filename)
Makes this display the file
filename
.
public void set_from_gicon (Icon icon)
Makes this display the
Icon .
public void set_from_icon_name (string icon_name)
Makes this display the icon named
icon_name
from the current icon theme.
public void set_from_pixbuf (Pixbuf ? pixbuf)
Makes this display pixbuf
.
public void set_from_stock (string stock_id)
Makes this display the stock icon
with the id stock_id
.
public void set_has_tooltip (bool has_tooltip)
Sets the has-tooltip property on this
to has_tooltip
.
public void set_name (string name)
Sets the name of this tray icon.
public void set_screen (Screen screen)
Sets the Screen where
this is displayed; if the icon is already mapped, it will be unmapped, and then remapped on the new
screen.
public void set_title (string title)
Sets the title of this tray icon.
public void set_tooltip_markup (string ? markup)
Sets markup
as the contents of the tooltip, which is
marked up with the Pango text markup language .
public void set_tooltip_text (string text)
Sets text
as the contents of the tooltip.
public void set_visible (bool visible)
Shows or hides a status icon.
Signals:
public virtual signal void activate ()
Gets emitted when the user activates the status icon.
public virtual signal bool button_press_event (EventButton event)
The button_press_event signal will be
emitted when a button (typically from a mouse) is pressed.
public virtual signal bool button_release_event (EventButton event)
The button_release_event signal will be
emitted when a button (typically from a mouse) is released.
public virtual signal void popup_menu (uint button, uint activate_time)
Gets emitted when the user brings up the context menu of the status
icon.
public virtual signal bool query_tooltip (int x, int y, bool keyboard_mode, Tooltip tooltip)
Emitted when the hover timeout has expired with the cursor hovering
above status_icon
; or emitted when status_icon
got focus in keyboard mode.
public virtual signal bool scroll_event (EventScroll event)
The scroll_event signal is emitted when a
button in the 4 to 7 range is pressed.
public virtual signal bool size_changed (int size)
Gets emitted when the size available for the image changes, e.
Inherited Members:
All known members inherited from class GLib.Object
@get
@new
@ref
@set
add_toggle_ref
add_weak_pointer
bind_property
connect
constructed
disconnect
dispose
dup_data
dup_qdata
force_floating
freeze_notify
get_class
get_data
get_property
get_qdata
get_type
getv
interface_find_property
interface_install_property
interface_list_properties
is_floating
new_valist
new_with_properties
newv
notify
notify_property
ref_count
ref_sink
remove_toggle_ref
remove_weak_pointer
replace_data
replace_qdata
set_data
set_data_full
set_property
set_qdata
set_qdata_full
set_valist
setv
steal_data
steal_qdata
thaw_notify
unref
watch_closure
weak_ref
weak_unref