summaryrefslogtreecommitdiff
path: root/src/CueSheets/Banshee.CueSheets/Gui/CueSheetsView.cs
blob: 6970d2d21af5a85250350e125ef330ad83036124 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
using System;
using Mono.Addins;

using Banshee.Base;
using Banshee.Sources;
using Banshee.Sources.Gui;

// Other namespaces you might want:
using Banshee.ServiceStack;
using Banshee.Preferences;
using Banshee.MediaEngine;
using Banshee.PlaybackController;
using System.IO;

using Banshee.CueSheets;
using System.Text.RegularExpressions;
using Banshee.Collection;
using Banshee.Library;
using Banshee.Collection.Gui;
using Hyena.Data;
using Hyena.Collections;
using System.Collections.Generic;
using Banshee.Collection.Database;
using Hyena.Data.Gui;
using Banshee.Gui;
using Banshee.I18n;
using Banshee.Configuration;

namespace Banshee.CueSheets
{
    public class CueSheetsView : ISourceContents
    {
		private CS_TrackListModel     	store;
		private Gtk.VBox		  		box;
		private Gtk.ScrolledWindow 		ascroll,tscroll,aascroll,gscroll,ccscroll;
		private int             		index=-1;
		private CueSheetsSource 		MySource=null;
		private CS_AlbumListView 		aview;
		private CS_TrackListView		view;
		private CS_ArtistListView 		aaview;
		private CS_ComposerListView		ccview;
		private CS_GenreListView   		gview;
		private CS_PlayListsView		plsview;
		private CS_PlayListAdmin		plsadmin;
		private Gtk.HPaned				hb;
		private Gtk.HPaned				hb1;
		private Gtk.HPaned				hbpls;
		private Gtk.VPaned				vp;
		private Gtk.Toolbar				bar;
		private Gtk.Label				filling;
		
		private uint 					_position=0;
		private bool					_set_position=false;
		private bool					_positioning=false;
		private String  				basedir=null;
		private CueSheet 				_selected=null;
		
		public string cuename(string f) {
			string cn=Regex.Replace(Tools.basename(f),"[.]cue$","");
			return cn;
		}
		
		public List<CueSheet> getSheets() {
			return MySource.getSheets ();
		}
					
		private bool _fill_ready=true;
		private Stack<string> _fill_dirs=new Stack<string>();
		private Stack<string> _fill_cues=new Stack<string>();
		private int  _fill_count=0;
		private int  _fill_dir_count=0;
		private bool _fill_canceled=false;			
		
		private void fill(string cwd) {
			Hyena.Log.Information ("Scanning directory "+cwd);
			string [] dirs=Directory.GetDirectories(cwd, "*");
			string [] sheets=Directory.GetFiles (cwd,"*.cue");
			foreach (string dir in dirs) {
				_fill_dirs.Push (dir);
			}
			foreach (string sheet in sheets) {
				_fill_cues.Push (sheet);
			} 
			
			GLib.Timeout.Add (10,delegate() {
				if (_fill_canceled) {
					return false;
				}
				
				int i;
				while(i<50 && _fill_cues.Count>0) {
					string sheet=_fill_cues.Pop ();
					string bn=Tools.basename (sheet);
					if (bn!="") {
						if (bn.Substring (0,1)!=".") {
							CueSheet cs=new CueSheet(sheet,cwd,basedir);
							getSheets().Add (cs);
						}
					}
					i+=1;
					_fill_count+=1;
				}
				
				filling.Text="scanning "+basedir+"..."+_fill_count+" files, "+_fill_dir_count+" directories";
				if (_fill_cues.Count==0) {
					if (_fill_dirs.Count>0) {
						string dir=_fill_dirs.Pop ();
						_fill_dir_count+=1;
						fill (dir);
					} else {
						_fill_ready=true;
					}
					return false;
				} else {
					return true;
				}
			});
		}
		
