Expand description
§Rust Adwaita bindings
This library contains safe Rust bindings for Adwaita, a library that offers building blocks for modern GNOME applications.
See also
- GTK 4 Rust bindings documentation
- Libadwaita documentation
- gtk-rs project overview
- Report bindings related issues
- Report upstream libadwaita issues
§Example
Adwaita needs to be initialized before use. This can be done by either:
- using
adw::Applicationinstead ofgtk::Application, or by - calling
initonstartup.
The libadwaita crate is usually renamed to adw. You can
do this globally in your Cargo.toml file:
[dependencies.adw]
package = "libadwaita"
version = "0.x.y"use adw::prelude::*;
use adw::{ActionRow, Application, ApplicationWindow, HeaderBar};
use gtk::{Box, ListBox, Orientation, SelectionMode};
fn main() {
let application = Application::builder()
.application_id("com.example.FirstAdwaitaApp")
.build();
application.connect_activate(|app| {
// ActionRows are only available in Adwaita
let row = ActionRow::builder()
.activatable(true)
.title("Click me")
.build();
row.connect_activated(|_| {
eprintln!("Clicked!");
});
let list = ListBox::builder()
.margin_top(32)
.margin_end(32)
.margin_bottom(32)
.margin_start(32)
.selection_mode(SelectionMode::None)
// makes the list look nicer
.css_classes(vec![String::from("boxed-list")])
.build();
list.append(&row);
// Combine the content in a box
let content = Box::new(Orientation::Vertical, 0);
// Adwaitas' ApplicationWindow does not include a HeaderBar
content.append(&HeaderBar::new());
content.append(&list);
let window = ApplicationWindow::builder()
.application(app)
.title("First App")
.default_width(350)
// add content to window
.content(&content)
.build();
window.present();
});
application.run();
}Re-exports§
Modules§
Structs§
- About
Dialog - GLib type: GObject with reference counted clone semantics.
- About
Window Deprecated - GLib type: GObject with reference counted clone semantics.
- Action
Row - GLib type: GObject with reference counted clone semantics.
- Alert
Dialog - GLib type: GObject with reference counted clone semantics.
- Animation
- GLib type: GObject with reference counted clone semantics.
- Animation
Target - GLib type: GObject with reference counted clone semantics.
- Application
- GLib type: GObject with reference counted clone semantics.
- Application
Window - GLib type: GObject with reference counted clone semantics.
- Avatar
- GLib type: GObject with reference counted clone semantics.
- Banner
- GLib type: GObject with reference counted clone semantics.
- Bin
- GLib type: GObject with reference counted clone semantics.
- Bottom
Sheet - GLib type: GObject with reference counted clone semantics.
- Breakpoint
- GLib type: GObject with reference counted clone semantics.
- Breakpoint
Bin - GLib type: GObject with reference counted clone semantics.
- Breakpoint
Condition - GLib type: Boxed type with copy-on-clone semantics.
- Button
Content - GLib type: GObject with reference counted clone semantics.
- Button
Row - GLib type: GObject with reference counted clone semantics.
- Callback
Animation Target - GLib type: GObject with reference counted clone semantics.
- Carousel
- GLib type: GObject with reference counted clone semantics.
- Carousel
Indicator Dots - GLib type: GObject with reference counted clone semantics.
- Carousel
Indicator Lines - GLib type: GObject with reference counted clone semantics.
- Clamp
- GLib type: GObject with reference counted clone semantics.
- Clamp
Layout - GLib type: GObject with reference counted clone semantics.
- Clamp
Scrollable - GLib type: GObject with reference counted clone semantics.
- Combo
Row - GLib type: GObject with reference counted clone semantics.
- Dialog
- GLib type: GObject with reference counted clone semantics.
- Entry
Row - GLib type: GObject with reference counted clone semantics.
- Enum
List Item - GLib type: GObject with reference counted clone semantics.
- Enum
List Model - GLib type: GObject with reference counted clone semantics.
- Expander
Row - GLib type: GObject with reference counted clone semantics.
- Flap
Deprecated - GLib type: GObject with reference counted clone semantics.
- Header
Bar - GLib type: GObject with reference counted clone semantics.
- Inline
View Switcher - GLib type: GObject with reference counted clone semantics.
- Layout
- GLib type: GObject with reference counted clone semantics.
- Layout
Slot - GLib type: GObject with reference counted clone semantics.
- Leaflet
Deprecated - GLib type: GObject with reference counted clone semantics.
- Leaflet
Page Deprecated - GLib type: GObject with reference counted clone semantics.
- Message
Dialog Deprecated - GLib type: GObject with reference counted clone semantics.
- Multi
Layout View - GLib type: GObject with reference counted clone semantics.
- Navigation
Page - GLib type: GObject with reference counted clone semantics.
- Navigation
Split View - GLib type: GObject with reference counted clone semantics.
- Navigation
View - GLib type: GObject with reference counted clone semantics.
- None
Animation Target - GLib type: GObject with reference counted clone semantics.
- Overlay
Split View - GLib type: GObject with reference counted clone semantics.
- Password
Entry Row - GLib type: GObject with reference counted clone semantics.
- Preferences
Dialog - GLib type: GObject with reference counted clone semantics.
- Preferences
Group - GLib type: GObject with reference counted clone semantics.
- Preferences
Page - GLib type: GObject with reference counted clone semantics.
- Preferences
Row - GLib type: GObject with reference counted clone semantics.
- Preferences
Window Deprecated - GLib type: GObject with reference counted clone semantics.
- Property
Animation Target - GLib type: GObject with reference counted clone semantics.
- Shortcut
Label - GLib type: GObject with reference counted clone semantics.
- Shortcuts
Dialog - GLib type: GObject with reference counted clone semantics.
- Shortcuts
Item - GLib type: GObject with reference counted clone semantics.
- Shortcuts
Section - GLib type: GObject with reference counted clone semantics.
- Sidebar
- GLib type: GObject with reference counted clone semantics.
- Sidebar
Item - GLib type: GObject with reference counted clone semantics.
- Sidebar
Section - GLib type: GObject with reference counted clone semantics.
- SpinRow
- GLib type: GObject with reference counted clone semantics.
- Spinner
- GLib type: GObject with reference counted clone semantics.
- Spinner
Paintable - GLib type: GObject with reference counted clone semantics.
- Split
Button - GLib type: GObject with reference counted clone semantics.
- Spring
Animation - GLib type: GObject with reference counted clone semantics.
- Spring
Params - GLib type: Shared boxed type with reference counted clone semantics.
- Squeezer
Deprecated - GLib type: GObject with reference counted clone semantics.
- Squeezer
Page Deprecated - GLib type: GObject with reference counted clone semantics.
- Status
Page - GLib type: GObject with reference counted clone semantics.
- Style
Manager - GLib type: GObject with reference counted clone semantics.
- Swipe
Tracker - GLib type: GObject with reference counted clone semantics.
- Swipeable
- GLib type: GObject with reference counted clone semantics.
- Switch
Row - GLib type: GObject with reference counted clone semantics.
- TabBar
- GLib type: GObject with reference counted clone semantics.
- TabButton
- GLib type: GObject with reference counted clone semantics.
- TabOverview
- GLib type: GObject with reference counted clone semantics.
- TabPage
- GLib type: GObject with reference counted clone semantics.
- TabView
- GLib type: GObject with reference counted clone semantics.
- TabView
Shortcuts - Timed
Animation - GLib type: GObject with reference counted clone semantics.
- Toast
- GLib type: GObject with reference counted clone semantics.
- Toast
Overlay - GLib type: GObject with reference counted clone semantics.
- Toggle
- GLib type: GObject with reference counted clone semantics.
- Toggle
Group - GLib type: GObject with reference counted clone semantics.
- Toolbar
View - GLib type: GObject with reference counted clone semantics.
- View
Stack - GLib type: GObject with reference counted clone semantics.
- View
Stack Page - GLib type: GObject with reference counted clone semantics.
- View
Stack Pages - GLib type: GObject with reference counted clone semantics.
- View
Switcher - GLib type: GObject with reference counted clone semantics.
- View
Switcher Bar - GLib type: GObject with reference counted clone semantics.
- View
Switcher Sidebar - GLib type: GObject with reference counted clone semantics.
- View
Switcher Title Deprecated - GLib type: GObject with reference counted clone semantics.
- Window
- GLib type: GObject with reference counted clone semantics.
- Window
Title - GLib type: GObject with reference counted clone semantics.
- WrapBox
- GLib type: GObject with reference counted clone semantics.
- Wrap
Layout - GLib type: GObject with reference counted clone semantics.
Enums§
- Accent
Color - Animation
State - Banner
Button Style - Breakpoint
Condition Length Type - Breakpoint
Condition Ratio Type - Centering
Policy - Color
Scheme - Dialog
Presentation Mode - Easing
- Flap
Fold Policy Deprecated - Flap
Transition Type Deprecated - Fold
Threshold Policy Deprecated - Inline
View Switcher Display Mode - Justify
Mode - Leaflet
Transition Type Deprecated - Length
Unit - Navigation
Direction - Pack
Direction - Response
Appearance - Sidebar
Mode - Squeezer
Transition Type Deprecated - Toast
Priority - Toolbar
Style - View
Switcher Policy - Wrap
Policy