Index: src/totem-playlist.c
===================================================================
--- src/totem-playlist.c	(revision 4082)
+++ src/totem-playlist.c	(working copy)
@@ -887,23 +887,103 @@
 	PlaylistSaveType *cur = NULL;
 	guint i;
 
-	if (active_format > 0)
-		totem_playlist_save_current_playlist_ext (playlist, filename,
-							save_types[active_format - 1].type);
+	if (active_format > 0) {
+		/* File format was selected, suffix is based on that selection */
+		totem_playlist_save_current_playlist_ext (playlist, filename, save_types[active_format - 1].type);
+	}
 	else {
+		/* No suffix format was selected in the filechooser dialog, suffix is based on the filename */
 		for (i = 0; i < G_N_ELEMENTS(save_types); i++) {
 			if (g_str_has_suffix (filename, save_types[i].suffix)) {
 				cur = &save_types[i];
 				break;
 			}
 		}
-		if (cur == NULL)
-			totem_playlist_error (_("Could not save the playlist"), _("Unknown file extension."), playlist);
-		else
+
+		if (cur == NULL) {
+			/* Playlist is saved with the default suffix, because the supplied suffix wasn't in save_types */
+			totem_playlist_save_current_playlist_ext (playlist, filename, save_types[0].type);
+		}
+		else {
+			/* Playlist is saved with the selected suffix from the filechooser dialog */
 			totem_playlist_save_current_playlist_ext (playlist, filename, cur->type);
+		}
 	}
 }
 
+static char *
+totem_playlist_save_files_change_filename (char *filename, gint active_format)
+{
+	PlaylistSaveType *cur = NULL;
+	guint i;
+	char *tmp, *dest = NULL;
+
+	if (active_format > 0) {
+		/* File format was selected, the suffix is based on that selection */
+		if (g_str_has_suffix (filename, save_types[active_format -1].suffix) == FALSE) {
+			/* Selected file format and suffix are not the same */
+			for (i = 0; i < G_N_ELEMENTS(save_types); i++) {
+				if (g_str_has_suffix (filename, save_types[i].suffix)) {
+					cur = &save_types[i];
+					break;
+				}
+			}
+
+			if (cur != NULL) {
+				/* Remove the suffix from filename */
+				dest = g_malloc (strlen (filename));
+				dest = g_strndup (filename, strlen (filename) - strlen (cur->suffix));
+
+				filename = dest;
+			}
+			/* Add new suffix to filename */
+			tmp = g_strconcat (filename, save_types[active_format - 1].suffix, NULL);
+			filename = tmp;
+		}
+	}
+	else {
+		/* No suffix format was selected in the filechooser dialog, suffix is based on the filename */
+		for (i = 0; i < G_N_ELEMENTS(save_types); i++) {
+			if (g_str_has_suffix (filename, save_types[i].suffix)) {
+				cur = &save_types[i];
+				break;
+			}
+		}
+
+		if (cur == NULL) {
+			tmp = g_strconcat (filename, save_types[0].suffix, NULL);
+			filename = tmp;
+		}
+	}
+	return filename;
+}
+
+static void
+totem_playlist_save_files_changed_cb (GtkComboBox *combo_box, GtkFileChooser *fs)
+{
+	char *filename, *tmp;
+	gint active_format;
+
+	/* Get data from the filechooser dialog  */
+	tmp = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (fs));
+	filename = g_strdup (gnome_vfs_uri_extract_short_path_name (gnome_vfs_uri_new (tmp)));
+	g_free (tmp);
+	active_format = gtk_combo_box_get_active (GTK_COMBO_BOX (combo_box));
+
+	/* Create the new filename based on the suffix selection from the combo box */
+	tmp = totem_playlist_save_files_change_filename (filename, active_format);
+	filename = gnome_vfs_unescape_string_for_display (tmp);
+
+	/* Put the new filename in the filechooser dialog */
+	if (filename != NULL && filename != "") {
+		gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (fs), filename);
+	}
+
+	g_free (tmp);
+	g_free (filename);
+	return;
+}
+
 static GtkWidget *
 totem_playlist_save_add_format_combo_box (GtkFileChooser *fc)
 {
@@ -960,21 +1040,25 @@
 	filename = g_strconcat (_("Playlist"), save_types[0].suffix, NULL);
 	gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (fs), filename);
 	g_free (filename);
+
 	combo_box = totem_playlist_save_add_format_combo_box (GTK_FILE_CHOOSER (fs));
 
-	if (playlist->_priv->save_path != NULL)
-	{
+	/* Connect signals to the callback functions */
+	g_signal_connect (G_OBJECT (combo_box), "changed", 
+		G_CALLBACK (totem_playlist_save_files_changed_cb), fs);
+
+	if (playlist->_priv->save_path != NULL) {
 		gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (fs),
 				playlist->_priv->save_path);
 	}
 
+	/* Show the filechooser and put its result in respone */
 	response = gtk_dialog_run (GTK_DIALOG (fs));
 	gtk_widget_hide (fs);
 	while (gtk_events_pending())
 		gtk_main_iteration();
 
-	if (response == GTK_RESPONSE_ACCEPT)
-	{
+	if (response == GTK_RESPONSE_ACCEPT) {
 		char *filename;
 		gint active_format;
 
@@ -991,9 +1075,9 @@
 
 		totem_playlist_save_playlist (playlist, filename, active_format);
 		g_free (filename);
-	} else {
+	}
+	else
 		gtk_widget_destroy (fs);
-	}
 }
 
 static void
