Made Disel NewModels private.

This commit is contained in:
Jordan Petridis
2017-11-22 05:50:25 +02:00
parent ee7c5ca26e
commit 9bc6df2cba
12 changed files with 35 additions and 51 deletions
+3 -3
View File
@@ -1,7 +1,7 @@
use gtk;
use gtk::prelude::*;
use hammond_data::models::NewSource;
use hammond_data::Source;
use hammond_data::utils::url_cleaner;
use podcasts_view::update_podcasts_view;
@@ -54,10 +54,10 @@ pub fn get_headerbar(stack: &gtk::Stack) -> gtk::HeaderBar {
}
fn on_add_bttn_clicked(stack: &gtk::Stack, url: &str) {
let source = NewSource::new_with_uri(url).into_source();
info!("{:?} feed added", url);
let source = Source::from_url(url);
if let Ok(s) = source {
info!("{:?} feed added", url);
// update the db
utils::refresh_feed(stack, Some(vec![s]), None);
} else {
+1 -1
View File
@@ -2,7 +2,7 @@ use glib;
use gtk;
use hammond_data::feed;
use hammond_data::models::Source;
use hammond_data::Source;
use std::{thread, time};
use std::cell::RefCell;
+1 -1
View File
@@ -4,7 +4,7 @@ use gdk_pixbuf::Pixbuf;
use diesel::associations::Identifiable;
use hammond_data::dbqueries;
use hammond_data::models::Podcast;
use hammond_data::Podcast;
use widgets::podcast::*;
+1 -1
View File
@@ -1,6 +1,6 @@
use open;
use hammond_data::dbqueries;
use hammond_data::models::{Episode, Podcast};
use hammond_data::{Episode, Podcast};
use hammond_downloader::downloader;
use hammond_data::utils::*;
use hammond_data::errors::*;
+8 -10
View File
@@ -5,7 +5,7 @@ use gdk_pixbuf::Pixbuf;
use std::fs;
use hammond_data::dbqueries;
use hammond_data::models::Podcast;
use hammond_data::Podcast;
use hammond_downloader::downloader;
use widgets::episode::episodes_listbox;
@@ -118,19 +118,17 @@ pub fn update_podcast_widget(stack: &gtk::Stack, pd: &Podcast) {
#[cfg(test)]
mod tests {
use hammond_data::models::NewPodcast;
use hammond_data::Source;
use super::*;
#[test]
fn test_get_pixbuf_from_path() {
let pd = NewPodcast {
title: "New Rustacean".to_string(),
description: "".to_string(),
link: "".to_string(),
image_uri: Some("http://newrustacean.com/podcast.png".to_string()),
source_id: 0,
};
let pd = Podcast::from(pd);
let pd = Source::from_url("http://www.newrustacean.com/feed.xml")
.unwrap()
.refresh()
.unwrap()
.index_channel()
.unwrap();
let pxbuf = get_pixbuf_from_path(&pd);
assert!(pxbuf.is_some());