cargo: Use gtk-rs master
Needed to take advantage of template callbacks and new APIs.
This commit is contained in:
parent
5c25a6a270
commit
5893d4b764
7 changed files with 309 additions and 485 deletions
|
|
@ -173,7 +173,7 @@ impl LpApplication {
|
|||
// Builders are a pattern that allow you to create
|
||||
// an object and set all relevant properties very
|
||||
// easily in a way that's idiomatic to Rust.
|
||||
let dialog = gtk::AboutDialogBuilder::new()
|
||||
let dialog = gtk::AboutDialog::builder()
|
||||
.authors(vec![String::from(
|
||||
"Christopher Davis <christopherdavis@gnome.org>",
|
||||
)])
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ pub fn get_file_display_name(file: &gio::File) -> Option<String> {
|
|||
.query_info(
|
||||
*gio::FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
|
||||
gio::FileQueryInfoFlags::empty(),
|
||||
gio::NONE_CANCELLABLE,
|
||||
gio::Cancellable::NONE,
|
||||
)
|
||||
.ok()?;
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ mod imp {
|
|||
impl ObjectImpl for LpImage {
|
||||
fn properties() -> &'static [glib::ParamSpec] {
|
||||
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
|
||||
vec![glib::ParamSpec::new_object(
|
||||
vec![glib::ParamSpecObject::new(
|
||||
"file",
|
||||
"File",
|
||||
"The current file",
|
||||
|
|
|
|||
|
|
@ -91,14 +91,14 @@ mod imp {
|
|||
fn properties() -> &'static [glib::ParamSpec] {
|
||||
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
|
||||
vec![
|
||||
glib::ParamSpec::new_string(
|
||||
glib::ParamSpecString::new(
|
||||
"filename",
|
||||
"Filename",
|
||||
"The filename of the current file",
|
||||
None,
|
||||
glib::ParamFlags::READABLE,
|
||||
),
|
||||
glib::ParamSpec::new_object(
|
||||
glib::ParamSpecObject::new(
|
||||
"controls",
|
||||
"Controls",
|
||||
"The controls for the image view",
|
||||
|
|
@ -188,7 +188,7 @@ impl LpImageView {
|
|||
*gio::FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE
|
||||
),
|
||||
gio::FileQueryInfoFlags::NONE,
|
||||
gio::NONE_CANCELLABLE,
|
||||
gio::Cancellable::NONE,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
|
|
@ -332,12 +332,7 @@ impl LpImageView {
|
|||
pub fn show_popover_at(&self, x: f64, y: f64) {
|
||||
let imp = imp::LpImageView::from_instance(&self);
|
||||
|
||||
let rect = gdk::Rectangle {
|
||||
x: x as i32,
|
||||
y: y as i32,
|
||||
width: 0,
|
||||
height: 0,
|
||||
};
|
||||
let rect = gdk::Rectangle::new(x as i32, y as i32, 0, 0);
|
||||
|
||||
imp.popover.set_pointing_to(&rect);
|
||||
imp.popover.popup();
|
||||
|
|
|
|||
|
|
@ -201,9 +201,7 @@ impl LpWindow {
|
|||
chooser.set_transient_for(Some(self));
|
||||
|
||||
let filter = gtk::FileFilter::new();
|
||||
filter
|
||||
.set_property("name", &String::from("Supported image files"))
|
||||
.unwrap();
|
||||
filter.set_property("name", &String::from("Supported image files"));
|
||||
filter.add_mime_type("image/*");
|
||||
chooser.add_filter(&filter);
|
||||
|
||||
|
|
@ -290,8 +288,8 @@ impl LpWindow {
|
|||
.unwrap();
|
||||
let monitor_geometry = monitor.geometry();
|
||||
|
||||
let monitor_width = monitor_geometry.width;
|
||||
let monitor_height = monitor_geometry.height;
|
||||
let monitor_width = monitor_geometry.width();
|
||||
let monitor_height = monitor_geometry.height();
|
||||
|
||||
if img_width > monitor_width || img_height + header_height > monitor_height {
|
||||
let width_factor = (monitor_width as f32 * 0.85) / img_width as f32;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue