Mercurial > audlegacy
annotate src/audacious/ui_playlist.c @ 4011:c19c8d47e221
vseparator in fileinfo came back
| author | Eugene Zagidullin <e.asphyx@gmail.com> |
|---|---|
| date | Sun, 25 Nov 2007 04:44:40 +0300 |
| parents | a575c29cee05 |
| children | 351dc6ef07b9 |
| rev | line source |
|---|---|
| 2313 | 1 /* Audacious - Cross-platform multimedia player |
| 2 * Copyright (C) 2005-2006 Audacious development team. | |
| 3 * | |
| 4 * BMP - Cross-platform multimedia player | |
| 5 * Copyright (C) 2003-2004 BMP development team. | |
| 6 * | |
| 7 * Based on XMMS: | |
| 8 * Copyright (C) 1998-2003 XMMS development team. | |
| 9 * | |
| 10 * This program is free software; you can redistribute it and/or modify | |
| 11 * it under the terms of the GNU General Public License as published by | |
|
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
3107
diff
changeset
|
12 * the Free Software Foundation; under version 3 of the License. |
| 2313 | 13 * |
| 14 * This program is distributed in the hope that it will be useful, | |
| 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 17 * GNU General Public License for more details. | |
| 18 * | |
| 19 * You should have received a copy of the GNU General Public License | |
|
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
3107
diff
changeset
|
20 * along with this program. If not, see <http://www.gnu.org/licenses>. |
|
3123
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
21 * |
|
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
22 * The Audacious team does not consider modular code linking to |
|
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
23 * Audacious or using our public API to be a derived work. |
| 2313 | 24 */ |
| 25 | |
| 26 #include "ui_playlist.h" | |
| 27 | |
| 28 #include <glib.h> | |
| 29 #include <glib/gi18n.h> | |
| 30 #include <gdk/gdk.h> | |
| 31 #include <gdk/gdkkeysyms.h> | |
| 32 #include <gtk/gtk.h> | |
| 33 #include <string.h> | |
| 34 | |
| 35 #include "platform/smartinclude.h" | |
| 36 | |
| 37 #include <unistd.h> | |
| 38 #include <errno.h> | |
| 39 | |
|
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
40 #include "actions-playlist.h" |
| 2313 | 41 #include "dnd.h" |
| 42 #include "dock.h" | |
| 43 #include "hints.h" | |
| 44 #include "input.h" | |
| 45 #include "main.h" | |
| 46 #include "playback.h" | |
| 47 #include "playlist.h" | |
| 48 #include "playlist_container.h" | |
|
2499
15a1f5ee4d1c
[svn] - playlist_manager -> ui_playlist_manager, since it's a UI component.
nenolod
parents:
2495
diff
changeset
|
49 #include "ui_playlist_manager.h" |
|
2373
ad1d7687814c
[svn] made strings.h for existing strings.c, cleanups
mf0102
parents:
2363
diff
changeset
|
50 #include "strings.h" |
|
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
51 #include "ui_equalizer.h" |
|
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
52 #include "ui_fileopener.h" |
|
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
53 #include "ui_main.h" |
|
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
54 #include "ui_manager.h" |
|
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
55 #include "util.h" |
|
3475
80cff88ad6d0
Default extension may not be xspf
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3375
diff
changeset
|
56 #include "config.h" |
| 2313 | 57 |
|
2494
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
2492
diff
changeset
|
58 #include "ui_skinned_window.h" |
|
2901
5ed0674fabd6
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
59 #include "ui_skinned_button.h" |
|
2943
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2904
diff
changeset
|
60 #include "ui_skinned_textbox.h" |
|
3135
7cdcf8ab08da
replace PlaylistSlider with UiSkinnedPlaylistSlider
Tomasz Mon <desowin@gmail.com>
parents:
3123
diff
changeset
|
61 #include "ui_skinned_playlist_slider.h" |
| 3217 | 62 #include "ui_skinned_playlist.h" |
|
2494
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
2492
diff
changeset
|
63 |
| 2313 | 64 #include "icons-stock.h" |
| 65 #include "images/audacious_playlist.xpm" | |
| 66 | |
| 67 GtkWidget *playlistwin; | |
| 68 | |
|
3137
19908efce4e5
one mutex is enough for resizing
Tomasz Mon <desowin@gmail.com>
parents:
3135
diff
changeset
|
69 static GMutex *resize_mutex = NULL; |
|
19908efce4e5
one mutex is enough for resizing
Tomasz Mon <desowin@gmail.com>
parents:
3135
diff
changeset
|
70 |
| 3217 | 71 GtkWidget *playlistwin_list = NULL; |
|
2901
5ed0674fabd6
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
72 GtkWidget *playlistwin_shade, *playlistwin_close; |
| 2313 | 73 |
| 74 static GdkBitmap *playlistwin_mask = NULL; | |
| 75 | |
| 76 static gboolean playlistwin_hint_flag = FALSE; | |
| 77 | |
|
3135
7cdcf8ab08da
replace PlaylistSlider with UiSkinnedPlaylistSlider
Tomasz Mon <desowin@gmail.com>
parents:
3123
diff
changeset
|
78 static GtkWidget *playlistwin_slider = NULL; |
|
2943
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2904
diff
changeset
|
79 static GtkWidget *playlistwin_time_min, *playlistwin_time_sec; |
|
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2904
diff
changeset
|
80 static GtkWidget *playlistwin_info, *playlistwin_sinfo; |
|
2902
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
81 static GtkWidget *playlistwin_srew, *playlistwin_splay; |
|
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
82 static GtkWidget *playlistwin_spause, *playlistwin_sstop; |
|
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
83 static GtkWidget *playlistwin_sfwd, *playlistwin_seject; |
|
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
84 static GtkWidget *playlistwin_sscroll_up, *playlistwin_sscroll_down; |
| 2313 | 85 |
| 86 void playlistwin_select_search_cbt_cb( GtkWidget *called_cbt , | |
| 87 gpointer other_cbt ); | |
| 88 static gboolean playlistwin_select_search_kp_cb( GtkWidget *entry , GdkEventKey *event , | |
| 89 gpointer searchdlg_win ); | |
| 90 | |
|
2491
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
91 static gboolean playlistwin_resizing = FALSE; |
|
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
92 static gint playlistwin_resize_x, playlistwin_resize_y; |
| 2313 | 93 |
| 94 gboolean | |
| 95 playlistwin_is_shaded(void) | |
| 96 { | |
| 97 return cfg.playlist_shaded; | |
| 98 } | |
| 99 | |
| 100 gint | |
| 101 playlistwin_get_width(void) | |
| 102 { | |
| 103 cfg.playlist_width /= PLAYLISTWIN_WIDTH_SNAP; | |
| 104 cfg.playlist_width *= PLAYLISTWIN_WIDTH_SNAP; | |
| 105 return cfg.playlist_width; | |
| 106 } | |
| 107 | |
| 108 gint | |
| 109 playlistwin_get_height_unshaded(void) | |
| 110 { | |
| 111 gint height; | |
| 112 cfg.playlist_height /= PLAYLISTWIN_HEIGHT_SNAP; | |
| 113 cfg.playlist_height *= PLAYLISTWIN_HEIGHT_SNAP; | |
| 114 height = cfg.playlist_height; | |
| 115 return height; | |
| 116 } | |
| 117 | |
| 118 gint | |
| 119 playlistwin_get_height_shaded(void) | |
| 120 { | |
| 121 return PLAYLISTWIN_SHADED_HEIGHT; | |
| 122 } | |
| 123 | |
| 124 gint | |
| 125 playlistwin_get_height(void) | |
| 126 { | |
| 127 if (playlistwin_is_shaded()) | |
| 128 return playlistwin_get_height_shaded(); | |
| 129 else | |
| 130 return playlistwin_get_height_unshaded(); | |
| 131 } | |
| 132 | |
| 133 void | |
| 134 playlistwin_get_size(gint * width, gint * height) | |
| 135 { | |
| 136 if (width) | |
| 137 *width = playlistwin_get_width(); | |
| 138 | |
| 139 if (height) | |
| 140 *height = playlistwin_get_height(); | |
| 141 } | |
| 142 | |
| 143 static void | |
| 144 playlistwin_update_info(Playlist *playlist) | |
| 145 { | |
| 146 gchar *text, *sel_text, *tot_text; | |
| 147 gulong selection, total; | |
| 148 gboolean selection_more, total_more; | |
| 149 | |
| 150 playlist_get_total_time(playlist, &total, &selection, &total_more, &selection_more); | |
| 151 | |
| 152 if (selection > 0 || (selection == 0 && !selection_more)) { | |
| 153 if (selection > 3600) | |
| 154 sel_text = | |
| 155 g_strdup_printf("%lu:%-2.2lu:%-2.2lu%s", selection / 3600, | |
| 156 (selection / 60) % 60, selection % 60, | |
| 157 (selection_more ? "+" : "")); | |
| 158 else | |
| 159 sel_text = | |
| 160 g_strdup_printf("%lu:%-2.2lu%s", selection / 60, | |
| 161 selection % 60, (selection_more ? "+" : "")); | |
| 162 } | |
| 163 else | |
| 164 sel_text = g_strdup("?"); | |
| 165 if (total > 0 || (total == 0 && !total_more)) { | |
| 166 if (total > 3600) | |
| 167 tot_text = | |
| 168 g_strdup_printf("%lu:%-2.2lu:%-2.2lu%s", total / 3600, | |
| 169 (total / 60) % 60, total % 60, | |
| 170 total_more ? "+" : ""); | |
| 171 else | |
| 172 tot_text = | |
| 173 g_strdup_printf("%lu:%-2.2lu%s", total / 60, total % 60, | |
| 174 total_more ? "+" : ""); | |
| 175 } | |
| 176 else | |
| 177 tot_text = g_strdup("?"); | |
| 178 text = g_strconcat(sel_text, "/", tot_text, NULL); | |
|
2943
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2904
diff
changeset
|
179 ui_skinned_textbox_set_text(playlistwin_info, text ? text : ""); |
| 2313 | 180 g_free(text); |
| 181 g_free(tot_text); | |
| 182 g_free(sel_text); | |
| 183 } | |
| 184 | |
| 185 static void | |
| 186 playlistwin_update_sinfo(Playlist *playlist) | |
| 187 { | |
| 188 gchar *posstr, *timestr, *title, *info; | |
| 189 gint pos, time; | |
| 190 | |
| 191 pos = playlist_get_position(playlist); | |
| 192 title = playlist_get_songtitle(playlist, pos); | |
| 193 | |
| 194 if (!title) { | |
|
2943
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2904
diff
changeset
|
195 ui_skinned_textbox_set_text(playlistwin_sinfo, ""); |
| 2313 | 196 return; |
| 197 } | |
| 198 | |
| 199 convert_title_text(title); | |
| 200 | |
| 201 time = playlist_get_songtime(playlist, pos); | |
| 202 | |
| 203 if (cfg.show_numbers_in_pl) | |
| 204 posstr = g_strdup_printf("%d. ", pos + 1); | |
| 205 else | |
| 206 posstr = g_strdup(""); | |
| 207 | |
| 208 if (time != -1) { | |
| 209 timestr = g_strdup_printf(" (%d:%-2.2d)", time / 60000, | |
| 210 (time / 1000) % 60); | |
| 211 } | |
| 212 else | |
| 213 timestr = g_strdup(""); | |
| 214 | |
| 215 info = g_strdup_printf("%s%s%s", posstr, title, timestr); | |
| 216 | |
| 217 g_free(posstr); | |
| 218 g_free(title); | |
| 219 g_free(timestr); | |
| 220 | |
|
2943
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2904
diff
changeset
|
221 ui_skinned_textbox_set_text(playlistwin_sinfo, info ? info : ""); |
| 2313 | 222 g_free(info); |
| 223 } | |
| 224 | |
| 225 gboolean | |
| 226 playlistwin_item_visible(gint index) | |
| 227 { | |
|
3959
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3512
diff
changeset
|
228 if (index >= UI_SKINNED_PLAYLIST(playlistwin_list)->first && |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3512
diff
changeset
|
229 index < (UI_SKINNED_PLAYLIST(playlistwin_list)->first + UI_SKINNED_PLAYLIST(playlistwin_list)->num_visible) ) { |
| 2313 | 230 return TRUE; |
|
3959
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3512
diff
changeset
|
231 } |
| 2313 | 232 return FALSE; |
| 233 } | |
| 234 | |
| 235 gint | |
|
3135
7cdcf8ab08da
replace PlaylistSlider with UiSkinnedPlaylistSlider
Tomasz Mon <desowin@gmail.com>
parents:
3123
diff
changeset
|
236 playlistwin_list_get_visible_count(void) |
|
7cdcf8ab08da
replace PlaylistSlider with UiSkinnedPlaylistSlider
Tomasz Mon <desowin@gmail.com>
parents:
3123
diff
changeset
|
237 { |
|
7cdcf8ab08da
replace PlaylistSlider with UiSkinnedPlaylistSlider
Tomasz Mon <desowin@gmail.com>
parents:
3123
diff
changeset
|
238 if (playlistwin_list) |
| 3217 | 239 return UI_SKINNED_PLAYLIST(playlistwin_list)->num_visible; |
|
3135
7cdcf8ab08da
replace PlaylistSlider with UiSkinnedPlaylistSlider
Tomasz Mon <desowin@gmail.com>
parents:
3123
diff
changeset
|
240 return (-1); |
|
7cdcf8ab08da
replace PlaylistSlider with UiSkinnedPlaylistSlider
Tomasz Mon <desowin@gmail.com>
parents:
3123
diff
changeset
|
241 } |
|
7cdcf8ab08da
replace PlaylistSlider with UiSkinnedPlaylistSlider
Tomasz Mon <desowin@gmail.com>
parents:
3123
diff
changeset
|
242 |
|
7cdcf8ab08da
replace PlaylistSlider with UiSkinnedPlaylistSlider
Tomasz Mon <desowin@gmail.com>
parents:
3123
diff
changeset
|
243 gint |
|
7cdcf8ab08da
replace PlaylistSlider with UiSkinnedPlaylistSlider
Tomasz Mon <desowin@gmail.com>
parents:
3123
diff
changeset
|
244 playlistwin_list_get_first(void) |
|
7cdcf8ab08da
replace PlaylistSlider with UiSkinnedPlaylistSlider
Tomasz Mon <desowin@gmail.com>
parents:
3123
diff
changeset
|
245 { |
|
7cdcf8ab08da
replace PlaylistSlider with UiSkinnedPlaylistSlider
Tomasz Mon <desowin@gmail.com>
parents:
3123
diff
changeset
|
246 if (playlistwin_list) |
| 3217 | 247 return UI_SKINNED_PLAYLIST(playlistwin_list)->first; |
|
3135
7cdcf8ab08da
replace PlaylistSlider with UiSkinnedPlaylistSlider
Tomasz Mon <desowin@gmail.com>
parents:
3123
diff
changeset
|
248 return (-1); |
|
7cdcf8ab08da
replace PlaylistSlider with UiSkinnedPlaylistSlider
Tomasz Mon <desowin@gmail.com>
parents:
3123
diff
changeset
|
249 } |
|
7cdcf8ab08da
replace PlaylistSlider with UiSkinnedPlaylistSlider
Tomasz Mon <desowin@gmail.com>
parents:
3123
diff
changeset
|
250 |
|
7cdcf8ab08da
replace PlaylistSlider with UiSkinnedPlaylistSlider
Tomasz Mon <desowin@gmail.com>
parents:
3123
diff
changeset
|
251 gint |
| 2313 | 252 playlistwin_get_toprow(void) |
| 253 { | |
| 254 if (playlistwin_list) | |
| 3217 | 255 return (UI_SKINNED_PLAYLIST(playlistwin_list)->first); |
| 2313 | 256 return (-1); |
| 257 } | |
| 258 | |
| 259 void | |
| 260 playlistwin_set_toprow(gint toprow) | |
| 261 { | |
| 262 if (playlistwin_list) | |
| 3217 | 263 UI_SKINNED_PLAYLIST(playlistwin_list)->first = toprow; |
| 2313 | 264 playlistwin_update_list(playlist_get_active()); |
| 265 } | |
| 266 | |
| 267 void | |
| 268 playlistwin_update_list(Playlist *playlist) | |
| 269 { | |
| 270 /* this can happen early on. just bail gracefully. */ | |
| 2363 | 271 g_return_if_fail(playlistwin_list); |
| 2313 | 272 |
|
3248
3cf247e4508c
fix not updating playlist on title change
Tomasz Mon <desowin@gmail.com>
parents:
3246
diff
changeset
|
273 playlistwin_update_info(playlist); |
|
3cf247e4508c
fix not updating playlist on title change
Tomasz Mon <desowin@gmail.com>
parents:
3246
diff
changeset
|
274 playlistwin_update_sinfo(playlist); |
| 3217 | 275 gtk_widget_queue_draw(playlistwin_list); |
|
3135
7cdcf8ab08da
replace PlaylistSlider with UiSkinnedPlaylistSlider
Tomasz Mon <desowin@gmail.com>
parents:
3123
diff
changeset
|
276 gtk_widget_queue_draw(playlistwin_slider); |
| 2313 | 277 } |
| 278 | |
| 279 static void | |
| 280 playlistwin_set_mask(void) | |
| 281 { | |
| 282 GdkGC *gc; | |
| 283 GdkColor pattern; | |
| 284 | |
| 285 if (playlistwin_mask) | |
| 286 g_object_unref(playlistwin_mask); | |
| 287 | |
| 288 playlistwin_mask = | |
| 289 gdk_pixmap_new(playlistwin->window, playlistwin_get_width(), | |
| 290 playlistwin_get_height(), 1); | |
| 291 gc = gdk_gc_new(playlistwin_mask); | |
| 292 pattern.pixel = 1; | |
| 293 gdk_gc_set_foreground(gc, &pattern); | |
| 294 gdk_draw_rectangle(playlistwin_mask, gc, TRUE, 0, 0, | |
| 295 playlistwin_get_width(), playlistwin_get_height()); | |
| 296 g_object_unref(gc); | |
| 297 | |
| 298 gtk_widget_shape_combine_mask(playlistwin, playlistwin_mask, 0, 0); | |
| 299 } | |
| 300 | |
| 301 static void | |
| 302 playlistwin_set_geometry_hints(gboolean shaded) | |
| 303 { | |
| 304 GdkGeometry geometry; | |
| 305 GdkWindowHints mask; | |
| 306 | |
| 307 geometry.min_width = PLAYLISTWIN_MIN_WIDTH; | |
| 308 geometry.max_width = G_MAXUINT16; | |
| 309 | |
| 310 geometry.width_inc = PLAYLISTWIN_WIDTH_SNAP; | |
| 311 geometry.height_inc = PLAYLISTWIN_HEIGHT_SNAP; | |
| 312 | |
| 313 if (shaded) { | |
| 314 geometry.min_height = PLAYLISTWIN_SHADED_HEIGHT; | |
| 315 geometry.max_height = PLAYLISTWIN_SHADED_HEIGHT; | |
| 316 geometry.base_height = PLAYLISTWIN_SHADED_HEIGHT; | |
| 317 } | |
| 318 else { | |
| 319 geometry.min_height = PLAYLISTWIN_MIN_HEIGHT; | |
| 320 geometry.max_height = G_MAXUINT16; | |
| 321 } | |
| 322 | |
| 323 mask = GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE | GDK_HINT_RESIZE_INC; | |
| 324 | |
| 325 gtk_window_set_geometry_hints(GTK_WINDOW(playlistwin), | |
| 326 playlistwin, &geometry, mask); | |
| 327 } | |
| 328 | |
| 329 void | |
| 330 playlistwin_set_sinfo_font(gchar *font) | |
| 331 { | |
| 332 gchar *tmp = NULL, *tmp2 = NULL; | |
| 333 | |
| 2363 | 334 g_return_if_fail(font); |
| 2313 | 335 |
| 336 tmp = g_strdup(font); | |
| 2363 | 337 g_return_if_fail(tmp); |
| 2313 | 338 |
| 339 *strrchr(tmp, ' ') = '\0'; | |
| 340 tmp2 = g_strdup_printf("%s 8", tmp); | |
| 2363 | 341 g_return_if_fail(tmp2); |
| 342 | |
|
2943
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2904
diff
changeset
|
343 ui_skinned_textbox_set_xfont(playlistwin_sinfo, cfg.mainwin_use_xfont, tmp2); |
| 2313 | 344 |
| 2363 | 345 g_free(tmp); |
| 346 g_free(tmp2); | |
| 2313 | 347 } |
| 348 | |
| 349 void | |
| 350 playlistwin_set_sinfo_scroll(gboolean scroll) | |
| 351 { | |
| 352 if(playlistwin_is_shaded()) | |
|
2943
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2904
diff
changeset
|
353 ui_skinned_textbox_set_scroll(playlistwin_sinfo, cfg.autoscroll); |
| 2313 | 354 else |
|
2943
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2904
diff
changeset
|
355 ui_skinned_textbox_set_scroll(playlistwin_sinfo, FALSE); |
| 2313 | 356 } |
| 357 | |
| 358 void | |
| 359 playlistwin_set_shade(gboolean shaded) | |
| 360 { | |
| 361 cfg.playlist_shaded = shaded; | |
| 362 | |
| 363 if (shaded) { | |
| 364 playlistwin_set_sinfo_font(cfg.playlist_font); | |
| 365 playlistwin_set_sinfo_scroll(cfg.autoscroll); | |
|
2943
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2904
diff
changeset
|
366 gtk_widget_show(playlistwin_sinfo); |
|
3006
3c4ed53a685f
use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
367 ui_skinned_set_push_button_data(playlistwin_shade, 128, 45, 150, 42); |
|
3c4ed53a685f
use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
368 ui_skinned_set_push_button_data(playlistwin_close, 138, 45, -1, -1); |
| 2313 | 369 } |
| 370 else { | |
|
2943
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2904
diff
changeset
|
371 gtk_widget_hide(playlistwin_sinfo); |
| 2313 | 372 playlistwin_set_sinfo_scroll(FALSE); |
|
3006
3c4ed53a685f
use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
373 ui_skinned_set_push_button_data(playlistwin_shade, 157, 3, 62, 42); |
|
3c4ed53a685f
use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
374 ui_skinned_set_push_button_data(playlistwin_close, 167, 3, -1, -1); |
| 2313 | 375 } |
| 376 | |
| 377 dock_shade(dock_window_list, GTK_WINDOW(playlistwin), | |
| 378 playlistwin_get_height()); | |
| 379 | |
| 380 playlistwin_set_geometry_hints(cfg.playlist_shaded); | |
| 381 | |
| 382 gtk_window_resize(GTK_WINDOW(playlistwin), | |
| 383 playlistwin_get_width(), | |
| 384 playlistwin_get_height()); | |
| 385 | |
| 386 playlistwin_set_mask(); | |
| 387 } | |
| 388 | |
| 389 static void | |
| 390 playlistwin_set_shade_menu(gboolean shaded) | |
| 391 { | |
| 392 GtkAction *action = gtk_action_group_get_action( | |
| 393 toggleaction_group_others , "roll up playlist editor" ); | |
| 394 gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(action) , shaded ); | |
| 395 | |
| 396 playlistwin_set_shade(shaded); | |
| 397 playlistwin_update_list(playlist_get_active()); | |
| 398 } | |
| 399 | |
| 400 void | |
| 401 playlistwin_shade_toggle(void) | |
| 402 { | |
| 403 playlistwin_set_shade_menu(!cfg.playlist_shaded); | |
| 404 } | |
| 405 | |
| 406 static void | |
| 407 playlistwin_release(GtkWidget * widget, | |
| 408 GdkEventButton * event, | |
| 409 gpointer callback_data) | |
| 410 { | |
| 411 if (event->button == 3) | |
| 412 return; | |
| 413 | |
| 414 playlistwin_resizing = FALSE; | |
|
3107
1f5552089a50
Just a few translatable strings.
Stany HENRY <StrassBoy@gmail.com>
parents:
3068
diff
changeset
|
415 |
| 2313 | 416 if (dock_is_moving(GTK_WINDOW(playlistwin))) |
| 417 dock_move_release(GTK_WINDOW(playlistwin)); | |
| 418 } | |
| 419 | |
| 420 void | |
| 421 playlistwin_scroll(gint num) | |
| 422 { | |
| 3217 | 423 UI_SKINNED_PLAYLIST(playlistwin_list)->first += num; |
| 2313 | 424 playlistwin_update_list(playlist_get_active()); |
| 425 } | |
| 426 | |
| 427 void | |
| 428 playlistwin_scroll_up_pushed(void) | |
| 429 { | |
| 430 playlistwin_scroll(-3); | |
| 431 } | |
| 432 | |
| 433 void | |
| 434 playlistwin_scroll_down_pushed(void) | |
| 435 { | |
| 436 playlistwin_scroll(3); | |
| 437 } | |
| 438 | |
| 439 static void | |
| 440 playlistwin_select_all(void) | |
| 441 { | |
| 442 Playlist *playlist = playlist_get_active(); | |
| 443 | |
| 444 playlist_select_all(playlist, TRUE); | |
| 3217 | 445 UI_SKINNED_PLAYLIST(playlistwin_list)->prev_selected = 0; |
| 446 UI_SKINNED_PLAYLIST(playlistwin_list)->prev_min = 0; | |
| 447 UI_SKINNED_PLAYLIST(playlistwin_list)->prev_max = playlist_get_length(playlist) - 1; | |
| 2313 | 448 playlistwin_update_list(playlist); |
| 449 } | |
| 450 | |
| 451 static void | |
| 452 playlistwin_select_none(void) | |
| 453 { | |
| 454 playlist_select_all(playlist_get_active(), FALSE); | |
| 3217 | 455 UI_SKINNED_PLAYLIST(playlistwin_list)->prev_selected = -1; |
| 456 UI_SKINNED_PLAYLIST(playlistwin_list)->prev_min = -1; | |
| 2313 | 457 playlistwin_update_list(playlist_get_active()); |
| 458 } | |
| 459 | |
| 460 static void | |
| 461 playlistwin_select_search(void) | |
| 462 { | |
| 463 Playlist *playlist = playlist_get_active(); | |
| 464 GtkWidget *searchdlg_win, *searchdlg_table; | |
| 465 GtkWidget *searchdlg_hbox, *searchdlg_logo, *searchdlg_helptext; | |
|
2807
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
466 GtkWidget *searchdlg_entry_title, *searchdlg_label_title; |
|
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
467 GtkWidget *searchdlg_entry_album, *searchdlg_label_album; |
| 2313 | 468 GtkWidget *searchdlg_entry_file_name, *searchdlg_label_file_name; |
| 469 GtkWidget *searchdlg_entry_performer, *searchdlg_label_performer; | |
| 470 GtkWidget *searchdlg_checkbt_clearprevsel; | |
| 471 GtkWidget *searchdlg_checkbt_newplaylist; | |
| 472 GtkWidget *searchdlg_checkbt_autoenqueue; | |
| 473 gint result; | |
| 474 | |
| 475 /* create dialog */ | |
| 476 searchdlg_win = gtk_dialog_new_with_buttons( | |
| 477 _("Search entries in active playlist") , GTK_WINDOW(mainwin) , | |
| 478 GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT , | |
| 479 GTK_STOCK_CANCEL , GTK_RESPONSE_REJECT , GTK_STOCK_OK , GTK_RESPONSE_ACCEPT , NULL ); | |
| 2904 | 480 gtk_window_set_position(GTK_WINDOW(searchdlg_win), GTK_WIN_POS_CENTER); |
| 481 | |
| 2313 | 482 /* help text and logo */ |
| 483 searchdlg_hbox = gtk_hbox_new( FALSE , 4 ); | |
| 484 searchdlg_logo = gtk_image_new_from_stock( GTK_STOCK_FIND , GTK_ICON_SIZE_DIALOG ); | |
| 485 searchdlg_helptext = gtk_label_new( _("Select entries in playlist by filling one or more " | |
| 486 "fields. Fields use regular expressions syntax, case-insensitive. If you don't know how " | |
| 487 "regular expressions work, simply insert a literal portion of what you're searching for.") ); | |
| 488 gtk_label_set_line_wrap( GTK_LABEL(searchdlg_helptext) , TRUE ); | |
| 489 gtk_box_pack_start( GTK_BOX(searchdlg_hbox) , searchdlg_logo , FALSE , FALSE , 0 ); | |
| 490 gtk_box_pack_start( GTK_BOX(searchdlg_hbox) , searchdlg_helptext , FALSE , FALSE , 0 ); | |
| 2904 | 491 |
|
2807
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
492 /* title */ |
|
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
493 searchdlg_label_title = gtk_label_new( _("Title: ") ); |
|
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
494 searchdlg_entry_title = gtk_entry_new(); |
|
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
495 gtk_misc_set_alignment( GTK_MISC(searchdlg_label_title) , 0 , 0.5 ); |
|
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
496 g_signal_connect( G_OBJECT(searchdlg_entry_title) , "key-press-event" , |
| 2313 | 497 G_CALLBACK(playlistwin_select_search_kp_cb) , searchdlg_win ); |
| 2904 | 498 |
|
2807
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
499 /* album */ |
|
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
500 searchdlg_label_album= gtk_label_new( _("Album: ") ); |
|
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
501 searchdlg_entry_album= gtk_entry_new(); |
|
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
502 gtk_misc_set_alignment( GTK_MISC(searchdlg_label_album) , 0 , 0.5 ); |
|
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
503 g_signal_connect( G_OBJECT(searchdlg_entry_album) , "key-press-event" , |
| 2313 | 504 G_CALLBACK(playlistwin_select_search_kp_cb) , searchdlg_win ); |
| 2904 | 505 |
| 2313 | 506 /* artist */ |
| 507 searchdlg_label_performer = gtk_label_new( _("Artist: ") ); | |
| 508 searchdlg_entry_performer = gtk_entry_new(); | |
| 509 gtk_misc_set_alignment( GTK_MISC(searchdlg_label_performer) , 0 , 0.5 ); | |
| 510 g_signal_connect( G_OBJECT(searchdlg_entry_performer) , "key-press-event" , | |
| 511 G_CALLBACK(playlistwin_select_search_kp_cb) , searchdlg_win ); | |
| 2904 | 512 |
| 2313 | 513 /* file name */ |
| 514 searchdlg_label_file_name = gtk_label_new( _("Filename: ") ); | |
| 515 searchdlg_entry_file_name = gtk_entry_new(); | |
| 516 gtk_misc_set_alignment( GTK_MISC(searchdlg_label_file_name) , 0 , 0.5 ); | |
| 517 g_signal_connect( G_OBJECT(searchdlg_entry_file_name) , "key-press-event" , | |
| 518 G_CALLBACK(playlistwin_select_search_kp_cb) , searchdlg_win ); | |
| 2904 | 519 |
| 2313 | 520 /* some options that control behaviour */ |
| 521 searchdlg_checkbt_clearprevsel = gtk_check_button_new_with_label( | |
| 522 _("Clear previous selection before searching") ); | |
| 523 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(searchdlg_checkbt_clearprevsel) , TRUE ); | |
| 524 searchdlg_checkbt_autoenqueue = gtk_check_button_new_with_label( | |
| 525 _("Automatically toggle queue for matching entries") ); | |
| 526 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(searchdlg_checkbt_autoenqueue) , FALSE ); | |
| 527 searchdlg_checkbt_newplaylist = gtk_check_button_new_with_label( | |
| 528 _("Create a new playlist with matching entries") ); | |
| 529 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(searchdlg_checkbt_newplaylist) , FALSE ); | |
| 530 g_signal_connect( G_OBJECT(searchdlg_checkbt_autoenqueue) , "clicked" , | |
| 531 G_CALLBACK(playlistwin_select_search_cbt_cb) , searchdlg_checkbt_newplaylist ); | |
| 532 g_signal_connect( G_OBJECT(searchdlg_checkbt_newplaylist) , "clicked" , | |
| 533 G_CALLBACK(playlistwin_select_search_cbt_cb) , searchdlg_checkbt_autoenqueue ); | |
| 2904 | 534 |
| 2313 | 535 /* place fields in searchdlg_table */ |
| 536 searchdlg_table = gtk_table_new( 8 , 2 , FALSE ); | |
| 537 gtk_table_set_row_spacing( GTK_TABLE(searchdlg_table) , 0 , 8 ); | |
| 538 gtk_table_set_row_spacing( GTK_TABLE(searchdlg_table) , 4 , 8 ); | |
| 539 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_hbox , | |
| 540 0 , 2 , 0 , 1 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 2 ); | |
|
2807
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
541 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_label_title , |
| 2313 | 542 0 , 1 , 1 , 2 , GTK_FILL , GTK_FILL | GTK_EXPAND , 0 , 2 ); |
|
2807
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
543 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_entry_title , |
| 2313 | 544 1 , 2 , 1 , 2 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 2 ); |
|
2807
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
545 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_label_album, |
| 2313 | 546 0 , 1 , 2 , 3 , GTK_FILL , GTK_FILL | GTK_EXPAND , 0 , 2 ); |
|
2807
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
547 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_entry_album, |
| 2313 | 548 1 , 2 , 2 , 3 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 2 ); |
| 549 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_label_performer , | |
| 550 0 , 1 , 3 , 4 , GTK_FILL , GTK_FILL | GTK_EXPAND , 0 , 2 ); | |
| 551 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_entry_performer , | |
| 552 1 , 2 , 3 , 4 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 2 ); | |
| 553 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_label_file_name , | |
| 554 0 , 1 , 4 , 5 , GTK_FILL , GTK_FILL | GTK_EXPAND , 0 , 2 ); | |
| 555 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_entry_file_name , | |
| 556 1 , 2 , 4 , 5 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 2 ); | |
| 557 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_checkbt_clearprevsel , | |
| 558 0 , 2 , 5 , 6 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 1 ); | |
| 559 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_checkbt_autoenqueue , | |
| 560 0 , 2 , 6 , 7 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 1 ); | |
| 561 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_checkbt_newplaylist , | |
| 562 0 , 2 , 7 , 8 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 1 ); | |
| 563 | |
| 564 gtk_container_set_border_width( GTK_CONTAINER(searchdlg_table) , 5 ); | |
| 565 gtk_container_add( GTK_CONTAINER(GTK_DIALOG(searchdlg_win)->vbox) , searchdlg_table ); | |
| 566 gtk_widget_show_all( searchdlg_win ); | |
| 567 result = gtk_dialog_run( GTK_DIALOG(searchdlg_win) ); | |
| 568 switch(result) | |
| 569 { | |
| 570 case GTK_RESPONSE_ACCEPT: | |
| 571 { | |
| 572 gint matched_entries_num = 0; | |
| 573 /* create a TitleInput tuple with user search data */ | |
|
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3271
diff
changeset
|
574 Tuple *tuple = tuple_new(); |
| 2313 | 575 gchar *searchdata = NULL; |
|
2807
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
576 searchdata = (gchar*)gtk_entry_get_text( GTK_ENTRY(searchdlg_entry_title) ); |
|
3490
602ec8c40d0d
Fixed to comply with the Tuple API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
3375
diff
changeset
|
577 tuple_associate_string(tuple, FIELD_TITLE, NULL, searchdata); |
|
2807
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
578 searchdata = (gchar*)gtk_entry_get_text( GTK_ENTRY(searchdlg_entry_album) ); |
|
3490
602ec8c40d0d
Fixed to comply with the Tuple API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
3375
diff
changeset
|
579 tuple_associate_string(tuple, FIELD_ALBUM, NULL, searchdata); |
| 2313 | 580 searchdata = (gchar*)gtk_entry_get_text( GTK_ENTRY(searchdlg_entry_performer) ); |
|
3490
602ec8c40d0d
Fixed to comply with the Tuple API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
3375
diff
changeset
|
581 tuple_associate_string(tuple, FIELD_ARTIST, NULL, searchdata); |
| 2313 | 582 searchdata = (gchar*)gtk_entry_get_text( GTK_ENTRY(searchdlg_entry_file_name) ); |
|
3490
602ec8c40d0d
Fixed to comply with the Tuple API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
3375
diff
changeset
|
583 tuple_associate_string(tuple, FIELD_FILE_NAME, NULL, searchdata); |
| 2313 | 584 /* check if previous selection should be cleared before searching */ |
| 585 if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(searchdlg_checkbt_clearprevsel)) == TRUE ) | |
| 586 playlistwin_select_none(); | |
| 587 /* now send this tuple to the real search function */ | |
| 588 matched_entries_num = playlist_select_search( playlist , tuple , 0 ); | |
| 589 /* we do not need the tuple and its data anymore */ | |
|
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3271
diff
changeset
|
590 mowgli_object_unref(tuple); |
| 2313 | 591 playlistwin_update_list(playlist_get_active()); |
| 592 /* check if a new playlist should be created after searching */ | |
| 593 if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(searchdlg_checkbt_newplaylist)) == TRUE ) | |
| 594 playlist_new_from_selected(); | |
| 595 /* check if matched entries should be queued */ | |
| 596 else if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(searchdlg_checkbt_autoenqueue)) == TRUE ) | |
| 597 playlist_queue(playlist_get_active()); | |
| 598 break; | |
| 599 } | |
| 600 default: | |
| 601 break; | |
| 602 } | |
| 603 /* done here :) */ | |
| 604 gtk_widget_destroy( searchdlg_win ); | |
| 605 } | |
| 606 | |
| 607 static void | |
| 608 playlistwin_inverse_selection(void) | |
| 609 { | |
| 610 playlist_select_invert_all(playlist_get_active()); | |
| 3217 | 611 UI_SKINNED_PLAYLIST(playlistwin_list)->prev_selected = -1; |
| 612 UI_SKINNED_PLAYLIST(playlistwin_list)->prev_min = -1; | |
| 2313 | 613 playlistwin_update_list(playlist_get_active()); |
| 614 } | |
| 615 | |
| 616 static void | |
| 617 playlistwin_resize(gint width, gint height) | |
| 618 { | |
|
2491
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
619 gint tx, ty; |
|
2507
e07c141dd326
[svn] - made new functions: widget_move_relative and widget_resize_relative
mf0102
parents:
2499
diff
changeset
|
620 gint dx, dy; |
| 2313 | 621 |
| 622 g_return_if_fail(width > 0 && height > 0); | |
| 623 | |
|
2491
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
624 tx = (width - PLAYLISTWIN_MIN_WIDTH) / PLAYLISTWIN_WIDTH_SNAP; |
|
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
625 tx = (tx * PLAYLISTWIN_WIDTH_SNAP) + PLAYLISTWIN_MIN_WIDTH; |
|
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
626 if (tx < PLAYLISTWIN_MIN_WIDTH) |
|
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
627 tx = PLAYLISTWIN_MIN_WIDTH; |
| 2313 | 628 |
| 629 if (!cfg.playlist_shaded) | |
|
2491
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
630 { |
|
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
631 ty = (height - PLAYLISTWIN_MIN_HEIGHT) / PLAYLISTWIN_HEIGHT_SNAP; |
|
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
632 ty = (ty * PLAYLISTWIN_HEIGHT_SNAP) + PLAYLISTWIN_MIN_HEIGHT; |
|
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
633 if (ty < PLAYLISTWIN_MIN_HEIGHT) |
|
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
634 ty = PLAYLISTWIN_MIN_HEIGHT; |
|
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
635 } |
| 2313 | 636 else |
|
2491
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
637 ty = cfg.playlist_height; |
|
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
638 |
|
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
639 if (tx == cfg.playlist_width && ty == cfg.playlist_height) |
|
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
640 return; |
|
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
641 |
|
2507
e07c141dd326
[svn] - made new functions: widget_move_relative and widget_resize_relative
mf0102
parents:
2499
diff
changeset
|
642 /* difference between previous size and new size */ |
|
e07c141dd326
[svn] - made new functions: widget_move_relative and widget_resize_relative
mf0102
parents:
2499
diff
changeset
|
643 dx = tx - cfg.playlist_width; |
|
e07c141dd326
[svn] - made new functions: widget_move_relative and widget_resize_relative
mf0102
parents:
2499
diff
changeset
|
644 dy = ty - cfg.playlist_height; |
|
e07c141dd326
[svn] - made new functions: widget_move_relative and widget_resize_relative
mf0102
parents:
2499
diff
changeset
|
645 |
|
2491
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
646 cfg.playlist_width = width = tx; |
|
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
647 cfg.playlist_height = height = ty; |
| 2313 | 648 |
|
3137
19908efce4e5
one mutex is enough for resizing
Tomasz Mon <desowin@gmail.com>
parents:
3135
diff
changeset
|
649 g_mutex_lock(resize_mutex); |
| 3217 | 650 ui_skinned_playlist_resize_relative(playlistwin_list, dx, dy); |
| 2313 | 651 |
|
3135
7cdcf8ab08da
replace PlaylistSlider with UiSkinnedPlaylistSlider
Tomasz Mon <desowin@gmail.com>
parents:
3123
diff
changeset
|
652 ui_skinned_playlist_slider_move_relative(playlistwin_slider, dx); |
|
7cdcf8ab08da
replace PlaylistSlider with UiSkinnedPlaylistSlider
Tomasz Mon <desowin@gmail.com>
parents:
3123
diff
changeset
|
653 ui_skinned_playlist_slider_resize_relative(playlistwin_slider, dy); |
| 2313 | 654 |
| 655 playlistwin_update_sinfo(playlist_get_active()); | |
| 656 | |
|
2901
5ed0674fabd6
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
657 ui_skinned_button_move_relative(playlistwin_shade, dx, 0); |
|
5ed0674fabd6
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
658 ui_skinned_button_move_relative(playlistwin_close, dx, 0); |
|
2943
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2904
diff
changeset
|
659 ui_skinned_textbox_move_relative(playlistwin_time_min, dx, dy); |
|
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2904
diff
changeset
|
660 ui_skinned_textbox_move_relative(playlistwin_time_sec, dx, dy); |
|
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2904
diff
changeset
|
661 ui_skinned_textbox_move_relative(playlistwin_info, dx, dy); |
|
2902
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
662 ui_skinned_button_move_relative(playlistwin_srew, dx, dy); |
|
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
663 ui_skinned_button_move_relative(playlistwin_splay, dx, dy); |
|
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
664 ui_skinned_button_move_relative(playlistwin_spause, dx, dy); |
|
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
665 ui_skinned_button_move_relative(playlistwin_sstop, dx, dy); |
|
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
666 ui_skinned_button_move_relative(playlistwin_sfwd, dx, dy); |
|
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
667 ui_skinned_button_move_relative(playlistwin_seject, dx, dy); |
|
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
668 ui_skinned_button_move_relative(playlistwin_sscroll_up, dx, dy); |
|
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
669 ui_skinned_button_move_relative(playlistwin_sscroll_down, dx, dy); |
| 2313 | 670 |
| 671 playlistwin_set_mask(); | |
| 672 | |
|
3250
2d43219d2799
solve always broken ui_skinned_textbox_resize_relative
Tomasz Mon <desowin@gmail.com>
parents:
3248
diff
changeset
|
673 gtk_widget_set_size_request(playlistwin_sinfo, playlistwin_get_width() - 35, |
|
2d43219d2799
solve always broken ui_skinned_textbox_resize_relative
Tomasz Mon <desowin@gmail.com>
parents:
3248
diff
changeset
|
674 bmp_active_skin->properties.textbox_bitmap_font_height); |
|
2965
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2950
diff
changeset
|
675 GList *iter; |
|
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2950
diff
changeset
|
676 for (iter = GTK_FIXED (SKINNED_WINDOW(playlistwin)->fixed)->children; iter; iter = g_list_next (iter)) { |
|
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2950
diff
changeset
|
677 GtkFixedChild *child_data = (GtkFixedChild *) iter->data; |
|
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2950
diff
changeset
|
678 GtkWidget *child = child_data->widget; |
|
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2950
diff
changeset
|
679 g_signal_emit_by_name(child, "redraw"); |
|
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2950
diff
changeset
|
680 } |
|
3137
19908efce4e5
one mutex is enough for resizing
Tomasz Mon <desowin@gmail.com>
parents:
3135
diff
changeset
|
681 g_mutex_unlock(resize_mutex); |
| 2313 | 682 } |
| 683 | |
| 684 static void | |
| 685 playlistwin_motion(GtkWidget * widget, | |
| 686 GdkEventMotion * event, | |
| 687 gpointer callback_data) | |
| 688 { | |
| 689 GdkEvent *gevent; | |
| 690 | |
|
2491
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
691 /* |
|
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
692 * GDK2's resize is broken and doesn't really play nice, so we have |
|
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
693 * to do all of this stuff by hand. |
|
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
694 */ |
|
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
695 if (playlistwin_resizing == TRUE) |
|
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
696 { |
|
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
697 if (event->x + playlistwin_resize_x != playlistwin_get_width() || |
|
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
698 event->y + playlistwin_resize_y != playlistwin_get_height()) |
|
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
699 { |
|
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
700 playlistwin_resize(event->x + playlistwin_resize_x, |
|
2507
e07c141dd326
[svn] - made new functions: widget_move_relative and widget_resize_relative
mf0102
parents:
2499
diff
changeset
|
701 event->y + playlistwin_resize_y); |
|
2491
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
702 } |
|
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
703 gdk_window_resize(playlistwin->window, |
|
2507
e07c141dd326
[svn] - made new functions: widget_move_relative and widget_resize_relative
mf0102
parents:
2499
diff
changeset
|
704 cfg.playlist_width, cfg.playlist_height); |
|
2491
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
705 } |
|
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
706 else if (dock_is_moving(GTK_WINDOW(playlistwin))) |
| 2313 | 707 dock_move_motion(GTK_WINDOW(playlistwin), event); |
| 708 gdk_flush(); | |
| 709 | |
| 2601 | 710 while ((gevent = gdk_event_get()) != NULL) gdk_event_free(gevent); |
| 2313 | 711 } |
| 712 | |
| 713 static void | |
| 714 playlistwin_show_filebrowser(void) | |
| 715 { | |
|
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
716 run_filebrowser(NO_PLAY_BUTTON); |
| 2313 | 717 } |
| 718 | |
| 719 static void | |
| 720 playlistwin_fileinfo(void) | |
| 721 { | |
| 722 Playlist *playlist = playlist_get_active(); | |
| 723 | |
| 724 /* Show the first selected file, or the current file if nothing is | |
| 725 * selected */ | |
| 726 GList *list = playlist_get_selected(playlist); | |
| 727 if (list) { | |
| 728 playlist_fileinfo(playlist, GPOINTER_TO_INT(list->data)); | |
| 729 g_list_free(list); | |
| 730 } | |
| 731 else | |
| 732 playlist_fileinfo_current(playlist); | |
| 733 } | |
| 734 | |
| 735 static void | |
| 2363 | 736 show_playlist_save_error(GtkWindow *parent, |
| 737 const gchar *filename) | |
| 2313 | 738 { |
| 739 GtkWidget *dialog; | |
|
3107
1f5552089a50
Just a few translatable strings.
Stany HENRY <StrassBoy@gmail.com>
parents:
3068
diff
changeset
|
740 |
| 2313 | 741 g_return_if_fail(GTK_IS_WINDOW(parent)); |
| 2363 | 742 g_return_if_fail(filename); |
| 2313 | 743 |
| 744 dialog = gtk_message_dialog_new(GTK_WINDOW(parent), | |
| 745 GTK_DIALOG_DESTROY_WITH_PARENT, | |
| 746 GTK_MESSAGE_ERROR, | |
| 747 GTK_BUTTONS_OK, | |
| 748 _("Error writing playlist \"%s\": %s"), | |
| 749 filename, strerror(errno)); | |
| 750 | |
| 2640 | 751 gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER); /* centering */ |
| 2313 | 752 gtk_dialog_run(GTK_DIALOG(dialog)); |
| 753 gtk_widget_destroy(dialog); | |
| 754 } | |
| 755 | |
| 756 static gboolean | |
| 757 show_playlist_overwrite_prompt(GtkWindow * parent, | |
| 758 const gchar * filename) | |
| 759 { | |
| 760 GtkWidget *dialog; | |
| 761 gint result; | |
| 762 | |
| 763 g_return_val_if_fail(GTK_IS_WINDOW(parent), FALSE); | |
| 764 g_return_val_if_fail(filename != NULL, FALSE); | |
| 765 | |
| 766 dialog = gtk_message_dialog_new(GTK_WINDOW(parent), | |
| 767 GTK_DIALOG_DESTROY_WITH_PARENT, | |
| 768 GTK_MESSAGE_QUESTION, | |
| 769 GTK_BUTTONS_YES_NO, | |
| 770 _("%s already exist. Continue?"), | |
| 771 filename); | |
| 772 | |
| 2635 | 773 gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER); /* centering */ |
| 2313 | 774 result = gtk_dialog_run(GTK_DIALOG(dialog)); |
| 775 gtk_widget_destroy(dialog); | |
| 776 | |
| 777 return (result == GTK_RESPONSE_YES); | |
| 778 } | |
| 779 | |
| 780 static void | |
| 781 show_playlist_save_format_error(GtkWindow * parent, | |
| 782 const gchar * filename) | |
| 783 { | |
|
3107
1f5552089a50
Just a few translatable strings.
Stany HENRY <StrassBoy@gmail.com>
parents:
3068
diff
changeset
|
784 const gchar *markup = |
| 2313 | 785 N_("<b><big>Unable to save playlist.</big></b>\n\n" |
| 786 "Unknown file type for '%s'.\n"); | |
| 787 | |
| 788 GtkWidget *dialog; | |
| 789 | |
| 790 g_return_if_fail(GTK_IS_WINDOW(parent)); | |
| 791 g_return_if_fail(filename != NULL); | |
| 792 | |
| 793 dialog = | |
| 794 gtk_message_dialog_new_with_markup(GTK_WINDOW(parent), | |
| 795 GTK_DIALOG_DESTROY_WITH_PARENT, | |
| 796 GTK_MESSAGE_ERROR, | |
| 797 GTK_BUTTONS_OK, | |
| 798 _(markup), | |
| 799 filename); | |
| 2640 | 800 |
| 801 gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER); /* centering */ | |
| 2313 | 802 gtk_dialog_run(GTK_DIALOG(dialog)); |
| 803 gtk_widget_destroy(dialog); | |
| 804 } | |
| 805 | |
| 806 static void | |
| 807 playlistwin_save_playlist(const gchar * filename) | |
| 808 { | |
| 809 PlaylistContainer *plc; | |
| 810 gchar *ext = strrchr(filename, '.') + 1; | |
| 811 | |
| 812 plc = playlist_container_find(ext); | |
| 813 if (plc == NULL) { | |
| 814 show_playlist_save_format_error(GTK_WINDOW(playlistwin), filename); | |
| 815 return; | |
| 816 } | |
| 817 | |
| 818 str_replace_in(&cfg.playlist_path, g_path_get_dirname(filename)); | |
| 819 | |
| 820 if (g_file_test(filename, G_FILE_TEST_IS_REGULAR)) | |
| 821 if (!show_playlist_overwrite_prompt(GTK_WINDOW(playlistwin), filename)) | |
| 822 return; | |
| 823 | |
| 824 if (!playlist_save(playlist_get_active(), filename)) | |
| 825 show_playlist_save_error(GTK_WINDOW(playlistwin), filename); | |
| 826 } | |
| 827 | |
| 828 static void | |
| 829 playlistwin_load_playlist(const gchar * filename) | |
| 830 { | |
|
3477
57f4971b7086
New functions for associating a filename with a playlist. Made title/filename setting more consistent.
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3475
diff
changeset
|
831 const gchar *title; |
| 2313 | 832 Playlist *playlist = playlist_get_active(); |
| 833 | |
| 834 g_return_if_fail(filename != NULL); | |
| 835 | |
| 2640 | 836 str_replace_in(&cfg.playlist_path, g_path_get_dirname(filename)); |
| 2313 | 837 |
| 838 playlist_clear(playlist); | |
| 839 mainwin_clear_song_info(); | |
| 840 | |
| 841 playlist_load(playlist, filename); | |
|
3477
57f4971b7086
New functions for associating a filename with a playlist. Made title/filename setting more consistent.
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3475
diff
changeset
|
842 title = playlist_get_current_name(playlist); |
|
57f4971b7086
New functions for associating a filename with a playlist. Made title/filename setting more consistent.
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3475
diff
changeset
|
843 if(!title || !title[0]) |
|
57f4971b7086
New functions for associating a filename with a playlist. Made title/filename setting more consistent.
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3475
diff
changeset
|
844 playlist_set_current_name(playlist, filename); |
| 2313 | 845 } |
| 846 | |
| 847 static gchar * | |
| 848 playlist_file_selection_load(const gchar * title, | |
| 849 const gchar * default_filename) | |
| 850 { | |
|
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2508
diff
changeset
|
851 GtkWidget *dialog; |
| 2313 | 852 gchar *filename; |
| 853 | |
| 854 g_return_val_if_fail(title != NULL, NULL); | |
| 855 | |
|
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2508
diff
changeset
|
856 dialog = make_filebrowser(title, FALSE); |
| 2640 | 857 gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), cfg.playlist_path); |
|
3173
734a25cd1efb
Only set the filename in the dialog if it has been defined before by a previous load or save opeation.
Christian Birchinger <joker@netswarm.net>
parents:
3165
diff
changeset
|
858 if (default_filename) |
|
734a25cd1efb
Only set the filename in the dialog if it has been defined before by a previous load or save opeation.
Christian Birchinger <joker@netswarm.net>
parents:
3165
diff
changeset
|
859 gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog), default_filename); |
| 2640 | 860 gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER); /* centering */ |
| 2313 | 861 |
| 862 if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) | |
| 863 filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); | |
| 864 else | |
| 865 filename = NULL; | |
| 866 | |
|
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2508
diff
changeset
|
867 gtk_widget_destroy(dialog); |
| 2313 | 868 return filename; |
| 869 } | |
| 870 | |
| 2636 | 871 static void |
| 872 on_static_toggle(GtkToggleButton *button, gpointer data) | |
| 873 { | |
| 874 Playlist *playlist = playlist_get_active(); | |
| 875 | |
| 876 playlist->attribute = | |
| 2640 | 877 gtk_toggle_button_get_active(button) ? |
| 878 playlist->attribute | PLAYLIST_STATIC : | |
| 879 playlist->attribute & ~PLAYLIST_STATIC; | |
| 2636 | 880 } |
| 881 | |
| 2641 | 882 static void |
| 883 on_relative_toggle(GtkToggleButton *button, gpointer data) | |
| 884 { | |
| 885 Playlist *playlist = playlist_get_active(); | |
| 886 | |
| 887 playlist->attribute = | |
| 888 gtk_toggle_button_get_active(button) ? | |
| 889 playlist->attribute | PLAYLIST_USE_RELATIVE : | |
| 890 playlist->attribute & ~PLAYLIST_USE_RELATIVE; | |
| 891 } | |
| 892 | |
| 2313 | 893 static gchar * |
| 894 playlist_file_selection_save(const gchar * title, | |
| 895 const gchar * default_filename) | |
| 896 { | |
|
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2508
diff
changeset
|
897 GtkWidget *dialog; |
| 2313 | 898 gchar *filename; |
| 2641 | 899 GtkWidget *hbox; |
| 900 GtkWidget *toggle, *toggle2; | |
| 2313 | 901 |
| 902 g_return_val_if_fail(title != NULL, NULL); | |
| 903 | |
|
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2508
diff
changeset
|
904 dialog = make_filebrowser(title, TRUE); |
| 2640 | 905 gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), cfg.playlist_path); |
|
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2508
diff
changeset
|
906 gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog), default_filename); |
| 2636 | 907 |
| 2641 | 908 hbox = gtk_hbox_new(FALSE, 5); |
| 909 | |
| 2636 | 910 /* static playlist */ |
|
3107
1f5552089a50
Just a few translatable strings.
Stany HENRY <StrassBoy@gmail.com>
parents:
3068
diff
changeset
|
911 toggle = gtk_check_button_new_with_label(_("Save as Static Playlist")); |
| 2636 | 912 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), |
| 913 (playlist_get_active()->attribute & PLAYLIST_STATIC) ? TRUE : FALSE); | |
| 914 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(on_static_toggle), dialog); | |
| 2641 | 915 gtk_box_pack_start(GTK_BOX(hbox), toggle, FALSE, FALSE, 0); |
| 916 | |
| 917 /* use relative path */ | |
|
3107
1f5552089a50
Just a few translatable strings.
Stany HENRY <StrassBoy@gmail.com>
parents:
3068
diff
changeset
|
918 toggle2 = gtk_check_button_new_with_label(_("Use Relative Path")); |
| 2641 | 919 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle2), |
| 920 (playlist_get_active()->attribute & PLAYLIST_USE_RELATIVE) ? TRUE : FALSE); | |
| 921 g_signal_connect(G_OBJECT(toggle2), "toggled", G_CALLBACK(on_relative_toggle), dialog); | |
| 922 gtk_box_pack_start(GTK_BOX(hbox), toggle2, FALSE, FALSE, 0); | |
| 923 | |
| 924 gtk_widget_show_all(hbox); | |
| 925 gtk_file_chooser_set_extra_widget(GTK_FILE_CHOOSER(dialog), hbox); | |
|
3107
1f5552089a50
Just a few translatable strings.
Stany HENRY <StrassBoy@gmail.com>
parents:
3068
diff
changeset
|
926 |
| 2313 | 927 if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) |
| 928 filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); | |
| 929 else | |
| 930 filename = NULL; | |
| 931 | |
|
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2508
diff
changeset
|
932 gtk_widget_destroy(dialog); |
| 2313 | 933 return filename; |
| 934 } | |
| 935 | |
| 936 void | |
| 937 playlistwin_select_playlist_to_load(const gchar * default_filename) | |
| 938 { | |
| 939 gchar *filename = | |
| 940 playlist_file_selection_load(_("Load Playlist"), default_filename); | |
| 941 | |
| 942 if (filename) { | |
| 943 playlistwin_load_playlist(filename); | |
| 944 g_free(filename); | |
| 945 } | |
| 946 } | |
| 947 | |
| 948 static void | |
| 949 playlistwin_select_playlist_to_save(const gchar * default_filename) | |
| 950 { | |
| 951 gchar *dot = NULL, *basename = NULL; | |
| 952 gchar *filename = | |
| 953 playlist_file_selection_save(_("Save Playlist"), default_filename); | |
| 954 | |
| 955 if (filename) { | |
|
3475
80cff88ad6d0
Default extension may not be xspf
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3375
diff
changeset
|
956 /* Default extension */ |
| 2313 | 957 basename = g_path_get_basename(filename); |
| 958 dot = strrchr(basename, '.'); | |
| 959 if( dot == NULL || dot == basename) { | |
| 960 gchar *oldname = filename; | |
|
3475
80cff88ad6d0
Default extension may not be xspf
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3375
diff
changeset
|
961 #ifdef HAVE_XSPF_PLAYLIST |
| 2313 | 962 filename = g_strconcat(oldname, ".xspf", NULL); |
|
3475
80cff88ad6d0
Default extension may not be xspf
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3375
diff
changeset
|
963 #else |
|
80cff88ad6d0
Default extension may not be xspf
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3375
diff
changeset
|
964 filename = g_strconcat(oldname, ".m3u", NULL); |
|
80cff88ad6d0
Default extension may not be xspf
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3375
diff
changeset
|
965 #endif |
| 2313 | 966 g_free(oldname); |
| 967 } | |
| 968 g_free(basename); | |
| 969 | |
| 970 playlistwin_save_playlist(filename); | |
| 971 g_free(filename); | |
| 972 } | |
| 973 } | |
| 974 | |
| 975 #define REGION_L(x1,x2,y1,y2) \ | |
| 976 (event->x >= (x1) && event->x < (x2) && \ | |
| 977 event->y >= cfg.playlist_height - (y1) && \ | |
| 978 event->y < cfg.playlist_height - (y2)) | |
| 979 | |
| 980 #define REGION_R(x1,x2,y1,y2) \ | |
| 981 (event->x >= playlistwin_get_width() - (x1) && \ | |
| 982 event->x < playlistwin_get_width() - (x2) && \ | |
| 983 event->y >= cfg.playlist_height - (y1) && \ | |
| 984 event->y < cfg.playlist_height - (y2)) | |
| 985 | |
| 986 static void | |
| 987 playlistwin_scrolled(GtkWidget * widget, | |
| 988 GdkEventScroll * event, | |
| 989 gpointer callback_data) | |
| 990 { | |
| 991 | |
| 992 if (event->direction == GDK_SCROLL_DOWN) | |
| 993 playlistwin_scroll(cfg.scroll_pl_by); | |
| 994 | |
| 995 if (event->direction == GDK_SCROLL_UP) | |
| 996 playlistwin_scroll(-cfg.scroll_pl_by); | |
| 997 | |
|
3246
2127f7108033
- fixed some cases where the playlist wasn't redrawn
mf0102 <0102@gmx.at>
parents:
3245
diff
changeset
|
998 // deactivating this fixed a gui freeze when scrolling. -- mf0102 |
|
3959
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3512
diff
changeset
|
999 g_cond_signal(cond_scan); |
| 2313 | 1000 |
| 1001 } | |
| 1002 | |
| 1003 static gboolean | |
| 1004 playlistwin_press(GtkWidget * widget, | |
| 1005 GdkEventButton * event, | |
| 1006 gpointer callback_data) | |
| 1007 { | |
| 1008 gint xpos, ypos; | |
| 1009 GtkRequisition req; | |
| 1010 | |
| 1011 gtk_window_get_position(GTK_WINDOW(playlistwin), &xpos, &ypos); | |
| 1012 | |
| 1013 if (event->button == 1 && !cfg.show_wm_decorations && | |
| 1014 ((!cfg.playlist_shaded && | |
| 1015 event->x > playlistwin_get_width() - 20 && | |
| 1016 event->y > cfg.playlist_height - 20) || | |
| 1017 (cfg.playlist_shaded && | |
| 1018 event->x >= playlistwin_get_width() - 31 && | |
| 1019 event->x < playlistwin_get_width() - 22))) { | |
| 1020 | |
|
3107
1f5552089a50
Just a few translatable strings.
Stany HENRY <StrassBoy@gmail.com>
parents:
3068
diff
changeset
|
1021 if (event->type != GDK_2BUTTON_PRESS && |
| 2313 | 1022 event->type != GDK_3BUTTON_PRESS) { |
| 1023 playlistwin_resizing = TRUE; | |
|
2492
ea80fe9c3ba4
[svn] - use ConfigureNotify to set playlist location, a proper use of ICCCM.
nenolod
parents:
2491
diff
changeset
|
1024 playlistwin_resize_x = cfg.playlist_width - event->x; |
|
ea80fe9c3ba4
[svn] - use ConfigureNotify to set playlist location, a proper use of ICCCM.
nenolod
parents:
2491
diff
changeset
|
1025 playlistwin_resize_y = cfg.playlist_height - event->y; |
| 2313 | 1026 } |
| 1027 } | |
| 1028 else if (event->button == 1 && REGION_L(12, 37, 29, 11)) { | |
| 1029 /* ADD button menu */ | |
| 1030 gtk_widget_size_request(playlistwin_pladd_menu, &req); | |
| 1031 ui_manager_popup_menu_show(GTK_MENU(playlistwin_pladd_menu), | |
| 1032 xpos + 12, | |
| 1033 (ypos + playlistwin_get_height()) - 8 - req.height, | |
| 1034 event->button, | |
| 1035 event->time); | |
| 1036 } | |
| 1037 else if (event->button == 1 && REGION_L(41, 66, 29, 11)) { | |
| 1038 /* SUB button menu */ | |
| 1039 gtk_widget_size_request(playlistwin_pldel_menu, &req); | |
| 1040 ui_manager_popup_menu_show(GTK_MENU(playlistwin_pldel_menu), | |
| 1041 xpos + 40, | |
| 1042 (ypos + playlistwin_get_height()) - 8 - req.height, | |
| 1043 event->button, | |
| 1044 event->time); | |
| 1045 } | |
| 1046 else if (event->button == 1 && REGION_L(70, 95, 29, 11)) { | |
| 1047 /* SEL button menu */ | |
| 1048 gtk_widget_size_request(playlistwin_plsel_menu, &req); | |
| 1049 ui_manager_popup_menu_show(GTK_MENU(playlistwin_plsel_menu), | |
| 1050 xpos + 68, | |
| 1051 (ypos + playlistwin_get_height()) - 8 - req.height, | |
| 1052 event->button, | |
| 1053 event->time); | |
| 1054 } | |
| 1055 else if (event->button == 1 && REGION_L(99, 124, 29, 11)) { | |
| 1056 /* MISC button menu */ | |
| 1057 gtk_widget_size_request(playlistwin_plsort_menu, &req); | |
| 1058 ui_manager_popup_menu_show(GTK_MENU(playlistwin_plsort_menu), | |
| 1059 xpos + 100, | |
| 1060 (ypos + playlistwin_get_height()) - 8 - req.height, | |
| 1061 event->button, | |
| 1062 event->time); | |
| 1063 } | |
| 1064 else if (event->button == 1 && REGION_R(46, 23, 29, 11)) { | |
| 1065 /* LIST button menu */ | |
| 1066 gtk_widget_size_request(playlistwin_pllist_menu, &req); | |
| 1067 ui_manager_popup_menu_show(GTK_MENU(playlistwin_pllist_menu), | |
| 1068 xpos + playlistwin_get_width() - req.width - 12, | |
| 1069 (ypos + playlistwin_get_height()) - 8 - req.height, | |
| 1070 event->button, | |
| 1071 event->time); | |
| 1072 } | |
| 1073 else if (event->button == 1 && event->type == GDK_BUTTON_PRESS && | |
|
2807
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
1074 (cfg.easy_move || event->y < 14)) |
| 2313 | 1075 { |
| 1076 dock_move_press(dock_window_list, GTK_WINDOW(playlistwin), event, | |
| 1077 FALSE); | |
| 1078 gtk_window_present(GTK_WINDOW(playlistwin)); | |
| 1079 } | |
|
3218
018b37cf0730
hasta la vista old widgetcore
Tomasz Mon <desowin@gmail.com>
parents:
3217
diff
changeset
|
1080 else if (event->button == 1 && event->type == GDK_2BUTTON_PRESS |
| 2313 | 1081 && event->y < 14) { |
| 1082 /* double click on title bar */ | |
| 1083 playlistwin_shade_toggle(); | |
| 1084 if (dock_is_moving(GTK_WINDOW(playlistwin))) | |
| 1085 dock_move_release(GTK_WINDOW(playlistwin)); | |
| 1086 return TRUE; | |
| 1087 } | |
|
3358
7f6787eac9aa
right click on textboxes without connected handler should bring up audacious menu
Tomasz Mon <desowin@gmail.com>
parents:
3351
diff
changeset
|
1088 else if (event->button == 3) { |
| 2313 | 1089 /* |
| 1090 * Pop up the main menu a few pixels down to avoid | |
| 1091 * anything to be selected initially. | |
| 1092 */ | |
| 1093 ui_manager_popup_menu_show(GTK_MENU(mainwin_general_menu), event->x_root, | |
| 1094 event->y_root + 2, 3, event->time); | |
| 1095 } | |
| 1096 | |
| 1097 return FALSE; | |
| 1098 } | |
| 1099 | |
| 1100 static gboolean | |
| 1101 playlistwin_delete(GtkWidget * w, gpointer data) | |
| 1102 { | |
| 1103 playlistwin_hide(); | |
| 1104 return TRUE; | |
| 1105 } | |
| 1106 | |
|
3375
6e4944657ab9
prevent some useless redraws
Tomasz Mon <desowin@gmail.com>
parents:
3366
diff
changeset
|
1107 static gboolean |
| 3217 | 1108 playlistwin_keypress_up_down_handler(UiSkinnedPlaylist * pl, |
| 2313 | 1109 gboolean up, guint state) |
| 1110 { | |
| 1111 Playlist *playlist = playlist_get_active(); | |
|
3375
6e4944657ab9
prevent some useless redraws
Tomasz Mon <desowin@gmail.com>
parents:
3366
diff
changeset
|
1112 if ((!(pl->prev_selected || pl->first) && up) || |
|
6e4944657ab9
prevent some useless redraws
Tomasz Mon <desowin@gmail.com>
parents:
3366
diff
changeset
|
1113 ((pl->prev_selected >= playlist_get_length(playlist) - 1) && !up)) |
|
6e4944657ab9
prevent some useless redraws
Tomasz Mon <desowin@gmail.com>
parents:
3366
diff
changeset
|
1114 return FALSE; |
| 2313 | 1115 |
| 1116 if ((state & GDK_MOD1_MASK) && (state & GDK_SHIFT_MASK)) | |
|
3375
6e4944657ab9
prevent some useless redraws
Tomasz Mon <desowin@gmail.com>
parents:
3366
diff
changeset
|
1117 return FALSE; |
| 2313 | 1118 if (!(state & GDK_MOD1_MASK)) |
| 1119 playlist_select_all(playlist, FALSE); | |
| 1120 | |
| 3217 | 1121 if (pl->prev_selected == -1 || |
| 1122 (!playlistwin_item_visible(pl->prev_selected) && | |
| 1123 !(state & GDK_SHIFT_MASK && pl->prev_min != -1))) { | |
| 1124 pl->prev_selected = pl->first; | |
| 2313 | 1125 } |
| 1126 else if (state & GDK_SHIFT_MASK) { | |
| 3217 | 1127 if (pl->prev_min == -1) { |
| 1128 pl->prev_max = pl->prev_selected; | |
| 1129 pl->prev_min = pl->prev_selected; | |
| 2313 | 1130 } |
| 3217 | 1131 pl->prev_max += (up ? -1 : 1); |
| 1132 pl->prev_max = | |
| 1133 CLAMP(pl->prev_max, 0, playlist_get_length(playlist) - 1); | |
| 2313 | 1134 |
| 3217 | 1135 pl->first = MIN(pl->first, pl->prev_max); |
| 1136 pl->first = MAX(pl->first, pl->prev_max - | |
| 1137 pl->num_visible + 1); | |
| 1138 playlist_select_range(playlist, pl->prev_min, pl->prev_max, TRUE); | |
|
3375
6e4944657ab9
prevent some useless redraws
Tomasz Mon <desowin@gmail.com>
parents:
3366
diff
changeset
|
1139 return TRUE; |
| 2313 | 1140 } |
| 1141 else if (state & GDK_MOD1_MASK) { | |
| 1142 if (up) | |
| 3217 | 1143 ui_skinned_playlist_move_up(pl); |
| 2313 | 1144 else |
| 3217 | 1145 ui_skinned_playlist_move_down(pl); |
| 1146 if (pl->prev_min < pl->first) | |
| 1147 pl->first = pl->prev_min; | |
| 1148 else if (pl->prev_max >= (pl->first + pl->num_visible)) | |
| 1149 pl->first = pl->prev_max - pl->num_visible + 1; | |
|
3375
6e4944657ab9
prevent some useless redraws
Tomasz Mon <desowin@gmail.com>
parents:
3366
diff
changeset
|
1150 return TRUE; |
| 2313 | 1151 } |
| 1152 else if (up) | |
| 3217 | 1153 pl->prev_selected--; |
| 2313 | 1154 else |
| 3217 | 1155 pl->prev_selected++; |
| 2313 | 1156 |
| 3217 | 1157 pl->prev_selected = |
| 1158 CLAMP(pl->prev_selected, 0, playlist_get_length(playlist) - 1); | |
| 2313 | 1159 |
| 3217 | 1160 if (pl->prev_selected < pl->first) |
| 1161 pl->first--; | |
| 1162 else if (pl->prev_selected >= (pl->first + pl->num_visible)) | |
| 1163 pl->first++; | |
| 2313 | 1164 |
| 3217 | 1165 playlist_select_range(playlist, pl->prev_selected, pl->prev_selected, TRUE); |
| 1166 pl->prev_min = -1; | |
|
3375
6e4944657ab9
prevent some useless redraws
Tomasz Mon <desowin@gmail.com>
parents:
3366
diff
changeset
|
1167 |
|
6e4944657ab9
prevent some useless redraws
Tomasz Mon <desowin@gmail.com>
parents:
3366
diff
changeset
|
1168 return TRUE; |
| 2313 | 1169 } |
| 1170 | |
| 1171 /* FIXME: Handle the keys through menu */ | |
| 1172 | |
| 1173 static gboolean | |
| 1174 playlistwin_keypress(GtkWidget * w, GdkEventKey * event, gpointer data) | |
| 1175 { | |
| 1176 Playlist *playlist = playlist_get_active(); | |
| 1177 | |
| 1178 guint keyval; | |
| 1179 gboolean refresh = FALSE; | |
| 1180 | |
| 1181 if (cfg.playlist_shaded) | |
| 1182 return FALSE; | |
| 1183 | |
| 1184 switch (keyval = event->keyval) { | |
| 1185 case GDK_KP_Up: | |
| 1186 case GDK_KP_Down: | |
| 1187 case GDK_Up: | |
| 1188 case GDK_Down: | |
|
3375
6e4944657ab9
prevent some useless redraws
Tomasz Mon <desowin@gmail.com>
parents:
3366
diff
changeset
|
1189 refresh = playlistwin_keypress_up_down_handler(UI_SKINNED_PLAYLIST(playlistwin_list), |
|
6e4944657ab9
prevent some useless redraws
Tomasz Mon <desowin@gmail.com>
parents:
3366
diff
changeset
|
1190 keyval == GDK_Up |
|
6e4944657ab9
prevent some useless redraws
Tomasz Mon <desowin@gmail.com>
parents:
3366
diff
changeset
|
1191 || keyval == GDK_KP_Up, |
|
6e4944657ab9
prevent some useless redraws
Tomasz Mon <desowin@gmail.com>
parents:
3366
diff
changeset
|
1192 event->state); |
| 2313 | 1193 break; |
| 1194 case GDK_Page_Up: | |
| 3217 | 1195 playlistwin_scroll(-UI_SKINNED_PLAYLIST(playlistwin_list)->num_visible); |
| 2313 | 1196 refresh = TRUE; |
| 1197 break; | |
| 1198 case GDK_Page_Down: | |
| 3217 | 1199 playlistwin_scroll(UI_SKINNED_PLAYLIST(playlistwin_list)->num_visible); |
| 2313 | 1200 refresh = TRUE; |
| 1201 break; | |
| 1202 case GDK_Home: | |
| 3217 | 1203 UI_SKINNED_PLAYLIST(playlistwin_list)->first = 0; |
| 2313 | 1204 refresh = TRUE; |
| 1205 break; | |
| 1206 case GDK_End: | |
| 3217 | 1207 UI_SKINNED_PLAYLIST(playlistwin_list)->first = |
| 1208 playlist_get_length(playlist) - UI_SKINNED_PLAYLIST(playlistwin_list)->num_visible; | |
| 2313 | 1209 refresh = TRUE; |
| 1210 break; | |
| 1211 case GDK_Return: | |
| 3217 | 1212 if (UI_SKINNED_PLAYLIST(playlistwin_list)->prev_selected > -1 |
| 1213 && playlistwin_item_visible(UI_SKINNED_PLAYLIST(playlistwin_list)->prev_selected)) { | |
| 1214 playlist_set_position(playlist, UI_SKINNED_PLAYLIST(playlistwin_list)->prev_selected); | |
| 2313 | 1215 if (!playback_get_playing()) |
| 1216 playback_initiate(); | |
| 1217 } | |
|
3246
2127f7108033
- fixed some cases where the playlist wasn't redrawn
mf0102 <0102@gmx.at>
parents:
3245
diff
changeset
|
1218 refresh = TRUE; |
| 2313 | 1219 break; |
| 1220 case GDK_3: | |
| 1221 if (event->state & GDK_CONTROL_MASK) | |
| 1222 playlistwin_fileinfo(); | |
| 1223 break; | |
| 1224 case GDK_Delete: | |
| 1225 if (event->state & GDK_CONTROL_MASK) | |
| 1226 playlist_delete(playlist, TRUE); | |
| 1227 else | |
| 1228 playlist_delete(playlist, FALSE); | |
| 1229 break; | |
| 1230 case GDK_Insert: | |
| 1231 if (event->state & GDK_MOD1_MASK) | |
| 1232 mainwin_show_add_url_window(); | |
| 1233 else | |
| 1234 playlistwin_show_filebrowser(); | |
| 1235 break; | |
| 1236 case GDK_Left: | |
| 1237 case GDK_KP_Left: | |
| 1238 case GDK_KP_7: | |
| 1239 if (playlist_get_current_length(playlist) != -1) | |
| 1240 playback_seek(CLAMP | |
| 1241 (playback_get_time() - 5000, 0, | |
| 1242 playlist_get_current_length(playlist)) / 1000); | |
| 1243 break; | |
| 1244 case GDK_Right: | |
| 1245 case GDK_KP_Right: | |
| 1246 case GDK_KP_9: | |
| 1247 if (playlist_get_current_length(playlist) != -1) | |
| 1248 playback_seek(CLAMP | |
| 1249 (playback_get_time() + 5000, 0, | |
| 1250 playlist_get_current_length(playlist)) / 1000); | |
| 1251 break; | |
| 1252 case GDK_KP_4: | |
| 1253 playlist_prev(playlist); | |
| 1254 break; | |
| 1255 case GDK_KP_6: | |
| 1256 playlist_next(playlist); | |
| 1257 break; | |
| 1258 | |
| 1259 case GDK_Escape: | |
| 1260 mainwin_minimize_cb(); | |
| 1261 break; | |
|
3350
1292e4ca0f08
press ctrl+tab to switch between windows
Tomasz Mon <desowin@gmail.com>
parents:
3312
diff
changeset
|
1262 case GDK_Tab: |
|
1292e4ca0f08
press ctrl+tab to switch between windows
Tomasz Mon <desowin@gmail.com>
parents:
3312
diff
changeset
|
1263 if (event->state & GDK_CONTROL_MASK) |
|
1292e4ca0f08
press ctrl+tab to switch between windows
Tomasz Mon <desowin@gmail.com>
parents:
3312
diff
changeset
|
1264 gtk_window_present(GTK_WINDOW(mainwin)); |
|
1292e4ca0f08
press ctrl+tab to switch between windows
Tomasz Mon <desowin@gmail.com>
parents:
3312
diff
changeset
|
1265 break; |
| 2313 | 1266 default: |
| 1267 return FALSE; | |
| 1268 } | |
| 1269 | |
| 1270 if (refresh) { | |
|
3246
2127f7108033
- fixed some cases where the playlist wasn't redrawn
mf0102 <0102@gmx.at>
parents:
3245
diff
changeset
|
1271 // fixes keyboard scrolling gui freeze for me. -- mf0102 |
|
3959
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3512
diff
changeset
|
1272 g_cond_signal(cond_scan); |
| 2313 | 1273 playlistwin_update_list(playlist_get_active()); |
| 1274 } | |
| 1275 | |
| 1276 return TRUE; | |
| 1277 } | |
| 1278 | |
| 1279 void | |
| 1280 playlistwin_hide_timer(void) | |
| 1281 { | |
|
2943
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2904
diff
changeset
|
1282 ui_skinned_textbox_set_text(playlistwin_time_min, " "); |
|
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2904
diff
changeset
|
1283 ui_skinned_textbox_set_text(playlistwin_time_sec, " "); |
| 2313 | 1284 } |
| 1285 | |
| 1286 void | |
| 1287 playlistwin_set_time(gint time, gint length, TimerMode mode) | |
| 1288 { | |
| 1289 gchar *text, sign; | |
| 1290 | |
| 1291 if (mode == TIMER_REMAINING && length != -1) { | |
| 1292 time = length - time; | |
| 1293 sign = '-'; | |
| 1294 } | |
| 1295 else | |
| 1296 sign = ' '; | |
| 1297 | |
| 1298 time /= 1000; | |
| 1299 | |
| 1300 if (time < 0) | |
| 1301 time = 0; | |
| 1302 if (time > 99 * 60) | |
| 1303 time /= 60; | |
| 1304 | |
| 1305 text = g_strdup_printf("%c%-2.2d", sign, time / 60); | |
|
2943
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2904
diff
changeset
|
1306 ui_skinned_textbox_set_text(playlistwin_time_min, text); |
| 2313 | 1307 g_free(text); |
| 1308 | |
| 1309 text = g_strdup_printf("%-2.2d", time % 60); | |
|
2943
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2904
diff
changeset
|
1310 ui_skinned_textbox_set_text(playlistwin_time_sec, text); |
| 2313 | 1311 g_free(text); |
| 1312 } | |
| 1313 | |
| 1314 static void | |
| 1315 playlistwin_drag_motion(GtkWidget * widget, | |
| 1316 GdkDragContext * context, | |
| 1317 gint x, gint y, | |
| 1318 GtkSelectionData * selection_data, | |
| 1319 guint info, guint time, gpointer user_data) | |
| 1320 { | |
| 3217 | 1321 UI_SKINNED_PLAYLIST(playlistwin_list)->drag_motion = TRUE; |
| 1322 UI_SKINNED_PLAYLIST(playlistwin_list)->drag_motion_x = x; | |
| 1323 UI_SKINNED_PLAYLIST(playlistwin_list)->drag_motion_y = y; | |
| 2313 | 1324 playlistwin_update_list(playlist_get_active()); |
| 1325 playlistwin_hint_flag = TRUE; | |
| 1326 } | |
| 1327 | |
| 1328 static void | |
| 1329 playlistwin_drag_end(GtkWidget * widget, | |
| 1330 GdkDragContext * context, gpointer user_data) | |
| 1331 { | |
| 3217 | 1332 UI_SKINNED_PLAYLIST(playlistwin_list)->drag_motion = FALSE; |
| 2313 | 1333 playlistwin_hint_flag = FALSE; |
| 1334 playlistwin_update_list(playlist_get_active()); | |
| 1335 } | |
| 1336 | |
| 1337 static void | |
| 1338 playlistwin_drag_data_received(GtkWidget * widget, | |
| 1339 GdkDragContext * context, | |
| 1340 gint x, gint y, | |
| 1341 GtkSelectionData * | |
| 1342 selection_data, guint info, | |
| 1343 guint time, gpointer user_data) | |
| 1344 { | |
| 1345 gint pos; | |
| 1346 Playlist *playlist = playlist_get_active(); | |
| 1347 | |
| 2363 | 1348 g_return_if_fail(selection_data); |
| 2313 | 1349 |
| 1350 if (!selection_data->data) { | |
| 1351 g_message("Received no DND data!"); | |
| 1352 return; | |
| 1353 } | |
| 3217 | 1354 if (x < playlistwin_get_width() - 20 || y < cfg.playlist_height - 38) { |
| 1355 pos = y / UI_SKINNED_PLAYLIST(playlistwin_list)->fheight + UI_SKINNED_PLAYLIST(playlistwin_list)->first; | |
| 2313 | 1356 |
| 1357 pos = MIN(pos, playlist_get_length(playlist)); | |
| 1358 playlist_ins_url(playlist, (gchar *) selection_data->data, pos); | |
| 1359 } | |
| 1360 else | |
| 1361 playlist_add_url(playlist, (gchar *) selection_data->data); | |
| 1362 } | |
| 1363 | |
| 1364 static void | |
| 1365 local_playlist_prev(void) | |
| 1366 { | |
| 1367 playlist_prev(playlist_get_active()); | |
| 1368 } | |
| 1369 | |
| 1370 static void | |
| 1371 local_playlist_next(void) | |
| 1372 { | |
| 1373 playlist_next(playlist_get_active()); | |
| 1374 } | |
| 1375 | |
| 1376 static void | |
| 1377 playlistwin_create_widgets(void) | |
| 1378 { | |
| 1379 /* This function creates the custom widgets used by the playlist editor */ | |
| 1380 | |
| 1381 /* text box for displaying song title in shaded mode */ | |
|
3107
1f5552089a50
Just a few translatable strings.
Stany HENRY <StrassBoy@gmail.com>
parents:
3068
diff
changeset
|
1382 playlistwin_sinfo = ui_skinned_textbox_new(SKINNED_WINDOW(playlistwin)->fixed, |
|
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1383 4, 4, playlistwin_get_width() - 35, TRUE, SKIN_TEXT); |
| 2313 | 1384 |
| 1385 playlistwin_set_sinfo_font(cfg.playlist_font); | |
| 1386 | |
|
2901
5ed0674fabd6
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
1387 playlistwin_shade = ui_skinned_button_new(); |
| 2313 | 1388 /* shade/unshade window push button */ |
| 1389 if (cfg.playlist_shaded) | |
|
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1390 ui_skinned_push_button_setup(playlistwin_shade, SKINNED_WINDOW(playlistwin)->fixed, |
|
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1391 playlistwin_get_width() - 21, 3, |
|
2901
5ed0674fabd6
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
1392 9, 9, 128, 45, 150, 42, SKIN_PLEDIT); |
| 2313 | 1393 else |
|
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1394 ui_skinned_push_button_setup(playlistwin_shade, SKINNED_WINDOW(playlistwin)->fixed, |
|
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1395 playlistwin_get_width() - 21, 3, |
|
2901
5ed0674fabd6
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
1396 9, 9, 157, 3, 62, 42, SKIN_PLEDIT); |
| 2313 | 1397 |
|
2901
5ed0674fabd6
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
1398 g_signal_connect(playlistwin_shade, "clicked", playlistwin_shade_toggle, NULL ); |
| 2313 | 1399 |
| 1400 /* close window push button */ | |
|
2901
5ed0674fabd6
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
1401 playlistwin_close = ui_skinned_button_new(); |
|
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1402 ui_skinned_push_button_setup(playlistwin_close, SKINNED_WINDOW(playlistwin)->fixed, |
|
2901
5ed0674fabd6
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
1403 playlistwin_get_width() - 11, 3, 9, 9, |
|
5ed0674fabd6
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
1404 cfg.playlist_shaded ? 138 : 167, |
|
5ed0674fabd6
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
1405 cfg.playlist_shaded ? 45 : 3, 52, 42, SKIN_PLEDIT); |
|
5ed0674fabd6
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
1406 |
|
5ed0674fabd6
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
1407 g_signal_connect(playlistwin_close, "clicked", playlistwin_hide, NULL ); |
|
5ed0674fabd6
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
1408 |
| 2313 | 1409 /* playlist list box */ |
| 3217 | 1410 playlistwin_list = ui_skinned_playlist_new(SKINNED_WINDOW(playlistwin)->fixed, 12, 20, |
| 2313 | 1411 playlistwin_get_width() - 31, |
| 1412 cfg.playlist_height - 58); | |
| 3217 | 1413 ui_skinned_playlist_set_font(cfg.playlist_font); |
| 2313 | 1414 |
| 1415 /* playlist list box slider */ | |
|
3135
7cdcf8ab08da
replace PlaylistSlider with UiSkinnedPlaylistSlider
Tomasz Mon <desowin@gmail.com>
parents:
3123
diff
changeset
|
1416 playlistwin_slider = ui_skinned_playlist_slider_new(SKINNED_WINDOW(playlistwin)->fixed, playlistwin_get_width() - 15, |
|
7cdcf8ab08da
replace PlaylistSlider with UiSkinnedPlaylistSlider
Tomasz Mon <desowin@gmail.com>
parents:
3123
diff
changeset
|
1417 20, cfg.playlist_height - 58); |
|
2528
60f2787cc7fd
[svn] - playlist editor: use SkinnedWindow widgetlist
nenolod
parents:
2527
diff
changeset
|
1418 |
| 2313 | 1419 /* track time (minute) */ |
|
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1420 playlistwin_time_min = ui_skinned_textbox_new(SKINNED_WINDOW(playlistwin)->fixed, |
| 2313 | 1421 playlistwin_get_width() - 82, |
| 1422 cfg.playlist_height - 15, 15, FALSE, SKIN_TEXT); | |
|
3366
ac752b5db631
introduce change_timer_mode_cb
Tomasz Mon <desowin@gmail.com>
parents:
3365
diff
changeset
|
1423 g_signal_connect(playlistwin_time_min, "button-press-event", G_CALLBACK(change_timer_mode_cb), NULL); |
| 2313 | 1424 |
| 1425 /* track time (second) */ | |
|
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1426 playlistwin_time_sec = ui_skinned_textbox_new(SKINNED_WINDOW(playlistwin)->fixed, |
| 2313 | 1427 playlistwin_get_width() - 64, |
| 1428 cfg.playlist_height - 15, 10, FALSE, SKIN_TEXT); | |
|
3366
ac752b5db631
introduce change_timer_mode_cb
Tomasz Mon <desowin@gmail.com>
parents:
3365
diff
changeset
|
1429 g_signal_connect(playlistwin_time_sec, "button-press-event", G_CALLBACK(change_timer_mode_cb), NULL); |
| 2313 | 1430 |
| 1431 /* playlist information (current track length / total track length) */ | |
|
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1432 playlistwin_info = ui_skinned_textbox_new(SKINNED_WINDOW(playlistwin)->fixed, |
| 2313 | 1433 playlistwin_get_width() - 143, |
| 1434 cfg.playlist_height - 28, 90, FALSE, SKIN_TEXT); | |
| 1435 | |
| 1436 /* mini play control buttons at right bottom corner */ | |
| 1437 | |
| 1438 /* rewind button */ | |
|
2902
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1439 playlistwin_srew = ui_skinned_button_new(); |
|
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1440 ui_skinned_small_button_setup(playlistwin_srew, SKINNED_WINDOW(playlistwin)->fixed, |
|
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1441 playlistwin_get_width() - 144, |
|
2902
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1442 cfg.playlist_height - 16, 8, 7); |
|
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1443 g_signal_connect(playlistwin_srew, "clicked", local_playlist_prev, NULL); |
| 2313 | 1444 |
| 1445 /* play button */ | |
|
2902
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1446 playlistwin_splay = ui_skinned_button_new(); |
|
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1447 ui_skinned_small_button_setup(playlistwin_splay, SKINNED_WINDOW(playlistwin)->fixed, |
|
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1448 playlistwin_get_width() - 138, |
|
2902
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1449 cfg.playlist_height - 16, 10, 7); |
|
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1450 g_signal_connect(playlistwin_splay, "clicked", mainwin_play_pushed, NULL); |
| 2313 | 1451 |
| 1452 /* pause button */ | |
|
2902
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1453 playlistwin_spause = ui_skinned_button_new(); |
|
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1454 ui_skinned_small_button_setup(playlistwin_spause, SKINNED_WINDOW(playlistwin)->fixed, |
|
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1455 playlistwin_get_width() - 128, |
|
2902
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1456 cfg.playlist_height - 16, 10, 7); |
|
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1457 g_signal_connect(playlistwin_spause, "clicked", playback_pause, NULL); |
| 2313 | 1458 |
| 1459 /* stop button */ | |
|
2902
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1460 playlistwin_sstop = ui_skinned_button_new(); |
|
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1461 ui_skinned_small_button_setup(playlistwin_sstop, SKINNED_WINDOW(playlistwin)->fixed, |
|
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1462 playlistwin_get_width() - 118, |
|
2902
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1463 cfg.playlist_height - 16, 9, 7); |
|
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1464 g_signal_connect(playlistwin_sstop, "clicked", mainwin_stop_pushed, NULL); |
| 2313 | 1465 |
| 1466 /* forward button */ | |
|
2902
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1467 playlistwin_sfwd = ui_skinned_button_new(); |
|
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1468 ui_skinned_small_button_setup(playlistwin_sfwd, SKINNED_WINDOW(playlistwin)->fixed, |
|
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1469 playlistwin_get_width() - 109, |
|
2902
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1470 cfg.playlist_height - 16, 8, 7); |
|
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1471 g_signal_connect(playlistwin_sfwd, "clicked", local_playlist_next, NULL); |
| 2313 | 1472 |
| 1473 /* eject button */ | |
|
2902
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1474 playlistwin_seject = ui_skinned_button_new(); |
|
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1475 ui_skinned_small_button_setup(playlistwin_seject, SKINNED_WINDOW(playlistwin)->fixed, |
|
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1476 playlistwin_get_width() - 100, |
|
2902
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1477 cfg.playlist_height - 16, 9, 7); |
|
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1478 g_signal_connect(playlistwin_seject, "clicked", mainwin_eject_pushed, NULL); |
| 2313 | 1479 |
|
2902
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1480 playlistwin_sscroll_up = ui_skinned_button_new(); |
|
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1481 ui_skinned_small_button_setup(playlistwin_sscroll_up, SKINNED_WINDOW(playlistwin)->fixed, |
|
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1482 playlistwin_get_width() - 14, |
|
2902
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1483 cfg.playlist_height - 35, 8, 5); |
|
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1484 g_signal_connect(playlistwin_sscroll_up, "clicked", playlistwin_scroll_up_pushed, NULL); |
|
2528
60f2787cc7fd
[svn] - playlist editor: use SkinnedWindow widgetlist
nenolod
parents:
2527
diff
changeset
|
1485 |
|
2902
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1486 playlistwin_sscroll_down = ui_skinned_button_new(); |
|
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1487 ui_skinned_small_button_setup(playlistwin_sscroll_down, SKINNED_WINDOW(playlistwin)->fixed, |
|
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1488 playlistwin_get_width() - 14, |
|
2902
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1489 cfg.playlist_height - 30, 8, 5); |
|
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1490 g_signal_connect(playlistwin_sscroll_down, "clicked", playlistwin_scroll_down_pushed, NULL); |
| 2313 | 1491 } |
| 1492 | |
| 1493 static void | |
| 1494 selection_received(GtkWidget * widget, | |
| 1495 GtkSelectionData * selection_data, gpointer data) | |
| 1496 { | |
| 1497 if (selection_data->type == GDK_SELECTION_TYPE_STRING && | |
| 1498 selection_data->length > 0) | |
| 1499 playlist_add_url(playlist_get_active(), (gchar *) selection_data->data); | |
| 1500 } | |
| 1501 | |
| 1502 static void | |
| 1503 playlistwin_create_window(void) | |
| 1504 { | |
| 1505 GdkPixbuf *icon; | |
| 1506 | |
|
3068
c5189bc4100b
Refactor skinned window code.
William Pitcock <nenolod@atheme-project.org>
parents:
3065
diff
changeset
|
1507 playlistwin = ui_skinned_window_new("playlist"); |
| 2313 | 1508 gtk_window_set_title(GTK_WINDOW(playlistwin), _("Audacious Playlist Editor")); |
| 1509 gtk_window_set_role(GTK_WINDOW(playlistwin), "playlist"); | |
| 1510 gtk_window_set_default_size(GTK_WINDOW(playlistwin), | |
| 1511 playlistwin_get_width(), | |
| 1512 playlistwin_get_height()); | |
| 1513 gtk_window_set_resizable(GTK_WINDOW(playlistwin), TRUE); | |
| 1514 playlistwin_set_geometry_hints(cfg.playlist_shaded); | |
| 1515 | |
| 1516 gtk_window_set_transient_for(GTK_WINDOW(playlistwin), | |
| 1517 GTK_WINDOW(mainwin)); | |
| 1518 gtk_window_set_skip_taskbar_hint(GTK_WINDOW(playlistwin), TRUE); | |
| 1519 | |
| 1520 icon = gdk_pixbuf_new_from_xpm_data((const gchar **) bmp_playlist_icon); | |
| 1521 gtk_window_set_icon(GTK_WINDOW(playlistwin), icon); | |
| 1522 g_object_unref(icon); | |
| 1523 | |
| 1524 gtk_widget_set_app_paintable(playlistwin, TRUE); | |
| 1525 | |
| 1526 if (cfg.playlist_x != -1 && cfg.save_window_position) | |
| 1527 gtk_window_move(GTK_WINDOW(playlistwin), | |
| 1528 cfg.playlist_x, cfg.playlist_y); | |
| 1529 | |
| 1530 gtk_widget_add_events(playlistwin, GDK_POINTER_MOTION_MASK | | |
| 1531 GDK_FOCUS_CHANGE_MASK | GDK_BUTTON_MOTION_MASK | | |
| 1532 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | | |
| 1533 GDK_SCROLL_MASK | GDK_VISIBILITY_NOTIFY_MASK); | |
| 1534 gtk_widget_realize(playlistwin); | |
| 1535 | |
| 1536 g_signal_connect(playlistwin, "delete_event", | |
| 1537 G_CALLBACK(playlistwin_delete), NULL); | |
| 1538 g_signal_connect(playlistwin, "button_press_event", | |
| 1539 G_CALLBACK(playlistwin_press), NULL); | |
| 1540 g_signal_connect(playlistwin, "button_release_event", | |
| 1541 G_CALLBACK(playlistwin_release), NULL); | |
| 1542 g_signal_connect(playlistwin, "scroll_event", | |
| 1543 G_CALLBACK(playlistwin_scrolled), NULL); | |
| 1544 g_signal_connect(playlistwin, "motion_notify_event", | |
| 1545 G_CALLBACK(playlistwin_motion), NULL); | |
| 1546 | |
| 1547 bmp_drag_dest_set(playlistwin); | |
| 1548 | |
| 1549 /* DnD stuff */ | |
| 1550 g_signal_connect(playlistwin, "drag-leave", | |
| 1551 G_CALLBACK(playlistwin_drag_end), NULL); | |
| 1552 g_signal_connect(playlistwin, "drag-data-delete", | |
| 1553 G_CALLBACK(playlistwin_drag_end), NULL); | |
| 1554 g_signal_connect(playlistwin, "drag-end", | |
| 1555 G_CALLBACK(playlistwin_drag_end), NULL); | |
| 1556 g_signal_connect(playlistwin, "drag-drop", | |
| 1557 G_CALLBACK(playlistwin_drag_end), NULL); | |
| 1558 g_signal_connect(playlistwin, "drag-data-received", | |
| 1559 G_CALLBACK(playlistwin_drag_data_received), NULL); | |
| 1560 g_signal_connect(playlistwin, "drag-motion", | |
| 1561 G_CALLBACK(playlistwin_drag_motion), NULL); | |
| 1562 | |
| 1563 g_signal_connect(playlistwin, "key_press_event", | |
| 1564 G_CALLBACK(playlistwin_keypress), NULL); | |
| 1565 g_signal_connect(playlistwin, "selection_received", | |
| 1566 G_CALLBACK(selection_received), NULL); | |
| 1567 | |
| 1568 playlistwin_set_mask(); | |
| 1569 } | |
| 1570 | |
| 1571 void | |
| 1572 playlistwin_create(void) | |
| 1573 { | |
|
3137
19908efce4e5
one mutex is enough for resizing
Tomasz Mon <desowin@gmail.com>
parents:
3135
diff
changeset
|
1574 resize_mutex = g_mutex_new(); |
| 2313 | 1575 playlistwin_create_window(); |
| 1576 | |
| 1577 playlistwin_create_widgets(); | |
| 1578 playlistwin_update_info(playlist_get_active()); | |
| 1579 | |
| 1580 gtk_window_add_accel_group(GTK_WINDOW(playlistwin), ui_manager_get_accel_group()); | |
| 1581 } | |
| 1582 | |
| 1583 | |
| 1584 void | |
| 1585 playlistwin_show(void) | |
| 1586 { | |
|
3311
8560d99e36be
revise ui_skinned_window_configure
Tomasz Mon <desowin@gmail.com>
parents:
3298
diff
changeset
|
1587 gtk_window_move(GTK_WINDOW(playlistwin), cfg.playlist_x, cfg.playlist_y); |
| 2313 | 1588 GtkAction *action = gtk_action_group_get_action( |
| 1589 toggleaction_group_others , "show playlist editor" ); | |
| 1590 gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(action) , TRUE ); | |
| 1591 | |
| 1592 cfg.playlist_visible = TRUE; | |
|
2901
5ed0674fabd6
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
1593 UI_SKINNED_BUTTON(mainwin_pl)->inside = TRUE; |
|
2999
e6340ab753a1
replace calling redraw signals with gtk_widget_queue_draw()
Tomasz Mon <desowin@gmail.com>
parents:
2980
diff
changeset
|
1594 gtk_widget_queue_draw(mainwin_pl); |
| 2313 | 1595 |
| 1596 playlistwin_set_toprow(0); | |
| 1597 playlist_check_pos_current(playlist_get_active()); | |
| 1598 | |
|
2901
5ed0674fabd6
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
1599 gtk_widget_show_all(playlistwin); |
|
2943
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2904
diff
changeset
|
1600 if (!cfg.playlist_shaded) |
|
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2904
diff
changeset
|
1601 gtk_widget_hide(playlistwin_sinfo); |
|
2901
5ed0674fabd6
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
1602 gtk_window_present(GTK_WINDOW(playlistwin)); |
| 2313 | 1603 } |
| 1604 | |
| 1605 void | |
| 1606 playlistwin_hide(void) | |
| 1607 { | |
| 1608 GtkAction *action = gtk_action_group_get_action( | |
| 1609 toggleaction_group_others , "show playlist editor" ); | |
| 1610 gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(action) , FALSE ); | |
| 1611 | |
| 1612 gtk_widget_hide(playlistwin); | |
| 1613 cfg.playlist_visible = FALSE; | |
|
2901
5ed0674fabd6
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
1614 UI_SKINNED_BUTTON(mainwin_pl)->inside = FALSE; |
|
2999
e6340ab753a1
replace calling redraw signals with gtk_widget_queue_draw()
Tomasz Mon <desowin@gmail.com>
parents:
2980
diff
changeset
|
1615 gtk_widget_queue_draw(mainwin_pl); |
| 2313 | 1616 |
|
2338
d0a04f1ee732
[svn] - in playlistwin_hide(), pass focus to the player main window only if it's visible
giacomo
parents:
2328
diff
changeset
|
1617 if ( cfg.player_visible ) |
|
d0a04f1ee732
[svn] - in playlistwin_hide(), pass focus to the player main window only if it's visible
giacomo
parents:
2328
diff
changeset
|
1618 { |
|
d0a04f1ee732
[svn] - in playlistwin_hide(), pass focus to the player main window only if it's visible
giacomo
parents:
2328
diff
changeset
|
1619 gtk_window_present(GTK_WINDOW(mainwin)); |
|
d0a04f1ee732
[svn] - in playlistwin_hide(), pass focus to the player main window only if it's visible
giacomo
parents:
2328
diff
changeset
|
1620 gtk_widget_grab_focus(mainwin); |
|
d0a04f1ee732
[svn] - in playlistwin_hide(), pass focus to the player main window only if it's visible
giacomo
parents:
2328
diff
changeset
|
1621 } |
| 2313 | 1622 } |
| 1623 | |
| 1624 void action_playlist_track_info(void) | |
| 1625 { | |
| 1626 playlistwin_fileinfo(); | |
| 1627 } | |
| 1628 | |
| 1629 void action_queue_toggle(void) | |
| 1630 { | |
| 1631 playlist_queue(playlist_get_active()); | |
| 1632 } | |
| 1633 | |
| 1634 void action_playlist_sort_by_playlist_entry(void) | |
| 1635 { | |
| 1636 Playlist *playlist = playlist_get_active(); | |
| 1637 | |
| 1638 playlist_sort(playlist, PLAYLIST_SORT_PLAYLIST); | |
| 1639 playlistwin_update_list(playlist); | |
| 1640 } | |
| 1641 | |
| 1642 void action_playlist_sort_by_track_number(void) | |
| 1643 { | |
| 1644 Playlist *playlist = playlist_get_active(); | |
| 1645 | |
| 1646 playlist_sort(playlist, PLAYLIST_SORT_TRACK); | |
| 1647 playlistwin_update_list(playlist); | |
| 1648 } | |
| 1649 | |
| 1650 void action_playlist_sort_by_title(void) | |
| 1651 { | |
| 1652 Playlist *playlist = playlist_get_active(); | |
| 1653 | |
| 1654 playlist_sort(playlist, PLAYLIST_SORT_TITLE); | |
| 1655 playlistwin_update_list(playlist); | |
| 1656 } | |
| 1657 | |
| 1658 void action_playlist_sort_by_artist(void) | |
| 1659 { | |
| 1660 Playlist *playlist = playlist_get_active(); | |
| 1661 | |
| 1662 playlist_sort(playlist, PLAYLIST_SORT_ARTIST); | |
| 1663 playlistwin_update_list(playlist); | |
| 1664 } | |
| 1665 | |
| 1666 void action_playlist_sort_by_full_path(void) | |
| 1667 { | |
| 1668 Playlist *playlist = playlist_get_active(); | |
| 1669 | |
| 1670 playlist_sort(playlist, PLAYLIST_SORT_PATH); | |
| 1671 playlistwin_update_list(playlist); | |
| 1672 } | |
| 1673 | |
| 1674 void action_playlist_sort_by_date(void) | |
| 1675 { | |
| 1676 Playlist *playlist = playlist_get_active(); | |
| 1677 | |
| 1678 playlist_sort(playlist, PLAYLIST_SORT_DATE); | |
| 1679 playlistwin_update_list(playlist); | |
| 1680 } | |
| 1681 | |
| 1682 void action_playlist_sort_by_filename(void) | |
| 1683 { | |
| 1684 Playlist *playlist = playlist_get_active(); | |
| 1685 | |
| 1686 playlist_sort(playlist, PLAYLIST_SORT_FILENAME); | |
| 1687 playlistwin_update_list(playlist); | |
| 1688 } | |
| 1689 | |
| 1690 void action_playlist_sort_selected_by_playlist_entry(void) | |
| 1691 { | |
| 1692 Playlist *playlist = playlist_get_active(); | |
| 1693 | |
| 1694 playlist_sort_selected(playlist, PLAYLIST_SORT_PLAYLIST); | |
| 1695 playlistwin_update_list(playlist); | |
| 1696 } | |
| 1697 | |
| 1698 void action_playlist_sort_selected_by_track_number(void) | |
| 1699 { | |
| 1700 Playlist *playlist = playlist_get_active(); | |
| 1701 | |
| 1702 playlist_sort_selected(playlist, PLAYLIST_SORT_TRACK); | |
| 1703 playlistwin_update_list(playlist); | |
| 1704 } | |
| 1705 | |
| 1706 void action_playlist_sort_selected_by_title(void) | |
| 1707 { | |
| 1708 Playlist *playlist = playlist_get_active(); | |
| 1709 | |
| 1710 playlist_sort_selected(playlist, PLAYLIST_SORT_TITLE); | |
| 1711 playlistwin_update_list(playlist); | |
| 1712 } | |
| 1713 | |
| 1714 void action_playlist_sort_selected_by_artist(void) | |
| 1715 { | |
| 1716 Playlist *playlist = playlist_get_active(); | |
| 1717 | |
| 1718 playlist_sort_selected(playlist, PLAYLIST_SORT_ARTIST); | |
| 1719 playlistwin_update_list(playlist); | |
| 1720 } | |
| 1721 | |
| 1722 void action_playlist_sort_selected_by_full_path(void) | |
| 1723 { | |
| 1724 Playlist *playlist = playlist_get_active(); | |
| 1725 | |
| 1726 playlist_sort_selected(playlist, PLAYLIST_SORT_PATH); | |
| 1727 playlistwin_update_list(playlist); | |
| 1728 } | |
| 1729 | |
| 1730 void action_playlist_sort_selected_by_date(void) | |
| 1731 { | |
| 1732 Playlist *playlist = playlist_get_active(); | |
| 1733 | |
| 1734 playlist_sort_selected(playlist, PLAYLIST_SORT_DATE); | |
| 1735 playlistwin_update_list(playlist); | |
| 1736 } | |
| 1737 | |
| 1738 void action_playlist_sort_selected_by_filename(void) | |
| 1739 { | |
| 1740 Playlist *playlist = playlist_get_active(); | |
| 1741 | |
| 1742 playlist_sort_selected(playlist, PLAYLIST_SORT_FILENAME); | |
| 1743 playlistwin_update_list(playlist); | |
| 1744 } | |
| 1745 | |
| 1746 void action_playlist_randomize_list(void) | |
| 1747 { | |
| 1748 Playlist *playlist = playlist_get_active(); | |
| 1749 | |
| 1750 playlist_random(playlist); | |
| 1751 playlistwin_update_list(playlist); | |
| 1752 } | |
| 1753 | |
| 1754 void action_playlist_reverse_list(void) | |
| 1755 { | |
| 1756 Playlist *playlist = playlist_get_active(); | |
| 1757 | |
| 1758 playlist_reverse(playlist); | |
| 1759 playlistwin_update_list(playlist); | |
| 1760 } | |
| 1761 | |
| 1762 void | |
| 1763 action_playlist_clear_queue(void) | |
| 1764 { | |
| 1765 playlist_clear_queue(playlist_get_active()); | |
| 1766 } | |
| 1767 | |
| 1768 void | |
| 1769 action_playlist_remove_unavailable(void) | |
| 1770 { | |
| 1771 playlist_remove_dead_files(playlist_get_active()); | |
| 1772 } | |
| 1773 | |
| 1774 void | |
| 1775 action_playlist_remove_dupes_by_title(void) | |
| 1776 { | |
| 1777 playlist_remove_duplicates(playlist_get_active(), PLAYLIST_DUPS_TITLE); | |
| 1778 } | |
| 1779 | |
| 1780 void | |
| 1781 action_playlist_remove_dupes_by_filename(void) | |
| 1782 { | |
| 1783 playlist_remove_duplicates(playlist_get_active(), PLAYLIST_DUPS_FILENAME); | |
| 1784 } | |
| 1785 | |
| 1786 void | |
| 1787 action_playlist_remove_dupes_by_full_path(void) | |
| 1788 { | |
| 1789 playlist_remove_duplicates(playlist_get_active(), PLAYLIST_DUPS_PATH); | |
| 1790 } | |
| 1791 | |
| 1792 void | |
| 1793 action_playlist_remove_all(void) | |
| 1794 { | |
| 1795 playlist_clear(playlist_get_active()); | |
| 1796 | |
| 1797 /* XXX -- should this really be coupled here? -nenolod */ | |
| 1798 mainwin_clear_song_info(); | |
| 1799 } | |
| 1800 | |
| 1801 void | |
| 1802 action_playlist_remove_selected(void) | |
| 1803 { | |
| 1804 playlist_delete(playlist_get_active(), FALSE); | |
| 1805 } | |
| 1806 | |
| 1807 void | |
| 1808 action_playlist_remove_unselected(void) | |
| 1809 { | |
| 1810 playlist_delete(playlist_get_active(), TRUE); | |
| 1811 } | |
| 1812 | |
| 1813 void | |
| 1814 action_playlist_add_files(void) | |
| 1815 { | |
|
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1816 run_filebrowser(NO_PLAY_BUTTON); |
| 2313 | 1817 } |
| 1818 | |
| 1819 void | |
| 1820 action_playlist_add_url(void) | |
| 1821 { | |
| 1822 mainwin_show_add_url_window(); | |
| 1823 } | |
| 1824 | |
| 1825 void | |
| 1826 action_playlist_new( void ) | |
| 1827 { | |
| 1828 Playlist *new_pl = playlist_new(); | |
| 1829 playlist_add_playlist(new_pl); | |
| 1830 playlist_select_playlist(new_pl); | |
| 1831 } | |
| 1832 | |
| 1833 void | |
| 1834 action_playlist_prev( void ) | |
| 1835 { | |
|
2807
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
1836 playlist_select_prev(); |
| 2313 | 1837 } |
| 1838 | |
| 1839 void | |
| 1840 action_playlist_next( void ) | |
| 1841 { | |
|
2807
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
1842 playlist_select_next(); |
| 2313 | 1843 } |
| 1844 | |
| 1845 void | |
| 1846 action_playlist_delete( void ) | |
| 1847 { | |
|
2807
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
1848 playlist_remove_playlist( playlist_get_active() ); |
| 2313 | 1849 } |
| 1850 | |
| 1851 void | |
| 1852 action_playlist_save_list(void) | |
| 1853 { | |
| 1854 Playlist *playlist = playlist_get_active(); | |
| 1855 | |
| 1856 playlistwin_select_playlist_to_save(playlist_get_current_name(playlist)); | |
| 1857 } | |
| 1858 | |
| 1859 void | |
| 1860 action_playlist_save_default_list(void) | |
| 1861 { | |
| 1862 Playlist *playlist = playlist_get_active(); | |
| 1863 | |
| 1864 playlist_save(playlist, bmp_paths[BMP_PATH_PLAYLIST_FILE]); | |
| 1865 } | |
| 1866 | |
| 1867 void | |
| 1868 action_playlist_load_list(void) | |
| 1869 { | |
| 1870 Playlist *playlist = playlist_get_active(); | |
| 1871 | |
| 1872 playlistwin_select_playlist_to_load(playlist_get_current_name(playlist)); | |
| 1873 } | |
| 1874 | |
| 1875 void | |
| 1876 action_playlist_refresh_list(void) | |
| 1877 { | |
| 1878 Playlist *playlist = playlist_get_active(); | |
| 1879 | |
| 1880 playlist_read_info_selection(playlist); | |
| 1881 playlistwin_update_list(playlist); | |
| 1882 } | |
| 1883 | |
| 1884 void | |
| 1885 action_open_list_manager(void) | |
| 1886 { | |
| 1887 playlist_manager_ui_show(); | |
| 1888 } | |
| 1889 | |
| 1890 void | |
| 1891 action_playlist_search_and_select(void) | |
| 1892 { | |
| 1893 playlistwin_select_search(); | |
| 1894 } | |
| 1895 | |
| 1896 void | |
| 1897 action_playlist_invert_selection(void) | |
| 1898 { | |
| 1899 playlistwin_inverse_selection(); | |
| 1900 } | |
| 1901 | |
| 1902 void | |
| 1903 action_playlist_select_none(void) | |
| 1904 { | |
| 1905 playlistwin_select_none(); | |
| 1906 } | |
| 1907 | |
| 1908 void | |
| 1909 action_playlist_select_all(void) | |
| 1910 { | |
| 1911 playlistwin_select_all(); | |
| 1912 } | |
| 1913 | |
| 1914 | |
| 1915 | |
| 1916 /* playlistwin_select_search callback functions | |
| 1917 placed here to avoid making the code messier :) */ | |
| 1918 void | |
| 2363 | 1919 playlistwin_select_search_cbt_cb(GtkWidget *called_cbt, gpointer other_cbt) |
| 2313 | 1920 { |
| 2363 | 1921 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(called_cbt)) == TRUE) |
| 1922 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(other_cbt), FALSE); | |
| 2313 | 1923 return; |
| 1924 } | |
| 1925 | |
| 1926 static gboolean | |
| 2363 | 1927 playlistwin_select_search_kp_cb(GtkWidget *entry, GdkEventKey *event, |
|
2807
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
1928 gpointer searchdlg_win) |
| 2313 | 1929 { |
| 1930 switch (event->keyval) | |
| 1931 { | |
| 1932 case GDK_Return: | |
| 2363 | 1933 gtk_dialog_response(GTK_DIALOG(searchdlg_win), GTK_RESPONSE_ACCEPT); |
| 2313 | 1934 return TRUE; |
| 1935 default: | |
| 1936 return FALSE; | |
| 1937 } | |
| 1938 } |
