Fix examples and tutorial with GTK API updates

This commit is contained in:
Víctor Manuel Jáquez Leal 2019-02-27 21:10:49 +01:00
parent c378167573
commit 066b22efc5
4 changed files with 15 additions and 9 deletions

View file

@ -66,7 +66,7 @@ fn create_ui(app: &gtk::Application) {
let vbox = gtk::Box::new(gtk::Orientation::Vertical, 0); let vbox = gtk::Box::new(gtk::Orientation::Vertical, 0);
// Add our widget to the gui // Add our widget to the gui
vbox.pack_start(&widget, true, true, 0); vbox.pack_start(&widget, true, true, 0);
let label = gtk::Label::new("Position: 00:00:00"); let label = gtk::Label::new(Some("Position: 00:00:00"));
vbox.pack_start(&label, true, true, 5); vbox.pack_start(&label, true, true, 5);
window.add(&vbox); window.add(&vbox);
window.show_all(); window.show_all();

View file

@ -170,7 +170,7 @@ fn create_ui(app: &gtk::Application) {
vbox.pack_start(&video_window, true, true, 0); vbox.pack_start(&video_window, true, true, 0);
let label = gtk::Label::new("Position: 00:00:00"); let label = gtk::Label::new(Some("Position: 00:00:00"));
vbox.pack_start(&label, true, true, 5); vbox.pack_start(&label, true, true, 5);
window.add(&vbox); window.add(&vbox);

View file

@ -114,7 +114,7 @@ fn create_pipeline() -> Result<gst::Pipeline, Error> {
// Select the text content and the font we want to use for the piece of text. // Select the text content and the font we want to use for the piece of text.
let font_desc = pango::FontDescription::from_string("Sans Bold 26"); let font_desc = pango::FontDescription::from_string("Sans Bold 26");
layout.set_font_description(&font_desc); layout.set_font_description(Some(&font_desc));
layout.set_text("GStreamer"); layout.set_text("GStreamer");
// The following is a context struct (containing the pango layout and the configured video info). // The following is a context struct (containing the pango layout and the configured video info).

View file

@ -112,8 +112,10 @@ mod tutorial5 {
Inhibit(false) Inhibit(false)
}); });
let play_button = let play_button = gtk::Button::new_from_icon_name(
gtk::Button::new_from_icon_name("media-playback-start", gtk::IconSize::SmallToolbar); Some("media-playback-start"),
gtk::IconSize::SmallToolbar,
);
let pipeline = playbin.clone(); let pipeline = playbin.clone();
play_button.connect_clicked(move |_| { play_button.connect_clicked(move |_| {
let pipeline = &pipeline; let pipeline = &pipeline;
@ -122,8 +124,10 @@ mod tutorial5 {
.expect("Unable to set the pipeline to the `Playing` state"); .expect("Unable to set the pipeline to the `Playing` state");
}); });
let pause_button = let pause_button = gtk::Button::new_from_icon_name(
gtk::Button::new_from_icon_name("media-playback-pause", gtk::IconSize::SmallToolbar); Some("media-playback-pause"),
gtk::IconSize::SmallToolbar,
);
let pipeline = playbin.clone(); let pipeline = playbin.clone();
pause_button.connect_clicked(move |_| { pause_button.connect_clicked(move |_| {
let pipeline = &pipeline; let pipeline = &pipeline;
@ -132,8 +136,10 @@ mod tutorial5 {
.expect("Unable to set the pipeline to the `Paused` state"); .expect("Unable to set the pipeline to the `Paused` state");
}); });
let stop_button = let stop_button = gtk::Button::new_from_icon_name(
gtk::Button::new_from_icon_name("media-playback-stop", gtk::IconSize::SmallToolbar); Some("media-playback-stop"),
gtk::IconSize::SmallToolbar,
);
let pipeline = playbin.clone(); let pipeline = playbin.clone();
stop_button.connect_clicked(move |_| { stop_button.connect_clicked(move |_| {
let pipeline = &pipeline; let pipeline = &pipeline;