Mercurial > audlegacy
changeset 2416:0fd7f4f969ad trunk
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
author | mf0102 |
---|---|
date | Fri, 26 Jan 2007 14:50:30 -0800 |
parents | e5e2c481eb59 |
children | ea17b8ee57d8 |
files | ChangeLog src/audacious/Makefile src/audacious/playback.c src/audacious/playlist.c src/audacious/ui_fileinfo.c src/audacious/ui_main.c src/audacious/ui_playlist.c src/audacious/ui_preferences.c src/audacious/urldecode.c src/audacious/urldecode.h src/audacious/util.c src/audacious/util.h src/audacious/vfs.c src/libaudacious/Makefile src/libaudacious/urldecode.c src/libaudacious/urldecode.h |
diffstat | 16 files changed, 370 insertions(+), 777 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Fri Jan 26 13:13:24 2007 -0800 +++ b/ChangeLog Fri Jan 26 14:50:30 2007 -0800 @@ -1,3 +1,10 @@ +2007-01-26 21:13:24 +0000 Michael Farber <01mf02@gmail.com> + revision [3840] + reworked file chooser + trunk/src/audacious/util.c | 118 ++++++++++++++++++++++++++++++++------------- + 1 file changed, 84 insertions(+), 34 deletions(-) + + 2007-01-26 17:11:10 +0000 Michael Farber <01mf02@gmail.com> revision [3838] removed last references to top_srcdir
--- a/src/audacious/Makefile Fri Jan 26 13:13:24 2007 -0800 +++ b/src/audacious/Makefile Fri Jan 26 14:50:30 2007 -0800 @@ -77,11 +77,13 @@ ui_equalizer.c \ ui_fileinfo.c \ ui_fileinfopopup.c \ + ui_fileopener.c \ ui_main.c \ ui_manager.c \ ui_playlist.c \ ui_preferences.c \ ui_skinselector.c \ + urldecode.c \ util.c \ vfs_buffer.c \ vfs_buffered_file.c \
--- a/src/audacious/playback.c Fri Jan 26 13:13:24 2007 -0800 +++ b/src/audacious/playback.c Fri Jan 26 14:50:30 2007 -0800 @@ -48,7 +48,7 @@ #include "playlist.h" #include "ui_playlist.h" #include "ui_skinselector.h" -#include "libaudacious/urldecode.h" +#include "urldecode.h" #include "util.h" #include "playback.h"
--- a/src/audacious/playlist.c Fri Jan 26 13:13:24 2007 -0800 +++ b/src/audacious/playlist.c Fri Jan 26 14:50:30 2007 -0800 @@ -52,10 +52,10 @@ #include "input.h" #include "main.h" #include "ui_main.h" -#include "libaudacious/util.h" +#include "util.h" #include "libaudacious/configdb.h" #include "vfs.h" -#include "libaudacious/urldecode.h" +#include "urldecode.h" #include "ui_equalizer.h" #include "playback.h" #include "playlist.h"
--- a/src/audacious/ui_fileinfo.c Fri Jan 26 13:13:24 2007 -0800 +++ b/src/audacious/ui_fileinfo.c Fri Jan 26 14:50:30 2007 -0800 @@ -48,7 +48,7 @@ #include "visualization.h" #include "main.h" -#include "libaudacious/urldecode.h" +#include "urldecode.h" #include "util.h" #include "dnd.h" #include "titlestring.h"
--- a/src/audacious/ui_main.c Fri Jan 26 13:13:24 2007 -0800 +++ b/src/audacious/ui_main.c Fri Jan 26 14:50:30 2007 -0800 @@ -55,31 +55,31 @@ #include "ui_main.h" #include "icons-stock.h" -#include "ui_manager.h" #include "actions-mainwin.h" #include "main.h" #include "controlsocket.h" -#include "pluginenum.h" - -#include "ui_credits.h" #include "dnd.h" #include "dock.h" -#include "ui_equalizer.h" +#include "genevent.h" #include "hints.h" #include "input.h" +#include "libaudacious/configdb.h" +#include "urldecode.h" +#include "playback.h" +#include "playlist.h" +#include "pluginenum.h" +#include "ui_credits.h" +#include "ui_equalizer.h" +#include "ui_fileopener.h" +#include "ui_manager.h" #include "ui_playlist.h" #include "ui_preferences.h" #include "ui_skinselector.h" -#include "genevent.h" -#include "playback.h" -#include "playlist.h" -#include "libaudacious/urldecode.h" #include "strings.h" #include "util.h" #include "visualization.h" -#include "libaudacious/configdb.h" static GTimeVal cb_time; /* click delay for tristate is defined by TRISTATE_THRESHOLD */ @@ -136,7 +136,7 @@ TextBox *mainwin_stime_min, *mainwin_stime_sec; static TextBox *mainwin_rate_text, *mainwin_freq_text, - *mainwin_othertext; + *mainwin_othertext; PlayStatus *mainwin_playstatus; @@ -279,22 +279,22 @@ textbox_set_scroll(mainwin_info, FALSE); if (playback_get_playing()) - { - widget_show(WIDGET(mainwin_sposition)); - widget_show(WIDGET(mainwin_stime_min)); - widget_show(WIDGET(mainwin_stime_sec)); - } - else - { - widget_hide(WIDGET(mainwin_sposition)); - widget_hide(WIDGET(mainwin_stime_min)); - widget_hide(WIDGET(mainwin_stime_sec)); - } + { + widget_show(WIDGET(mainwin_sposition)); + widget_show(WIDGET(mainwin_stime_min)); + widget_show(WIDGET(mainwin_stime_sec)); + } + else + { + widget_hide(WIDGET(mainwin_sposition)); + widget_hide(WIDGET(mainwin_stime_min)); + widget_hide(WIDGET(mainwin_stime_sec)); + } mainwin_shade->pb_ny = mainwin_shade->pb_py = 27; } else { - gint height = !bmp_active_skin->properties.mainwin_height ? MAINWIN_HEIGHT : + gint height = !bmp_active_skin->properties.mainwin_height ? MAINWIN_HEIGHT : bmp_active_skin->properties.mainwin_height; dock_shade(dock_window_list, GTK_WINDOW(mainwin), height * (cfg.doublesize + 1)); @@ -533,9 +533,9 @@ if (!w->redraw || !w->visible) continue; - if (w->x > bmp_active_skin->properties.mainwin_width || - w->y > bmp_active_skin->properties.mainwin_height) - continue; + if (w->x > bmp_active_skin->properties.mainwin_width || + w->y > bmp_active_skin->properties.mainwin_height) + continue; if (cfg.doublesize) { gint width, height; @@ -594,11 +594,11 @@ { if (mainwin_info_text_locked != TRUE) mainwin_tb_old_text = g_strdup(bmp_active_skin->properties.mainwin_othertext_is_status ? - mainwin_othertext->tb_text : mainwin_info->tb_text); + mainwin_othertext->tb_text : mainwin_info->tb_text); mainwin_info_text_locked = TRUE; textbox_set_text(bmp_active_skin->properties.mainwin_othertext_is_status ? - mainwin_othertext : mainwin_info, text); + mainwin_othertext : mainwin_info, text); } void @@ -609,12 +609,12 @@ if (mainwin_tb_old_text != NULL) { textbox_set_text(bmp_active_skin->properties.mainwin_othertext_is_status ? - mainwin_othertext : mainwin_info, mainwin_tb_old_text); + mainwin_othertext : mainwin_info, mainwin_tb_old_text); g_free(mainwin_tb_old_text); mainwin_tb_old_text = NULL; } else - mainwin_set_info_text(); /* XXX: best we can do */ + mainwin_set_info_text(); /* XXX: best we can do */ } @@ -640,135 +640,135 @@ mainwin_refresh_hints(void) { if (bmp_active_skin && bmp_active_skin->properties.mainwin_othertext - == TRUE) + == TRUE) { - widget_hide(WIDGET(mainwin_rate_text)); - widget_hide(WIDGET(mainwin_freq_text)); - widget_hide(WIDGET(mainwin_monostereo)); - - if (bmp_active_skin->properties.mainwin_othertext_visible) - widget_show(WIDGET(mainwin_othertext)); + widget_hide(WIDGET(mainwin_rate_text)); + widget_hide(WIDGET(mainwin_freq_text)); + widget_hide(WIDGET(mainwin_monostereo)); + + if (bmp_active_skin->properties.mainwin_othertext_visible) + widget_show(WIDGET(mainwin_othertext)); } else { - widget_show(WIDGET(mainwin_rate_text)); - widget_show(WIDGET(mainwin_freq_text)); - widget_show(WIDGET(mainwin_monostereo)); - widget_hide(WIDGET(mainwin_othertext)); + widget_show(WIDGET(mainwin_rate_text)); + widget_show(WIDGET(mainwin_freq_text)); + widget_show(WIDGET(mainwin_monostereo)); + widget_hide(WIDGET(mainwin_othertext)); } /* positioning and size attributes */ if (bmp_active_skin->properties.mainwin_vis_x && bmp_active_skin->properties.mainwin_vis_y) - widget_move(WIDGET(mainwin_vis), bmp_active_skin->properties.mainwin_vis_x, - bmp_active_skin->properties.mainwin_vis_y); + widget_move(WIDGET(mainwin_vis), bmp_active_skin->properties.mainwin_vis_x, + bmp_active_skin->properties.mainwin_vis_y); if (bmp_active_skin->properties.mainwin_vis_width) - widget_resize(WIDGET(mainwin_vis), bmp_active_skin->properties.mainwin_vis_width, - mainwin_vis->vs_widget.height); + widget_resize(WIDGET(mainwin_vis), bmp_active_skin->properties.mainwin_vis_width, + mainwin_vis->vs_widget.height); if (bmp_active_skin->properties.mainwin_text_x && bmp_active_skin->properties.mainwin_text_y) - widget_move(WIDGET(mainwin_info), bmp_active_skin->properties.mainwin_text_x, - bmp_active_skin->properties.mainwin_text_y); + widget_move(WIDGET(mainwin_info), bmp_active_skin->properties.mainwin_text_x, + bmp_active_skin->properties.mainwin_text_y); if (bmp_active_skin->properties.mainwin_text_width) - widget_resize(WIDGET(mainwin_info), bmp_active_skin->properties.mainwin_text_width, - mainwin_info->tb_widget.height); + widget_resize(WIDGET(mainwin_info), bmp_active_skin->properties.mainwin_text_width, + mainwin_info->tb_widget.height); if (bmp_active_skin->properties.mainwin_infobar_x && bmp_active_skin->properties.mainwin_infobar_y) - widget_move(WIDGET(mainwin_othertext), bmp_active_skin->properties.mainwin_infobar_x, - bmp_active_skin->properties.mainwin_infobar_y); + widget_move(WIDGET(mainwin_othertext), bmp_active_skin->properties.mainwin_infobar_x, + bmp_active_skin->properties.mainwin_infobar_y); if (bmp_active_skin->properties.mainwin_number_0_x && bmp_active_skin->properties.mainwin_number_0_y) - widget_move(WIDGET(mainwin_minus_num), bmp_active_skin->properties.mainwin_number_0_x, - bmp_active_skin->properties.mainwin_number_0_y); + widget_move(WIDGET(mainwin_minus_num), bmp_active_skin->properties.mainwin_number_0_x, + bmp_active_skin->properties.mainwin_number_0_y); if (bmp_active_skin->properties.mainwin_number_1_x && bmp_active_skin->properties.mainwin_number_1_y) - widget_move(WIDGET(mainwin_10min_num), bmp_active_skin->properties.mainwin_number_1_x, - bmp_active_skin->properties.mainwin_number_1_y); + widget_move(WIDGET(mainwin_10min_num), bmp_active_skin->properties.mainwin_number_1_x, + bmp_active_skin->properties.mainwin_number_1_y); if (bmp_active_skin->properties.mainwin_number_2_x && bmp_active_skin->properties.mainwin_number_2_y) - widget_move(WIDGET(mainwin_min_num), bmp_active_skin->properties.mainwin_number_2_x, - bmp_active_skin->properties.mainwin_number_2_y); + widget_move(WIDGET(mainwin_min_num), bmp_active_skin->properties.mainwin_number_2_x, + bmp_active_skin->properties.mainwin_number_2_y); if (bmp_active_skin->properties.mainwin_number_3_x && bmp_active_skin->properties.mainwin_number_3_y) - widget_move(WIDGET(mainwin_10sec_num), bmp_active_skin->properties.mainwin_number_3_x, - bmp_active_skin->properties.mainwin_number_3_y); + widget_move(WIDGET(mainwin_10sec_num), bmp_active_skin->properties.mainwin_number_3_x, + bmp_active_skin->properties.mainwin_number_3_y); if (bmp_active_skin->properties.mainwin_number_4_x && bmp_active_skin->properties.mainwin_number_4_y) - widget_move(WIDGET(mainwin_sec_num), bmp_active_skin->properties.mainwin_number_4_x, - bmp_active_skin->properties.mainwin_number_4_y); + widget_move(WIDGET(mainwin_sec_num), bmp_active_skin->properties.mainwin_number_4_x, + bmp_active_skin->properties.mainwin_number_4_y); if (bmp_active_skin->properties.mainwin_playstatus_x && bmp_active_skin->properties.mainwin_playstatus_y) - widget_move(WIDGET(mainwin_playstatus), bmp_active_skin->properties.mainwin_playstatus_x, - bmp_active_skin->properties.mainwin_playstatus_y); + widget_move(WIDGET(mainwin_playstatus), bmp_active_skin->properties.mainwin_playstatus_x, + bmp_active_skin->properties.mainwin_playstatus_y); if (bmp_active_skin->properties.mainwin_volume_x && bmp_active_skin->properties.mainwin_volume_y) - widget_move(WIDGET(mainwin_volume), bmp_active_skin->properties.mainwin_volume_x, - bmp_active_skin->properties.mainwin_volume_y); + widget_move(WIDGET(mainwin_volume), bmp_active_skin->properties.mainwin_volume_x, + bmp_active_skin->properties.mainwin_volume_y); if (bmp_active_skin->properties.mainwin_balance_x && bmp_active_skin->properties.mainwin_balance_y) - widget_move(WIDGET(mainwin_balance), bmp_active_skin->properties.mainwin_balance_x, - bmp_active_skin->properties.mainwin_balance_y); + widget_move(WIDGET(mainwin_balance), bmp_active_skin->properties.mainwin_balance_x, + bmp_active_skin->properties.mainwin_balance_y); if (bmp_active_skin->properties.mainwin_position_x && bmp_active_skin->properties.mainwin_position_y) - widget_move(WIDGET(mainwin_position), bmp_active_skin->properties.mainwin_position_x, - bmp_active_skin->properties.mainwin_position_y); + widget_move(WIDGET(mainwin_position), bmp_active_skin->properties.mainwin_position_x, + bmp_active_skin->properties.mainwin_position_y); if (bmp_active_skin->properties.mainwin_previous_x && bmp_active_skin->properties.mainwin_previous_y) - widget_move(WIDGET(mainwin_rew), bmp_active_skin->properties.mainwin_previous_x, - bmp_active_skin->properties.mainwin_previous_y); + widget_move(WIDGET(mainwin_rew), bmp_active_skin->properties.mainwin_previous_x, + bmp_active_skin->properties.mainwin_previous_y); if (bmp_active_skin->properties.mainwin_play_x && bmp_active_skin->properties.mainwin_play_y) - widget_move(WIDGET(mainwin_play), bmp_active_skin->properties.mainwin_play_x, - bmp_active_skin->properties.mainwin_play_y); + widget_move(WIDGET(mainwin_play), bmp_active_skin->properties.mainwin_play_x, + bmp_active_skin->properties.mainwin_play_y); if (bmp_active_skin->properties.mainwin_pause_x && bmp_active_skin->properties.mainwin_pause_y) - widget_move(WIDGET(mainwin_pause), bmp_active_skin->properties.mainwin_pause_x, - bmp_active_skin->properties.mainwin_pause_y); + widget_move(WIDGET(mainwin_pause), bmp_active_skin->properties.mainwin_pause_x, + bmp_active_skin->properties.mainwin_pause_y); if (bmp_active_skin->properties.mainwin_stop_x && bmp_active_skin->properties.mainwin_stop_y) - widget_move(WIDGET(mainwin_stop), bmp_active_skin->properties.mainwin_stop_x, - bmp_active_skin->properties.mainwin_stop_y); + widget_move(WIDGET(mainwin_stop), bmp_active_skin->properties.mainwin_stop_x, + bmp_active_skin->properties.mainwin_stop_y); if (bmp_active_skin->properties.mainwin_next_x && bmp_active_skin->properties.mainwin_next_y) - widget_move(WIDGET(mainwin_fwd), bmp_active_skin->properties.mainwin_next_x, - bmp_active_skin->properties.mainwin_next_y); + widget_move(WIDGET(mainwin_fwd), bmp_active_skin->properties.mainwin_next_x, + bmp_active_skin->properties.mainwin_next_y); if (bmp_active_skin->properties.mainwin_eject_x && bmp_active_skin->properties.mainwin_eject_y) - widget_move(WIDGET(mainwin_eject), bmp_active_skin->properties.mainwin_eject_x, - bmp_active_skin->properties.mainwin_eject_y); + widget_move(WIDGET(mainwin_eject), bmp_active_skin->properties.mainwin_eject_x, + bmp_active_skin->properties.mainwin_eject_y); if (bmp_active_skin->properties.mainwin_eqbutton_x && bmp_active_skin->properties.mainwin_eqbutton_y) - widget_move(WIDGET(mainwin_eq), bmp_active_skin->properties.mainwin_eqbutton_x, - bmp_active_skin->properties.mainwin_eqbutton_y); + widget_move(WIDGET(mainwin_eq), bmp_active_skin->properties.mainwin_eqbutton_x, + bmp_active_skin->properties.mainwin_eqbutton_y); if (bmp_active_skin->properties.mainwin_plbutton_x && bmp_active_skin->properties.mainwin_plbutton_y) - widget_move(WIDGET(mainwin_pl), bmp_active_skin->properties.mainwin_plbutton_x, - bmp_active_skin->properties.mainwin_plbutton_y); + widget_move(WIDGET(mainwin_pl), bmp_active_skin->properties.mainwin_plbutton_x, + bmp_active_skin->properties.mainwin_plbutton_y); if (bmp_active_skin->properties.mainwin_shuffle_x && bmp_active_skin->properties.mainwin_shuffle_y) - widget_move(WIDGET(mainwin_shuffle), bmp_active_skin->properties.mainwin_shuffle_x, - bmp_active_skin->properties.mainwin_shuffle_y); + widget_move(WIDGET(mainwin_shuffle), bmp_active_skin->properties.mainwin_shuffle_x, + bmp_active_skin->properties.mainwin_shuffle_y); if (bmp_active_skin->properties.mainwin_repeat_x && bmp_active_skin->properties.mainwin_repeat_y) - widget_move(WIDGET(mainwin_repeat), bmp_active_skin->properties.mainwin_repeat_x, - bmp_active_skin->properties.mainwin_repeat_y); + widget_move(WIDGET(mainwin_repeat), bmp_active_skin->properties.mainwin_repeat_x, + bmp_active_skin->properties.mainwin_repeat_y); if (bmp_active_skin->properties.mainwin_about_x && bmp_active_skin->properties.mainwin_about_y) - widget_move(WIDGET(mainwin_about), bmp_active_skin->properties.mainwin_about_x, - bmp_active_skin->properties.mainwin_about_y); + widget_move(WIDGET(mainwin_about), bmp_active_skin->properties.mainwin_about_x, + bmp_active_skin->properties.mainwin_about_y); if (bmp_active_skin->properties.mainwin_minimize_x && bmp_active_skin->properties.mainwin_minimize_y) - widget_move(WIDGET(mainwin_minimize), cfg.player_shaded ? 244 : bmp_active_skin->properties.mainwin_minimize_x, - cfg.player_shaded ? 3 : bmp_active_skin->properties.mainwin_minimize_y); + widget_move(WIDGET(mainwin_minimize), cfg.player_shaded ? 244 : bmp_active_skin->properties.mainwin_minimize_x, + cfg.player_shaded ? 3 : bmp_active_skin->properties.mainwin_minimize_y); if (bmp_active_skin->properties.mainwin_shade_x && bmp_active_skin->properties.mainwin_shade_y) - widget_move(WIDGET(mainwin_shade), cfg.player_shaded ? 254 : bmp_active_skin->properties.mainwin_shade_x, - cfg.player_shaded ? 3 : bmp_active_skin->properties.mainwin_shade_y); + widget_move(WIDGET(mainwin_shade), cfg.player_shaded ? 254 : bmp_active_skin->properties.mainwin_shade_x, + cfg.player_shaded ? 3 : bmp_active_skin->properties.mainwin_shade_y); if (bmp_active_skin->properties.mainwin_close_x && bmp_active_skin->properties.mainwin_close_y) - widget_move(WIDGET(mainwin_close), cfg.player_shaded ? 264 : bmp_active_skin->properties.mainwin_close_x, - cfg.player_shaded ? 3 : bmp_active_skin->properties.mainwin_close_y); + widget_move(WIDGET(mainwin_close), cfg.player_shaded ? 264 : bmp_active_skin->properties.mainwin_close_x, + cfg.player_shaded ? 3 : bmp_active_skin->properties.mainwin_close_y); /* visibility attributes */ if (bmp_active_skin->properties.mainwin_menurow_visible) @@ -794,30 +794,30 @@ /* window size, mainwinWidth && mainwinHeight properties */ if (bmp_active_skin->properties.mainwin_height && bmp_active_skin->properties.mainwin_width) { - gint width, height; - - gdk_window_get_size(mainwin->window, &width, &height); + gint width, height; + + gdk_window_get_size(mainwin->window, &width, &height); if (width == bmp_active_skin->properties.mainwin_width * (cfg.doublesize + 1) && - height == bmp_active_skin->properties.mainwin_height * (cfg.doublesize + 1)) + height == bmp_active_skin->properties.mainwin_height * (cfg.doublesize + 1)) return; dock_window_resize(GTK_WINDOW(mainwin), cfg.player_shaded ? MAINWIN_SHADED_WIDTH * (cfg.doublesize + 1) : bmp_active_skin->properties.mainwin_width * (cfg.doublesize + 1), - cfg.player_shaded ? MAINWIN_SHADED_HEIGHT * (cfg.doublesize + 1) : bmp_active_skin->properties.mainwin_height * (cfg.doublesize + 1), - bmp_active_skin->properties.mainwin_width * (cfg.doublesize + 1), - bmp_active_skin->properties.mainwin_height * (cfg.doublesize + 1)); - - g_object_unref(mainwin_bg); - g_object_unref(mainwin_bg_x2); + cfg.player_shaded ? MAINWIN_SHADED_HEIGHT * (cfg.doublesize + 1) : bmp_active_skin->properties.mainwin_height * (cfg.doublesize + 1), + bmp_active_skin->properties.mainwin_width * (cfg.doublesize + 1), + bmp_active_skin->properties.mainwin_height * (cfg.doublesize + 1)); + + g_object_unref(mainwin_bg); + g_object_unref(mainwin_bg_x2); mainwin_bg = gdk_pixmap_new(mainwin->window, - bmp_active_skin->properties.mainwin_width, - bmp_active_skin->properties.mainwin_height, -1); + bmp_active_skin->properties.mainwin_width, + bmp_active_skin->properties.mainwin_height, -1); mainwin_bg_x2 = gdk_pixmap_new(mainwin->window, - bmp_active_skin->properties.mainwin_width * 2, - bmp_active_skin->properties.mainwin_height * 2, -1); + bmp_active_skin->properties.mainwin_width * 2, + bmp_active_skin->properties.mainwin_height * 2, -1); mainwin_set_back_pixmap(); - widget_list_change_pixmap(mainwin_wlist, mainwin_bg); - gdk_flush(); + widget_list_change_pixmap(mainwin_wlist, mainwin_bg); + gdk_flush(); } } @@ -882,7 +882,7 @@ } if (bmp_active_skin && bmp_active_skin->properties.mainwin_othertext - == TRUE) + == TRUE) { if (bitrate != -1) g_snprintf(text, 512, "%d kbps, %0.1f kHz, %s", @@ -996,7 +996,7 @@ if (dock_is_moving(GTK_WINDOW(mainwin))) { dock_move_release(GTK_WINDOW(mainwin)); - draw_playlist_window(TRUE); + draw_playlist_window(TRUE); } if (mainwin_menurow->mr_doublesize_selected) { @@ -1022,11 +1022,11 @@ if (event->is_hint != FALSE) { gdk_window_get_pointer(GDK_WINDOW(mainwin->window), - &x, &y, &state); - - /* If it's a hint, we had to query X, so override the + &x, &y, &state); + + /* If it's a hint, we had to query X, so override the * information we we're given... it's probably useless... --nenolod - */ + */ event->x = x; event->y = y; event->state = state; @@ -1104,26 +1104,26 @@ mainwin_scrolled(GtkWidget *widget, GdkEventScroll *event, gpointer callback_data) { - Playlist *playlist = playlist_get_active(); - - switch (event->direction) { - case GDK_SCROLL_UP: - mainwin_set_volume_diff(cfg.mouse_change); - break; - case GDK_SCROLL_DOWN: - mainwin_set_volume_diff(-cfg.mouse_change); - break; - case GDK_SCROLL_LEFT: - if (playlist_get_current_length(playlist) != -1) - playback_seek(CLAMP(playback_get_time() - 1000, - 0, playlist_get_current_length(playlist)) / 1000); - break; - case GDK_SCROLL_RIGHT: - if (playlist_get_current_length(playlist) != -1) - playback_seek(CLAMP(playback_get_time() + 1000, - 0, playlist_get_current_length(playlist)) / 1000); - break; - } + Playlist *playlist = playlist_get_active(); + + switch (event->direction) { + case GDK_SCROLL_UP: + mainwin_set_volume_diff(cfg.mouse_change); + break; + case GDK_SCROLL_DOWN: + mainwin_set_volume_diff(-cfg.mouse_change); + break; + case GDK_SCROLL_LEFT: + if (playlist_get_current_length(playlist) != -1) + playback_seek(CLAMP(playback_get_time() - 1000, + 0, playlist_get_current_length(playlist)) / 1000); + break; + case GDK_SCROLL_RIGHT: + if (playlist_get_current_length(playlist) != -1) + playback_seek(CLAMP(playback_get_time() + 1000, + 0, playlist_get_current_length(playlist)) / 1000); + break; + } } static gboolean @@ -1224,13 +1224,13 @@ if (event->button == 1) { if (widget_contains(WIDGET(mainwin_minus_num), event->x, event->y) || - widget_contains(WIDGET(mainwin_10min_num), event->x, event->y) || - widget_contains(WIDGET(mainwin_min_num), event->x, event->y) || - widget_contains(WIDGET(mainwin_10sec_num), event->x, event->y) || - widget_contains(WIDGET(mainwin_sec_num), event->x, event->y) || - widget_contains(WIDGET(mainwin_stime_min), event->x, event->y) || - widget_contains(WIDGET(mainwin_stime_sec), event->x, event->y)) - { + widget_contains(WIDGET(mainwin_10min_num), event->x, event->y) || + widget_contains(WIDGET(mainwin_min_num), event->x, event->y) || + widget_contains(WIDGET(mainwin_10sec_num), event->x, event->y) || + widget_contains(WIDGET(mainwin_sec_num), event->x, event->y) || + widget_contains(WIDGET(mainwin_stime_min), event->x, event->y) || + widget_contains(WIDGET(mainwin_stime_sec), event->x, event->y)) + { if (cfg.timer_mode == TIMER_ELAPSED) set_timer_mode(TIMER_REMAINING); else @@ -1550,21 +1550,21 @@ static gboolean mainwin_jump_to_file_edit_keypress_cb(GtkWidget * object, - GdkEventKey * event, - gpointer data) + GdkEventKey * event, + gpointer data) { - switch (event->keyval) { - case GDK_Return: - if (gtk_im_context_filter_keypress (GTK_ENTRY (object)->im_context, event)) { - GTK_ENTRY (object)->need_im_reset = TRUE; - return TRUE; - } else { - mainwin_jump_to_file_jump(GTK_TREE_VIEW(data)); - return TRUE; - } - default: - return FALSE; - } + switch (event->keyval) { + case GDK_Return: + if (gtk_im_context_filter_keypress (GTK_ENTRY (object)->im_context, event)) { + GTK_ENTRY (object)->need_im_reset = TRUE; + return TRUE; + } else { + mainwin_jump_to_file_jump(GTK_TREE_VIEW(data)); + return TRUE; + } + default: + return FALSE; + } } static gboolean @@ -1637,21 +1637,21 @@ PlaylistEntry *entry = PLAYLIST_ENTRY(playlist_glist->data); if (entry->title) - desc_buf = g_strdup(entry->title); + desc_buf = g_strdup(entry->title); else if (strchr(entry->filename, '/')) - desc_buf = str_to_utf8(strrchr(entry->filename, '/') + 1); + desc_buf = str_to_utf8(strrchr(entry->filename, '/') + 1); else - desc_buf = str_to_utf8(entry->filename); + desc_buf = str_to_utf8(entry->filename); gtk_list_store_append(GTK_LIST_STORE(store), &iter); gtk_list_store_set(GTK_LIST_STORE(store), &iter, 0, row, 1, desc_buf, -1); row++; - if(desc_buf) { - g_free(desc_buf); - desc_buf = NULL; - } + if(desc_buf) { + g_free(desc_buf); + desc_buf = NULL; + } } gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter); @@ -1715,7 +1715,7 @@ title = entry->title; if (!title) { - filename = str_to_utf8(entry->filename); + filename = str_to_utf8(entry->filename); if (strchr(filename, '/')) title = strrchr(filename, '/') + 1; @@ -1746,10 +1746,10 @@ } song_index++; - if (filename) { - g_free(filename); - filename = NULL; - } + if (filename) { + g_free(filename); + filename = NULL; + } } PLAYLIST_UNLOCK(playlist->mutex); @@ -1935,21 +1935,21 @@ PlaylistEntry *entry = PLAYLIST_ENTRY(playlist_glist->data); if (entry->title) - desc_buf = g_strdup(entry->title); + desc_buf = g_strdup(entry->title); else if (strchr(entry->filename, '/')) - desc_buf = str_to_utf8(strrchr(entry->filename, '/') + 1); + desc_buf = str_to_utf8(strrchr(entry->filename, '/') + 1); else - desc_buf = str_to_utf8(entry->filename); + desc_buf = str_to_utf8(entry->filename); gtk_list_store_append(GTK_LIST_STORE(jtf_store), &iter); gtk_list_store_set(GTK_LIST_STORE(jtf_store), &iter, 0, row, 1, desc_buf, -1); row++; - if (desc_buf) { - g_free(desc_buf); - desc_buf = NULL; - } + if (desc_buf) { + g_free(desc_buf); + desc_buf = NULL; + } } PLAYLIST_UNLOCK(playlist->mutex); @@ -2010,8 +2010,8 @@ if (str_has_prefix_nocase((gchar *) selection_data->data, "fonts:///")) { - gchar *path = (gchar *) selection_data->data + 9; /* skip fonts:/// */ - gchar *decoded = xmms_urldecode_plain(path); + gchar *path = (gchar *) selection_data->data + 9; /* skip fonts:/// */ + gchar *decoded = xmms_urldecode_plain(path); cfg.playlist_font = g_strconcat(decoded, strrchr(cfg.playlist_font, ' '), NULL); playlist_list_set_font(cfg.playlist_font); @@ -2059,7 +2059,7 @@ if (!url_window) { url_window = util_add_url_dialog_new(_("Enter location to play:"), - G_CALLBACK(on_add_url_ok_clicked), + G_CALLBACK(on_add_url_ok_clicked), G_CALLBACK(on_add_url_add_clicked)); gtk_window_set_transient_for(GTK_WINDOW(url_window), GTK_WINDOW(mainwin)); @@ -2086,7 +2086,7 @@ void mainwin_eject_pushed(void) { - util_run_filebrowser(PLAY_BUTTON); + run_filebrowser(PLAY_BUTTON); } void @@ -2479,9 +2479,9 @@ gtk_window_resize(GTK_WINDOW(mainwin), !bmp_active_skin->properties.mainwin_width ? PLAYER_WIDTH : - bmp_active_skin->properties.mainwin_width, + bmp_active_skin->properties.mainwin_width, !bmp_active_skin->properties.mainwin_height ? PLAYER_HEIGHT : - bmp_active_skin->properties.mainwin_height); + bmp_active_skin->properties.mainwin_height); draw_main_window(TRUE); @@ -2537,8 +2537,8 @@ mainwin_set_shape_mask(); dock_window_resize(GTK_WINDOW(mainwin), cfg.player_shaded ? MAINWIN_SHADED_WIDTH : bmp_active_skin->properties.mainwin_width, - cfg.player_shaded ? MAINWIN_SHADED_HEIGHT : bmp_active_skin->properties.mainwin_height, - bmp_active_skin->properties.mainwin_width * 2, bmp_active_skin->properties.mainwin_height * 2); + cfg.player_shaded ? MAINWIN_SHADED_HEIGHT : bmp_active_skin->properties.mainwin_height, + bmp_active_skin->properties.mainwin_width * 2, bmp_active_skin->properties.mainwin_height * 2); if (cfg.doublesize) { gdk_window_set_back_pixmap(mainwin->window, mainwin_bg_x2, 0); @@ -2579,7 +2579,7 @@ show_about_window(); break; case MAINWIN_GENERAL_PLAYFILE: - util_run_filebrowser(NO_PLAY_BUTTON); + run_filebrowser(NO_PLAY_BUTTON); break; case MAINWIN_GENERAL_PLAYCD: play_medium(); @@ -2653,23 +2653,23 @@ if (ab_position_a == -1) { ab_position_a = playback_get_time(); ab_position_b = -1; - mainwin_lock_info_text("LOOP-POINT A POSITION SET."); + mainwin_lock_info_text("LOOP-POINT A POSITION SET."); } else if (ab_position_b == -1) { int time = playback_get_time(); if (time > ab_position_a) ab_position_b = time; - mainwin_release_info_text(); + mainwin_release_info_text(); } else { ab_position_a = playback_get_time(); ab_position_b = -1; - mainwin_lock_info_text("LOOP-POINT A POSITION RESET."); + mainwin_lock_info_text("LOOP-POINT A POSITION RESET."); } } break; case MAINWIN_GENERAL_CLEARAB: if (playlist_get_current_length(playlist) != -1) { ab_position_a = ab_position_b = -1; - mainwin_release_info_text(); + mainwin_release_info_text(); } break; case MAINWIN_GENERAL_NEW_PL: @@ -3208,7 +3208,7 @@ mainwin_rew = create_pbutton_ex(&mainwin_wlist, mainwin_bg, mainwin_gc, 16, 88, 23, 18, 0, 0, 0, 18, mainwin_rev_pushed, mainwin_rev_release, - SKIN_CBUTTONS, SKIN_CBUTTONS); + SKIN_CBUTTONS, SKIN_CBUTTONS); mainwin_play = create_pbutton(&mainwin_wlist, mainwin_bg, mainwin_gc, 39, 88, 23, 18, 23, 0, 23, 18, mainwin_play_pushed, SKIN_CBUTTONS); @@ -3226,7 +3226,7 @@ mainwin_fwd = create_pbutton_ex(&mainwin_wlist, mainwin_bg, mainwin_gc, 108, 88, 22, 18, 92, 0, 92, 18, mainwin_fwd_pushed, mainwin_fwd_release, - SKIN_CBUTTONS, SKIN_CBUTTONS); + SKIN_CBUTTONS, SKIN_CBUTTONS); mainwin_eject = create_pbutton(&mainwin_wlist, mainwin_bg, mainwin_gc, 136, 89, 22, @@ -3280,8 +3280,8 @@ textbox_set_xfont(mainwin_info, cfg.mainwin_use_xfont, cfg.mainwin_font); mainwin_othertext = - create_textbox(&mainwin_wlist, mainwin_bg, mainwin_gc, 112, 43, - 153, 1, SKIN_TEXT); + create_textbox(&mainwin_wlist, mainwin_bg, mainwin_gc, 112, 43, + 153, 1, SKIN_TEXT); mainwin_rate_text = create_textbox(&mainwin_wlist, mainwin_bg, mainwin_gc, 111, 43, 15, @@ -3464,10 +3464,10 @@ mainwin_gc = gdk_gc_new(mainwin->window); mainwin_bg = gdk_pixmap_new(mainwin->window, bmp_active_skin->properties.mainwin_width, - bmp_active_skin->properties.mainwin_height, -1); + bmp_active_skin->properties.mainwin_height, -1); mainwin_bg_x2 = gdk_pixmap_new(mainwin->window, bmp_active_skin->properties.mainwin_width * 2, - bmp_active_skin->properties.mainwin_height * 2, -1); + bmp_active_skin->properties.mainwin_height * 2, -1); mainwin_set_back_pixmap(); mainwin_create_widgets(); @@ -3586,7 +3586,7 @@ vis_playback_start(); else { vis_playback_stop(); - ab_position_a = ab_position_b = -1; + ab_position_a = ab_position_b = -1; } draw_main_window(mainwin_force_redraw); @@ -3856,131 +3856,131 @@ void action_about_audacious( void ) { - show_about_window(); + show_about_window(); } void action_play_file( void ) { - util_run_filebrowser(PLAY_BUTTON); + run_filebrowser(PLAY_BUTTON); } void action_play_location( void ) { - mainwin_show_add_url_window(); + mainwin_show_add_url_window(); } void action_ab_set( void ) { - Playlist *playlist = playlist_get_active(); - if (playlist_get_current_length(playlist) != -1) - { - if (ab_position_a == -1) - { - ab_position_a = playback_get_time(); - ab_position_b = -1; - mainwin_lock_info_text("LOOP-POINT A POSITION SET."); - } - else if (ab_position_b == -1) + Playlist *playlist = playlist_get_active(); + if (playlist_get_current_length(playlist) != -1) { - int time = playback_get_time(); - if (time > ab_position_a) - ab_position_b = time; - mainwin_release_info_text(); + if (ab_position_a == -1) + { + ab_position_a = playback_get_time(); + ab_position_b = -1; + mainwin_lock_info_text("LOOP-POINT A POSITION SET."); + } + else if (ab_position_b == -1) + { + int time = playback_get_time(); + if (time > ab_position_a) + ab_position_b = time; + mainwin_release_info_text(); + } + else + { + ab_position_a = playback_get_time(); + ab_position_b = -1; + mainwin_lock_info_text("LOOP-POINT A POSITION RESET."); + } } - else - { - ab_position_a = playback_get_time(); - ab_position_b = -1; - mainwin_lock_info_text("LOOP-POINT A POSITION RESET."); - } - } } void action_ab_clear( void ) { - Playlist *playlist = playlist_get_active(); - if (playlist_get_current_length(playlist) != -1) - { - ab_position_a = ab_position_b = -1; - mainwin_release_info_text(); - } + Playlist *playlist = playlist_get_active(); + if (playlist_get_current_length(playlist) != -1) + { + ab_position_a = ab_position_b = -1; + mainwin_release_info_text(); + } } void action_current_track_info( void ) { - playlist_fileinfo_current(playlist_get_active()); + playlist_fileinfo_current(playlist_get_active()); } void action_jump_to_file( void ) { - mainwin_jump_to_file(); + mainwin_jump_to_file(); } void action_jump_to_playlist_start( void ) { - Playlist *playlist = playlist_get_active(); - playlist_set_position(playlist, 0); + Playlist *playlist = playlist_get_active(); + playlist_set_position(playlist, 0); } void action_jump_to_time( void ) { - mainwin_jump_to_time(); + mainwin_jump_to_time(); } void action_playback_next( void ) { - Playlist *playlist = playlist_get_active(); - playlist_next(playlist); + Playlist *playlist = playlist_get_active(); + playlist_next(playlist); } void action_playback_previous( void ) { - Playlist *playlist = playlist_get_active(); - playlist_prev(playlist); + Playlist *playlist = playlist_get_active(); + playlist_prev(playlist); } void action_playback_play( void ) { - mainwin_play_pushed(); + mainwin_play_pushed(); } void action_playback_playcd( void ) { - play_medium(); + play_medium(); } void action_playback_pause( void ) { - playback_pause(); + playback_pause(); } void action_playback_stop( void ) { - mainwin_stop_pushed(); + mainwin_stop_pushed(); } void action_preferences( void ) { - show_prefs_window(); + show_prefs_window(); } void action_quit( void ) { - mainwin_quit_cb(); + mainwin_quit_cb(); }
--- a/src/audacious/ui_playlist.c Fri Jan 26 13:13:24 2007 -0800 +++ b/src/audacious/ui_playlist.c Fri Jan 26 14:50:30 2007 -0800 @@ -35,23 +35,23 @@ #include <unistd.h> #include <errno.h> -#include "libaudacious/util.h" - +#include "actions-playlist.h" #include "dnd.h" #include "dock.h" -#include "ui_equalizer.h" #include "hints.h" #include "input.h" #include "main.h" -#include "ui_main.h" -#include "ui_manager.h" -#include "ui_fileinfopopup.h" -#include "actions-playlist.h" #include "playback.h" #include "playlist.h" #include "playlist_container.h" #include "playlist_manager.h" #include "strings.h" +#include "ui_equalizer.h" +#include "ui_fileopener.h" +#include "ui_fileinfopopup.h" +#include "ui_main.h" +#include "ui_manager.h" +#include "util.h" #include "icons-stock.h" #include "images/audacious_playlist.xpm" @@ -715,7 +715,7 @@ static void playlistwin_show_filebrowser(void) { - util_run_filebrowser(NO_PLAY_BUTTON); + run_filebrowser(NO_PLAY_BUTTON); } static void @@ -1995,7 +1995,7 @@ void action_playlist_add_files(void) { - util_run_filebrowser(NO_PLAY_BUTTON); + run_filebrowser(NO_PLAY_BUTTON); } void add_medium(void); /* XXX */
--- a/src/audacious/ui_preferences.c Fri Jan 26 13:13:24 2007 -0800 +++ b/src/audacious/ui_preferences.c Fri Jan 26 14:50:30 2007 -0800 @@ -48,7 +48,7 @@ #include "main.h" #include "widgets/widgetcore.h" -#include "libaudacious/urldecode.h" +#include "urldecode.h" #include "strings.h" #include "util.h" #include "dnd.h"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audacious/urldecode.c Fri Jan 26 14:50:30 2007 -0800 @@ -0,0 +1,68 @@ +/* Audacious - Cross-platform multimedia player + * Copyright (C) 2005-2007 Audacious development team + * + * Based on BMP: + * Copyright (C) 2003-2004 BMP development team. + * + * Based on XMMS: + * Copyright (C) 1998-2003 XMMS development team. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; under version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "urldecode.h" + +#include <glib.h> +#include <stdio.h> +#include <string.h> + +#include "util.h" + +gchar * +xmms_urldecode_plain(const gchar * encoded_path) +{ + const gchar *cur, *ext; + gchar *path, *tmp; + gint realchar; + + if (!encoded_path) + return NULL; + + cur = encoded_path; + if (*cur == '/') + while (cur[1] == '/') + cur++; + + tmp = g_malloc0(strlen(cur) + 1); + + while ((ext = strchr(cur, '%')) != NULL) { + strncat(tmp, cur, ext - cur); + ext++; + cur = ext + 2; + if (!sscanf(ext, "%2x", &realchar)) { + /* + * Assume it is a literal '%'. Several file + * managers send unencoded file: urls on on + * drag and drop. + */ + realchar = '%'; + cur -= 2; + } + tmp[strlen(tmp)] = realchar; + } + + path = g_strconcat(tmp, cur, NULL); + g_free(tmp); + return path; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audacious/urldecode.h Fri Jan 26 14:50:30 2007 -0800 @@ -0,0 +1,27 @@ +/* Audacious - Cross-platform multimedia player + * Copyright (C) 2005-2007 Audacious development team + * + * Based on BMP: + * Copyright (C) 2003-2004 BMP development team. + * + * Based on XMMS: + * Copyright (C) 1998-2003 XMMS development team. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; under version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include <glib.h> + +gchar *xmms_urldecode_path(const gchar *); +gchar *xmms_urldecode_plain(const gchar *);
--- a/src/audacious/util.c Fri Jan 26 13:13:24 2007 -0800 +++ b/src/audacious/util.c Fri Jan 26 14:50:30 2007 -0800 @@ -672,417 +672,6 @@ return win; } -static void -filebrowser_add_files(GtkFileChooser * browser, - GSList * files) -{ - GSList *cur; - gchar *ptr; - guint ctr = 0; - Playlist *playlist = playlist_get_active(); - - if (GTK_IS_WIDGET(mainwin_jtf)) - gtk_widget_set_sensitive(mainwin_jtf, FALSE); - - for (cur = files; cur; cur = g_slist_next(cur)) { - - if (g_file_test(cur->data,G_FILE_TEST_IS_DIR)) { - playlist_add_dir(playlist, (const gchar *) cur->data); - } else { - playlist_add(playlist, (const gchar *) cur->data); - } - - if (++ctr == 20) { - playlistwin_update_list(playlist); - ctr = 0; - while (gtk_events_pending() ) gtk_main_iteration(); - } - } - - playlistwin_update_list(playlist); - - if (GTK_IS_WIDGET(mainwin_jtf)) - gtk_widget_set_sensitive(mainwin_jtf, TRUE); - - ptr = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(browser)); - - g_free(cfg.filesel_path); - cfg.filesel_path = ptr; -} - -static void -action_button_cb(GtkWidget *widget, gpointer data) -{ - GtkWidget *window = g_object_get_data(data, "window"); - GtkWidget *chooser = g_object_get_data(data, "chooser"); - GtkWidget *toggle = g_object_get_data(data, "toggle-button"); - cfg.close_dialog_open = - gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle)); - - gboolean play_button = - GPOINTER_TO_INT(g_object_get_data(data, "play-button")); - - - GSList *files; - files = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(chooser)); - if (!files) return; - - if (play_button) - playlist_clear(playlist_get_active()); - - filebrowser_add_files(GTK_FILE_CHOOSER(chooser), files); - g_slist_foreach(files, (GFunc) g_free, NULL); - g_slist_free(files); - - if (play_button) - playback_initiate(); - - - if (cfg.close_dialog_open) - gtk_widget_destroy(window); -} - - -static void -close_button_cb(GtkWidget *widget, gpointer data) -{ - gtk_widget_destroy(GTK_WIDGET(data)); -} - -void -util_run_filebrowser_gtk2style(gboolean play_button) -{ - GtkWidget *window; - GtkWidget *vbox, *hbox, *bbox; - GtkWidget *chooser; - GtkWidget *action_button, *close_button; - GtkWidget *toggle; - - gchar *window_title = play_button ? _("Open Files") : _("Add Files"); - gchar *toggle_text = play_button ? - _("Close dialog on Open") : _("Close dialog on Add"); - gpointer action_stock = play_button ? GTK_STOCK_OPEN : GTK_STOCK_ADD; - - window = gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_window_set_title(GTK_WINDOW(window), window_title); - gtk_window_set_default_size(GTK_WINDOW(window), 700, 450); - gtk_container_set_border_width(GTK_CONTAINER(window), 10); - - vbox = gtk_vbox_new(FALSE, 0); - gtk_container_add(GTK_CONTAINER(window), vbox); - - chooser = gtk_file_chooser_widget_new(GTK_FILE_CHOOSER_ACTION_OPEN); - gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(chooser), TRUE); - if (cfg.filesel_path) - gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(chooser), - cfg.filesel_path); - gtk_box_pack_start(GTK_BOX(vbox), chooser, TRUE, TRUE, 5); - - hbox = gtk_hbox_new(TRUE, 0); - gtk_box_pack_end(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); - - toggle = gtk_check_button_new_with_label(toggle_text); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), - cfg.close_dialog_open ? TRUE : FALSE); - gtk_box_pack_start(GTK_BOX(hbox), toggle, TRUE, TRUE, 5); - - bbox = gtk_hbutton_box_new(); - gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); - gtk_box_pack_end(GTK_BOX(hbox), bbox, TRUE, TRUE, 5); - - close_button = gtk_button_new_from_stock(GTK_STOCK_CANCEL); - action_button = gtk_button_new_from_stock(action_stock); - gtk_container_add(GTK_CONTAINER(bbox), close_button); - gtk_container_add(GTK_CONTAINER(bbox), action_button); - - // this storage object holds several other objects which are used in the - // callback functions - gpointer storage = g_object_new(G_TYPE_OBJECT, NULL); - g_object_set_data(storage, "window", window); - g_object_set_data(storage, "chooser", chooser); - g_object_set_data(storage, "toggle-button", toggle); - g_object_set_data(storage, "play-button", GINT_TO_POINTER(play_button)); - - g_signal_connect(chooser, "file-activated", - G_CALLBACK(action_button_cb), storage); - g_signal_connect(action_button, "clicked", - G_CALLBACK(action_button_cb), storage); - g_signal_connect(close_button, "clicked", - G_CALLBACK(close_button_cb), window); - g_signal_connect(window, "destroy", - G_CALLBACK(gtk_widget_destroyed), &window); - - gtk_widget_show_all(window); -} - -/* - * Derived from Beep Media Player 0.9.6.1. - * Which is (C) 2003 - 2006 Milosz Derezynski &c - * - * Although I changed it quite a bit. -nenolod - */ -static void filebrowser_changed_classic(GtkFileSelection * filesel) -{ - GList *list; - GList *node; - char *filename = (char *) - gtk_file_selection_get_filename(GTK_FILE_SELECTION(filesel)); - GtkListStore *store; - GtkTreeIter iter; - - if ((list = input_scan_dir(filename)) != NULL) - { - /* - * We enter a directory that has been "hijacked" by an - * input-plugin. This is used by the CDDA plugin - */ - store = - GTK_LIST_STORE(gtk_tree_view_get_model - (GTK_TREE_VIEW(filesel->file_list))); - gtk_list_store_clear(store); - - node = list; - while (node) { - gtk_list_store_append(store, &iter); - gtk_list_store_set(store, &iter, 0, node->data, -1); - g_free(node->data); - node = g_list_next(node); - } - - g_list_free(list); - } -} - -static void filebrowser_entry_changed_classic(GtkEditable * entry, gpointer data) -{ - filebrowser_changed_classic(GTK_FILE_SELECTION(data)); -} - -gboolean util_filebrowser_is_dir_classic(GtkFileSelection * filesel) -{ - char *text; - struct stat buf; - gboolean retv = FALSE; - - text = g_strdup(gtk_file_selection_get_filename(filesel)); - - if (stat(text, &buf) == 0 && S_ISDIR(buf.st_mode)) { - /* Selected directory */ - int len = strlen(text); - if (len > 3 && !strcmp(text + len - 4, "/../")) { - if (len == 4) - /* At the root already */ - *(text + len - 3) = '\0'; - else { - char *ptr; - *(text + len - 4) = '\0'; - ptr = strrchr(text, '/'); - *(ptr + 1) = '\0'; - } - } else if (len > 2 && !strcmp(text + len - 3, "/./")) - *(text + len - 2) = '\0'; - gtk_file_selection_set_filename(filesel, text); - retv = TRUE; - } - g_free(text); - return retv; -} - -static void filebrowser_add_files_classic(gchar ** files, - GtkFileSelection * filesel) -{ - int ctr = 0; - char *ptr; - Playlist *playlist = playlist_get_active(); - - if (GTK_IS_WIDGET(mainwin_jtf)) - gtk_widget_set_sensitive(mainwin_jtf, FALSE); - - while (files[ctr] != NULL) { - playlist_add(playlist, files[ctr++]); - } - playlistwin_update_list(playlist); - - if (GTK_IS_WIDGET(mainwin_jtf)) - gtk_widget_set_sensitive(mainwin_jtf, TRUE); - - gtk_label_get(GTK_LABEL(GTK_BIN(filesel->history_pulldown)->child), - &ptr); - - /* This will give an extra slash if the current dir is the root. */ - cfg.filesel_path = g_strconcat(ptr, "/", NULL); -} - -static void filebrowser_ok_classic(GtkWidget * w, GtkWidget * filesel) -{ - gchar **files; - - if (util_filebrowser_is_dir_classic(GTK_FILE_SELECTION(filesel))) - return; - files = gtk_file_selection_get_selections(GTK_FILE_SELECTION(filesel)); - filebrowser_add_files_classic(files, GTK_FILE_SELECTION(filesel)); - gtk_widget_destroy(filesel); -} - -static void filebrowser_play_classic(GtkWidget * w, GtkWidget * filesel) -{ - gchar **files; - - if (util_filebrowser_is_dir_classic - (GTK_FILE_SELECTION(GTK_FILE_SELECTION(filesel)))) - return; - playlist_clear(playlist_get_active()); - files = gtk_file_selection_get_selections(GTK_FILE_SELECTION(filesel)); - filebrowser_add_files_classic(files, GTK_FILE_SELECTION(filesel)); - gtk_widget_destroy(filesel); - playback_initiate(); -} - -static void filebrowser_add_selected_files_classic(GtkWidget * w, gpointer data) -{ - gchar **files; - - GtkFileSelection *filesel = GTK_FILE_SELECTION(data); - files = gtk_file_selection_get_selections(filesel); - - filebrowser_add_files_classic(files, filesel); - gtk_tree_selection_unselect_all(gtk_tree_view_get_selection - (GTK_TREE_VIEW(filesel->file_list))); - - gtk_entry_set_text(GTK_ENTRY(filesel->selection_entry), ""); -} - -static void filebrowser_add_all_files_classic(GtkWidget * w, gpointer data) -{ - gchar **files; - GtkFileSelection *filesel; - - filesel = data; - gtk_tree_selection_select_all(gtk_tree_view_get_selection - (GTK_TREE_VIEW(filesel->file_list))); - files = gtk_file_selection_get_selections(filesel); - filebrowser_add_files_classic(files, filesel); - gtk_tree_selection_unselect_all(gtk_tree_view_get_selection - (GTK_TREE_VIEW(filesel->file_list))); - gtk_entry_set_text(GTK_ENTRY(filesel->selection_entry), ""); -} - -void -util_run_filebrowser_classic(gboolean play_button) -{ - static GtkWidget *dialog; - GtkWidget *button_add_selected, *button_add_all, *button_close, - *button_add; - char *title; - - if (dialog != NULL) { - gtk_window_present(GTK_WINDOW(dialog)); - return; - } - - if (play_button) - title = _("Play files"); - else - title = _("Load files"); - - dialog = gtk_file_selection_new(title); - - gtk_file_selection_set_select_multiple - (GTK_FILE_SELECTION(dialog), TRUE); - - if (cfg.filesel_path) - gtk_file_selection_set_filename(GTK_FILE_SELECTION(dialog), - cfg.filesel_path); - - gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(dialog)); - gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER); - - gtk_widget_hide(GTK_FILE_SELECTION(dialog)->ok_button); - gtk_widget_destroy(GTK_FILE_SELECTION(dialog)->cancel_button); - - /* - * The mnemonics are quite unorthodox, but that should guarantee they're unique in any locale - * plus kinda easy to use - */ - button_add_selected = - gtk_dialog_add_button(GTK_DIALOG(dialog), "Add selected", - GTK_RESPONSE_NONE); - gtk_button_set_use_underline(GTK_BUTTON(button_add_selected), TRUE); - g_signal_connect(G_OBJECT(button_add_selected), "clicked", - G_CALLBACK(filebrowser_add_selected_files_classic), dialog); - - button_add_all = - gtk_dialog_add_button(GTK_DIALOG(dialog), "Add all", - GTK_RESPONSE_NONE); - gtk_button_set_use_underline(GTK_BUTTON(button_add_all), TRUE); - g_signal_connect(G_OBJECT(button_add_all), "clicked", - G_CALLBACK(filebrowser_add_all_files_classic), dialog); - - if (play_button) { - button_add = - gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_MEDIA_PLAY, - GTK_RESPONSE_NONE); - gtk_button_set_use_stock(GTK_BUTTON(button_add), TRUE); - g_signal_connect(G_OBJECT(button_add), "clicked", - G_CALLBACK(filebrowser_play_classic), dialog); - g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(dialog)->ok_button), - "clicked", G_CALLBACK(filebrowser_play_classic), dialog); - } else { - button_add = - gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_ADD, - GTK_RESPONSE_NONE); - gtk_button_set_use_stock(GTK_BUTTON(button_add), TRUE); - g_signal_connect(G_OBJECT(button_add), "clicked", - G_CALLBACK(filebrowser_ok_classic), dialog); - g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(dialog)->ok_button), - "clicked", G_CALLBACK(filebrowser_ok_classic), dialog); - } - - button_close = - gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CLOSE, - GTK_RESPONSE_NONE); - gtk_button_set_use_stock(GTK_BUTTON(button_close), TRUE); - g_signal_connect_swapped(G_OBJECT(button_close), "clicked", - G_CALLBACK(gtk_widget_destroy), - G_OBJECT(dialog)); - - gtk_widget_set_size_request(dialog, 600, 450); - gtk_widget_realize(dialog); - - g_signal_connect(G_OBJECT - (GTK_FILE_SELECTION(dialog)->history_pulldown), - "changed", G_CALLBACK(filebrowser_entry_changed_classic), - dialog); - - g_signal_connect(G_OBJECT(dialog), "destroy", - G_CALLBACK(gtk_widget_destroyed), &dialog); - - filebrowser_changed_classic(GTK_FILE_SELECTION(dialog)); - - gtk_widget_show(dialog); -} - -/* - * util_run_filebrowser(gboolean play_button) - * - * Inputs: - * - whether or not a play button should be used - * - * Outputs: - * - none - * - * Side Effects: - * - either a GTK1 or a GTK2 fileselector is launched - */ -void -util_run_filebrowser(gboolean play_button) -{ - if (!cfg.use_xmms_style_fileselector) - util_run_filebrowser_gtk2style(play_button); - else - util_run_filebrowser_classic(play_button); -} - GdkFont * util_font_load(const gchar * name) {
--- a/src/audacious/util.h Fri Jan 26 13:13:24 2007 -0800 +++ b/src/audacious/util.h Fri Jan 26 14:50:30 2007 -0800 @@ -35,12 +35,8 @@ G_BEGIN_DECLS -#define NO_PLAY_BUTTON FALSE -#define PLAY_BUTTON TRUE - #define SWAP(a, b) { a^=b; b^=a; a^=b; } - typedef gboolean(*DirForeachFunc) (const gchar * path, const gchar * basename, gpointer user_data); @@ -66,9 +62,6 @@ void util_menu_position(GtkMenu * menu, gint * x, gint * y, gboolean * push_in, gpointer data); -void util_run_filebrowser(gboolean clear_pl_on_ok); -gboolean util_filechooser_is_dir(GtkFileChooser * filesel); - GdkFont *util_font_load(const gchar * name); void util_set_cursor(GtkWidget * window); gboolean text_get_extents(const gchar * fontname, const gchar * text,
--- a/src/audacious/vfs.c Fri Jan 26 13:13:24 2007 -0800 +++ b/src/audacious/vfs.c Fri Jan 26 14:50:30 2007 -0800 @@ -24,7 +24,7 @@ #include <string.h> -#include "libaudacious/urldecode.h" +#include "urldecode.h" static GList *vfs_transports = NULL;
--- a/src/libaudacious/Makefile Fri Jan 26 13:13:24 2007 -0800 +++ b/src/libaudacious/Makefile Fri Jan 26 14:50:30 2007 -0800 @@ -28,15 +28,17 @@ util.c \ formatter.c \ titlestring.c \ - xconvert.c \ - urldecode.c + xconvert.c OBJECTS = ${SOURCES:.c=.o} HEADERS = \ - rcfile.h configdb.h \ - beepctrl.h urldecode.h \ - formatter.h titlestring.h xconvert.h + rcfile.h \ + configdb.h \ + beepctrl.h \ + formatter.h \ + titlestring.h \ + xconvert.h include ../../mk/objective.mk
--- a/src/libaudacious/urldecode.c Fri Jan 26 13:13:24 2007 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* Audacious - Cross-platform multimedia player - * Copyright (C) 2005-2007 Audacious development team - * - * Based on BMP: - * Copyright (C) 2003-2004 BMP development team. - * - * Based on XMMS: - * Copyright (C) 1998-2003 XMMS development team. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; under version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "urldecode.h" - -#include <glib.h> -#include <stdio.h> -#include <string.h> - -#include "util.h" - -gchar * -xmms_urldecode_plain(const gchar * encoded_path) -{ - const gchar *cur, *ext; - gchar *path, *tmp; - gint realchar; - - if (!encoded_path) - return NULL; - - cur = encoded_path; - if (*cur == '/') - while (cur[1] == '/') - cur++; - - tmp = g_malloc0(strlen(cur) + 1); - - while ((ext = strchr(cur, '%')) != NULL) { - strncat(tmp, cur, ext - cur); - ext++; - cur = ext + 2; - if (!sscanf(ext, "%2x", &realchar)) { - /* - * Assume it is a literal '%'. Several file - * managers send unencoded file: urls on on - * drag and drop. - */ - realchar = '%'; - cur -= 2; - } - tmp[strlen(tmp)] = realchar; - } - - path = g_strconcat(tmp, cur, NULL); - g_free(tmp); - return path; -}
--- a/src/libaudacious/urldecode.h Fri Jan 26 13:13:24 2007 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* Audacious - Cross-platform multimedia player - * Copyright (C) 2005-2007 Audacious development team - * - * Based on BMP: - * Copyright (C) 2003-2004 BMP development team. - * - * Based on XMMS: - * Copyright (C) 1998-2003 XMMS development team. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; under version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include <glib.h> - -gchar *xmms_urldecode_path(const gchar *); -gchar *xmms_urldecode_plain(const gchar *);