Index: sound-juicer.glade
===================================================================
RCS file: /cvs/gnome/sound-juicer/data/sound-juicer.glade,v
retrieving revision 1.34
diff -u -r1.34 sound-juicer.glade
--- sound-juicer.glade	1 Feb 2005 21:53:48 -0000	1.34
+++ sound-juicer.glade	7 Feb 2005 08:21:45 -0000
@@ -1450,29 +1450,6 @@
 	      </child>
 
 	      <child>
-		<widget class="GtkCheckButton" id="check_strip">
-		  <property name="visible">True</property>
-		  <property name="can_focus">True</property>
-		  <property name="label" translatable="yes">_Strip special characters</property>
-		  <property name="use_underline">True</property>
-		  <property name="relief">GTK_RELIEF_NORMAL</property>
-		  <property name="focus_on_click">True</property>
-		  <property name="active">False</property>
-		  <property name="inconsistent">False</property>
-		  <property name="draw_indicator">True</property>
-		  <signal name="toggled" handler="prefs_strip_toggled" last_modification_time="Fri, 25 Apr 2003 08:29:02 GMT"/>
-		</widget>
-		<packing>
-		  <property name="left_attach">0</property>
-		  <property name="right_attach">2</property>
-		  <property name="top_attach">4</property>
-		  <property name="bottom_attach">5</property>
-		  <property name="x_options">fill</property>
-		  <property name="y_options"></property>
-		</packing>
-	      </child>
-
-	      <child>
 		<widget class="GtkComboBox" id="path_option">
 		  <property name="visible">True</property>
 		  <property name="items" translatable="yes"></property>
@@ -1499,6 +1476,61 @@
 		  <property name="bottom_attach">3</property>
 		  <property name="x_options">fill</property>
 		  <property name="y_options">fill</property>
+		</packing>
+	      </child>
+
+	      <child>
+		<widget class="GtkVBox" id="vbox14">
+		  <property name="visible">True</property>
+		  <property name="homogeneous">False</property>
+		  <property name="spacing">0</property>
+
+		  <child>
+		    <widget class="GtkCheckButton" id="check_strip">
+		      <property name="visible">True</property>
+		      <property name="can_focus">True</property>
+		      <property name="label" translatable="yes">_Strip special characters</property>
+		      <property name="use_underline">True</property>
+		      <property name="relief">GTK_RELIEF_NORMAL</property>
+		      <property name="focus_on_click">True</property>
+		      <property name="active">False</property>
+		      <property name="inconsistent">False</property>
+		      <property name="draw_indicator">True</property>
+		      <signal name="toggled" handler="prefs_strip_toggled" last_modification_time="Fri, 25 Apr 2003 08:29:02 GMT"/>
+		    </widget>
+		    <packing>
+		      <property name="padding">0</property>
+		      <property name="expand">False</property>
+		      <property name="fill">False</property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkCheckButton" id="check_playlist">
+		      <property name="visible">True</property>
+		      <property name="can_focus">True</property>
+		      <property name="label" translatable="yes">_Create Playlist after Extracting</property>
+		      <property name="use_underline">True</property>
+		      <property name="relief">GTK_RELIEF_NORMAL</property>
+		      <property name="focus_on_click">True</property>
+		      <property name="active">False</property>
+		      <property name="inconsistent">False</property>
+		      <property name="draw_indicator">True</property>
+		      <signal name="toggled" handler="prefs_playlist_toggled" last_modification_time="Mon, 07 Feb 2005 07:40:05 GMT"/>
+		    </widget>
+		    <packing>
+		      <property name="padding">0</property>
+		      <property name="expand">False</property>
+		      <property name="fill">False</property>
+		    </packing>
+		  </child>
+		</widget>
+		<packing>
+		  <property name="left_attach">0</property>
+		  <property name="right_attach">2</property>
+		  <property name="top_attach">4</property>
+		  <property name="bottom_attach">5</property>
+		  <property name="x_options">fill</property>
 		</packing>
 	      </child>
 	    </widget>
Index: sound-juicer.h
===================================================================
RCS file: /cvs/gnome/sound-juicer/src/sound-juicer.h,v
retrieving revision 1.12
diff -u -r1.12 sound-juicer.h
--- sound-juicer.h	20 Nov 2004 12:54:26 -0000	1.12
+++ sound-juicer.h	7 Feb 2005 08:22:32 -0000
@@ -124,6 +124,7 @@
 #define GCONF_AUDIO_PROFILE GCONF_ROOT "/audio_profile"
 #define GCONF_PARANOIA GCONF_ROOT "/paranoia"
 #define GCONF_STRIP GCONF_ROOT "/strip-special"
+#define GCONF_PLAYLIST GCONF_ROOT "/playlist"
 #define GCONF_MUSICBRAINZ_SERVER GCONF_ROOT "/musicbrainz_server"
 
 #define GCONF_PROXY_ROOT "/system/http_proxy"
