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