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.
- 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.
- 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.
- 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.
- 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 unowned string STYLE_CLASS_ACCENT
Style class to give accent color to a Gtk.Label or symbolic icon
- public const unowned string STYLE_CLASS_AVATAR
- public const unowned string STYLE_CLASS_BACK_BUTTON
Style class for shaping a Gtk.Button
- public const unowned string STYLE_CLASS_BADGE
Style class for numbered badges as in a Granite.Widgets.SourceList
- public const unowned string STYLE_CLASS_CARD
Style class for adding a small shadow to a container such as for image thumbnails
- public const unowned string STYLE_CLASS_CATEGORY_EXPANDER
- public const unowned string STYLE_CLASS_CHECKERBOARD
Style class for checkered backgrounds to represent transparency in images
- public const unowned string STYLE_CLASS_H1_LABEL
Style class for large primary text as seen in Granite.Widgets.Welcome
- public const unowned string STYLE_CLASS_H2_LABEL
Style class for large seondary text as seen in Granite.Widgets.Welcome
- public const unowned string STYLE_CLASS_H3_LABEL
Style class for small primary text
- public const unowned string STYLE_CLASS_H4_LABEL
Style class for a Granite.HeaderLabel
- public const unowned 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 unowned string STYLE_CLASS_OVERLAY_BAR
Style class for a Granite.Widgets.OverlayBar
- public const unowned string STYLE_CLASS_PRIMARY_LABEL
Style class for primary label text in a Granite.MessageDialog
- public const unowned string STYLE_CLASS_SEEKBAR
Style class for a Granite.SeekBar
- public const unowned string STYLE_CLASS_SOURCE_LIST
Style class for a Granite.Widgets.SourceList
- public const unowned string STYLE_CLASS_STORAGEBAR
Style class for a
- public const unowned string STYLE_CLASS_TERMINAL
- public const unowned string STYLE_CLASS_WELCOME
Style class for a Granite.Widgets.Welcome
- 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 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:
- public const unowned string BADGE
- public const unowned string CATEGORY_EXPANDER
- public const unowned string COMPOSITED
- public const unowned string CONTENT_VIEW
- public const unowned string CONTENT_VIEW_WINDOW
- public const unowned string DECORATED_WINDOW
- public const unowned string H1_TEXT
- public const unowned string H2_TEXT
- public const unowned string H3_TEXT
- public const unowned string HELP_BUTTON
- public const unowned string OVERLAY_BAR
- public const unowned string POPOVER
- public const unowned string POPOVER_BG
- public const unowned string SOURCE_LIST
- public const unowned string THIN_PANE_SEPARATOR
- public const unowned 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.
- AboutDialog - This class makes an about dialog which goes in the App Menu on most apps. This class is deprecated. Applications should instead provide an Appstream appdata.xml file to describe their metadata
- AlertView - The AlertView widget shows to the user that some actions are now restricted.
- AppMenu - An App Menu is the gear menu that goes on the right of the toolbar.
- 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.