Index: src/apps/mediaplayer/playlist/PlaylistListView.cpp
===================================================================
--- src/apps/mediaplayer/playlist/PlaylistListView.cpp	(revision 26901)
+++ src/apps/mediaplayer/playlist/PlaylistListView.cpp	(working copy)
@@ -15,6 +15,9 @@
 #include <ScrollBar.h>
 #include <ScrollView.h>
 #include <Window.h>
+#include <NodeInfo.h>
+#include <Mime.h>
+#include <Bitmap.h>
 
 #include "CommandStack.h"
 #include "Controller.h"
@@ -51,33 +54,78 @@
 	return ceilf(fh.ascent * 0.8);
 }
 
+static BString
+get_mime_string(const entry_ref* ref)
+{
+	BFile file(ref, B_READ_ONLY);
+	BNodeInfo nodeInfo(&file);
+	char mimeString[B_MIME_TYPE_LENGTH];
+	if (nodeInfo.GetType(mimeString) != B_OK) {
+		BMimeType type;
+		if (BMimeType::GuessMimeType(ref, &type) != B_OK)
+			return BString();
 
+		strlcpy(mimeString, type.Type(), B_MIME_TYPE_LENGTH);
+		nodeInfo.SetType(type.Type());
+	}
+	return BString(mimeString);	
+}
+
 class PlaylistItem : public SimpleItem {
  public:
-								PlaylistItem(const entry_ref& ref);
-		virtual					~PlaylistItem();
+			 PlaylistItem(const entry_ref& ref);
+	virtual	~PlaylistItem();
 
-				void			Draw(BView* owner, BRect frame,
-									const font_height& fh,
-									bool tintedLine, uint32 mode,
-									bool active,
-									uint32 playbackState);
+	void Draw(BView* owner, BRect frame, const font_height& fh, bool tintedLine,
+				uint32 mode, bool active, uint32 playbackState);
 
- private:
-				entry_ref		fRef;
-
+private:
+	entry_ref	fRef;
+	BBitmap *	fBitmap;
 };
 
 
 PlaylistItem::PlaylistItem(const entry_ref& ref)
 	: SimpleItem(ref.name),
-	  fRef(ref)
+	  fRef(ref),
+	  fBitmap(NULL)
 {
+	BRect rect(0, 0, B_MINI_ICON - 1, B_MINI_ICON - 1);
+
+#ifdef HAIKU_TARGET_PLATFORM_HAIKU
+	fBitmap = new BBitmap(rect, B_RGBA32);
+#else
+	fBitmap = new BBitmap(rect, B_CMAP8);
+#endif
+
+	BString mimeString = get_mime_string(&ref);
+	BMimeType mimeType(mimeString.String());
+	status_t status = mimeType.GetIcon(fBitmap, B_MINI_ICON);
+
+	// get supertype icon
+	if (status != B_OK) {
+		BMimeType superType;
+		status = mimeType.GetSupertype(&superType);
+		if (status == B_OK)
+			status = superType.GetIcon(fBitmap, B_MINI_ICON);
+	}
+
+	// get default icon
+	if (status != B_OK) {
+		BMimeType genericType(B_FILE_MIME_TYPE);
+		status = genericType.GetIcon(fBitmap, B_MINI_ICON);
+	}
+
+	if (status != B_OK) {
+		delete fBitmap;
+		fBitmap = NULL;
+	}
 }
 
 
 PlaylistItem::~PlaylistItem()
 {
+	delete fBitmap;
 }
 
 
@@ -88,15 +136,16 @@
 	rgb_color color = (rgb_color){ 255, 255, 255, 255 };
 	if (tintedLine)
 		color = tint_color(color, 1.04);
+
 	// background
 	if (IsSelected())
 		color = tint_color(color, B_DARKEN_2_TINT);
 	owner->SetLowColor(color);
 	owner->FillRect(frame, B_SOLID_LOW);
+
 	// label
 	rgb_color black = (rgb_color){ 0, 0, 0, 255 };
 	owner->SetHighColor(black);
-	const char* text = Text();
 	switch (mode) {
 		case DISPLAY_NAME:
 			// TODO
@@ -108,25 +157,35 @@
 			break;
 	}
 
-	float playbackMarkSize = playback_mark_size(fh);
-	float textOffset = text_offset(fh);
+	float iconOffset = frame.left + 4;
+	float textOffset = iconOffset + B_MINI_ICON + 4;
+	float playbackSize = playback_mark_size(fh);
+	float playbackOffset = frame.Width() - playbackSize - 4;
 
-	BString truncatedString(text);
+	BString truncatedString(Text());
+
 	owner->TruncateString(&truncatedString, B_TRUNCATE_MIDDLE,
-		frame.Width() - playbackMarkSize - textOffset);
-	owner->DrawString(truncatedString.String(),
-		BPoint(frame.left + playbackMarkSize + textOffset,
+		playbackOffset - textOffset - text_offset(fh) - 4);
+	owner->DrawString(truncatedString.String(), BPoint(textOffset, 
 			floorf(frame.top + frame.bottom + fh.ascent) / 2 - 1));
 
+	if (fBitmap) {
+		BPoint point(iconOffset, 
+			frame.top + (frame.Height() - B_MINI_ICON) / 2.0f);
+		owner->SetDrawingMode(B_OP_ALPHA);
+		owner->DrawBitmap(fBitmap, point);
+	}
+
+	owner->SetDrawingMode(B_OP_COPY);
+
 	// playmark
 	if (active) {
 		rgb_color green = (rgb_color){ 0, 255, 0, 255 };
 		if (playbackState != PLAYBACK_STATE_PLAYING)
 			green = tint_color(color, B_DARKEN_1_TINT);
 
-		BRect r(0, 0, playbackMarkSize, playbackMarkSize);
-		r.OffsetTo(frame.left + 4,
-			ceilf((frame.top + frame.bottom) / 2) - 5);
+		BRect r(0, 0, playbackSize, playbackSize);
+		r.OffsetTo(playbackOffset, ceilf((frame.top + frame.bottom) / 2) - 4);
 
 		BPoint arrow[3];
 		arrow[0] = r.LeftTop();
