Two fixes:

- One from Justin O'Dell which properly enables and disables the play and stop
	buttons.
- One from me which doesn't crash Sounds if you try to open a file which has no
	MIME type set. It previously assumed the super type would always exist.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22010 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ryan Leavengood
2007-08-19 05:23:31 +00:00
parent 8b39e73209
commit c18df4b601
+11 -2
View File
@@ -139,6 +139,7 @@ HWindow::InitGUI()
,new BMessage(M_STOP_MESSAGE) ,new BMessage(M_STOP_MESSAGE)
,B_FOLLOW_RIGHT | B_FOLLOW_TOP); ,B_FOLLOW_RIGHT | B_FOLLOW_TOP);
button->ResizeToPreferred(); button->ResizeToPreferred();
button->SetEnabled(false);
button->MoveTo(box->Bounds().right - button->Bounds().Width() - 15, rect.top); button->MoveTo(box->Bounds().right - button->Bounds().Width() - 15, rect.top);
box->AddChild(button); box->AddChild(button);
@@ -153,6 +154,7 @@ HWindow::InitGUI()
,new BMessage(M_PLAY_MESSAGE) ,new BMessage(M_PLAY_MESSAGE)
,B_FOLLOW_RIGHT | B_FOLLOW_TOP); ,B_FOLLOW_RIGHT | B_FOLLOW_TOP);
button->ResizeToPreferred(); button->ResizeToPreferred();
button->SetEnabled(false);
button->MoveTo(rect.left - button->Bounds().Width() - 15, rect.top); button->MoveTo(rect.left - button->Bounds().Width() - 15, rect.top);
box->AddChild(button); box->AddChild(button);
@@ -212,7 +214,7 @@ HWindow::MessageReceived(BMessage *message)
BMimeType mtype(type); BMimeType mtype(type);
BMimeType superType; BMimeType superType;
mtype.GetSupertype(&superType); mtype.GetSupertype(&superType);
if(strcmp(superType.Type(),"audio") != 0) { if (superType.Type() == NULL || strcmp(superType.Type(), "audio") != 0) {
beep(); beep();
(new BAlert("","This is not a audio file.","OK",NULL,NULL, (new BAlert("","This is not a audio file.","OK",NULL,NULL,
B_WIDTH_AS_USUAL,B_STOP_ALERT))->Go(); B_WIDTH_AS_USUAL,B_STOP_ALERT))->Go();
@@ -408,9 +410,16 @@ HWindow::Pulse()
if(!menufield) if(!menufield)
return; return;
if(sel >=0) { if(sel >=0) {
menufield->SetEnabled(true); menufield->SetEnabled(true);
button->SetEnabled(true);
HEventItem *item = cast_as(fEventList->ItemAt(sel),HEventItem);
const char* path = item->Path();
if (path && strcmp(path, ""))
button->SetEnabled(true);
else
button->SetEnabled(false);
} else { } else {
menufield->SetEnabled(false); menufield->SetEnabled(false);
button->SetEnabled(false); button->SetEnabled(false);