Commit Graph

759 Commits

Author SHA1 Message Date
Jordan Petridis
ed87a00225
EpisodeWidget: Cleanup parts of the state machine. 2018-02-16 14:43:16 +02:00
Jordan Petridis
bcc3608c04
EpisodeWidget: Split ButtonState enum from the MediaMachine.
Add a ButtonState Machine which represents the state of total_size
label, play button, and download button. Also implemented the
update/determine_state function for ButtonState.

Also implemented required generic functions for MediaMachine<X,Y,Z>
that convert it to the desired state.
2018-02-16 13:32:13 +02:00
Jordan Petridis
973d47ee05
EpisodeWidget: Expose the connect_clicked callbacks from the statemachine enum. 2018-02-15 18:07:21 +02:00
Jordan Petridis
f50c990d93
Yay, finally something that works. 2018-02-15 11:33:56 +02:00
Jordan Petridis
72eef6f104
Running in circles. 2018-02-15 11:08:21 +02:00
Jordan Petridis
5ccdb5d100
Minor cleanup. 2018-02-15 05:31:36 +02:00
Jordan Petridis
4b8fceaa7d
Nothing makes sense. 2018-02-15 05:15:25 +02:00
Jordan Petridis
73f7bfa64b
I dont even know what I am doing at this point. 2018-02-14 04:18:05 +02:00
Jordan Petridis
159b0d92dd
EpisodeWidget: Merge Size and Progress machines, Split total_size to it's own machine. 2018-02-13 07:51:00 +02:00
Jordan Petridis
02de2059db
EpisodeWidget: Shrink the Size state Machine. 2018-02-13 05:03:16 +02:00
Jordan Petridis
bdf8901dd8
This compiles.
Instead of having a Wrapper of StateMachinesWrappers, use only the desired
possible states in A new struct with only 1 Wrapper that covers all 3 of
the embeded state machines.

I don't even know if the comment makes any sense. Sorry.
2018-02-13 02:23:32 +02:00
Jordan Petridis
2fbc833ebe
EpisodeWidget: Add a state machine that will manager progress_bar and cancel bttn. 2018-02-10 09:11:31 +02:00
Jordan Petridis
f7b5b35374
EpisodeWidget: change DownloadPlayMachine default constructor to a hidden state. 2018-02-10 08:13:07 +02:00
Jordan Petridis
46bd23cf66
EpisodeWidget: Add a StateMachine that manages Play and Download Buttons. 2018-02-10 08:00:12 +02:00
Jordan Petridis
6d9dfe6fe1
EpisodeWidget: Add a StateMachine for the size labels. 2018-02-10 05:41:25 +02:00
Jordan Petridis
fc48ce9c47
EpisodeWidget: Migrate Duration Machine to use take mut too, and revert the api to require just &mut self. 2018-02-10 03:33:39 +02:00
Jordan Petridis
3a9a2f4033
EpisdoeWidget: Use take_mut crate to allow for a better api.
Currently it's required that you take mut self in order to manipulate
the internal state machines. This would not allow passing an Arc/Rc to
a callback since A/Rc<T> only derefs to &T and not T.

The take_mut crate allows the retrieval of ownership if you have a &mut refference
and as long you return T again. So Arc<Mutex<Machine> could work with
callbacks and embed Nested state machies without copying.
2018-02-10 03:15:12 +02:00
Jordan Petridis
f0ce0eb653
EpisodeWidget: Implement a state machine for duration label. 2018-02-09 10:12:37 +02:00
Jordan Petridis
23979b8f22
EpisodeWidget: Move state machine implementations into a separate module. 2018-02-09 09:13:41 +02:00
Jordan Petridis
e22a78fac6
EpisodeWidget: Re-enable on_play_bttn_clicked callback.
Before we were avoiding reloading the widget in view by
directly dimming the title label. Now instead we reload
the whole widget since I can't figure out a way to have
multiple Owneded refferences of the same state machine.
2018-02-09 08:59:50 +02:00
Jordan Petridis
7690cb1356
Remove code duplication using generics. 2018-02-09 08:43:47 +02:00
Jordan Petridis
a96f4c57c9
Probably the worst state machine implementation that was ever written. 2018-02-09 08:43:43 +02:00
Jordan Petridis
45522b86df
Remove another unwrap. Though it would never be hit currently. 2018-02-08 21:34:11 +02:00
Jordan Petridis
1135d77147
EpisodeWidget: Remove unwrap on that could occur if an invalid path was passed. 2018-02-08 21:10:36 +02:00
Jordan Petridis
9dfb18a487
EpisodeWidget: Minor refactor of set_total_size method. 2018-02-08 21:02:16 +02:00
Jordan Petridis
fbfa0de17e
EpisodeWidget: Fix minutes label parsing.
Before if a feed had reported a number between 1 and 60, a label 0 min
would be set.

