changeset 2641:c06b07b17fb5 trunk

[svn] - add support for writing relative path.
author yaz
date Thu, 22 Mar 2007 22:20:59 -0700
parents 66e128528d54
children a30d6b36c00f
files ChangeLog src/audacious/build_stamp.c src/audacious/playlist.h src/audacious/ui_playlist.c
diffstat 4 files changed, 38 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Mar 22 00:38:29 2007 -0700
+++ b/ChangeLog	Thu Mar 22 22:20:59 2007 -0700
@@ -1,3 +1,13 @@
+2007-03-22 07:38:29 +0000  Yoshiki Yazawa <yaz@cc.rim.or.jp>
+  revision [4302]
+  improve save/load playlist UI:
+  - Load/Save List dialog remembers last used directory for playlist.
+  - centering some error dialogs.
+  
+  trunk/src/audacious/ui_playlist.c |   16 +++++++++++-----
+  1 file changed, 11 insertions(+), 5 deletions(-)
+
+
 2007-03-21 20:47:48 +0000  Giacomo Lozito <james@develia.org>
   revision [4296]
   - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
--- a/src/audacious/build_stamp.c	Thu Mar 22 00:38:29 2007 -0700
+++ b/src/audacious/build_stamp.c	Thu Mar 22 22:20:59 2007 -0700
@@ -1,2 +1,2 @@
 #include <glib.h>
-const gchar *svn_stamp = "20070321-4296";
+const gchar *svn_stamp = "20070322-4302";
--- a/src/audacious/playlist.h	Thu Mar 22 00:38:29 2007 -0700
+++ b/src/audacious/playlist.h	Thu Mar 22 22:20:59 2007 -0700
@@ -77,7 +77,7 @@
 typedef enum {
     PLAYLIST_PLAIN = 0,
     PLAYLIST_STATIC = 1,
-//  PLAYLIST_FOO = 1 << 1, // for future use.
+    PLAYLIST_USE_RELATIVE = 1 << 1,
 } PlaylistAttribute;
 
 typedef struct _Playlist {
--- a/src/audacious/ui_playlist.c	Thu Mar 22 00:38:29 2007 -0700
+++ b/src/audacious/ui_playlist.c	Thu Mar 22 22:20:59 2007 -0700
@@ -905,13 +905,25 @@
         playlist->attribute & ~PLAYLIST_STATIC;
 }
 
+static void
+on_relative_toggle(GtkToggleButton *button, gpointer data)
+{
+    Playlist *playlist = playlist_get_active();
+
+    playlist->attribute =
+        gtk_toggle_button_get_active(button) ?
+        playlist->attribute | PLAYLIST_USE_RELATIVE :
+        playlist->attribute & ~PLAYLIST_USE_RELATIVE;
+}
+
 static gchar *
 playlist_file_selection_save(const gchar * title,
                         const gchar * default_filename)
 {
     GtkWidget *dialog;
     gchar *filename;
-    GtkWidget *toggle;
+    GtkWidget *hbox;
+    GtkWidget *toggle, *toggle2;
 
     g_return_val_if_fail(title != NULL, NULL);
 
@@ -919,12 +931,24 @@
     gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), cfg.playlist_path);
     gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog), default_filename);
 
+    hbox = gtk_hbox_new(FALSE, 5);
+
     /* static playlist */
     toggle = gtk_check_button_new_with_label("Save as Static Playlist");
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle),
                                  (playlist_get_active()->attribute & PLAYLIST_STATIC) ? TRUE : FALSE);
-    gtk_file_chooser_set_extra_widget(GTK_FILE_CHOOSER(dialog), toggle);
     g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(on_static_toggle), dialog);
+    gtk_box_pack_start(GTK_BOX(hbox), toggle, FALSE, FALSE, 0);
+
+    /* use relative path */
+    toggle2 = gtk_check_button_new_with_label("Use Relative Path");
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle2),
+                                 (playlist_get_active()->attribute & PLAYLIST_USE_RELATIVE) ? TRUE : FALSE);
+    g_signal_connect(G_OBJECT(toggle2), "toggled", G_CALLBACK(on_relative_toggle), dialog);
+    gtk_box_pack_start(GTK_BOX(hbox), toggle2, FALSE, FALSE, 0);
+
+    gtk_widget_show_all(hbox);
+    gtk_file_chooser_set_extra_widget(GTK_FILE_CHOOSER(dialog), hbox);
    
     if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
         filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));