		public void fill() {
			Gtk.Button cancel=new Gtk.Button("Cancel scan");
			Gtk.VSeparator sep=new Gtk.VSeparator();
			cancel.Clicked+=delegate(object sender,EventArgs args) {
				_fill_canceled=true;
			};
			bar.Add (sep);
			sep.Show ();
			bar.Add (cancel);
			cancel.Show ();
			bar.Show ();
			getSheets().Clear ();
			basedir=MySource.getCueSheetDir();
			Hyena.Log.Information ("Base directory="+basedir);
			if (basedir!=null) {
				_fill_ready=false;
				_fill_count=0;
				_fill_dir_count=0;
				_fill_canceled=false;
				_fill_cues.Clear ();
				_fill_dirs.Clear ();
				fill (basedir);
				GLib.Timeout.Add (500,delegate() {
					if (_fill_ready || _fill_canceled) {
						try {
							Hyena.Log.Information("Reload albums");
							MySource.getAlbumModel ().Reload ();
							Hyena.Log.Information(MySource.getAlbumModel ().Count.ToString ());
							Hyena.Log.Information("Reload artists");
							MySource.getArtistModel ().Reload ();
							Hyena.Log.Information(MySource.getArtistModel ().Count.ToString ());
							Hyena.Log.Information("Reload composers");
							MySource.getComposerModel ().Reload ();
							Hyena.Log.Information(MySource.getComposerModel ().Count.ToString ());
							Hyena.Log.Information("Reload genres");
							MySource.getGenreModel ().Reload ();
							Hyena.Log.Information(MySource.getGenreModel ().Count.ToString ());
							Hyena.Log.Information("Reload tracks");
							MySource.getTrackModel ().Reload ();
							Hyena.Log.Information("Reload play lists");
							MySource.getPlayListsModel().Reload();
							Hyena.Log.Information("Reloaded all");
						} catch(System.Exception e) {
							Hyena.Log.Information (e.ToString());
						}
						Hyena.Log.Information("Reloaded");
						filling.Text="";
						bar.Remove (sep);
						bar.Remove (cancel);
						bar.Hide ();
						return false;
					} else {
						return true;
					}
				});
			} 
		}
		
		private string _song_file=null;
		private string _song_id=null;
		
		public void seekSong(int i) {
			Hyena.Log.Information("SeekSong called "+i);
			try {
				CueSheet sheet=MySource.getSheet ();
				if (sheet.Count==0) {
					if (_selected!=null) {
						loadCueSheet (_selected);
					}
				}
				CueSheetEntry e=sheet.entry (i);
				_song_id=e.id ();
				if (_song_file!=e.file ()) {
					ServiceManager.PlayerEngine.Open (e);
					ServiceManager.PlayerEngine.Play ();
					_song_file=e.file ();
				}
				double offset=e.offset ();
				ServiceManager.PlayerEngine.SetCurrentTrack(e);
				_position=(uint) (offset*1000.0);
				_set_position=true;
				mscount=chgcount-(1000/timeout);
			} catch (SystemException ex) {
				Hyena.Log.Information(ex.ToString ());
			}
		}
		
		public void reLoad() {
			index=0;
			try {
				CueSheet sheet=MySource.getSheet ();
				ServiceManager.PlayerEngine.SetAccurateSeek(true);
				CueSheetEntry e=sheet.entry(index);
				ServiceManager.PlayerEngine.Open (e);
				ServiceManager.PlayerEngine.Play ();
				if (ServiceManager.PlaybackController.Source!=MySource) {
					ServiceManager.PlaybackController.Source=MySource; 
				} 
				if (ServiceManager.PlaybackController.NextSource!=MySource) {
					ServiceManager.PlaybackController.NextSource=MySource; 
				}
				ServiceManager.PlaybackController.SetSeekMode (true);
			} catch (SystemException ex) {
				Hyena.Log.Information(ex.ToString ());
			}
			mscount=chgcount-1;
		}
		
		// Every N ms
		private int 			timeout=100;
		private int 			mscount=0;
		private int 			chgcount=3000/100; // every 3 seconds
		//private CueSheetEntry 	_playing=null;
		
