14 releases (breaking)

1.0.0-alpha Aug 5, 2020
0.11.1 Jan 15, 2024
0.10.0 Feb 10, 2023
0.9.0 Jan 15, 2022
0.1.0 Dec 27, 2018

#728 in GUI

Download history 1/week @ 2024-07-22 4/week @ 2024-08-19 85/week @ 2024-09-02 37/week @ 2024-09-09 97/week @ 2024-09-23 11/week @ 2024-09-30 3/week @ 2024-10-07 12/week @ 2024-10-14 71/week @ 2024-10-21 10/week @ 2024-10-28 4/week @ 2024-11-04

97 downloads per month

LGPL-2.1-only

735KB
19K SLoC

Rust Handy bindings

This library contains safe Rust bindings for Handy, a library that offers building blocks for modern adaptive GNOME applications.

See also

Example

use gtk::prelude::*;
use gtk::{Application, Box, ListBox, Orientation};
use libhandy::prelude::*;
use libhandy::{ActionRow, ApplicationWindow, HeaderBar};

fn main() {
    let application = Application::builder()
        .application_id("com.example.FirstHandyApp")
        .build();

    application.connect_activate(|app| {
        libhandy::init();

        // ActionRows are only available in Handy
        let row = ActionRow::builder()
            .activatable(true)
            .selectable(false)
            .margin(32)
            .title("Click me")
            .build();
        row.connect_activated(|_| {
            eprintln!("Clicked!");
        });

        let list = ListBox::builder().child(&row).build();
        // the content class makes the list look nicer
        list.style_context().add_class("content");

        // Combine the content in a box
        let content = Box::new(Orientation::Vertical, 0);
        // Handy's ApplicationWindow does not include a HeaderBar
        content.add(
            &HeaderBar::builder()
                .show_close_button(true)
                .title("First Handy Program")
                .build(),
        );
        content.add(&list);

        let window = ApplicationWindow::builder()
            .default_width(350)
            .default_height(70)
            // add content to window
            .child(&content)
            .build();
        window.set_application(Some(app));
        window.show_all();
    });

    application.run();
}

Dependencies

~17MB
~402K SLoC