diff --git a/widget/public/Makefile.in b/widget/public/Makefile.in index 0d5a819b6a9f..09058194af12 100644 --- a/widget/public/Makefile.in +++ b/widget/public/Makefile.in @@ -83,9 +83,9 @@ EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS)) MODULE = raptor XPIDL_MODULE = widget -XPIDLSRCS = \ - nsIFileSpecWithUI.idl \ - nsISound.idl \ +XPIDLSRCS = \ + nsIFileSpecWithUI.idl \ + nsISound.idl \ $(NULL) include $(topsrcdir)/config/config.mk diff --git a/widget/public/nsISound.idl b/widget/public/nsISound.idl index 9aa7ea99ef39..f7a77c726ce5 100644 --- a/widget/public/nsISound.idl +++ b/widget/public/nsISound.idl @@ -17,13 +17,14 @@ */ #include "nsISupports.idl" +#include "nsIFileSpec.idl" [scriptable, uuid(B148EED1-236D-11d3-B35C-00A0CC3C1CDE)] interface nsISound : nsISupports { void Init(); - void Play(in string filename); + void Play(in nsIFileSpec filespec); // void Stop(); void Beep(); diff --git a/widget/src/beos/nsSound.cpp b/widget/src/beos/nsSound.cpp index 1c6174bdfd37..3611a7008e4e 100644 --- a/widget/src/beos/nsSound.cpp +++ b/widget/src/beos/nsSound.cpp @@ -65,7 +65,7 @@ NS_METHOD nsSound::Beep() return NS_OK; } -NS_METHOD nsSound::Play(const char *filename) +NS_METHOD nsSound::Play(nsIFileSpec *filespec) { NS_NOTYETIMPLEMENTED("nsSound::Play"); return NS_OK; diff --git a/widget/src/beos/nsSound.h b/widget/src/beos/nsSound.h index 9c8d2102dc52..adb3005a69e3 100644 --- a/widget/src/beos/nsSound.h +++ b/widget/src/beos/nsSound.h @@ -33,7 +33,7 @@ class nsSound : public nsISound { NS_IMETHOD Init(void); - NS_IMETHOD Play(const char *filename); + NS_IMETHOD Play(nsIFileSpec *filespec); NS_IMETHOD Beep(void); diff --git a/widget/src/gtk/nsSound.cpp b/widget/src/gtk/nsSound.cpp index a9dd3ea916b7..ab7d9863e5b5 100644 --- a/widget/src/gtk/nsSound.cpp +++ b/widget/src/gtk/nsSound.cpp @@ -102,13 +102,19 @@ NS_METHOD nsSound::Beep() return NS_OK; } -NS_METHOD nsSound::Play(const char *filename) +NS_METHOD nsSound::Play(nsIFileSpec *filespec) { if (lib) { + char *filename; + filespec->GetNativePath(&filename); + g_print("there are some issues with playing sound right now, but this should work\n"); EsdPlayFileType EsdPlayFile = (EsdPlayFileType) PR_FindSymbol(lib, "esd_play_file"); (*EsdPlayFile)("mozilla", filename, 1); + + nsCRT::free(filename); + return NS_OK; } return NS_OK; diff --git a/widget/src/gtk/nsSound.h b/widget/src/gtk/nsSound.h index dc8ab9cd6404..e667ae8ff30c 100644 --- a/widget/src/gtk/nsSound.h +++ b/widget/src/gtk/nsSound.h @@ -33,7 +33,7 @@ class nsSound : public nsISound { NS_IMETHOD Init(void); - NS_IMETHOD Play(const char *filename); + NS_IMETHOD Play(nsIFileSpec *filespec); NS_IMETHOD Beep(void); diff --git a/widget/src/mac/nsSound.cpp b/widget/src/mac/nsSound.cpp index dd3a7c911caf..5fae67c684e2 100644 --- a/widget/src/mac/nsSound.cpp +++ b/widget/src/mac/nsSound.cpp @@ -65,7 +65,7 @@ NS_METHOD nsSound::Beep() return NS_OK; } -NS_METHOD nsSound::Play(const char *filename) +NS_METHOD nsSound::Play(nsIFileSpec *filespec) { NS_NOTYETIMPLEMENTED("nsSound::Play"); return NS_OK; diff --git a/widget/src/mac/nsSound.h b/widget/src/mac/nsSound.h index d81f413a6316..42b9190425f0 100644 --- a/widget/src/mac/nsSound.h +++ b/widget/src/mac/nsSound.h @@ -33,7 +33,7 @@ class nsSound : public nsISound { NS_IMETHOD Init(void); - NS_IMETHOD Play(const char *filename); + NS_IMETHOD Play(nsIFileSpec *filespec); NS_IMETHOD Beep(void); diff --git a/widget/src/photon/nsSound.cpp b/widget/src/photon/nsSound.cpp index b319738d2c7f..2a9558b9a8e2 100644 --- a/widget/src/photon/nsSound.cpp +++ b/widget/src/photon/nsSound.cpp @@ -68,7 +68,7 @@ NS_METHOD nsSound::Beep() return NS_OK; } -NS_METHOD nsSound::Play(const char *filename) +NS_METHOD nsSound::Play(nsIFileSpec *filespec) { PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsSound::Play - Not Implemented\n")); NS_NOTYETIMPLEMENTED("nsSound::Play"); diff --git a/widget/src/photon/nsSound.h b/widget/src/photon/nsSound.h index 54261f6640bd..655bf491ba57 100644 --- a/widget/src/photon/nsSound.h +++ b/widget/src/photon/nsSound.h @@ -31,7 +31,7 @@ class nsSound : public nsISound { NS_IMETHOD Init(void); - NS_IMETHOD Play(const char *filename); + NS_IMETHOD Play(nsIFileSpec *filespec); NS_IMETHOD Beep(void); diff --git a/widget/src/windows/nsSound.cpp b/widget/src/windows/nsSound.cpp index ccd9842598cd..7aa7dc441c1d 100644 --- a/widget/src/windows/nsSound.cpp +++ b/widget/src/windows/nsSound.cpp @@ -65,9 +65,15 @@ NS_METHOD nsSound::Beep() return NS_OK; } -NS_METHOD nsSound::Play(const char *filename) +NS_METHOD nsSound::Play(nsIFileSpec *filespec) { + char *filename; + filespec->GetNativePath(&filename); + ::PlaySound(filename, nsnull, SND_FILENAME | SND_NODEFAULT | SND_ASYNC); + + nsCRT::free(filename); + return NS_OK; } diff --git a/widget/src/windows/nsSound.h b/widget/src/windows/nsSound.h index 54261f6640bd..655bf491ba57 100644 --- a/widget/src/windows/nsSound.h +++ b/widget/src/windows/nsSound.h @@ -31,7 +31,7 @@ class nsSound : public nsISound { NS_IMETHOD Init(void); - NS_IMETHOD Play(const char *filename); + NS_IMETHOD Play(nsIFileSpec *filespec); NS_IMETHOD Beep(void);