Rust bindings for GTK+, Cairo, GtkSourceView and other GLib-compatible libraries
Questions tagged [gtk-rs]
94 questions
2
votes
0 answers
How can I make the text of a GTK MenuItem bold using gtk-rs?
I use gtk-rs to implement a little of UI for an AppIndicator application. I would like to make certain menu items in my appindicator menu bold, but I can't figure out how to go about it.
The menu item is initialized like so:
let foobar =…

Boris Terzic
- 10,858
- 8
- 45
- 59
2
votes
1 answer
In rust and gtk4, why does not gtk::Label satisfy gtk::Widget?
I'm trying to learn rust with its gtk4 bindings and decided to try ListStore as a model for ListBox. In order to bind the model, function which returns Widget is needed, but i need a Label. Why doesn't Label, which inherits Widget (implements…

mspehar
- 527
- 1
- 6
- 19
2
votes
1 answer
Creating an Async Image Gtk3 Rust
I'm trying to create a similar widget like Granite.AsyncImage using Rust Gtk, but I can't figure how to make it work because Pixbuff is not safe thread.
I have a code like next:
let file =…

Carlos Lopez
- 133
- 4
2
votes
0 answers
How can we handle button click like event for entry box in gtk-rs?
We can add a button click event in gtk-rs like this
let btn: Button = builder.get_object("button1").expect("Cant get button");
btn.connect_clicked(|_| {
println!("Activated");
});
like the above code how can I add similar click event…

Eka
- 14,170
- 38
- 128
- 212
2
votes
1 answer
Assertion fails in g_application_parse_command_line whenever gtk application run multiple times
My Gtk-rs program crashes if I want to run a gtk application multiple times.
use gio::prelude::*;
use gtk::prelude::*;
static APP_ID: &'static str = "com.localserver.app";
fn build_ui(app: >k::Application, fallback_message: Option<&'static…

noconst
- 639
- 4
- 15
2
votes
0 answers
How to connect Buttons to Actions in custom SimpleActionGroups in gtk-rs?
I'd like to use a SimpleActionGroup registered to a Widget that handles SimpleActions. But anyhow every Button that targets to Actions with my custom prefix are grayed out and can't be clicked. However Buttons that are targeting the action prefixes…

dosch
- 31
- 6
2
votes
1 answer
How do I create a simple Gtk MessageDialog in Rust / gtk-rs?
I am trying out gtk-rs and while there is certainly documentation available, it is much too hard to understand for a beginner. I just see many different impls and traits and generics, but there never are any code examples from which I can learn.…

casualcoder
- 231
- 2
- 11
2
votes
2 answers
Gtk-ERROR **: failed to add UI: Error on line 1 char 1: Document must begin with an element
Why is GTK+ 3 throwing this error?
(.:11977): Gtk-ERROR **: 21:10:01.149: failed to add UI: Errore alla riga 1 carattere 1: Il documento deve iniziare con un elemento (es. )
Translated from Italian to English:
(.:11977): Gtk-ERROR **:…

Edoardo La Greca
- 43
- 8
2
votes
1 answer
How safe is this behavior of GTK-rs Builder::get_object?
In The Rust Programming Language, it says something like:
Move semantics
There’s some more subtlety here, though: Rust ensures that there is
exactly one binding to any given resource. For example, if we have a
vector, we can assign it to…

Angel Angel
- 19,670
- 29
- 79
- 105
1
vote
2 answers
how to get the state of a grouped gtk.CheckButton using Action
I'm trying to get the state of a gtk.CheckButton using Action since gtk docs says:
When the code must keep track of the state of a group of radio buttons, it is recommended to keep track of such state through a stateful GAction with a target for…

raven
- 775
- 6
- 22
1
vote
1 answer
How do I create a `glib::MainContext::channel()` outside of the `connect_activate()` and then pass it in?
I am new to rust and GTK. I'd like to create a glib::MainContext::channel() pair prior to initializing my gtk::Application. I believe this can be thought of exactly like a std::sync::mpsc. And while I can create the rx/tx channel pair and save it,…

awm129
- 305
- 2
- 11
1
vote
3 answers
How do you limit the number of GtkColumnView rows
I'm trying to reduce the load time of a ColumnView widget with lots of rows. quoting from
gtk list widget documentation:
While it is not a problem for short lists to instantiate widgets for every item in the model, once lists grow to thousands or…

raven
- 775
- 6
- 22
1
vote
1 answer
GTK-rs getting input from GTK::Entry
I have a small gtk-rs application where I am trying to display an input field and get the input from the user. At the moment I can't get the input from the input field when the user clicks the button. I know button.connect_clicked is where I need to…

John554
- 145
- 1
- 7
1
vote
0 answers
Using SVG as css-background in GTK-rs
I have recently started working with gtk-rs for the first time and I'm trying to use an svg file defined in a css file as the background for a box. All my css on my other elements load in perfectly and the properties for the box also load in but the…

macl
- 11
- 2
1
vote
0 answers
Cannot build gtk4-rs based cargo, build fails with linking error "LINK : fatal error LNK1181: cannot open input file 'gobject-2.0.lib'"
I am trying to build a hello world project to see if gtk4-rs is working correctly, which always fails at creating the binaries. The rest of the build seems to fine (tried to run cargo clean and cargo check a couple of times, those do not produce any…

valhrafnaz
- 11
- 2