Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • May 11 2015 14:08
    GuillaumeGomez commented #71
codic12
@codic12
but no dialog shows up
i want to have the dialog show up, and also actually put some text in it (see commented out line). And access the gtk::ResponseType for the button value from it. how can i do these?
i get no errors
Dario Navin
@Zarathustra2

Hey guys, I would like to draw nodes and lines between those nodes. These graphs will be used to simulate algorithms on them. At which structs should I take a look?

My use case is:

  • draw n nodes and give them a color
  • connect some of the nodes with a straight line also in a specific color
Dario Navin
@Zarathustra2
Found the DrawingArea, seems like this is what I need
matrixbot
@matrixbot
vancha112 hey everyone ^^ I'm looking to increase the size of my text in gtk-rs. I knew that gtk could make use of css for increasing for example text size, but I don't know how to do so in gtk-rs :(
matrixbot
@matrixbot
gondolyr Hey everyone, I'm looking to start a project with libhandy but when I go to build, I get failed to add UI: .:7:1 Invalid object type 'HdyApplicationWindow'. I've installed libgtk-3-dev and libhandy-0.0-0, though I'd like to use libhandy-1 when it's available from the Debian repository. Also, if anyone has a handy tutorial, I'd appreciate that as well.
matrixbot
@matrixbot
gondolyr I contacted the maintainers of my distro and they happily added libhandy to the repo.
matrixbot
@matrixbot

mmstick > <@vancha112:matrix.org> hey everyone ^^ I'm looking to increase the size of my text in gtk-rs. I knew that gtk could make use of css for increasing for example text size, but I don't know how to do so in gtk-rs :(

You could use CSS, but pango also works for modifying text attributes.

matrixbot
@matrixbot
vancha112 Then pango it will be, thanks mmstick :)
dhgelling
@dhgelling
Hi all, I'm just learning gtk and using gtk-rs to do a tiny app, tried to follow the tutorial but it isn't completely up to date. My main problem off the bat is that if I close the app window, the main loop keeps running
how do I get the app to close?
my code currently looks like this
use gtk::prelude::*;

fn main() {
    if let Err(msg) = gtk::init() {
        println!("Failed to initialize GTK: '{}'", msg);
        return;
    }

    let layout_src = include_str!("../res/gui_layout.glade");
    let builder = gtk::Builder::from_string(layout_src);

    let window: gtk::Window = builder.get_object("window").unwrap();
    window.show_all();
    gtk::main();
}
matrixbot
@matrixbot
mmstick You need to connect the delete event on your window with gtk::main_quit()
window.connect_delete_event(move |_, _| {
    gtk::main_quit();
    gtk::Inhibit(false)
});
dhgelling
@dhgelling
awesome! thanks
what does the gtk::Inhibit do?
matrixbot
@matrixbot
mmstick It won't do anything here since gtk::main_quit() will quit the application
matrixbot
@matrixbot
Timo I was trying the gtk4 rust bindings on fedora and got errors
Timo Is it broken atm?
Timo That us the error message:
error: failed to select a version for `gsk4-sys`.
    ... required by package `gtk4 v0.1.0 (https://github.com/gtk-rs/gtk4#8aeb9dce)`
    ... which is depended on by `gtk-rs-examples4 v0.0.1 (/home/timo/Programming/RustExperiments/examples4)`
versions that meet the requirements `*` are: 0.1.0

the package `gsk4-sys` links to the native library `gtk-4`, but it conflicts with a previous package which links to `gtk-4` as well:
package `gdk4-sys v0.1.0 (https://github.com/gtk-rs/sys#dbd887f1)`
    ... which is depended on by `gdk4 v0.1.0 (https://github.com/gtk-rs/gdk4#bf87233c)`
    ... which is depended on by `gtk-rs-examples4 v0.0.1 (/home/timo/Programming/RustExperiments/examples4)`

failed to select a version for `gsk4-sys` which could resolve this conflict
Timo * That is the error message:
error: failed to select a version for `gsk4-sys`.
    ... required by package `gtk4 v0.1.0 (https://github.com/gtk-rs/gtk4#8aeb9dce)`
    ... which is depended on by `gtk-rs-examples4 v0.0.1 (/home/timo/Programming/RustExperiments/examples4)`
versions that meet the requirements `*` are: 0.1.0

the package `gsk4-sys` links to the native library `gtk-4`, but it conflicts with a previous package which links to `gtk-4` as well:
package `gdk4-sys v0.1.0 (https://github.com/gtk-rs/sys#dbd887f1)`
    ... which is depended on by `gdk4 v0.1.0 (https://github.com/gtk-rs/gdk4#bf87233c)`
    ... which is depended on by `gtk-rs-examples4 v0.0.1 (/home/timo/Programming/RustExperiments/examples4)`

failed to select a version for `gsk4-sys` which could resolve this conflict
Artie Fuffkin
@smallB007
Hello everyone, I've started just recently using gtk-rs and I have a question, how to use builder connect_signals from gtk-rs?
sodo
@djdisodo
how can i use cairo-rs with gtk-rs
matrixbot
@matrixbot
mmstick What are you trying to do?
Artūrs
@Townsheriff
Hey , any ideas how to get gobject from element?
Ben Konz
@benkonz
Does anyone have any experience getting GTK3 working on windows (through either native or cross compilation). I'm trying to follow https://gtk-rs.org/docs-src/tutorial/cross but am having trouble finding distros of the correct versions of GTK3 compiled with MinGW
john01dav
@john01dav_gitlab
@benkonz I managed to get it to compile once. IIRC what I did was install GTK3 via msys2, then pull out all the DLLS and point Cargo/Rust to them outside of msys2, with a seprate mingw toolchain.
matrixbot
@matrixbot
Timo🚳
@toger5:matrix.org
[m]
Not that many ppl here yet
(From the matrix side at least)
Michael Ditto
@Miridyan
Hey, could someone give me some direction on generating new bindings for VTE3?
Im trying to update the bindings from https://github.com/antoyo/vte-rs to use the latest version of gtk-rs, but it just won't build once I change the version number in Cargo.toml and regenerating the bindings with Gir
error[E0432]: unresolved import `gtk_sys`
 --> src/lib.rs:9:5
  |
9 | use gtk_sys as gtk;
  |     ^^^^^^^^^^^^^^ no `gtk_sys` in the root

error[E0432]: unresolved import `glib_sys`
  --> src/lib.rs:10:5
   |
10 | use glib_sys as glib;
   |     ^^^^^^^^^^^^^^^^ no `glib_sys` in the root

error[E0432]: unresolved import `gobject_sys`
  --> src/lib.rs:11:5
   |
11 | use gobject_sys as gobject;
   |     ^^^^^^^^^^^^^^^^^^^^^^ no `gobject_sys` in the root

error[E0432]: unresolved import `gio_sys`
  --> src/lib.rs:12:5
   |
12 | use gio_sys as gio;
   |     ^^^^^^^^^^^^^^ no `gio_sys` in the root

error[E0432]: unresolved import `atk_sys`
  --> src/lib.rs:13:5
   |
13 | use atk_sys as atk;
   |     ^^^^^^^^^^^^^^ no `atk_sys` in the root

error[E0432]: unresolved import `gdk_sys`
  --> src/lib.rs:14:5
   |
14 | use gdk_sys as gdk;
   |     ^^^^^^^^^^^^^^ no `gdk_sys` in the root

error[E0432]: unresolved import `pango_sys`
  --> src/lib.rs:15:5
   |
15 | use pango_sys as pango;
   |     ^^^^^^^^^^^^^^^^^^ no `pango_sys` in the root

error[E0432]: unresolved import `libc`
  --> src/lib.rs:18:5
   |
18 | use libc::{c_int, c_char, c_uchar, c_float, c_uint, c_double,
   |     ^^^^ maybe a missing crate `libc`?
All the libraries are in the Cargo.toml, but for some reason it doesn't see them?
I can clearly see gtk_sys and whatnot compiling from the cargo process, but then vte-sys-rs just fails with this error
Colby Eckert
@Tahlwyn
hi all. is it possible to align a Toolbar vertically along a screen edge? I know that Notebook has the really convenient set_tab_pos function that just takes a PositionType but Toolbar doesn't seem to have anything like that
garfreak
@garfreak

Hello. I am trying to implement a grid with two columns containing image buttons. The columns are evenly distributed and I have vertical scrolling enabled. I want to load images into the buttons dynamically such that they are scaled to use the available width and the height implied by this width and the image's aspect ratio. They also shall be resized when their environment does. I tried to use the size_allocate signal but this is kind of unlegit as I request a larger height when already allocating. It also does not work, the button only resizes delayed when it gets its next update by window resizing or similar. So I tried to create a custom sublass to somehow be able to customize height for width and similar functions. But it seems like buttons currently are not subclassable.

Does anyone have an idea on how to solve this problem? I am trying to do so for two days...

garfreak
@garfreak
Seems like I actually achieved getting larger buttons by a custom container with a custom height for width function. But the image inside the button is too small. When I scale a pixbuf to 0.9 times the image allocation (did this for padding) it starts with a very small allocation (12x9) and gets smaller with each update until crashing due to scaling to a zero-width/height. I modified the allocation signal handler to get the allocations of the parent elements of the image. I have a hierarchy ToggleButton->Alignment->Box->Image which seems to be generated by button.set_image. Outputting the allocations of all those widgets reveals that Box and Image have a small allocation (14x11) while the other ones have a much larger one (e.g. 377x301 for the Alignment). I set h/v expand and h/v align to true/Fill for the Box. The Box also just has a single child. I do not understand why the Box does not use the size of the Alignment. Furthermore, I have problems trying more things with the Alignment because it seems like it is not part of the language binding (it was in previous versions).
garfreak
@garfreak

I was able to fix the problem by not using set_image. Now I directly use add to add a child to the button as a button also is a container.

According to its functionality, gtk::Alignment likely is what caused my problems here as it seems to ignore other expand attributes. While it is flagged as deprecated (or at least all its member functions are), it is still used when setting the image for a button (where it is configured not to expand its content). I think that the reason why it was removed from gtk-rs is that it is deprecated but I could not find any further information about when and why it was removed. In my opinion it should be readded or potential problems caused by it should be documented for e.g. set_image as it is still being used by gtk3. Currently, it adds potentially unwanted behaviour while gtk-rs provides no interface to influence this behaviour.

garfreak
@garfreak
How can I subclass the gtk::Container? I worked with the normal subclassing procedure and had this tutorial (http://ptomato.name/advanced-gtk-techniques/html/custom-container.html) in C as orientation on what to implement. I added a vector of widgets to my subclass to be filled by add(). But get_children() does not return those widgets as foreach() and forall() are not overridden while they are in the C tutorial. But ContainerImpl does not allow me to override this? How can I fix this? Is there some special way of adding children I did not find in the documentation?
carmazine
@dearkarm

Hi Guys,

I'm trying to compile gtk4-rs with Cargo. I get a linker error:

note: /usr/bin/ld: /opt/gtk/lib/x86_64-linux-gnu/libgtk-4.so: undefined reference to `pango_fc_font_get_languages'

The /opt directory is where I have a freshly compiled gtk4. I am passing it to Cargo via this command:

CPPFLAGS="-I/opt/gtk/include" LDFLAGS="-L/opt/gtk/lib/x86_64-linux-gnu/" PKG_CONFIG_PATH="/opt/gtk/lib/x86_64-linux-gnu/pkgconfig" cargo build --release

Is there anything I can do to get past this error?

carmazine
@dearkarm
I just checked /opt/gtk/include/pango-1.0/pango/pangofc-font.h and the function is defined there
Fabian Freyer
@fabianfreyer
Hi! Is this the right place to ask about glib/gobject and glib_wrapper!?
1 reply
zygon.sisyphus
@zygon.sisyphus:matrix.org
[m]
hi, is gtk-rs working with msys2 ?
4 replies
zygon.sisyphus
@zygon.sisyphus:matrix.org
[m]
thx
zygon.sisyphus
@zygon.sisyphus:matrix.org
[m]
is working
some examples