Mercurial > audlegacy
changeset 2508:ecdfed7b1861 trunk
[svn] - more playlist cleanups (generalized code for playlist loading/saving
browser)
author | mf0102 |
---|---|
date | Mon, 12 Feb 2007 09:22:32 -0800 |
parents | e07c141dd326 |
children | b1ec2cbe0d0c |
files | ChangeLog src/audacious/build_stamp.c src/audacious/ui_playlist.c |
diffstat | 3 files changed, 54 insertions(+), 45 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Mon Feb 12 08:59:08 2007 -0800 +++ b/ChangeLog Mon Feb 12 09:22:32 2007 -0800 @@ -1,3 +1,16 @@ +2007-02-12 16:59:08 +0000 Michael Farber <01mf02@gmail.com> + revision [4024] + - made new functions: widget_move_relative and widget_resize_relative + - cleaned up playlist resizing code (removed lots of constants with help + of the new widget functions) + + + trunk/src/audacious/ui_playlist.c | 45 ++++++++++++++++++----------------- + trunk/src/audacious/widgets/widget.c | 17 ++++++++++--- + trunk/src/audacious/widgets/widget.h | 4 +-- + 3 files changed, 40 insertions(+), 26 deletions(-) + + 2007-02-12 16:13:53 +0000 Michael Farber <01mf02@gmail.com> revision [4022] - changed plugin directory to ~/.local/share/audacious/Plugins (seems more logical to me)
--- a/src/audacious/build_stamp.c Mon Feb 12 08:59:08 2007 -0800 +++ b/src/audacious/build_stamp.c Mon Feb 12 09:22:32 2007 -0800 @@ -1,2 +1,2 @@ #include <glib.h> -const gchar *svn_stamp = "20070212-4022"; +const gchar *svn_stamp = "20070212-4024";
--- a/src/audacious/ui_playlist.c Mon Feb 12 08:59:08 2007 -0800 +++ b/src/audacious/ui_playlist.c Mon Feb 12 09:22:32 2007 -0800 @@ -694,12 +694,10 @@ playlistwin_configure(GtkWidget * window, GdkEventConfigure * event, gpointer data) { - if (!GTK_WIDGET_VISIBLE(window)) - return FALSE; + g_return_val_if_fail(GTK_WIDGET_VISIBLE(window), FALSE); cfg.playlist_x = event->x; cfg.playlist_y = event->y; - return TRUE; } @@ -881,35 +879,50 @@ 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 *button; gchar *filename; g_return_val_if_fail(title != NULL, NULL); - if(!dialog) { - dialog = gtk_file_chooser_dialog_new(title, GTK_WINDOW(mainwin), - GTK_FILE_CHOOSER_ACTION_OPEN, 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), - GTK_STOCK_OPEN, - GTK_RESPONSE_ACCEPT); - gtk_button_set_use_stock(GTK_BUTTON(button), TRUE); - gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); - } + if (!dialog) + dialog = playlist_file_selection_browser(title, default_filename, + GTK_FILE_CHOOSER_ACTION_OPEN); if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); @@ -925,31 +938,14 @@ const gchar * default_filename) { static GtkWidget *dialog = NULL; - GtkWidget *button; gchar *filename; g_return_val_if_fail(title != NULL, NULL); - if(!dialog) { - dialog = gtk_file_chooser_dialog_new(title, GTK_WINDOW(mainwin), - GTK_FILE_CHOOSER_ACTION_SAVE, 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), - 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); - } - + if (!dialog) + dialog = playlist_file_selection_browser(title, default_filename, + GTK_FILE_CHOOSER_ACTION_SAVE); + if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); else