Rust bindings for GTK+, Cairo, GtkSourceView and other GLib-compatible libraries
Questions tagged [gtk-rs]
94 questions
0
votes
0 answers
How do you get the value of a GTK4 scale in gtk-rs
I am new to GTK and Rust and I am wondering how to get the value of a GTK Scale as the things I have tried have not worked.
I was expecting the scale_var.get_value() function in the GTK Docs to work, but I simply get an error saying the function…

lar0ld42
- 1
- 3
0
votes
1 answer
value moved into closure here, in previous iteration of loop when setting value
I am trying to write a small app in gtk-rs that takes an input and checks if it is correct against a value and displays an error if it is not. I am struggling with handling the code to display the error.
I have seen a number of questions covering…

John554
- 145
- 1
- 7
0
votes
2 answers
gtk-rs Set maximum size of window
Is it possible to set the maximum size for a window in gtk-rs? When reading the documentation I can find lots of options to set the minimum window size and the default window size however I can not find any options to set the maximum window size.
It…

John554
- 145
- 1
- 7
0
votes
1 answer
How do I set the width of buttons when using stack switcher in gtk-rs
I am using gtk-rs to build an application and currently I am having some trouble adjusting the width of the buttons when using StackSwitcher. I have tried using CSS for this as the gtk-rs book seems to imply but I just get an error stating No…

John554
- 145
- 1
- 7
0
votes
1 answer
gtk-rs getting user input from button press
I am have a gtk-rs application where a Gtk::Entry is used to get user input when the user hits a submit button. Everything compiles and runs however I can not get the user input outside of the method that handles the button press.
I can check that…

John554
- 145
- 1
- 7
0
votes
1 answer
What is the gtk-rs design pattern for changing the widgets on a page?
I am using gtk-rs to build a small application and I am struggling with the concept of changing the widgets displayed on a page. So far I have been working through this guide but I have not found the information I am looking for.
An example would be…

John554
- 145
- 1
- 7
0
votes
1 answer
How can I remove the duplication in this Rust code?
This working Rust code repeats itself somewhat:
fn append_column(tree: &TreeView, attribute: &str, id: i32) {
let column = TreeViewColumn::new();
match attribute {
"text" => {
let cell = CellRendererText::new();
…

DobbyTheElf
- 604
- 6
- 21
0
votes
1 answer
gtk-rs - rust - Use struct method as a callback function to a signal
I'm struggling to pass a method as a callback function, when calling connect_activate() on a gtk::Application, as shown in the code below. I've made a closure to avoid troubles concerning the &self argument, but now I cannot fix this lifetime issues…

LRMAAX
- 301
- 3
- 10
0
votes
1 answer
gtk-rs: Does a gtk4 widget hold a reference to its callbacks while a gtk3 widget doesn't?
I am porting a working gtk-rs application from gtk3 to gtk4. The following code is a reduced self-contained example to demonstrate the Problem. The code is for gtk3 with the changes required for gtk4 indicated by comments.
use gtk::prelude::*;
use…

Donald
- 19
- 3
0
votes
0 answers
Rust GTK4 can't get monitors parameters
I want to list monitors to fill dropdown with monitors parameters.
I'm able to get display then all 3 connected monitors but monitors.item(i).unwrap() is Object not Monitor. How can I get to monitors to get params from them?
fn…

d3im
- 323
- 2
- 4
- 18
0
votes
1 answer
How to store Rust object without Default in GObject
I am basically following the gtk-rs book to create a simple app. I have the following rust struct, which I want to display in a ListView. This struct is basically read-only and should not be edited, so I do not want to expose it's members as…

Hellstorm
- 562
- 4
- 23
0
votes
1 answer
Update the values of child objects at runtime
How I can update child widget of gtk::Grid (gtk::Label in example) in runtime?
In example code after change value SpinButton, I add recreated Grid (fn grid()) with updated childs (I don't want remove old Grid in example).
In a real project I need to…

Aiany
- 13
- 2
0
votes
1 answer
Gtk-rs pass window as value
New to Rust and I'm trying to build a simple Rust GUI using gtk-rs following the docs here. What I'm wondering is whether it's possible to pass around the window that gets built in the build_ui function, so that I can update it from other operations…

jschuss
- 645
- 1
- 8
- 21
0
votes
1 answer
Error LNK1181: cannot open input file 'gobject-2.0.lib'
I am trying to build a gtk-4 GUI application with the Rust in VScode, but I am unable to because I can't build my project. What could be the problem? How do I fix it?
Here's the error
fatal error LNK1181: cannot open input file 'gobject-2.0.lib'
My…

Jayson Meribe
- 134
- 9
0
votes
1 answer
libadwaita-rs 1.1 missing check_template_children
I'm trying to use libadwaita 1.1 in my Gtk-rs (GTK 4) application in order to access the new PreferenceGroup suffix feature introduced in 1.1. However, when I update my Cargo.toml to use libadwaita 0.1.1 (from 0.1) I get an error in most of my UI…

Ricky Kresslein
- 372
- 1
- 13