Merge branch 'alatiera/updates' into 'master'

Update gtk-rs

See merge request World/podcasts!137
This commit is contained in:
Jordan Petridis 2020-02-07 19:22:28 +00:00
commit 59a57a740f
10 changed files with 844 additions and 731 deletions

1496
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -12,7 +12,7 @@ dependency('glib-2.0', version: '>= 2.56')
dependency('gio-2.0', version: '>= 2.56') dependency('gio-2.0', version: '>= 2.56')
dependency('gdk-pixbuf-2.0') dependency('gdk-pixbuf-2.0')
dependency('gtk+-3.0', version: '>= 3.24.11') dependency('gtk+-3.0', version: '>= 3.24.11')
dependency('libhandy-0.0', version: '>= 0.0.11') dependency('libhandy-0.0', version: '>= 0.0.13')
dependency('gstreamer-1.0', version: '>= 1.16') dependency('gstreamer-1.0', version: '>= 1.16')
dependency('gstreamer-base-1.0', version: '>= 1.16') dependency('gstreamer-base-1.0', version: '>= 1.16')

View File

@ -25,7 +25,6 @@
"--share=network" "--share=network"
], ],
"env" : { "env" : {
"RUSTFLAGS" : "--error-format=short --remap-path-prefix =../",
"CARGO_HOME" : "/run/build/Podcasts/cargo", "CARGO_HOME" : "/run/build/Podcasts/cargo",
"RUSTFLAGS" : "", "RUSTFLAGS" : "",
"RUST_BACKTRACE" : "1" "RUST_BACKTRACE" : "1"
@ -51,7 +50,7 @@
{ {
"type" : "git", "type" : "git",
"url" : "https://source.puri.sm/Librem5/libhandy.git", "url" : "https://source.puri.sm/Librem5/libhandy.git",
"commit" : "f5909a897f70143bdd2f89f47a63c1bf848330ce" "tag" : "v0.0.13"
} }
] ]
}, },

View File

@ -27,7 +27,6 @@
], ],
"env" : { "env" : {
"CARGO_HOME" : "/run/build/Podcasts/cargo", "CARGO_HOME" : "/run/build/Podcasts/cargo",
"RUSTFLAGS" : "--error-format=short --remap-path-prefix =../",
"RUST_BACKTRACE" : "1" "RUST_BACKTRACE" : "1"
} }
}, },
@ -51,7 +50,7 @@
{ {
"type" : "git", "type" : "git",
"url" : "https://source.puri.sm/Librem5/libhandy.git", "url" : "https://source.puri.sm/Librem5/libhandy.git",
"commit" : "f5909a897f70143bdd2f89f47a63c1bf848330ce" "tag" : "v0.0.13"
} }
] ]
}, },

View File

@ -7,12 +7,12 @@ edition = "2018"
[dependencies] [dependencies]
chrono = "0.4.9" chrono = "0.4.9"
crossbeam-channel = "0.3.9" crossbeam-channel = "0.3.9"
gdk = "0.11.0" gdk = "0.12.0"
gdk-pixbuf = "0.7.0" gdk-pixbuf = "0.8.0"
gobject-sys = "0.9.0" gobject-sys = "0.9.1"
glib-sys = "0.9.0" glib-sys = "0.9.1"
gst = { version = "0.14.0", package = "gstreamer" } gst = { version = "0.15.2", package = "gstreamer" }
gst-player = { version = "0.14.0", package = "gstreamer-player" } gst-player = { version = "0.15.0", package = "gstreamer-player" }
humansize = "1.1.0" humansize = "1.1.0"
lazy_static = "1.4.0" lazy_static = "1.4.0"
log = "0.4.8" log = "0.4.8"
@ -28,8 +28,8 @@ reqwest = "0.9.22"
serde_json = "1.0.41" serde_json = "1.0.41"
# html2text = "0.1.8" # html2text = "0.1.8"
html2text = { git = "https://github.com/jugglerchris/rust-html2text" } html2text = { git = "https://github.com/jugglerchris/rust-html2text" }
mpris-player = "0.4.0" mpris-player = "0.5.0"
pango = "0.7.0" pango = "0.8.0"
[dependencies.gettext-rs] [dependencies.gettext-rs]
git = "https://github.com/danigm/gettext-rs" git = "https://github.com/danigm/gettext-rs"
@ -37,19 +37,18 @@ branch = "no-gettext"
features = ["gettext-system"] features = ["gettext-system"]
[dependencies.glib] [dependencies.glib]
features = ["subclassing"] version = "0.9.1"
version = "0.8.2"
[dependencies.gio] [dependencies.gio]
features = ["v2_50", "subclassing"] features = ["v2_50"]
version = "0.7.0" version = "0.8.0"
[dependencies.gtk] [dependencies.gtk]
features = ["v3_24", "subclassing"] features = ["v3_24"]
version = "0.7.0" version = "0.8.0"
[dependencies.libhandy] [dependencies.libhandy]
version = "0.4.0" version = "0.5.0"
features = [ "v0_0_10"] features = [ "v0_0_10"]
# [dependencies.mpris-player] # [dependencies.mpris-player]

View File

@ -81,11 +81,21 @@ impl WindowGeometry {
} }
pub(crate) fn write(&self, settings: &gio::Settings) { pub(crate) fn write(&self, settings: &gio::Settings) {
settings.set_int("persist-window-geometry-left", self.left); settings
settings.set_int("persist-window-geometry-top", self.top); .set_int("persist-window-geometry-left", self.left)
settings.set_int("persist-window-geometry-width", self.width); .unwrap();
settings.set_int("persist-window-geometry-height", self.height); settings
settings.set_boolean("persist-window-geometry-maximized", self.is_maximized); .set_int("persist-window-geometry-top", self.top)
.unwrap();
settings
.set_int("persist-window-geometry-width", self.width)
.unwrap();
settings
.set_int("persist-window-geometry-height", self.height)
.unwrap();
settings
.set_boolean("persist-window-geometry-maximized", self.is_maximized)
.unwrap();
} }
} }

View File

@ -90,7 +90,7 @@ impl PopulatedStack {
pub(crate) fn replace_shows(&mut self) -> Result<(), Error> { pub(crate) fn replace_shows(&mut self) -> Result<(), Error> {
let old = &self.populated.view.container().clone(); let old = &self.populated.view.container().clone();
debug!("Name: {:?}", WidgetExt::get_name(old)); debug!("Name: {:?}", old.get_widget_name());
let vadj = self.populated.view.get_vadjustment(); let vadj = self.populated.view.get_vadjustment();
let pop = ShowsView::new(self.sender.clone(), vadj); let pop = ShowsView::new(self.sender.clone(), vadj);

View File

@ -17,8 +17,8 @@
// //
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
use gio::{resources_register, Error, Resource}; use gio::{resources_register, Resource};
use glib::Bytes; use glib::{Error, Bytes};
pub(crate) fn init() -> Result<(), Error> { pub(crate) fn init() -> Result<(), Error> {
// load the gresource binary at build time and include/link it into the final // load the gresource binary at build time and include/link it into the final

View File

@ -19,11 +19,12 @@
#![allow(clippy::type_complexity)] #![allow(clippy::type_complexity)]
use gdk_pixbuf::{Object, Pixbuf}; use gdk_pixbuf::Pixbuf;
use glib::{self, object::WeakRef}; use glib::{self, object::WeakRef};
use glib::{IsA, Object};
use gtk; use gtk;
use gtk::prelude::*; use gtk::prelude::*;
use gtk::{IsA, Widget}; use gtk::Widget;
use chrono::prelude::*; use chrono::prelude::*;
use crossbeam_channel::{bounded, unbounded, Sender}; use crossbeam_channel::{bounded, unbounded, Sender};
@ -388,7 +389,6 @@ fn lookup_id(id: u32) -> Result<String, Error> {
} }
pub(crate) fn on_import_clicked(window: &gtk::ApplicationWindow, sender: &Sender<Action>) { pub(crate) fn on_import_clicked(window: &gtk::ApplicationWindow, sender: &Sender<Action>) {
use glib::translate::ToGlib;
use gtk::{FileChooserAction, FileChooserNative, FileFilter, ResponseType}; use gtk::{FileChooserAction, FileChooserNative, FileFilter, ResponseType};
// Create the FileChooser Dialog // Create the FileChooser Dialog
@ -412,7 +412,7 @@ pub(crate) fn on_import_clicked(window: &gtk::ApplicationWindow, sender: &Sender
let resp = dialog.run(); let resp = dialog.run();
debug!("Dialog Response {}", resp); debug!("Dialog Response {}", resp);
if resp == ResponseType::Accept.to_glib() { if resp == ResponseType::Accept {
if let Some(filename) = dialog.get_filename() { if let Some(filename) = dialog.get_filename() {
debug!("File selected: {:?}", filename); debug!("File selected: {:?}", filename);
@ -436,7 +436,6 @@ pub(crate) fn on_import_clicked(window: &gtk::ApplicationWindow, sender: &Sender
} }
pub(crate) fn on_export_clicked(window: &gtk::ApplicationWindow, sender: &Sender<Action>) { pub(crate) fn on_export_clicked(window: &gtk::ApplicationWindow, sender: &Sender<Action>) {
use glib::translate::ToGlib;
use gtk::{FileChooserAction, FileChooserNative, FileFilter, ResponseType}; use gtk::{FileChooserAction, FileChooserNative, FileFilter, ResponseType};
// Create the FileChooser Dialog // Create the FileChooser Dialog
@ -460,7 +459,7 @@ pub(crate) fn on_export_clicked(window: &gtk::ApplicationWindow, sender: &Sender
let resp = dialog.run(); let resp = dialog.run();
debug!("Dialog Response {}", resp); debug!("Dialog Response {}", resp);
if resp == ResponseType::Accept.to_glib() { if resp == ResponseType::Accept {
if let Some(filename) = dialog.get_filename() { if let Some(filename) = dialog.get_filename() {
debug!("File selected: {:?}", filename); debug!("File selected: {:?}", filename);

View File

@ -100,7 +100,8 @@ fn populate_flowbox(shows: &Rc<ShowsView>, vadj: Option<Adjustment>) -> Result<(
fn on_child_activate(child: &gtk::FlowBoxChild, sender: &Sender<Action>) -> Result<(), Error> { fn on_child_activate(child: &gtk::FlowBoxChild, sender: &Sender<Action>) -> Result<(), Error> {
// This is such an ugly hack... // This is such an ugly hack...
let id = WidgetExt::get_name(child) let id = child
.get_widget_name()
.ok_or_else(|| format_err!("Failed to get \"episodes\" child from the stack."))? .ok_or_else(|| format_err!("Failed to get \"episodes\" child from the stack."))?
.parse::<i32>()?; .parse::<i32>()?;
let pd = Arc::new(dbqueries::get_podcast_from_id(id)?); let pd = Arc::new(dbqueries::get_podcast_from_id(id)?);
@ -148,7 +149,7 @@ impl ShowsChild {
fn init(&self, pd: &Show) { fn init(&self, pd: &Show) {
self.child.set_tooltip_text(Some(pd.title())); self.child.set_tooltip_text(Some(pd.title()));
WidgetExt::set_name(&self.child, &pd.id().to_string()); self.child.set_widget_name(&pd.id().to_string());
self.set_cover(pd.id()) self.set_cover(pd.id())
} }