@@ -29,6 +29,8 @@ mod imp {
2929 pub artists : RefCell < Vec < RockboxArtist > > ,
3030 pub current_playlist_folder : RefCell < Option < String > > ,
3131 pub parent_playlist_folder : RefCell < Option < String > > ,
32+ pub selected_playlist : RefCell < Option < String > > ,
33+ pub selected_playlist_folder : RefCell < Option < String > > ,
3234 }
3335
3436 #[ glib:: object_subclass]
@@ -65,6 +67,8 @@ impl AppState {
6567 obj. imp ( ) . tracks . replace ( Vec :: new ( ) ) ;
6668 obj. imp ( ) . current_playlist_folder . replace ( None ) ;
6769 obj. imp ( ) . parent_playlist_folder . replace ( None ) ;
70+ obj. imp ( ) . selected_playlist . replace ( None ) ;
71+ obj. imp ( ) . selected_playlist_folder . replace ( None ) ;
6872 obj
6973 }
7074
@@ -124,6 +128,16 @@ impl AppState {
124128 self_. parent_playlist_folder . borrow ( ) . clone ( )
125129 }
126130
131+ pub fn selected_playlist_folder ( & self ) -> Option < String > {
132+ let self_ = imp:: AppState :: from_obj ( self ) ;
133+ self_. selected_playlist_folder . borrow ( ) . clone ( )
134+ }
135+
136+ pub fn selected_playlist ( & self ) -> Option < String > {
137+ let self_ = imp:: AppState :: from_obj ( self ) ;
138+ self_. selected_playlist . borrow ( ) . clone ( )
139+ }
140+
127141 pub fn music_directory ( & self ) -> Option < String > {
128142 let self_ = imp:: AppState :: from_obj ( self ) ;
129143 self_. music_directory . borrow ( ) . clone ( )
@@ -144,6 +158,16 @@ impl AppState {
144158 * self_. parent_playlist_folder . borrow_mut ( ) = folder_id;
145159 }
146160
161+ pub fn set_selected_playlist ( & self , playlist_id : Option < String > ) {
162+ let self_ = imp:: AppState :: from_obj ( self ) ;
163+ * self_. selected_playlist . borrow_mut ( ) = playlist_id;
164+ }
165+
166+ pub fn set_selected_playlist_folder ( & self , folder_id : Option < String > ) {
167+ let self_ = imp:: AppState :: from_obj ( self ) ;
168+ * self_. selected_playlist_folder . borrow_mut ( ) = folder_id;
169+ }
170+
147171 pub fn set_music_directory ( & self , path : & str ) {
148172 let self_ = imp:: AppState :: from_obj ( self ) ;
149173 * self_. music_directory . borrow_mut ( ) = Some ( path. to_string ( ) ) ;
0 commit comments