1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
//! # Rust Adwaita bindings
//!
//! This library contains safe Rust bindings for [Adwaita](https://gitlab.gnome.org/GNOME/libadwaita), a library that offers
//! building blocks for modern GNOME applications.
//!
//! See also
//!
//! - [GTK 4 Rust bindings documentation](mod@gtk)
//! - [Libadwaita documentation](https://gnome.pages.gitlab.gnome.org/libadwaita/)
//! - [gtk-rs project overview](https://gtk-rs.org/)
//!
//! # Example
//!
//! Adwaita needs to be initialized before use by calling [`fn@init`] on
//! [`startup`](fn@gio::prelude::ApplicationExt::connect_startup).
//!
//! The [`libadwaita`](mod@crate) crate is usually renamed to `adw`. You can
//! do this globally in your `Cargo.toml` file:
//!
//! ```toml
//! [dependencies.adw]
//! package = "libadwaita"
//! version = "0.x.y"
//! ```
//!
//! ```no_run
//! # use libadwaita as adw;
//! use adw::prelude::*;
//! use gtk::prelude::*;
//!
//! use adw::{ActionRow, ApplicationWindow, HeaderBar};
//! use gtk::{Application, Box, ListBox, Orientation};
//!
//! fn main() {
//! let application = Application::builder()
//! .application_id("com.example.FirstAdwaitaApp")
//! .build();
//!
//! application.connect_startup(|_| {
//! adw::init();
//! });
//!
//! application.connect_activate(|app| {
//! // ActionRows are only available in Adwaita
//! let row = ActionRow::builder()
//! .activatable(true)
//! .selectable(false)
//! .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)
//! // the content class makes the list look nicer
//! .css_classes(vec![String::from("content")])
//! .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::builder()
//! .title_widget(&adw::WindowTitle::new("First App", ""))
//! .build(),
//! );
//! content.append(&list);
//!
//! let window = ApplicationWindow::builder()
//! .application(app)
//! .default_width(350)
//! // add content to window
//! .child(&content)
//! .build();
//! window.show();
//! });
//!
//! application.run();
//! }
//! ```
// Re-export the -sys bindings
pub use ffi;
pub use gtk;
/// Asserts that this is the main thread and `gtk::init` has been called.
pub use ComboRowBuilder;
pub use *;
pub use *;