mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-15 09:10:08 +00:00
replace deprecated Picture::for_pixbuf method with Picture::for_paintable
This commit is contained in:
parent
6ca1b3ce9a
commit
c5ca74702a
@ -19,6 +19,7 @@ use crate::app::browser::{
|
||||
};
|
||||
use crate::Profile;
|
||||
use gtk::{
|
||||
gdk::Texture,
|
||||
gdk_pixbuf::Pixbuf,
|
||||
gio::{
|
||||
Cancellable, IOStream, NetworkAddress, SocketClient, SocketClientEvent, SocketConnectable,
|
||||
@ -673,7 +674,7 @@ impl Page {
|
||||
.set_title(uri_to_title(&uri).as_str());
|
||||
|
||||
// Update page content
|
||||
content.to_image(&buffer);
|
||||
content.to_image(&Texture::for_pixbuf(&buffer));
|
||||
|
||||
// Update window components
|
||||
update.activate(Some(&id));
|
||||
|
@ -8,9 +8,9 @@ use text::Text;
|
||||
|
||||
use crate::app::browser::window::{tab::item::Action as TabAction, Action as WindowAction};
|
||||
use gtk::{
|
||||
gdk_pixbuf::Pixbuf,
|
||||
gdk::Paintable,
|
||||
glib::Uri,
|
||||
prelude::{BoxExt, WidgetExt},
|
||||
prelude::{BoxExt, IsA, WidgetExt},
|
||||
Box, Orientation,
|
||||
};
|
||||
use std::{rc::Rc, time::Duration};
|
||||
@ -38,9 +38,9 @@ impl Content {
|
||||
/// Set new `content::Image` component for `Self`
|
||||
///
|
||||
/// * action removes previous children component from `Self`
|
||||
pub fn to_image(&self, buffer: &Pixbuf) -> Image {
|
||||
pub fn to_image(&self, paintable: &impl IsA<Paintable>) -> Image {
|
||||
self.clean();
|
||||
let image = Image::new_from_pixbuf(buffer);
|
||||
let image = Image::new_from_paintable(paintable);
|
||||
self.gobject.append(image.gobject());
|
||||
image
|
||||
}
|
||||
|
@ -1,4 +1,8 @@
|
||||
use gtk::{gdk_pixbuf::Pixbuf, prelude::WidgetExt, ContentFit, Picture};
|
||||
use gtk::{
|
||||
gdk::Paintable,
|
||||
prelude::{IsA, WidgetExt},
|
||||
ContentFit, Picture,
|
||||
};
|
||||
|
||||
pub struct Image {
|
||||
gobject: Picture,
|
||||
@ -12,8 +16,8 @@ impl Image {
|
||||
|
||||
// Constructors
|
||||
|
||||
pub fn new_from_pixbuf(buffer: &Pixbuf) -> Self {
|
||||
let gobject = Picture::for_pixbuf(buffer);
|
||||
pub fn new_from_paintable(paintable: &impl IsA<Paintable>) -> Self {
|
||||
let gobject = Picture::for_paintable(paintable);
|
||||
|
||||
gobject.set_content_fit(Self::DEFAULT_CONTENT_FIT);
|
||||
gobject.set_margin_end(Self::DEFAULT_MARGIN);
|
||||
|
Loading…
x
Reference in New Issue
Block a user