		public bool PositionDisplay() {
			if (ServiceManager.PlaybackController.Source==MySource) {
				CueSheet sheet=MySource.getSheet ();
				if (sheet!=null) {
					mscount+=1;
					if (mscount>chgcount) { mscount=0; }
					
					// Position if necessary
					if (_set_position) {
						_set_position=false;
						_positioning=true;
						ServiceManager.PlayerEngine.Position=_position;
					}
						
					// Do nothing while seeking
					uint pos=ServiceManager.PlayerEngine.Position;
					double p=((double) pos)/1000.0;
					if (_positioning && pos<=_position) {
							//Hyena.Log.Information ("seek="+_position+", pos="+pos);
							// do nothing
					} else {
						_positioning=false;
						// Track number
						int i=sheet.searchIndex(_song_id,p);
						if (i!=index && i>=0) {
							// Handle repeat track
							if (ServiceManager.PlaybackController.RepeatMode==PlaybackRepeatMode.RepeatSingle) {
								seekSong (index);
							} 
							// Every 2 seconds
							if (mscount==0) {
								Hyena.Log.Information("Found index i="+i+", songid="+_song_id);
								index=i;
								CueSheetEntry e=sheet.entry(index);
								ServiceManager.PlayerEngine.SetCurrentTrack (e);
							}
						}
						
						if (mscount==0 && index>=0) {
							Hyena.Log.Information ("mscount="+mscount+", index="+index);
							view.ScrollTo(index);
							view.Selection.QuietUnselect (view.Selection.FirstIndex);
							view.Selection.Select(index);
						}
					}
						
				}
			}
			return true;
		}
		
		public Boolean next() {
			CueSheet sheet=MySource.getSheet ();
			if (sheet==null) { return false; }
			if (index<sheet.nEntries ()-1) {
				index+=1;
			} else {
				index=0;
			}
			seekSong(index);
			return true;
		}
		
		public Boolean previous() {
			CueSheet sheet=MySource.getSheet ();
			if (sheet==null) { return false; }
			if (index>0) {
				index-=1;
			} else {
				index=sheet.nEntries ()-1;
			}
			seekSong(index);
			return true;
		}
		
		private int _set_column_sizes=0;
		
		public void setColumnSizes(CueSheet s) {
			int N=view.ColumnController.Count;
			int i;
			for(i=0;i<N;i++) {
				_set_column_sizes+=1;
				CS_Column col=(CS_Column) view.ColumnController[i];
				double w=(i==0) ? 0.05 : 0.16;
				if (s!=null) {
					w=MySource.getColumnWidth (col.id(),s.id ());
				}
				col.Width=w;
			}
		}
		
		public void loadCueSheet(CueSheet s) { //,Gtk.ListStore store) {
			MySource.setSheet(s);
			CueSheet sheet=MySource.getSheet ();
			store.SetSheet(sheet);
			store.Reload ();
			reLoad ();
			Hyena.Log.Information ("Setting column sizes for "+s.id ()); 
			setColumnSizes (s);
		}
		
		public void loadCueSheet(int i) {
			loadCueSheet (MySource.getSheets ()[i]);
		}
		
		public void EditSheet(CueSheet s) {
			Hyena.Log.Information (s.cueFile ());
			CueSheetEditor edt=new CueSheetEditor(s);
			edt.Do ();
			MySource.getAlbumModel ().Reload ();
			MySource.getArtistModel ().Reload ();
		}
		
		public void MusicFileToDevice(CueSheet s) {
			CS_MusicToDevice mtd=new CS_MusicToDevice(s);
			mtd.Do ();
		}
		
		public void PlayPlayList (CS_PlayList pls)
		{
			Hyena.Log.Information ("Playing playlist "+pls.PlsName);
			CueSheet s=pls.GetCueSheet ();
			loadCueSheet (s);
		}
			
