Forgot to cargo fmt

This commit is contained in:
Zander Brown 2019-07-01 15:13:40 +01:00 committed by Zander
parent 25289fbb5f
commit 938d1be04b
2 changed files with 16 additions and 12 deletions

View File

@ -26,8 +26,8 @@ use glib::subclass::prelude::*;
use glib::translate::*; use glib::translate::*;
use glib::{glib_object_impl, glib_object_subclass, glib_object_wrapper, glib_wrapper}; use glib::{glib_object_impl, glib_object_subclass, glib_object_wrapper, glib_wrapper};
use gio::{self, prelude::*, ActionMapExt, ApplicationFlags, SettingsExt};
use gio::subclass::application::ApplicationImplExt; use gio::subclass::application::ApplicationImplExt;
use gio::{self, prelude::*, ActionMapExt, ApplicationFlags, SettingsExt};
use gtk; use gtk;
use gtk::prelude::*; use gtk::prelude::*;
@ -39,7 +39,7 @@ use fragile::Fragile;
use podcasts_data::Show; use podcasts_data::Show;
use crate::settings; use crate::settings;
use crate::stacks::{PopulatedState}; use crate::stacks::PopulatedState;
use crate::utils; use crate::utils;
use crate::widgets::appnotif::{InAppNotification, SpinnerState, State}; use crate::widgets::appnotif::{InAppNotification, SpinnerState, State};
use crate::widgets::show_menu::{mark_all_notif, remove_show_notif, ShowMenu}; use crate::widgets::show_menu::{mark_all_notif, remove_show_notif, ShowMenu};
@ -54,7 +54,7 @@ use crate::i18n::i18n;
pub struct HmdApplicationPrivate { pub struct HmdApplicationPrivate {
window: RefCell<Option<MainWindow>>, window: RefCell<Option<MainWindow>>,
settings: RefCell<Option<gio::Settings>> settings: RefCell<Option<gio::Settings>>,
} }
impl ObjectSubclass for HmdApplicationPrivate { impl ObjectSubclass for HmdApplicationPrivate {
@ -219,8 +219,10 @@ impl HmdApplication {
Action::ShowWidgetAnimated => { Action::ShowWidgetAnimated => {
let shows = window.content.get_shows(); let shows = window.content.get_shows();
let pop = shows.borrow().populated(); let pop = shows.borrow().populated();
pop.borrow_mut() pop.borrow_mut().switch_visible(
.switch_visible(PopulatedState::Widget, gtk::StackTransitionType::SlideLeft); PopulatedState::Widget,
gtk::StackTransitionType::SlideLeft,
);
} }
Action::ShowShowsAnimated => { Action::ShowShowsAnimated => {
let shows = window.content.get_shows(); let shows = window.content.get_shows();
@ -269,7 +271,8 @@ impl HmdApplication {
let old = window.updater.replace(Some(updater)); let old = window.updater.replace(Some(updater));
old.map(|i| i.destroy()); old.map(|i| i.destroy());
window.updater window
.updater
.borrow() .borrow()
.as_ref() .as_ref()
.map(|i| i.show(&window.overlay)); .map(|i| i.show(&window.overlay));
@ -283,7 +286,8 @@ impl HmdApplication {
window.headerbar.set_secondary_menu(menu); window.headerbar.set_secondary_menu(menu);
} }
Action::EmptyState => { Action::EmptyState => {
window.window window
.window
.lookup_action("refresh") .lookup_action("refresh")
.and_then(|action| action.downcast::<gio::SimpleAction>().ok()) .and_then(|action| action.downcast::<gio::SimpleAction>().ok())
// Disable refresh action // Disable refresh action
@ -293,7 +297,8 @@ impl HmdApplication {
window.content.switch_to_empty_views(); window.content.switch_to_empty_views();
} }
Action::PopulatedState => { Action::PopulatedState => {
window.window window
.window
.lookup_action("refresh") .lookup_action("refresh")
.and_then(|action| action.downcast::<gio::SimpleAction>().ok()) .and_then(|action| action.downcast::<gio::SimpleAction>().ok())
// Enable refresh action // Enable refresh action

View File

@ -27,6 +27,7 @@ use gtk::prelude::*;
use crossbeam_channel::{unbounded, Receiver, Sender}; use crossbeam_channel::{unbounded, Receiver, Sender};
use crate::app::{Action, HmdApplication};
use crate::headerbar::Header; use crate::headerbar::Header;
use crate::settings::{self, WindowGeometry}; use crate::settings::{self, WindowGeometry};
use crate::stacks::Content; use crate::stacks::Content;
@ -34,11 +35,10 @@ use crate::utils;
use crate::widgets::about_dialog; use crate::widgets::about_dialog;
use crate::widgets::appnotif::InAppNotification; use crate::widgets::appnotif::InAppNotification;
use crate::widgets::player; use crate::widgets::player;
use crate::app::{Action, HmdApplication};
use std::cell::RefCell; use std::cell::RefCell;
use std::rc::Rc;
use std::ops::Deref; use std::ops::Deref;
use std::rc::Rc;
use crate::config::APP_ID; use crate::config::APP_ID;
use crate::i18n::i18n; use crate::i18n::i18n;
@ -71,7 +71,7 @@ pub struct MainWindow {
} }
impl MainWindow { impl MainWindow {
pub fn new (app: &HmdApplication) -> Self { pub fn new(app: &HmdApplication) -> Self {
let settings = gio::Settings::new("org.gnome.Podcasts"); let settings = gio::Settings::new("org.gnome.Podcasts");
let (sender, receiver) = unbounded(); let (sender, receiver) = unbounded();
@ -220,4 +220,3 @@ impl Deref for MainWindow {
&self.window &self.window
} }
} }