diff src/audacious/ui_playlist.c @ 2514:7934ac463591 trunk

[svn] - removed unused function bmp_menu_translate() - removed playlist_file_selection_browser() and replaced it with make_filebrowser() - modified make_filebrowser() behaviour - adapted equalizer file loading/saving functions to new make_filebrowser()
author mf0102
date Tue, 13 Feb 2007 06:09:50 -0800
parents ecdfed7b1861
children 319b10203d7c
line wrap: on
line diff
--- a/src/audacious/ui_playlist.c	Tue Feb 13 05:48:33 2007 -0800
+++ b/src/audacious/ui_playlist.c	Tue Feb 13 06:09:50 2007 -0800
@@ -879,57 +879,24 @@
     playlist_set_current_name(playlist, filename);
 }
 
-static GtkWidget *
-playlist_file_selection_browser(const gchar *title,
-                                const gchar *default_filename,
-                                GtkFileChooserAction action)
-{
-    GtkWidget *dialog;
-    GtkWidget *button;
-
-    dialog = gtk_file_chooser_dialog_new(title, GTK_WINDOW(mainwin),
-                                         action, NULL, NULL);
-
-    if (default_filename)
-        gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog),
-                                      default_filename);
-
-    button = gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CANCEL,
-                                   GTK_RESPONSE_REJECT);
-
-    gtk_button_set_use_stock(GTK_BUTTON(button), TRUE);
-    GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
-
-    button = gtk_dialog_add_button(GTK_DIALOG(dialog),
-                                   (action == GTK_FILE_CHOOSER_ACTION_OPEN) ?
-                                   GTK_STOCK_OPEN : GTK_STOCK_SAVE,
-                                   GTK_RESPONSE_ACCEPT);
-
-    gtk_button_set_use_stock(GTK_BUTTON(button), TRUE);
-    gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
-
-    return dialog;
-}
-
 static gchar *
 playlist_file_selection_load(const gchar * title,
                         const gchar * default_filename)
 {
-    static GtkWidget *dialog = NULL;
+    GtkWidget *dialog;
     gchar *filename;
 
     g_return_val_if_fail(title != NULL, NULL);
 
-    if (!dialog)
-        dialog = playlist_file_selection_browser(title, default_filename,
-                                                 GTK_FILE_CHOOSER_ACTION_OPEN);
+    dialog = make_filebrowser(title, FALSE);
+    gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog), default_filename);
 
     if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
         filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
     else
         filename = NULL;
 
-    gtk_widget_hide(dialog);
+    gtk_widget_destroy(dialog);
     return filename;
 }
 
@@ -937,21 +904,20 @@
 playlist_file_selection_save(const gchar * title,
                         const gchar * default_filename)
 {
-    static GtkWidget *dialog = NULL;
+    GtkWidget *dialog;
     gchar *filename;
 
     g_return_val_if_fail(title != NULL, NULL);
 
-    if (!dialog)
-        dialog = playlist_file_selection_browser(title, default_filename,
-                                                 GTK_FILE_CHOOSER_ACTION_SAVE);
+    dialog = make_filebrowser(title, TRUE);
+    gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog), default_filename);
    
     if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
         filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
     else
         filename = NULL;
 
-    gtk_widget_hide(dialog);
+    gtk_widget_destroy(dialog);
     return filename;
 }