		public void ToggleGrid(string forId) {
			Hyena.Log.Information ("ToggleGrid for id "+forId);
			bool grid=!MySource.getGridLayout (forId);
			Hyena.Log.Information ("Grid = "+grid);
			if (grid) {
				aview.EnableGrid ();
			} else {
				aview.DisableGrid ();
			}
			MySource.setGridLayout (forId,grid);
		}
		
		public void ToggleGrid() {
			ArtistInfo aa=MySource.getAlbumModel().filterArtist();
			CS_GenreInfo  gg=MySource.getAlbumModel().filterGenre();
			string fa="";
			bool in_tracks=false;
			MySource.getAlbumModel ().filterAlbumOrTracks(out fa,out in_tracks);
			string a="@@allartist@@";
			if (aa!=null) { a=aa.Name; }
			string g="@@allgenre@@";
			if (gg!=null) { g=gg.Genre; }
			string f="@@searchfilter@@";
			if (fa!=null) { f=fa; }
			string id=a+"-"+g+"-"+f;
			ToggleGrid(id);
		}
		
		public void SetGrid() {
			ArtistInfo aa=MySource.getAlbumModel().filterArtist();
			CS_GenreInfo  gg=MySource.getAlbumModel().filterGenre();
			string fa="";
			bool in_tracks=false;
			MySource.getAlbumModel ().filterAlbumOrTracks(out fa,out in_tracks);
			string a="@@allartist@@";
			if (aa!=null) { a=aa.Name; }
			string g="@@allgenre@@";
			if (gg!=null) { g=gg.Genre; }
			string f="@@searchfilter@@";
			if (fa!=null) { f=fa; }
			string id=a+"-"+g+"-"+f;
			Hyena.Log.Information ("SetGrid for id "+id);
			bool grid=MySource.getGridLayout (id);
			Hyena.Log.Information ("Grid = "+grid);
			if (grid) { aview.EnableGrid (); }
			else { aview.DisableGrid (); }
		}
		
