cargo: Use gtk-rs master

Needed to take advantage of template callbacks
and new APIs.
This commit is contained in:
Christopher Davis 2021-12-22 18:17:38 -08:00
parent 5c25a6a270
commit 5893d4b764
7 changed files with 309 additions and 485 deletions

759
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -9,8 +9,8 @@ gtk-macros = "0.2.0"
log = "0.4.11"
once_cell = "1.5.2"
pretty_env_logger = "0.4.0"
zbus = "1.3.0"
zvariant = "2.3.0"
zbus = "2.0.0-beta.7"
zvariant = "2.9.0"
cairo-rs = "0.14"
[dependencies.ashpd]
@ -19,11 +19,11 @@ features = ["feature_gtk4"]
[dependencies.gtk]
package = "gtk4"
version = "0.3"
git = "https://github.com/gtk-rs/gtk4-rs"
[dependencies.adw]
package = "libadwaita"
version = "0.1.0-alpha-6"
git = "https://gitlab.gnome.org/World/Rust/libadwaita-rs.git"
[dependencies.gettext-rs]
version = "0.7.0"

View file

@ -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>",
)])

View file

@ -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()?;

View file

@ -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",

View 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();

View file

@ -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;