Index: sj-prefs.c
===================================================================
RCS file: /cvs/gnome/sound-juicer/src/sj-prefs.c,v
retrieving revision 1.30
diff -u -r1.30 sj-prefs.c
--- sj-prefs.c	1 Feb 2005 22:18:16 -0000	1.30
+++ sj-prefs.c	7 Feb 2005 08:23:54 -0000
@@ -37,7 +37,7 @@
 
 static GtkWidget *audio_profile;
 static GtkWidget *prefs_dialog;
-static GtkWidget *cd_option, *path_option, *file_option, *basepath_label, *check_strip, *check_eject;
+static GtkWidget *cd_option, *path_option, *file_option, *basepath_label, *check_strip, *check_eject, *check_playlist;
 static GtkWidget *path_example_label;
 static GList *cdroms = NULL;
 
@@ -202,6 +202,16 @@
                          NULL);
 }
 
+/**
+ * The Playlist check was toggled.
+ */
+void prefs_playlist_toggled (GtkToggleButton *togglebutton, gpointer user_data)
+{
+  gconf_client_set_bool (gconf_client, GCONF_PLAYLIST,
+                         gtk_toggle_button_get_active (togglebutton),
+                         NULL);
+}
+
 static void device_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data)
 {
   g_return_if_fail (strcmp (entry->key, GCONF_DEVICE) == 0);
@@ -270,6 +280,18 @@
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_strip), value);
 }
 
+static void playlist_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data)
+{
+  gboolean value = FALSE;
+  g_return_if_fail (strcmp (entry->key, GCONF_PLAYLIST) == 0);
+
+  if (entry->value != NULL) {
+    g_return_if_fail (entry->value->type == GCONF_VALUE_BOOL);
+    value = gconf_value_get_bool (entry->value);
+  }
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_playlist), value);
+}
+
 static void eject_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data)
 {
   gboolean value = FALSE;
@@ -413,6 +435,7 @@
     file_option = glade_xml_get_widget (glade, "file_option");
     audio_profile = glade_xml_get_widget (glade, "audio_profile");
     check_strip = glade_xml_get_widget (glade, "check_strip");
+    check_playlist = glade_xml_get_widget (glade, "check_playlist");
     check_eject = glade_xml_get_widget (glade, "check_eject");
     path_example_label = glade_xml_get_widget (glade, "path_example_label");
 
@@ -426,6 +449,7 @@
     gconf_client_notify_add (gconf_client, GCONF_BASEPATH, basepath_changed_cb, NULL, NULL, NULL);
     gconf_client_notify_add (gconf_client, GCONF_AUDIO_PROFILE, audio_profile_changed_cb, NULL, NULL, NULL);
     gconf_client_notify_add (gconf_client, GCONF_STRIP, strip_changed_cb, NULL, NULL, NULL);
+    gconf_client_notify_add (gconf_client, GCONF_PLAYLIST, playlist_changed_cb, NULL, NULL, NULL);
     gconf_client_notify_add (gconf_client, GCONF_EJECT, eject_changed_cb, NULL, NULL, NULL);
     gconf_client_notify_add (gconf_client, GCONF_PATH_PATTERN, path_pattern_changed_cb, NULL, NULL, NULL);
     gconf_client_notify_add (gconf_client, GCONF_FILE_PATTERN, file_pattern_changed_cb, NULL, NULL, NULL);
@@ -434,6 +458,7 @@
   device_changed_cb (gconf_client, -1, gconf_client_get_entry (gconf_client, GCONF_DEVICE, NULL, TRUE, NULL), NULL);
   audio_profile_changed_cb (gconf_client, -1, gconf_client_get_entry (gconf_client, GCONF_AUDIO_PROFILE, NULL, TRUE, NULL), NULL);
   strip_changed_cb (gconf_client, -1, gconf_client_get_entry (gconf_client, GCONF_STRIP, NULL, TRUE, NULL), NULL);
+  playlist_changed_cb (gconf_client, -1, gconf_client_get_entry (gconf_client, GCONF_PLAYLIST, NULL, TRUE, NULL), NULL);
   eject_changed_cb (gconf_client, -1, gconf_client_get_entry (gconf_client, GCONF_EJECT, NULL, TRUE, NULL), NULL);
   file_pattern_changed_cb (gconf_client, -1, gconf_client_get_entry (gconf_client, GCONF_FILE_PATTERN, NULL, TRUE, NULL), NULL);
   path_pattern_changed_cb (gconf_client, -1, gconf_client_get_entry (gconf_client, GCONF_PATH_PATTERN, NULL, TRUE, NULL), NULL);
Index: sj-extracting.c
===================================================================
RCS file: /cvs/gnome/sound-juicer/src/sj-extracting.c,v
retrieving revision 1.49
diff -u -r1.49 sj-extracting.c
--- sj-extracting.c	1 Feb 2005 22:05:53 -0000	1.49
+++ sj-extracting.c	7 Feb 2005 08:24:09 -0000
@@ -244,12 +244,38 @@
     char *file_path, *directory;
     GError *error = NULL;
     char *text;
-    
+    FILE *fp;
+	GConfClient *client;
+    static int no_of_times;
+    char *filename;	
+	gboolean playlist;
+
+	client = gconf_client_get_default();
+
     /* Pop the next track to extract */
     track = pending->data;
     pending = g_list_remove (pending, track);
     /* Build the filename for this track */
     file_path = build_filename (track);
+    /* Building Playlist */
+    playlist = gconf_client_get_bool(client, GCONF_PLAYLIST, NULL);
+	if (playlist)
+    {
+    filename = g_build_filename (base_path, g_strconcat (track->artist,"-", track->album->title, ".m3u", NULL), NULL);
+	    if (no_of_times == 0){
+	        fp = fopen(filename, "w");
+	    	fprintf(fp, "%s\n", "#EXTM3U");
+		}
+	    else
+	        {
+		fp = fopen(filename, "a+");
+		}
+    no_of_times ++;	
+    fprintf(fp, "%s:%d,%s\n", "#EXTINF", track->duration, track->title);
+    fprintf(fp, "%s\n", file_path);
+    fclose(fp); 	
+	}
+
     /* And create the directory it lives in */
     directory = create_directory_for (file_path, &error);
     if (error) {
Index: sj-main.c
===================================================================
RCS file: /cvs/gnome/sound-juicer/src/sj-main.c,v
retrieving revision 1.67
diff -u -r1.67 sj-main.c
--- sj-main.c	1 Feb 2005 21:53:48 -0000	1.67
+++ sj-main.c	7 Feb 2005 08:25:04 -0000
@@ -71,6 +71,7 @@
 const char *device = NULL;
 gboolean strip_chars;
 gboolean eject_finished;
+gboolean playlist;
 gboolean extracting = FALSE;
 static gboolean tray_opened = FALSE;
 static guint poll_id = 0;
@@ -436,6 +437,19 @@
 }
 
 /**
+ * The GConf key for the playlist option changed
+ */
+void playlist_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data)
+{
+  g_assert (strcmp (entry->key, GCONF_PLAYLIST) == 0);
+  if (entry->value == NULL) {
+    playlist = FALSE;
+  } else {
+    playlist = gconf_value_get_bool (entry->value);
+  }
+}
+
+/**
  * The GConf key for the eject when finished option changed
  */
 void eject_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data)
