Granite is an extension of GTK+. Among other things, it provides complex widgets and convenience functions designed for use in apps built for elementary OS.
- AccelLabel - AccelLabel is meant to be used as a Gtk.MenuItem child for displaying a GLib.Action's accelerator alongside the Menu Item label.
- Application - This is the base class for all Granite-based apps. It has methods that help to create a great deal of an app's functionality.
- AsyncImage - AsyncImage is a Gtk.Image that provides a way to load icons and images asynchronously without blocking the main GTK thread.
- Dialog - Granite.Dialog is a styled Gtk.Dialog that uses an empty title area and action widgets in the bottom/end position.
- HeaderLabel - HeaderLabel is a start-aligned Gtk.Label with the Granite H4 style class
- MessageDialog - MessageDialog is an elementary OS styled dialog used to display a message to the user.
- ModeSwitch - ModeSwitch is a selection control for choosing between two options that can be described with an icon.
- SeekBar - This widget is a playback statusbar that contains a Gtk.Scale widget and two labels displaying the current progression and the total duration.
- Settings - Granite.Settings provides a way to share Pantheon desktop settings with applications.
- SettingsPage - AbstractSettingsPage is a Gtk.ScrolledWindow subclass with properties used by other Granite settings widgets.
- SettingsSidebar - SettingsSidebar acts as a controller for a Gtk.Stack; it shows a row of buttons to switch between the various pages of the associated stack widget.
- SimpleSettingsPage - SimpleSettingsPage is a widget divided into three sections: a predefined header, a content area, and an action area.
- SwitchModelButton - SwitchModelButton is a Gtk.ToggleButton containing a Gtk.Label and a Gtk.Switch and using the menuitem css name. It can optionally show description text when activated.
- ValidatedEntry - ValidatedEntry is a Gtk.Entry subclass that is meant to be used in forms where input must be validated before the form can be submitted. It provides feedback to users about the state of input validation and keeps track of its own validation state. By default, input is considered invalid.
- CloseButtonPosition - An enum used to derermine where the window manager currently displays its close button on windows. Used with Granite.Widgets.Utils.get_default_close_button_position.
- public const string STYLE_CLASS_ACCENT
Style class to give accent color to a Gtk.Label or symbolic icon
- public const string STYLE_CLASS_AVATAR
- public const string STYLE_CLASS_BACK_BUTTON
Style class for shaping a Gtk.Button
- public const string STYLE_CLASS_BADGE
Style class for numbered badges as in a Granite.Widgets.SourceList
- public const string STYLE_CLASS_CARD
Style class for adding a small shadow to a container such as for image thumbnails
- public const string STYLE_CLASS_CATEGORY_EXPANDER
- public const string STYLE_CLASS_CHECKERBOARD
Style class for checkered backgrounds to represent transparency in images
- public const string STYLE_CLASS_COLOR_BUTTON
- public const string STYLE_CLASS_DEFAULT_DECORATION
Style class for slim headerbars, like in Terminal
- public const string STYLE_CLASS_H1_LABEL
Style class for large primary text as seen in Granite.Widgets.Welcome
- public const string STYLE_CLASS_H2_LABEL
Style class for large seondary text as seen in Granite.Widgets.Welcome
- public const string STYLE_CLASS_H3_LABEL
Style class for small primary text
- public const string STYLE_CLASS_H4_LABEL
Style class for a Granite.HeaderLabel
- public const string STYLE_CLASS_KEYCAP
Style class for a Gtk.Label to be displayed as a keyboard key cap
- public const string STYLE_CLASS_MODE_SWITCH
Style class for a Gtk.Switch used to change between two modes rather than active and inactive states
- public const string STYLE_CLASS_OVERLAY_BAR
Style class for a Granite.Widgets.OverlayBar
- public const string STYLE_CLASS_PRIMARY_LABEL
Style class for primary label text in a Granite.MessageDialog
- public const string STYLE_CLASS_ROUNDED
- public const string STYLE_CLASS_SEEKBAR
Style class for a Granite.SeekBar
- public const string STYLE_CLASS_SMALL_LABEL
Style class for a Gtk.Label to emulate Pango's "<small>" and "size='smaller'"
- public const string STYLE_CLASS_SOURCE_LIST
Style class for a Granite.Widgets.SourceList
- public const string STYLE_CLASS_STORAGEBAR
Style class for a
- public const string STYLE_CLASS_TEMPERATURE
Style class for a temperature scale, a Gtk.Scale with a "cold" to "hot" color gradient
- public const string STYLE_CLASS_TERMINAL
- public const string STYLE_CLASS_WARMTH
Style class for a warmth scale, a Gtk.Scale with a "less warm" to "more warm" color gradient
- public const string STYLE_CLASS_WELCOME
Style class for a Granite.Widgets.Welcome
- public const string TOOLTIP_SECONDARY_TEXT_MARKUP
Pango markup to use for secondary text in a Gtk.Tooltip, such as for accelerators, extended descriptions, etc.
- public const int TRANSITION_DURATION_CLOSE
Transition duration when a widget closes, hides a portion of its content, or exits the screen
- public const int TRANSITION_DURATION_OPEN
Transition duration when a widget opens, reveals more content, or enters the screen
- public delegate void WidgetsDroppedDelegate ()
- public string accel_to_string (string? accel)
Converts a Gtk.accelerator_parse style accel string to a human-readable string.
- public RGBA contrasting_foreground_color (RGBA bg_color)
Takes a Gdk.RGBA background color and returns a suitably-contrasting foreground color, i.e. for determining text color on a colored background. There is a slight bias toward returning white, as white generally looks better on a wider range of colored backgrounds than black.
- public void force_elementary_style ()
Sets the app's icons, cursors, and stylesheet to elementary defaults.
- public string markup_accel_tooltip (string? accels, string? description = null)
- DateTime - The DateTime namespace contains useful functions for getting the default translated format for either date and time.
- public string get_default_date_format (bool with_weekday = false, bool with_day = true, bool with_year = false)
Gets the default translated date format. The function constructs a new string interpreting the with_weekday, with_day and with_year parameters so that it can be used with formatting functions like GLib.DateTime.format.
- public string get_default_time_format (bool is_12h = false, bool with_second = false)
Gets a default translated time format. The function constructs a new string interpreting the is_12h and with_second parameters so that it can be used with formatting functions like GLib.DateTime.format.
- public string get_relative_datetime (DateTime date_time)
Compares a GLib.DateTime to
GLib.DateTime.now_localand returns a location, relative date and time string. Results appear as natural-language strings like "Now", "5m ago", "Yesterday"
- public bool is_same_day (DateTime day1, DateTime day2)
Compare two GLib.DateTime and return true if they occur on the same day of the same year
- public string seconds_to_time (int seconds)
Converts seconds into the ISO 8601 standard date format for minutes (e.g. 100s to 01:40). Output of negative seconds is prepended with minus character.
- BufferSurface - A buffer containing an internal Cairo-usable surface and context, designed for usage with large, rarely updated draw operations.
- Color - A class containing an RGBA color and methods for more powerful color manipulation.
- Utilities - A utility class for frequently-performed drawing operations.
- Contract - Interface for executing and accessing properties of Contractor actions
- SettingsSerializable - This interface is used by objects that need to be serialized in a Settings. The object must have a string representation and provide these methods to translate between the string and object representations.
- ContractorProxy - Provides a convenient GObject wrapper around Contractor's D-bus API
- IconFactory - This class provides an easy way to access symbolic icons.
- Logger - This class helps in the use of logs in a Granite application.
- Paths - A class for interacting with frequently-used directories, following the XDG Base Directory specification: http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
- Settings - Class for interacting with an internal GLib.Settings using native Vala properties. Clients of this class should not connect to the GLib.Object.notify signal. Instead, they should connect to the Granite.Services.Settings.changed signal.
- SimpleCommand - This class is a wrapper to run an async command. It provides useful signals.
- System - Utility class for frequently-used system-related functions, such as opening files, launching applications, or executing terminal commands.
- LogLevel - LogLevel:
- Application - Utilities for Applications
- public async bool set_badge (int64 count) throws Error
Set the badge count, usually visible with the dock in the desktop. There is no guarantee that the target environment supports it in any way. For it to be visible, one has to make sure to call set_badge_visible().
- public async bool set_badge_visible (bool visible) throws Error
Set the badge visibility.
- public async bool set_progress (double progress) throws Error
Set the progress of the application, usually visible with the dock in the desktop. There is no guarantee that the target environment supports it in any way. For it to be visible, one has to make sure to call set_progress_visible().
- public async bool set_progress_visible (bool visible) throws Error
Set the progress visibility.
- public const string BADGE
- public const string CATEGORY_EXPANDER
- public const string COMPOSITED
- public const string CONTENT_VIEW
- public const string CONTENT_VIEW_WINDOW
- public const string DECORATED_WINDOW
- public const string H1_TEXT
- public const string H2_TEXT
- public const string H3_TEXT
- public const string HELP_BUTTON
- public const string OVERLAY_BAR
- public const string POPOVER
- public const string POPOVER_BG
- public const string SOURCE_LIST
- public const string THIN_PANE_SEPARATOR
- public const string TITLE_TEXT
- SourceListDragDest - An interface for receiving data from other widgets via drag-and-drop.
- SourceListDragSource - An interface for dragging items out of the source list widget.
- SourceListSortable - An interface for sorting items.
- AlertView - The AlertView widget shows to the user that some actions are now restricted.
- Avatar - The Avatar widget allowes to theme & crop images with css BORDER_RADIUS property in the .avatar class.
- CellRendererBadge - A badge renderer.
- CellRendererExpander - An expander renderer.
- CollapsiblePaned - A paned that can be easily collapsed by double-clicking over the pane separator. If it was previously collapsed, it is expanded, and vice-versa.
- CompositedWindow - CompositedWindow is an invisible window without decorations or background.
- DatePicker - This class allows users to pick dates from a calendar.
- DynamicNotebook - Tab bar widget designed for a variable number of tabs. Supports showing a "New tab" button, restoring closed tabs, "pinning" tabs, and more.
- ModeButton - This widget is a multiple option modal switch
- OverlayBar - A floating status bar that displays a single line of text.
- SourceList - A widget that can display a list of items organized in categories.
- StorageBar - An horizontal bar showing the remaining amount of space.
- Tab - This is a standard tab which can be used in a notebook to form a tabbed UI.
- TimePicker - This widget allows users to easily pick a time.
- Toast - Toasts are small in-app notifications that provide feedback about an operation in a small popup. They only fill the space required to show the message and do not block the UI.
- Welcome - This class is for making a first -launch screen easily
- Utils - This namespace contains functions to apply CSS stylesheets to widgets.
- public void apply_text_style_to_label (TextStyle text_style, Label label)
This method applies given text style to given label
- public string? get_button_layout_schema ()
This methods returns the schema used by Granite.Widgets.Utils.get_default_close_button_position to determine the close button placement. It will first check for the pantheon/gala schema and then fallback to the default gnome one. If neither is available, null is returned. Make sure to check for this case, as otherwise your program may crash on startup.
- public CssProvider? get_css_provider (string stylesheet)
- public bool get_default_close_button_position (out CloseButtonPosition position)
This method detects the close button position as configured for the window manager. If you need to know when this key changed, it's best to listen on the schema returned by Granite.Widgets.Utils.get_button_layout_schema for changes and then call this method again.
- public CssProvider? set_color_primary (Widget window, RGBA color, int priority = STYLE_PROVIDER_PRIORITY_APPLICATION)
Applies colorPrimary property to the window. The colorPrimary property currently changes the color of the Gtk.HeaderBar and it's children so that the application window can have a so-called "brand color".
- public CssProvider? set_theming (Widget widget, string stylesheet, string? class_name, int priority)
Applies the stylesheet to the widget.
- public CssProvider? set_theming_for_screen (Screen screen, string stylesheet, int priority)
Applies a stylesheet to the given screen. This will affect all the widgets which are part of that screen.