granite-7
Description:
Granite is a platform library for Gtk 4. It provides complex widgets and convenience functions designed for use in apps built for elementary OS.
Content:
Namespaces:
- Granite
- AccelLabel - AccelLabel is meant to be used
as a
Gtk.MenuItem
child for displaying a GLib.Action's accelerator alongside the Menu Item label. - DatePicker - This class allows users to pick dates from a calendar.
- 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
- HyperTextView - This class enables navigatable URLs in Gtk.TextView
- 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.
- OverlayBar - A floating status bar that displays a single line of text.
- Placeholder - Placeholder is used to provide further information in an empty view such as a Gtk.ListBox or when onboarding.
- 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.
- 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.
- 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.
- public const string STYLE_CLASS_ACCENT
Style class to give accent color to a Gtk.Label or symbolic icon
- public const string STYLE_CLASS_BACKGROUND
Style class to match the window background
- 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
- 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_CHECKERBOARD
Style class for checkered backgrounds to represent transparency in images
- public const string STYLE_CLASS_CIRCULAR
Style class for a circular Gtk.Button
- public const string STYLE_CLASS_COLOR_BUTTON
Style class for color chooser buttons to be applied to Gtk.CheckButton or
Gtk.RadioButton
- public const string STYLE_CLASS_DEFAULT_DECORATION
Style class for slim headerbars, like in Terminal
- public const string STYLE_CLASS_DESTRUCTIVE_ACTION
Style class for Gtk.Button with a destructive action
- public const string STYLE_CLASS_DIALOG_CONTENT_AREA
Style class for the content area in dialogs.
- public const string STYLE_CLASS_DIM_LABEL
Style class for dimmed labels.
- public const string STYLE_CLASS_ERROR
Style class for widgets in error state.
- public const string STYLE_CLASS_FLAT
Style class for flattened widgets, such as buttons,
- public const string STYLE_CLASS_FRAME
Style class for adding a border to Gtk.ListBox, Gtk.InfoBar, and others
- 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_LARGE_ICONS
Style class for a Gtk.Image used to set a context-aware large icon size. By default this is 32px, but in certain contexts it could be larger or smaller depending on the default assumed icon size.
- public const string STYLE_CLASS_LINKED
Style class for linked widgets, such as a box containing buttons belonging to the same control.
- public const string STYLE_CLASS_MENU
Style class for Gtk.Popover which is used as a menu.
- public const string STYLE_CLASS_MENUITEM
Style class for Gtk.Popover children which are used as menu items.
- public const string STYLE_CLASS_MESSAGE_DIALOG
Style class for message dialogs.
- 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_OSD
Style class for "on-screen display" widgets such as Granite.Toast and Granite.OverlayBar
- public const string STYLE_CLASS_RICH_LIST
Style class for setting standard row padding and row height in a Gtk.ListBox
- public const string STYLE_CLASS_ROUNDED
Style class for rounded corners, i.e. on a Gtk.Window or Granite.STYLE_CLASS_CARD
- public const string STYLE_CLASS_SIDEBAR
Style class defining a sidebar, such as the left side in a file chooser
- 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_SUGGESTED_ACTION
Style class for when an action (usually a button) is the primary suggested action in a specific context.
- 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
Style class for Gtk.Label or Gtk.TextView to emulate the appearance of Terminal. This includes text color, background color, selection highlighting, and selecting the system monospace font.
- public const string STYLE_CLASS_TITLE_LABEL
Style class for title label text in a Granite.MessageDialog
- public const string STYLE_CLASS_VIEW
Style class for widgets which should use base color as their background
- 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_WARNING
Style class for widgets in warning state.
- 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_IN_PLACE
Transition duration when a widget transforms in-place, like when filtering content with a view switcher
- public const int TRANSITION_DURATION_OPEN
Transition duration when a widget opens, reveals more content, or enters the screen
- 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 init ()
- public string markup_accel_tooltip (string[]? accels, string? description = null)
Takes a description and an array of accels and returns Pango markup for use in a Gtk.Tooltip . This method uses Granite.accel_to_string.
- 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_local
and 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.
- Services
- 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
- System - Utility class for frequently- used system-related functions, such as opening files, launching applications, or executing terminal commands.
- ContractorError - thrown by Granite.Services.ContractorProxy
- 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.
- SettingsUri - Deep links to specific Settings pages.
- public const string LOCATION
Link to open Security & Privacy → Location Services settings page
- public const string NETWORK
Link to Network settings page
- public const string NOTIFICATIONS
Link to open Notifications settings page
- public const string ONLINE_ACCOUNTS
Link to open Online Accounts settings page
- public const string PERMISSIONS
Link to open Applications → Permissions settings page
- public const string SHORTCUTS
Link to open Keyboard → Shortcuts → Custom settings page
- public const string SOUND_INPUT
Link to open Sound → Input settings page
- Widgets
- Utils - This namespace contains functions to apply CSS stylesheets to widgets.
- 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".