		public CueSheetsView(CueSheetsSource ms) {
			MySource=ms;
			
			basedir=MySource.getCueSheetDir (); 
			
			store = new CS_TrackListModel();
			view  = new CS_TrackListView(this);
			
			{
				ColumnController colc=view.ColumnController;
				int i,N;
				for(i=0,N=colc.Count;i<N;i++) {
					CS_Column col=(CS_Column) colc[i];
					col.WidthChanged+=delegate(object sender,EventArgs args) {
						Hyena.Log.Information ("set-column-sizes="+_set_column_sizes);
						if (_set_column_sizes<=0) {
							_set_column_sizes=0;
							MySource.setColumnWidth (col.id(),MySource.getSheet ().id (),col.Width);
						} else {
							_set_column_sizes-=1;
						}
					};
				}
			}
			
			view.SetModel(store);
			this.setColumnSizes(null);
			
			Hyena.Log.Information("New albumlist");
			aview=new CS_AlbumListView(this);
			aaview=new CS_ArtistListView();
			ccview=new CS_ComposerListView();
			gview=new CS_GenreListView();
			try {
			plsview=new CS_PlayListsView(this);
			} catch (System.Exception ex) {
				Hyena.Log.Error (ex.ToString ());
			}
			
			Hyena.Log.Information("init models");
			aview.SetModel (MySource.getAlbumModel ());
			aaview.SetModel (MySource.getArtistModel ());
			gview.SetModel (MySource.getGenreModel ());
			ccview.SetModel (MySource.getComposerModel());
			plsview.SetModel(MySource.getPlayListsModel());
			
			plsadmin=new CS_PlayListAdmin(plsview,MySource.getPlayListsModel(),MySource.getPlayListCollection());

			MySource.getGenreModel();
			Hyena.Log.Information("model albumlist");
			Hyena.Log.Information("albumlist initialized");
			
			aview.RowActivated+=new Hyena.Data.Gui.RowActivatedHandler<AlbumInfo>(EvtRowActivated);
			aview.Selection.Changed += HandleAviewSelectionChanged;
			gview.RowActivated+=new Hyena.Data.Gui.RowActivatedHandler<CS_GenreInfo>(EvtGenreActivated);
			aaview.RowActivated+=new Hyena.Data.Gui.RowActivatedHandler<ArtistInfo>(EvtArtistActivated);
			ccview.RowActivated+=new Hyena.Data.Gui.RowActivatedHandler<CS_ComposerInfo>(EvtComposerActivated);
			plsview.RowActivated+=new Hyena.Data.Gui.RowActivatedHandler<CS_PlayList>(EvtPlayListActivated);
			view.RowActivated+=new RowActivatedHandler<CueSheetEntry>(EvtTrackRowActivated); 
			
			bar=new Gtk.Toolbar();
			if (basedir==null) {
				Hyena.Log.Information("basedir="+basedir);
				Gtk.Label lbl=new Gtk.Label();
				lbl.Markup="<b>You need to configure the CueSheets music directory first, using the right mouse button on the extension</b>";
				bar.Add (lbl);
			}
			filling=new Gtk.Label();
			bar.Add (filling);
			
			ascroll=new Gtk.ScrolledWindow();
			ascroll.Add (aview);
			aascroll=new Gtk.ScrolledWindow();
			aascroll.Add (aaview);
			tscroll=new Gtk.ScrolledWindow();
			tscroll.Add (view);
			gscroll=new Gtk.ScrolledWindow();
			gscroll.Add (gview);
			ccscroll=new Gtk.ScrolledWindow();
			ccscroll.Add(ccview);
			
			bool view_artist=true;
			Gtk.VBox vac=new Gtk.VBox();
			Gtk.Button vab=new Gtk.Button("Artists");
			vab.Clicked+=delegate(object sender,EventArgs args) {
				if (view_artist) {
					view_artist=false;
					vab.Label="Composers";
					vac.Remove (aascroll);
					vac.PackEnd (ccscroll);
					ccscroll.ShowAll ();
				} else {
					view_artist=true;
					vab.Label="Artists";
					vac.Remove (ccscroll);
					vac.PackEnd (aascroll);
					aascroll.ShowAll ();
				}
			};
			vac.PackStart (vab,false,false,0);
			vac.PackEnd (aascroll);
			
			hb=new Gtk.HPaned();
			hb.Add(gscroll);
			hb.Add (vac);
			hb1=new Gtk.HPaned();
			hb1.Add (hb);
			hb1.Add (ascroll);
			
			vp=new Gtk.VPaned();
			vp.Add (hb1);
			vp.Add (tscroll);

			Gtk.HPaned hppls=new Gtk.HPaned();
			hppls.Add1 (vp);
			hppls.Add2 (plsadmin);
			hbpls=hppls;
			
			{
				int hb_pls,hb_p,hb1_p,vp_p;
				MySource.getPositions (out hb_pls,out hb_p,out hb1_p,out vp_p);
				hppls.Position=hb_pls;
				hb.Position=hb_p;
				hb1.Position=hb1_p;
				vp.Position=vp_p;
			}
			

			box   = new Gtk.VBox();
			box.PackStart (bar,false,true,0);
			box.PackStart (hppls);
			box.ShowAll();
			
			GLib.Timeout.Add ((uint) 1000,(GLib.TimeoutHandler) GardDividers);
			GLib.Timeout.Add ((uint) timeout,(GLib.TimeoutHandler) PositionDisplay);
			
			fill ();
		}

		void HandleAviewSelectionChanged (object sender, EventArgs e) {
			int index=((Selection) sender).FirstIndex;
			CS_AlbumInfo a=(CS_AlbumInfo) MySource.getAlbumModel ()[index];
			_selected=a.getSheet ();
		}
		
		int hb_prev=-1;
		int hb1_prev=-1;
		int vp_prev=-1;
		int hbpls_prev=-1;
		
