cargo: Update to gtk4-rs 0.9 and core 0.20
This commit is contained in:
parent
dfd74b060f
commit
4650e6766a
10 changed files with 398 additions and 177 deletions
|
|
@ -61,7 +61,7 @@ impl Glycin {
|
|||
|
||||
let mut metadata: Metadata = Metadata::default();
|
||||
metadata.set_image_info(image.info().details.clone());
|
||||
metadata.set_mime_type(image.mime_type());
|
||||
metadata.set_mime_type(image.mime_type().to_string());
|
||||
updater.send(DecoderUpdate::Metadata(Box::new(metadata)));
|
||||
|
||||
let dimensions = (image.info().width, image.info().height);
|
||||
|
|
@ -70,14 +70,11 @@ impl Glycin {
|
|||
let frame = image.next_frame().await?;
|
||||
|
||||
let mut metadata: Metadata = Metadata::default();
|
||||
metadata.set_frame_info(frame.details);
|
||||
metadata.set_frame_info(frame.details().clone());
|
||||
updater.send(DecoderUpdate::Metadata(Box::new(metadata)));
|
||||
tiles.set_original_dimensions((
|
||||
frame.texture.width() as u32,
|
||||
frame.texture.height() as u32,
|
||||
));
|
||||
tiles.set_original_dimensions((frame.width() as u32, frame.height() as u32));
|
||||
|
||||
if let Some(delay) = frame.delay {
|
||||
if let Some(delay) = frame.delay() {
|
||||
updater.send(DecoderUpdate::Animated);
|
||||
|
||||
let position = (0, 0);
|
||||
|
|
@ -86,7 +83,7 @@ impl Glycin {
|
|||
position,
|
||||
zoom_level: tiling::zoom_to_level(1.),
|
||||
bleed: 0,
|
||||
texture: frame.texture,
|
||||
texture: frame.texture(),
|
||||
};
|
||||
|
||||
tiles.push_frame(tile, dimensions, delay);
|
||||
|
|
@ -103,10 +100,10 @@ impl Glycin {
|
|||
position,
|
||||
zoom_level: tiling::zoom_to_level(1.),
|
||||
bleed: 0,
|
||||
texture: frame.texture,
|
||||
texture: frame.texture(),
|
||||
};
|
||||
|
||||
tiles.push_frame(tile, dimensions, frame.delay.unwrap_or(delay));
|
||||
tiles.push_frame(tile, dimensions, frame.delay().unwrap_or(delay));
|
||||
|
||||
if tiles.n_frames() >= FRAME_BUFFER {
|
||||
break;
|
||||
|
|
@ -122,7 +119,7 @@ impl Glycin {
|
|||
position: (0, 0),
|
||||
zoom_level: tiling::zoom_to_level(1.),
|
||||
bleed: 0,
|
||||
texture: frame.texture,
|
||||
texture: frame.texture(),
|
||||
};
|
||||
|
||||
tiles.push(tile);
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ impl Svg {
|
|||
|
||||
let mut metadata: Metadata = Metadata::default();
|
||||
metadata.set_image_info(image.info().details.clone());
|
||||
metadata.set_mime_type(image.mime_type());
|
||||
metadata.set_mime_type(image.mime_type().to_string());
|
||||
updater.send(DecoderUpdate::Metadata(Box::new(metadata)));
|
||||
|
||||
tiles.set_original_dimensions((image.info().width, image.info().height));
|
||||
|
|
@ -145,7 +145,7 @@ impl Svg {
|
|||
tile_instructions.area.y() as u32,
|
||||
);
|
||||
|
||||
tiles.push_tile(tiling, position, frame.texture);
|
||||
tiles.push_tile(tiling, position, frame.texture());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -188,6 +188,6 @@ impl Svg {
|
|||
let frame_request = glycin::FrameRequest::new().scale(width as u32, height as u32);
|
||||
let frame = image.specific_frame(frame_request).await?;
|
||||
|
||||
Ok(frame.texture)
|
||||
Ok(frame.texture())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ impl LpErrorDetails {
|
|||
);
|
||||
}));
|
||||
|
||||
obj.present(root);
|
||||
obj.present(Some(root));
|
||||
obj
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ impl LpImagePage {
|
|||
let image = self.image();
|
||||
|
||||
if image.is_unsupported() {
|
||||
let message = if glycin::supported_mime_types().await.is_empty() {
|
||||
let message = if glycin::supported_loader_mime_types().await.is_empty() {
|
||||
// Translators: {} is replace with a version number
|
||||
gettext_f(
|
||||
"No image loaders available. Maybe the “glycin-loaders” package with compatibility version “{}+” is not installed.",
|
||||
|
|
|
|||
|
|
@ -446,9 +446,9 @@ impl LpPrint {
|
|||
.build();
|
||||
|
||||
let print_settings = if let Some(print_setup) = print_setup {
|
||||
print_dialog.set_page_setup(&print_setup.page_setup().unwrap());
|
||||
print_dialog.set_page_setup(&print_setup.page_setup());
|
||||
|
||||
print_setup.print_settings().unwrap()
|
||||
print_setup.print_settings()
|
||||
} else {
|
||||
gtk::PrintSettings::new()
|
||||
};
|
||||
|
|
@ -465,7 +465,7 @@ impl LpPrint {
|
|||
log::warn!("Failed to print: {err}");
|
||||
return;
|
||||
}
|
||||
Ok(print_setup) => print_setup.unwrap(),
|
||||
Ok(print_setup) => print_setup,
|
||||
};
|
||||
|
||||
Self::new(image, parent, print_dialog, print_setup);
|
||||
|
|
@ -513,7 +513,7 @@ impl LpPrint {
|
|||
}
|
||||
|
||||
pub fn print_settings(&self) -> gtk::PrintSettings {
|
||||
self.print_setup().print_settings().unwrap()
|
||||
self.print_setup().print_settings()
|
||||
}
|
||||
|
||||
pub fn file(&self) -> gio::File {
|
||||
|
|
@ -836,7 +836,7 @@ impl LpPrint {
|
|||
}
|
||||
|
||||
pub fn page_setup(&self) -> gtk::PageSetup {
|
||||
self.print_setup().page_setup().unwrap()
|
||||
self.print_setup().page_setup()
|
||||
}
|
||||
|
||||
/// Go back to print dialog from image layout
|
||||
|
|
@ -862,7 +862,7 @@ impl LpPrint {
|
|||
log::warn!("Print error: {err}");
|
||||
return;
|
||||
}
|
||||
Ok(output_stream) => obj.draw_page(output_stream.unwrap()).await,
|
||||
Ok(output_stream) => obj.draw_page(output_stream).await,
|
||||
};
|
||||
|
||||
if let Err(err) = draw_result {
|
||||
|
|
|
|||
|
|
@ -440,8 +440,8 @@ impl LpWindow {
|
|||
|
||||
let filter_supported_formats = gtk::FileFilter::new();
|
||||
filter_supported_formats.set_name(Some(&gettext("Supported image formats")));
|
||||
for mime_type in glycin::supported_mime_types().await {
|
||||
filter_supported_formats.add_mime_type(&mime_type);
|
||||
for mime_type in glycin::supported_loader_mime_types().await {
|
||||
filter_supported_formats.add_mime_type(mime_type.as_str());
|
||||
}
|
||||
|
||||
let filter_all_files = gtk::FileFilter::new();
|
||||
|
|
@ -519,7 +519,7 @@ impl LpWindow {
|
|||
|
||||
/// Returns true if some text in metadata is currently selected
|
||||
fn has_metadata_selected(&self) -> bool {
|
||||
if let Some(focus_widget) = self.focus_widget() {
|
||||
if let Some(focus_widget) = self.focus() {
|
||||
if focus_widget.is_ancestor(&*self.imp().properties_view) {
|
||||
if let Ok(label) = focus_widget.downcast::<gtk::Label>() {
|
||||
return label.selection_bounds().is_some();
|
||||
|
|
@ -817,11 +817,11 @@ impl LpWindow {
|
|||
fn on_fullscreen_changed(&self) {
|
||||
self.imp()
|
||||
.image_view
|
||||
.on_fullscreen_changed(self.is_fullscreened());
|
||||
.on_fullscreen_changed(self.is_fullscreen());
|
||||
|
||||
self.update_headerbar_style();
|
||||
|
||||
if !self.is_fullscreened() {
|
||||
if !self.is_fullscreen() {
|
||||
self.set_cursor(None);
|
||||
self.show_controls();
|
||||
}
|
||||
|
|
@ -845,7 +845,7 @@ impl LpWindow {
|
|||
}
|
||||
|
||||
fn is_content_extended_to_top(&self) -> bool {
|
||||
self.is_fullscreened() && !self.imp().properties_button.is_active()
|
||||
self.is_fullscreen() && !self.imp().properties_button.is_active()
|
||||
}
|
||||
|
||||
fn update_headerbar_style(&self) {
|
||||
|
|
@ -884,6 +884,6 @@ impl LpWindow {
|
|||
|
||||
async fn show_about(&self) {
|
||||
let about = crate::about::dialog().await;
|
||||
about.present(self);
|
||||
about.present(Some(self));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -408,7 +408,7 @@ impl Action {
|
|||
|
||||
Action::ToggleFullscreen => {
|
||||
klass.install_action(&action, None, move |win, _, _| {
|
||||
win.toggle_fullscreen(!win.is_fullscreened());
|
||||
win.toggle_fullscreen(!win.is_fullscreen());
|
||||
});
|
||||
klass.add_binding_action(gdk::Key::F11, gdk::ModifierType::empty(), &action);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,13 +29,13 @@ impl LpWindow {
|
|||
self.image_view().controls_box_start().set_opacity(opacity);
|
||||
self.image_view().controls_box_end().set_opacity(opacity);
|
||||
|
||||
if self.is_headerbar_flat() && self.is_fullscreened() {
|
||||
if self.is_headerbar_flat() && self.is_fullscreen() {
|
||||
self.headerbar().set_opacity(opacity);
|
||||
} else {
|
||||
self.headerbar().set_opacity(1.);
|
||||
}
|
||||
|
||||
if self.is_fullscreened() && hiding && opacity < 0.9 {
|
||||
if self.is_fullscreen() && hiding && opacity < 0.9 {
|
||||
self.set_cursor(gdk::Cursor::from_name("none", None).as_ref());
|
||||
} else {
|
||||
self.set_cursor(None);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue