From 2312df371823e9027162a4774ee00522f1a86da6 Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Sun, 20 May 2018 14:32:06 +0300 Subject: [PATCH 1/6] Fix rustfmt config. --- rustfmt.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/rustfmt.toml b/rustfmt.toml index 2eeaaa8..898973f 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,5 +1,4 @@ unstable_features = true -verbose = false max_width = 100 comment_width = 100 wrap_comments = true From 0b6bbf6733b278bab6f288c491b7e79719a596a0 Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Sun, 20 May 2018 14:36:20 +0300 Subject: [PATCH 2/6] CI: Fix rustfmt job. --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ffa6c14..cd0cac3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -125,7 +125,7 @@ rustfmt: script: - rustc -Vv && cargo -Vv - cargo fmt --version - - cargo fmt --all -- --write-mode=diff + - cargo fmt --all -- --check # Configure and run clippy on nightly # Only fails on errors atm. @@ -140,4 +140,4 @@ clippy: # Force regeneration of gresources regardless of artifacts chage - cd hammond-gtk/resources/ && glib-compile-resources --generate resources.xml && cd ../../ - cargo clippy --all - <<: *cargo_cache \ No newline at end of file + <<: *cargo_cache From 784e117a8ae526b16946a08053b298c31c3af4a1 Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Sun, 20 May 2018 16:39:36 +0300 Subject: [PATCH 3/6] cargo fmt --- hammond-data/src/feed.rs | 3 ++- hammond-data/src/models/new_episode.rs | 27 +++++++++++++++++--------- hammond-data/src/models/new_podcast.rs | 6 ++++-- hammond-downloader/src/downloader.rs | 6 ++++-- hammond-gtk/src/widgets/episode.rs | 6 ++++-- hammond-gtk/src/widgets/home_view.rs | 3 ++- hammond-gtk/src/widgets/show.rs | 3 ++- hammond-gtk/src/widgets/shows_view.rs | 3 ++- 8 files changed, 38 insertions(+), 19 deletions(-) diff --git a/hammond-data/src/feed.rs b/hammond-data/src/feed.rs index c2ee2e6..745e551 100644 --- a/hammond-data/src/feed.rs +++ b/hammond-data/src/feed.rs @@ -174,7 +174,8 @@ mod tests { fn test_complete_index() { truncate_db().unwrap(); - let feeds: Vec<_> = URLS.iter() + let feeds: Vec<_> = URLS + .iter() .map(|&(path, url)| { // Create and insert a Source into db let s = Source::from_url(url).unwrap(); diff --git a/hammond-data/src/models/new_episode.rs b/hammond-data/src/models/new_episode.rs index d41371b..0018042 100644 --- a/hammond-data/src/models/new_episode.rs +++ b/hammond-data/src/models/new_episode.rs @@ -101,17 +101,23 @@ impl Index<()> for NewEpisode { impl PartialEq for NewEpisode { fn eq(&self, other: &EpisodeMinimal) -> bool { - (self.title() == other.title()) && (self.uri() == other.uri()) - && (self.duration() == other.duration()) && (self.epoch() == other.epoch()) - && (self.guid() == other.guid()) && (self.podcast_id() == other.podcast_id()) + (self.title() == other.title()) + && (self.uri() == other.uri()) + && (self.duration() == other.duration()) + && (self.epoch() == other.epoch()) + && (self.guid() == other.guid()) + && (self.podcast_id() == other.podcast_id()) } } impl PartialEq for NewEpisode { fn eq(&self, other: &Episode) -> bool { - (self.title() == other.title()) && (self.uri() == other.uri()) - && (self.duration() == other.duration()) && (self.epoch() == other.epoch()) - && (self.guid() == other.guid()) && (self.podcast_id() == other.podcast_id()) + (self.title() == other.title()) + && (self.uri() == other.uri()) + && (self.duration() == other.duration()) + && (self.epoch() == other.epoch()) + && (self.guid() == other.guid()) + && (self.podcast_id() == other.podcast_id()) && (self.description() == other.description()) && (self.length() == other.length()) } @@ -182,9 +188,12 @@ pub(crate) struct NewEpisodeMinimal { impl PartialEq for NewEpisodeMinimal { fn eq(&self, other: &EpisodeMinimal) -> bool { - (self.title() == other.title()) && (self.uri() == other.uri()) - && (self.duration() == other.duration()) && (self.epoch() == other.epoch()) - && (self.guid() == other.guid()) && (self.podcast_id() == other.podcast_id()) + (self.title() == other.title()) + && (self.uri() == other.uri()) + && (self.duration() == other.duration()) + && (self.epoch() == other.epoch()) + && (self.guid() == other.guid()) + && (self.podcast_id() == other.podcast_id()) } } diff --git a/hammond-data/src/models/new_podcast.rs b/hammond-data/src/models/new_podcast.rs index 2bf727b..75152c5 100644 --- a/hammond-data/src/models/new_podcast.rs +++ b/hammond-data/src/models/new_podcast.rs @@ -83,7 +83,8 @@ impl Index<()> for NewPodcast { impl PartialEq for NewPodcast { fn eq(&self, other: &Podcast) -> bool { - (self.link() == other.link()) && (self.title() == other.title()) + (self.link() == other.link()) + && (self.title() == other.title()) && (self.image_uri() == other.image_uri()) && (self.description() == other.description()) && (self.source_id() == other.source_id()) @@ -103,7 +104,8 @@ impl NewPodcast { .to_string(); // Try to get the itunes img first - let itunes_img = chan.itunes_ext() + let itunes_img = chan + .itunes_ext() .and_then(|s| s.image().map(|url| url.trim())) .map(|s| s.to_owned()); // If itunes is None, try to get the channel.image from the rss spec diff --git a/hammond-downloader/src/downloader.rs b/hammond-downloader/src/downloader.rs index e62bdab..0315887 100644 --- a/hammond-downloader/src/downloader.rs +++ b/hammond-downloader/src/downloader.rs @@ -197,7 +197,8 @@ pub fn get_episode( } pub fn cache_image(pd: &PodcastCoverQuery) -> Result { - let url = pd.image_uri() + let url = pd + .image_uri() .ok_or_else(|| DownloadError::NoImageLocation)? .to_owned(); @@ -215,7 +216,8 @@ pub fn cache_image(pd: &PodcastCoverQuery) -> Result { // For some reason there is no .first() method so nth(0) is used let path = foo.nth(0).and_then(|x| x.ok()); if let Some(p) = path { - return Ok(p.to_str() + return Ok(p + .to_str() .ok_or_else(|| DownloadError::InvalidCachedImageLocation)? .into()); } diff --git a/hammond-gtk/src/widgets/episode.rs b/hammond-gtk/src/widgets/episode.rs index 01ae0ff..cc2e468 100644 --- a/hammond-gtk/src/widgets/episode.rs +++ b/hammond-gtk/src/widgets/episode.rs @@ -299,7 +299,8 @@ fn progress_bar_helper( episode_rowid: i32, ) -> Result { let (fraction, downloaded) = { - let m = prog.lock() + let m = prog + .lock() .map_err(|_| format_err!("Failed to get a lock on the mutex."))?; (m.get_fraction(), m.get_downloaded()) }; @@ -357,7 +358,8 @@ fn total_size_helper( ) -> Result { // Get the total_bytes. let total_bytes = { - let m = prog.lock() + let m = prog + .lock() .map_err(|_| format_err!("Failed to get a lock on the mutex."))?; m.get_total_size() }; diff --git a/hammond-gtk/src/widgets/home_view.rs b/hammond-gtk/src/widgets/home_view.rs index c3359cb..f598e3e 100644 --- a/hammond-gtk/src/widgets/home_view.rs +++ b/hammond-gtk/src/widgets/home_view.rs @@ -138,7 +138,8 @@ impl HomeView { /// Save the vertical scrollbar position. pub fn save_alignment(&self) -> Result<(), Error> { if let Ok(mut guard) = EPISODES_VIEW_VALIGNMENT.lock() { - let adj = self.scrolled_window + let adj = self + .scrolled_window .get_vadjustment() .ok_or_else(|| format_err!("Could not get the adjustment"))?; *guard = Some(SendCell::new(adj)); diff --git a/hammond-gtk/src/widgets/show.rs b/hammond-gtk/src/widgets/show.rs index 674e693..fb1f023 100644 --- a/hammond-gtk/src/widgets/show.rs +++ b/hammond-gtk/src/widgets/show.rs @@ -130,7 +130,8 @@ impl ShowWidget { /// Save the scrollabar vajustment to the cache. pub fn save_vadjustment(&self, oldid: i32) -> Result<(), Error> { if let Ok(mut guard) = SHOW_WIDGET_VALIGNMENT.lock() { - let adj = self.scrolled_window + let adj = self + .scrolled_window .get_vadjustment() .ok_or_else(|| format_err!("Could not get the adjustment"))?; *guard = Some((oldid, SendCell::new(adj))); diff --git a/hammond-gtk/src/widgets/shows_view.rs b/hammond-gtk/src/widgets/shows_view.rs index d9dc9e7..b282918 100644 --- a/hammond-gtk/src/widgets/shows_view.rs +++ b/hammond-gtk/src/widgets/shows_view.rs @@ -78,7 +78,8 @@ impl ShowsView { /// Save the vertical scrollbar position. pub fn save_alignment(&self) -> Result<(), Error> { if let Ok(mut guard) = SHOWS_VIEW_VALIGNMENT.lock() { - let adj = self.scrolled_window + let adj = self + .scrolled_window .get_vadjustment() .ok_or_else(|| format_err!("Could not get the adjustment"))?; *guard = Some(SendCell::new(adj)); From 2869bb3ef37c7fb95acd22b5285eb9d38c94bd8b Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Sun, 20 May 2018 17:37:48 +0300 Subject: [PATCH 4/6] Flatpak: Allow the app to access the Home folder. This is needed in order to import an OPML file. There might be a better solution to this. --- org.gnome.Hammond.json | 1 + 1 file changed, 1 insertion(+) diff --git a/org.gnome.Hammond.json b/org.gnome.Hammond.json index d646dc9..acd2510 100644 --- a/org.gnome.Hammond.json +++ b/org.gnome.Hammond.json @@ -14,6 +14,7 @@ "finish-args" : [ "--filesystem=xdg-run/dconf", "--filesystem=~/.config/dconf:ro", + "--filesystem=home", "--talk-name=ca.desrt.dconf", "--env=DCONF_USER_CONFIG_DIR=.config/dconf", "--share=network", From 1c657036da1f60a78ba3f2d31532c49d2fdfb940 Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Sun, 20 May 2018 17:40:27 +0300 Subject: [PATCH 5/6] Update Changelog. --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c7f416..99a3f01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Fixed: ### Removed: +## [0.3.4] - 2018-05-20 +### Fixed: +- Flatpak can now access the Home folder. This fixes the OPML import feature from +not being able to access any file. + ## [0.3.3] - 2018-05-19 ### Added: - Initial functionality for importing shows from an OPML file was implemented. From 74f8e744ac2ff4d511d54aa9ad535117946bb01c Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Sun, 20 May 2018 17:47:33 +0300 Subject: [PATCH 6/6] Version bump. --- hammond-gtk/resources/org.gnome.Hammond.appdata.xml | 2 +- hammond-gtk/src/headerbar.rs | 2 +- meson.build | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hammond-gtk/resources/org.gnome.Hammond.appdata.xml b/hammond-gtk/resources/org.gnome.Hammond.appdata.xml index db08187..e94a861 100644 --- a/hammond-gtk/resources/org.gnome.Hammond.appdata.xml +++ b/hammond-gtk/resources/org.gnome.Hammond.appdata.xml @@ -28,7 +28,7 @@ - + https://gitlab.gnome.org/World/hammond jpetridis@gnome.org diff --git a/hammond-gtk/src/headerbar.rs b/hammond-gtk/src/headerbar.rs index 597a96c..8fddaa6 100644 --- a/hammond-gtk/src/headerbar.rs +++ b/hammond-gtk/src/headerbar.rs @@ -312,7 +312,7 @@ fn about_dialog(window: >k::Window) { dialog.set_modal(true); // TODO: make it show it fetches the commit hash from which it was built // and the version number is kept in sync automaticly - dialog.set_version("0.3.3"); + dialog.set_version("0.3.4"); dialog.set_program_name("Hammond"); // TODO: Need a wiki page first. // dialog.set_website("https://wiki.gnome.org/Design/Apps/Potential/Podcasts"); diff --git a/meson.build b/meson.build index e86c25f..d9e620e 100644 --- a/meson.build +++ b/meson.build @@ -3,7 +3,7 @@ project( 'hammond', 'rust', - version: '0.3.3', + version: '0.3.4', license: 'GPLv3', )