		public bool GardDividers() {
			if (hb_prev==-1) {
				hb_prev=hb.Position;
				hb1_prev=hb1.Position;
				vp_prev=vp.Position;
				hbpls_prev=hbpls.Position;
			}
			bool changed=false;
			if (hb_prev!=hb.Position) {
				hb_prev=hb.Position;
				changed=true;
			}
			if (hb1_prev!=hb1.Position) {
				hb1_prev=hb1.Position;
				changed=true;
			}
			if (vp_prev!=vp.Position) {
				vp_prev=vp.Position;
				changed=true;
			}
			if (hbpls_prev!=hbpls.Position) {
				hbpls_prev=hbpls.Position;
				changed=true;
			}
			if (changed) {
				MySource.setPositions(hbpls_prev,hb_prev,hb1_prev,vp_prev);
			}
			return true;
		}
		
		public void EvtCursorChanged(object sender,EventArgs a) {
			mscount=0; 
		}
		
		public void PlayAlbum(CS_AlbumInfo a) {
			loadCueSheet (a.getSheet ());
		}
		
		public void OpenContainingFolder(CS_AlbumInfo a) {
			CueSheet s=a.getSheet ();
		 	string path = System.IO.Path.GetDirectoryName (s.cueFile ());
            if (Banshee.IO.Directory.Exists (path)) {
               System.Diagnostics.Process.Start (path);
            }
		}
		
		public void EvtSearchAlbumOrTracks(object sender,string searchString,bool also_in_tracks) {
			MySource.getAlbumModel ().filterAlbumOrTracks(searchString,also_in_tracks);
			SetGrid ();
		}
		
		public void EvtRowActivated(object sender,RowActivatedArgs<AlbumInfo> args) {
			CS_AlbumInfo a=(CS_AlbumInfo) args.RowValue;
			PlayAlbum (a);
		}

		public void EvtGenreActivated(object sender,RowActivatedArgs<CS_GenreInfo> args) {
			CS_GenreInfo g=args.RowValue;
			if (MySource.getGenreModel ().isNullGenre (g)) { g=null; }
			MySource.getAlbumModel ().filterGenre(g);
			MySource.getArtistModel ().filterGenre(g);
			MySource.getComposerModel ().filterGenre (g);
			SetGrid ();
		}

		public void EvtArtistActivated(object sender,RowActivatedArgs<ArtistInfo> args) {
			//Hyena.Log.Information("I'm here! "+sender+", "+args);
			ArtistInfo a=args.RowValue;
			if (MySource.getArtistModel ().isNullArtist (a)) { a=null; }
			MySource.getAlbumModel ().filterArtist(a);
			MySource.getComposerModel ().filterArtist (a);
			SetGrid ();
		}

		public void EvtComposerActivated(object sender,RowActivatedArgs<CS_ComposerInfo> args) {
			CS_ComposerInfo a=(CS_ComposerInfo) args.RowValue;
			if (MySource.getComposerModel ().isNullComposer (a)) { a=null; }
			MySource.getAlbumModel ().filterComposer(a);
			MySource.getArtistModel ().filterComposer (a);
			SetGrid ();
		}
		
		public void EvtPlayListActivated(object sender,RowActivatedArgs<CS_PlayList> args) {
			Hyena.Log.Information("I'm here! "+sender+", "+args);
			
			
			//CS_ComposerInfo a=(CS_ComposerInfo) args.RowValue;
			//if (MySource.getComposerModel ().isNullComposer (a)) { a=null; }
			//MySource.getAlbumModel ().filterComposer(a);
			//MySource.getArtistModel ().filterComposer (a);
			//SetGrid ();
		}
		
		public void EvtTrackRowActivated(object sender,RowActivatedArgs<CueSheetEntry> args) {
			Hyena.Log.Information ("Row activated, seeking");
			seekSong (args.Row);
		}
			
		public CueSheetsSource GetSource() { return MySource; }

        public bool SetSource (ISource source) { return true; }
        public void ResetSource () { }
        public Gtk.Widget Widget { get { return box; } }
        public ISource Source { get { return null; } }
    }
}