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