@@ -961,6 +975,7 @@
   gconf_client_notify_add (gconf_client, GCONF_EJECT, eject_changed_cb, NULL, NULL, NULL);
   gconf_client_notify_add (gconf_client, GCONF_BASEPATH, basepath_changed_cb, NULL, NULL, NULL);
   gconf_client_notify_add (gconf_client, GCONF_STRIP, strip_changed_cb, NULL, NULL, NULL);
+  gconf_client_notify_add (gconf_client, GCONF_PLAYLIST, playlist_changed_cb, NULL, NULL, NULL);
   gconf_client_notify_add (gconf_client, GCONF_AUDIO_PROFILE, profile_changed_cb, NULL, NULL, NULL);
   gconf_client_notify_add (gconf_client, GCONF_PARANOIA, paranoia_changed_cb, NULL, NULL, NULL);
   gconf_client_notify_add (gconf_client, GCONF_PATH_PATTERN, path_pattern_changed_cb, NULL, NULL, NULL);
@@ -1065,6 +1080,7 @@
   profile_changed_cb (gconf_client, -1, gconf_client_get_entry (gconf_client, GCONF_AUDIO_PROFILE, NULL, TRUE, NULL), NULL);
   paranoia_changed_cb (gconf_client, -1, gconf_client_get_entry (gconf_client, GCONF_PARANOIA, NULL, TRUE, NULL), NULL);
   strip_changed_cb (gconf_client, -1, gconf_client_get_entry (gconf_client, GCONF_STRIP, NULL, TRUE, NULL), NULL);
+  playlist_changed_cb (gconf_client, -1, gconf_client_get_entry (gconf_client, GCONF_PLAYLIST, NULL, TRUE, NULL), NULL);
   eject_changed_cb (gconf_client, -1, gconf_client_get_entry (gconf_client, GCONF_EJECT, NULL, TRUE, NULL), NULL);
   device_changed_cb (gconf_client, -1, gconf_client_get_entry (gconf_client, GCONF_DEVICE, NULL, TRUE, NULL), GINT_TO_POINTER (TRUE));
 
