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
759
Cargo.lock
generated
759
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -9,8 +9,8 @@ gtk-macros = "0.2.0"
|
||||||
log = "0.4.11"
|
log = "0.4.11"
|
||||||
once_cell = "1.5.2"
|
once_cell = "1.5.2"
|
||||||
pretty_env_logger = "0.4.0"
|
pretty_env_logger = "0.4.0"
|
||||||
zbus = "1.3.0"
|
zbus = "2.0.0-beta.7"
|
||||||
zvariant = "2.3.0"
|
zvariant = "2.9.0"
|
||||||
cairo-rs = "0.14"
|
cairo-rs = "0.14"
|
||||||
|
|
||||||
[dependencies.ashpd]
|
[dependencies.ashpd]
|
||||||
|
|
@ -19,11 +19,11 @@ features = ["feature_gtk4"]
|
||||||
|
|
||||||
[dependencies.gtk]
|
[dependencies.gtk]
|
||||||
package = "gtk4"
|
package = "gtk4"
|
||||||
version = "0.3"
|
git = "https://github.com/gtk-rs/gtk4-rs"
|
||||||
|
|
||||||
[dependencies.adw]
|
[dependencies.adw]
|
||||||
package = "libadwaita"
|
package = "libadwaita"
|
||||||
version = "0.1.0-alpha-6"
|
git = "https://gitlab.gnome.org/World/Rust/libadwaita-rs.git"
|
||||||
|
|
||||||
[dependencies.gettext-rs]
|
[dependencies.gettext-rs]
|
||||||
version = "0.7.0"
|
version = "0.7.0"
|
||||||
|
|
|
||||||
|
|
@ -173,7 +173,7 @@ impl LpApplication {
|
||||||
// Builders are a pattern that allow you to create
|
// Builders are a pattern that allow you to create
|
||||||
// an object and set all relevant properties very
|
// an object and set all relevant properties very
|
||||||
// easily in a way that's idiomatic to Rust.
|
// easily in a way that's idiomatic to Rust.
|
||||||
let dialog = gtk::AboutDialogBuilder::new()
|
let dialog = gtk::AboutDialog::builder()
|
||||||
.authors(vec![String::from(
|
.authors(vec![String::from(
|
||||||
"Christopher Davis <christopherdavis@gnome.org>",
|
"Christopher Davis <christopherdavis@gnome.org>",
|
||||||
)])
|
)])
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ pub fn get_file_display_name(file: &gio::File) -> Option<String> {
|
||||||
.query_info(
|
.query_info(
|
||||||
*gio::FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
|
*gio::FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
|
||||||
gio::FileQueryInfoFlags::empty(),
|
gio::FileQueryInfoFlags::empty(),
|
||||||
gio::NONE_CANCELLABLE,
|
gio::Cancellable::NONE,
|
||||||
)
|
)
|
||||||
.ok()?;
|
.ok()?;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ mod imp {
|
||||||
impl ObjectImpl for LpImage {
|
impl ObjectImpl for LpImage {
|
||||||
fn properties() -> &'static [glib::ParamSpec] {
|
fn properties() -> &'static [glib::ParamSpec] {
|
||||||
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
|
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
|
||||||
vec![glib::ParamSpec::new_object(
|
vec![glib::ParamSpecObject::new(
|
||||||
"file",
|
"file",
|
||||||
"File",
|
"File",
|
||||||
"The current file",
|
"The current file",
|
||||||
|
|
|
||||||
|
|
@ -91,14 +91,14 @@ mod imp {
|
||||||
fn properties() -> &'static [glib::ParamSpec] {
|
fn properties() -> &'static [glib::ParamSpec] {
|
||||||
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
|
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
|
||||||
vec![
|
vec![
|
||||||
glib::ParamSpec::new_string(
|
glib::ParamSpecString::new(
|
||||||
"filename",
|
"filename",
|
||||||
"Filename",
|
"Filename",
|
||||||
"The filename of the current file",
|
"The filename of the current file",
|
||||||
None,
|
None,
|
||||||
glib::ParamFlags::READABLE,
|
glib::ParamFlags::READABLE,
|
||||||
),
|
),
|
||||||
glib::ParamSpec::new_object(
|
glib::ParamSpecObject::new(
|
||||||
"controls",
|
"controls",
|
||||||
"Controls",
|
"Controls",
|
||||||
"The controls for the image view",
|
"The controls for the image view",
|
||||||
|
|
@ -188,7 +188,7 @@ impl LpImageView {
|
||||||
*gio::FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE
|
*gio::FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE
|
||||||
),
|
),
|
||||||
gio::FileQueryInfoFlags::NONE,
|
gio::FileQueryInfoFlags::NONE,
|
||||||
gio::NONE_CANCELLABLE,
|
gio::Cancellable::NONE,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
|
@ -332,12 +332,7 @@ impl LpImageView {
|
||||||
pub fn show_popover_at(&self, x: f64, y: f64) {
|
pub fn show_popover_at(&self, x: f64, y: f64) {
|
||||||
let imp = imp::LpImageView::from_instance(&self);
|
let imp = imp::LpImageView::from_instance(&self);
|
||||||
|
|
||||||
let rect = gdk::Rectangle {
|
let rect = gdk::Rectangle::new(x as i32, y as i32, 0, 0);
|
||||||
x: x as i32,
|
|
||||||
y: y as i32,
|
|
||||||
width: 0,
|
|
||||||
height: 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
imp.popover.set_pointing_to(&rect);
|
imp.popover.set_pointing_to(&rect);
|
||||||
imp.popover.popup();
|
imp.popover.popup();
|
||||||
|
|
|
||||||
|
|
@ -201,9 +201,7 @@ impl LpWindow {
|
||||||
chooser.set_transient_for(Some(self));
|
chooser.set_transient_for(Some(self));
|
||||||
|
|
||||||
let filter = gtk::FileFilter::new();
|
let filter = gtk::FileFilter::new();
|
||||||
filter
|
filter.set_property("name", &String::from("Supported image files"));
|
||||||
.set_property("name", &String::from("Supported image files"))
|
|
||||||
.unwrap();
|
|
||||||
filter.add_mime_type("image/*");
|
filter.add_mime_type("image/*");
|
||||||
chooser.add_filter(&filter);
|
chooser.add_filter(&filter);
|
||||||
|
|
||||||
|
|
@ -290,8 +288,8 @@ impl LpWindow {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let monitor_geometry = monitor.geometry();
|
let monitor_geometry = monitor.geometry();
|
||||||
|
|
||||||
let monitor_width = monitor_geometry.width;
|
let monitor_width = monitor_geometry.width();
|
||||||
let monitor_height = monitor_geometry.height;
|
let monitor_height = monitor_geometry.height();
|
||||||
|
|
||||||
if img_width > monitor_width || img_height + header_height > monitor_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;
|
let width_factor = (monitor_width as f32 * 0.85) / img_width as f32;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue