gtk-rs / gtk

DEPRECATED, use https://github.com/gtk-rs/gtk3-rs repository instead!
https://gtk-rs.org/
MIT License
1.24k stars 82 forks source link

set_icon_name exists, but is not accessible #855

Closed starfear closed 5 years ago

starfear commented 5 years ago

I have included all traits, using

use gio::prelude::*;
use gtk::prelude::*;

but code below is not working:

let button = gtk::Button::new();
button.set_icon_name("mail-reply-sender");

I have also tried:

use gtk::*;
use gtk::ToolButtonExt;
use ToolButtonExt;

Error: the method set_icon_name exists but the following trait bounds were not satisfied: gtk::Button : gtk::GtkWindowExt gtk::Button : gtk::ToolButtonExt

my cargo config:

[dependencies.gtk]
version = "0.7.0"
# features = ["v3_16"]

[dependencies.gio]
version = ""
features = ["v2_44"]
sdroege commented 5 years ago

Why do you think there should be a set_icon_name() on generic buttons? It exists in GTK4 but not in GTK3. In GTK3 it only exists on gtk::ToolButton and gtk::Window as you discovered, and gtk::DragSet / gtk::DragSource (which are not included in the bindings currently).

GTK4 bindings are currently being developed and will be merged into the gtk-rs organization over the next weeks.

@GuillaumeGomez I think this one can be closed?