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::Application
instead ofgtk::Application
, or by - calling
init
onstartup
.
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 v1_5
- GLib type: GObject with reference counted clone semantics.
- About
Window Deprecated v1_2
- GLib type: GObject with reference counted clone semantics.
- Action
Row - GLib type: GObject with reference counted clone semantics.
- Alert
Dialog v1_5
- 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
v1_3
- GLib type: GObject with reference counted clone semantics.
- Bin
- GLib type: GObject with reference counted clone semantics.
- Bottom
Sheet v1_6
- GLib type: GObject with reference counted clone semantics.
- Breakpoint
v1_4
- GLib type: GObject with reference counted clone semantics.
- Breakpoint
Bin v1_4
- GLib type: GObject with reference counted clone semantics.
- Breakpoint
Condition v1_4
- GLib type: Boxed type with copy-on-clone semantics.
- Button
Content - GLib type: GObject with reference counted clone semantics.
- Button
Row v1_6
- 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
v1_5
- GLib type: GObject with reference counted clone semantics.
- Entry
Row v1_2
- 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 v1_7
- GLib type: GObject with reference counted clone semantics.
- Layout
v1_6
- GLib type: GObject with reference counted clone semantics.
- Layout
Slot v1_6
- 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 v1_2
- GLib type: GObject with reference counted clone semantics.
- Multi
Layout View v1_6
- GLib type: GObject with reference counted clone semantics.
- Navigation
Page v1_4
- GLib type: GObject with reference counted clone semantics.
- Navigation
Split View v1_4
- GLib type: GObject with reference counted clone semantics.
- Navigation
View v1_4
- GLib type: GObject with reference counted clone semantics.
- Overlay
Split View v1_4
- GLib type: GObject with reference counted clone semantics.
- Password
Entry Row v1_2
- GLib type: GObject with reference counted clone semantics.
- Preferences
Dialog v1_5
- 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 v1_2
- GLib type: GObject with reference counted clone semantics.
- SpinRow
v1_4
- GLib type: GObject with reference counted clone semantics.
- Spinner
v1_6
- GLib type: GObject with reference counted clone semantics.
- Spinner
Paintable v1_6
- 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 v1_4
- GLib type: GObject with reference counted clone semantics.
- TabBar
- GLib type: GObject with reference counted clone semantics.
- TabButton
v1_3
- GLib type: GObject with reference counted clone semantics.
- TabOverview
v1_3
- 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 v1_2
- 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
v1_7
- GLib type: GObject with reference counted clone semantics.
- Toggle
Group v1_7
- GLib type: GObject with reference counted clone semantics.
- Toolbar
View v1_4
- 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 v1_4
- 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 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
v1_7
- GLib type: GObject with reference counted clone semantics.
- Wrap
Layout v1_7
- GLib type: GObject with reference counted clone semantics.
Enums§
- Accent
Color v1_6
- Animation
State - Banner
Button Style v1_7
- Breakpoint
Condition Length Type v1_4
- Breakpoint
Condition Ratio Type v1_4
- Centering
Policy - Color
Scheme - Dialog
Presentation Mode v1_5
- Easing
- Flap
Fold Policy Deprecated - Flap
Transition Type Deprecated - Fold
Threshold Policy Deprecated - Inline
View Switcher Display Mode v1_7
- Justify
Mode v1_7
- Leaflet
Transition Type Deprecated - Length
Unit v1_4
- Navigation
Direction - Pack
Direction v1_7
- Response
Appearance v1_2
- Squeezer
Transition Type Deprecated - Toast
Priority - Toolbar
Style v1_4
- View
Switcher Policy - Wrap
Policy v1_7