This fixes that, while also using chrono::Duration for parsing minutes.
2018-02-08 20:39:37 +02:00
Jordan Petridis
ea29aae64a
Fix benchmarks. 2018-02-08 17:33:40 +02:00
Jordan Petridis
e77b0a84c7
Update dependancies. 2018-02-08 17:03:26 +02:00
Jordan Petridis
c5e0bf34cb
Headerbar: Use the Application Action instead of relying directly on Content. 2018-02-08 05:40:40 +02:00
Jordan Petridis
4ba82c1515
EpisodeWidget: Set title alignment from glade. 2018-02-08 05:29:47 +02:00
Jordan Petridis
b172aa7aa3
Remove forgotten unwrap(). 2018-02-08 04:39:51 +02:00
Jordan Petridis
c6f5a4200d
EpisodeWidget: Fix progressbar alignment. 2018-02-07 22:08:52 +02:00
Jordan Petridis
e2a1762af4
EpisodeWidget: Use refference counting intead of unnecessary clones.
Pass owenership of EpisodeWidgetQuery and use Atomic Ref counting
to pass to the callbacks. This should avoid extra allocations.
2018-02-07 18:40:22 +02:00
Jordan Petridis
07c1a9a0e9
Fix private field visibility of stacks. 2018-02-07 07:11:40 +02:00
Jordan Petridis
31bd75ae45
Minor Arc changes. 2018-02-07 07:02:24 +02:00
Jordan Petridis
67af85e347
Hammond-gtk: Use Atomic Refference counting to reduce cloning of Podcast. 2018-02-07 06:28:16 +02:00
Jordan Petridis
df02054b29
Hammond-gtk: Change the privacy of the widgets module. 2018-02-07 05:47:58 +02:00
Jordan Petridis
0cdd48ac1e
Hammond-gtk: Change the privacy of the views module. 2018-02-07 05:37:07 +02:00
Jordan Petridis
bdda596806
Hammond-gtk: Inital split of content.rs into stacks module. 2018-02-07 05:33:29 +02:00
Jordan Petridis
8cbae4050e Merge branch '40-gtk-unwrap-cleanup' into 'master'
Resolve "Clean up the unwraps in the Gtk Client."

Closes #40

See merge request alatiera/Hammond!17
2018-02-07 02:12:11 +00:00
Jordan Petridis
d3696fc5ec
Minor Error messages wording changes. 2018-02-07 03:52:21 +02:00
Jordan Petridis
2d33606251
Hammond-gtk: Stack, Content constructors return Results now.
Constructors now proxy underlying errors that migth occur during initialazation.
I think that's about the last unwraps in the main thread.
2018-02-07 03:17:37 +02:00
Jordan Petridis
89564996df
ShowStack: Convert rest methods to return Result<T, Error>. 2018-02-07 01:19:07 +02:00
Jordan Petridis
e196a6c905
ShowStack: update_widget methods now return Result<T, Error>. 2018-02-07 00:55:43 +02:00
Jordan Petridis
7eb038b899
EpisodesStack: Refactor update method to return a Result<T, Error>. 2018-02-07 00:31:04 +02:00
Jordan Petridis
1c84f0d721
hammond-gtk::manager: Switch the add function to return a Result<(), Error>. 2018-02-06 22:03:17 +02:00
Jordan Petridis
ab519a54d3
Headerbar: Use Result<T, failure::Error> wherever possible. 2018-02-06 21:32:21 +02:00
Jordan Petridis
7ed1cd8b26
hammond-gtk: Change utils::get_pixbuf_from_path function to return a Result. 2018-02-06 20:56:55 +02:00
Jordan Petridis
c6e426cbac
Downloader: Change cache_image function to return Result<T, DownlaoderError> instead of Option<T>. 2018-02-06 20:14:03 +02:00
Jordan Petridis
d3f279374a
ShowWidget: Refactor to return Result<T, Error> wherever possible. 2018-02-06 02:47:39 +02:00