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