Crate libadwaita

Source
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

§Example

Adwaita needs to be initialized before use. This can be done by either:

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§

pub use ffi;
pub use gdk;
pub use gio;
pub use glib;
pub use gtk;

Modules§

builders
prelude
subclass

Structs§

AboutDialogv1_5
GLib type: GObject with reference counted clone semantics.
AboutWindowDeprecatedv1_2
GLib type: GObject with reference counted clone semantics.
ActionRow
GLib type: GObject with reference counted clone semantics.
AlertDialogv1_5
GLib type: GObject with reference counted clone semantics.
Animation
GLib type: GObject with reference counted clone semantics.
AnimationTarget
GLib type: GObject with reference counted clone semantics.
Application
GLib type: GObject with reference counted clone semantics.
ApplicationWindow
GLib type: GObject with reference counted clone semantics.
Avatar
GLib type: GObject with reference counted clone semantics.
Bannerv1_3
GLib type: GObject with reference counted clone semantics.
Bin
GLib type: GObject with reference counted clone semantics.
BottomSheetv1_6
GLib type: GObject with reference counted clone semantics.
Breakpointv1_4
GLib type: GObject with reference counted clone semantics.
BreakpointBinv1_4
GLib type: GObject with reference counted clone semantics.
BreakpointConditionv1_4
GLib type: Boxed type with copy-on-clone semantics.
ButtonContent
GLib type: GObject with reference counted clone semantics.
ButtonRowv1_6
GLib type: GObject with reference counted clone semantics.
CallbackAnimationTarget
GLib type: GObject with reference counted clone semantics.
Carousel
GLib type: GObject with reference counted clone semantics.
CarouselIndicatorDots
GLib type: GObject with reference counted clone semantics.
CarouselIndicatorLines
GLib type: GObject with reference counted clone semantics.
Clamp
GLib type: GObject with reference counted clone semantics.
ClampLayout
GLib type: GObject with reference counted clone semantics.
ClampScrollable
GLib type: GObject with reference counted clone semantics.
ComboRow
GLib type: GObject with reference counted clone semantics.
Dialogv1_5
GLib type: GObject with reference counted clone semantics.
EntryRowv1_2
GLib type: GObject with reference counted clone semantics.
EnumListItem
GLib type: GObject with reference counted clone semantics.
EnumListModel
GLib type: GObject with reference counted clone semantics.
ExpanderRow
GLib type: GObject with reference counted clone semantics.
FlapDeprecated
GLib type: GObject with reference counted clone semantics.
HeaderBar
GLib type: GObject with reference counted clone semantics.
InlineViewSwitcherv1_7
GLib type: GObject with reference counted clone semantics.
Layoutv1_6
GLib type: GObject with reference counted clone semantics.
LayoutSlotv1_6
GLib type: GObject with reference counted clone semantics.
LeafletDeprecated
GLib type: GObject with reference counted clone semantics.
LeafletPageDeprecated
GLib type: GObject with reference counted clone semantics.
MessageDialogDeprecatedv1_2
GLib type: GObject with reference counted clone semantics.
MultiLayoutViewv1_6
GLib type: GObject with reference counted clone semantics.
NavigationPagev1_4
GLib type: GObject with reference counted clone semantics.
NavigationSplitViewv1_4
GLib type: GObject with reference counted clone semantics.
NavigationViewv1_4
GLib type: GObject with reference counted clone semantics.
OverlaySplitViewv1_4
GLib type: GObject with reference counted clone semantics.
PasswordEntryRowv1_2
GLib type: GObject with reference counted clone semantics.
PreferencesDialogv1_5
GLib type: GObject with reference counted clone semantics.
PreferencesGroup
GLib type: GObject with reference counted clone semantics.
PreferencesPage
GLib type: GObject with reference counted clone semantics.
PreferencesRow
GLib type: GObject with reference counted clone semantics.
PreferencesWindowDeprecated
GLib type: GObject with reference counted clone semantics.
PropertyAnimationTargetv1_2
GLib type: GObject with reference counted clone semantics.
SpinRowv1_4
GLib type: GObject with reference counted clone semantics.
Spinnerv1_6
GLib type: GObject with reference counted clone semantics.
SpinnerPaintablev1_6
GLib type: GObject with reference counted clone semantics.
SplitButton
GLib type: GObject with reference counted clone semantics.
SpringAnimation
GLib type: GObject with reference counted clone semantics.
SpringParams
GLib type: Shared boxed type with reference counted clone semantics.
SqueezerDeprecated
GLib type: GObject with reference counted clone semantics.
SqueezerPageDeprecated
GLib type: GObject with reference counted clone semantics.
StatusPage
GLib type: GObject with reference counted clone semantics.
StyleManager
GLib type: GObject with reference counted clone semantics.
SwipeTracker
GLib type: GObject with reference counted clone semantics.
Swipeable
GLib type: GObject with reference counted clone semantics.
SwitchRowv1_4
GLib type: GObject with reference counted clone semantics.
TabBar
GLib type: GObject with reference counted clone semantics.
TabButtonv1_3
GLib type: GObject with reference counted clone semantics.
TabOverviewv1_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.
TabViewShortcutsv1_2
TimedAnimation
GLib type: GObject with reference counted clone semantics.
Toast
GLib type: GObject with reference counted clone semantics.
ToastOverlay
GLib type: GObject with reference counted clone semantics.
Togglev1_7
GLib type: GObject with reference counted clone semantics.
ToggleGroupv1_7
GLib type: GObject with reference counted clone semantics.
ToolbarViewv1_4
GLib type: GObject with reference counted clone semantics.
ViewStack
GLib type: GObject with reference counted clone semantics.
ViewStackPage
GLib type: GObject with reference counted clone semantics.
ViewStackPagesv1_4
GLib type: GObject with reference counted clone semantics.
ViewSwitcher
GLib type: GObject with reference counted clone semantics.
ViewSwitcherBar
GLib type: GObject with reference counted clone semantics.
ViewSwitcherTitleDeprecated
GLib type: GObject with reference counted clone semantics.
Window
GLib type: GObject with reference counted clone semantics.
WindowTitle
GLib type: GObject with reference counted clone semantics.
WrapBoxv1_7
GLib type: GObject with reference counted clone semantics.
WrapLayoutv1_7
GLib type: GObject with reference counted clone semantics.

Enums§

AccentColorv1_6
AnimationState
BannerButtonStylev1_7
BreakpointConditionLengthTypev1_4
BreakpointConditionRatioTypev1_4
CenteringPolicy
ColorScheme
DialogPresentationModev1_5
Easing
FlapFoldPolicyDeprecated
FlapTransitionTypeDeprecated
FoldThresholdPolicyDeprecated
InlineViewSwitcherDisplayModev1_7
JustifyModev1_7
LeafletTransitionTypeDeprecated
LengthUnitv1_4
NavigationDirection
PackDirectionv1_7
ResponseAppearancev1_2
SqueezerTransitionTypeDeprecated
ToastPriority
ToolbarStylev1_4
ViewSwitcherPolicy
WrapPolicyv1_7

Functions§

init
is_animations_enabled
is_initialized
lerp
major_version
micro_version
minor_version
rgba_to_standalonev1_6