Fix cargo warnings

This commit is contained in:
Julian Mutter 2023-11-21 18:16:27 +01:00
parent 4feecffb9b
commit a9729005ff
3 changed files with 11 additions and 41 deletions

View File

@ -1,15 +1,11 @@
use cairo::{Context, Format, ImageSurface, ImageSurfaceData, ImageSurfaceDataOwned};
use glib::{clone, Bytes};
use gtk::{gdk::Texture, Picture};
use pdfium_render::{pdfium, prelude::*};
use poppler::{Document, Page}; use poppler::{Document, Page};
use std::{ use std::{
collections::BTreeMap, collections::BTreeMap,
path::{Path, PathBuf}, path::{Path, PathBuf},
sync::{Arc, Mutex}, sync::Arc,
}; };
use async_channel::{Receiver, Sender}; use async_channel::Sender;
type PageNumber = usize; type PageNumber = usize;
pub type MyPageType = Page; pub type MyPageType = Page;

View File

@ -1,22 +1,7 @@
use std::{ use cairo::Context;
cell::RefCell, collections::BTreeMap, path::Path, rc::Rc, sync::Arc, thread, time::Duration,
};
use async_channel::Sender; use crate::ui::Ui;
use cairo::{Context, Format, ImageSurface, ImageSurfaceData, ImageSurfaceDataOwned}; use gtk::{prelude::*, DrawingArea};
use gtk::{
gdk::Paintable, gio, glib, prelude::*, subclass::drawing_area, Application, ApplicationWindow,
Box, Button, DrawingArea, FileChooserAction, FileChooserDialog, HeaderBar, Label, Orientation,
Picture, ResponseType,
};
use poppler::{Document, Page};
use crate::{
cache::{self, CacheCommand, MyPageType, PageCache},
ui::Ui,
};
use glib::clone;
use gtk::prelude::*;
pub fn draw(ui: &mut Ui, area: &DrawingArea, context: &Context) { pub fn draw(ui: &mut Ui, area: &DrawingArea, context: &Context) {
println!("Draw"); println!("Draw");

View File

@ -1,18 +1,14 @@
use std::{ use std::{cell::RefCell, path::Path, rc::Rc, sync::Arc};
cell::RefCell, collections::BTreeMap, path::Path, rc::Rc, sync::Arc, thread, time::Duration,
};
use async_channel::Sender; use async_channel::Sender;
use cairo::{Context, Format, ImageSurface, ImageSurfaceData, ImageSurfaceDataOwned}; use cairo::{Context, Format, ImageSurface};
use gtk::{ use gtk::{
gdk::Paintable, gio, glib, prelude::*, subclass::drawing_area, Application, ApplicationWindow, glib, Application, ApplicationWindow, Box, Button, DrawingArea, FileChooserAction,
Box, Button, DrawingArea, FileChooserAction, FileChooserDialog, HeaderBar, Label, Orientation, FileChooserDialog, HeaderBar, Label, Orientation, ResponseType,
Picture, ResponseType,
}; };
use poppler::{Document, Page};
use crate::{ use crate::{
cache::{self, CacheCommand, MyPageType, PageCache}, cache::{self, CacheCommand, MyPageType},
draw, draw,
}; };
use glib::clone; use glib::clone;
@ -24,7 +20,6 @@ pub struct Ui {
header_bar: gtk::HeaderBar, header_bar: gtk::HeaderBar,
page_indicator: gtk::Label, page_indicator: gtk::Label,
drawing_area: gtk::DrawingArea, drawing_area: gtk::DrawingArea,
picture: Picture,
pub drawing_context: cairo::Context, pub drawing_context: cairo::Context,
pub document_canvas: Option<DocumentCanvas>, pub document_canvas: Option<DocumentCanvas>,
} }
@ -136,7 +131,7 @@ fn update_page_status(ui: &Ui) {
ui.page_indicator.set_label(page_status.as_str()); ui.page_indicator.set_label(page_status.as_str());
} }
fn process_right_click(ui: &mut Ui, x: f64, y: f64) { fn process_right_click(ui: &mut Ui, _x: f64, _y: f64) {
if ui.document_canvas.is_none() { if ui.document_canvas.is_none() {
return; return;
} }
@ -200,12 +195,6 @@ impl Ui {
.hexpand(true) .hexpand(true)
.vexpand(true) .vexpand(true)
.build(), .build(),
picture: Picture::builder()
.width_request(400)
.height_request(300)
.hexpand(true)
.vexpand(true)
.build(),
drawing_context: create_drawing_context(), drawing_context: create_drawing_context(),
document_canvas: None, document_canvas: None,
}; };