Mercurial > audlegacy
annotate src/audacious/ui_jumptotrack.c @ 3468:440877c9360e trunk
Changed PLAYLIST_{UN}LOCK() macros to use playlist itself as argument, not
the mutex.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 09 Sep 2007 22:05:24 +0300 |
parents | f02623377013 |
children | 56e2a8704164 |
rev | line source |
---|---|
2500 | 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:
3096
diff
changeset
|
12 * the Free Software Foundation; under version 3 of the License. |
2500 | 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:
3096
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. |
2500 | 24 */ |
25 | |
26 #ifdef HAVE_CONFIG_H | |
27 # include "config.h" | |
28 #endif | |
29 | |
30 | |
31 #include <glib.h> | |
32 #include <glib/gi18n.h> | |
33 #include <glib/gprintf.h> | |
34 #include <gtk/gtk.h> | |
35 #include <gtk/gtkmessagedialog.h> | |
36 | |
37 /* GDK including */ | |
38 #include "platform/smartinclude.h" | |
39 | |
40 #include <math.h> | |
41 #include <stdlib.h> | |
42 #include <string.h> | |
43 | |
44 #include <X11/Xlib.h> | |
45 | |
46 #include <sys/types.h> | |
47 | |
48 #if defined(USE_REGEX_ONIGURUMA) | |
49 #include <onigposix.h> | |
50 #elif defined(USE_REGEX_PCRE) | |
51 #include <pcreposix.h> | |
52 #else | |
53 #include <regex.h> | |
54 #endif | |
55 | |
56 #include "ui_main.h" | |
57 #include "icons-stock.h" | |
58 | |
59 #include "actions-mainwin.h" | |
60 | |
61 #include "main.h" | |
62 | |
63 #include "dnd.h" | |
64 #include "dock.h" | |
65 #include "hints.h" | |
66 #include "input.h" | |
67 #include "playback.h" | |
68 #include "playlist.h" | |
69 #include "pluginenum.h" | |
70 #include "ui_credits.h" | |
71 #include "ui_equalizer.h" | |
72 #include "ui_fileopener.h" | |
73 #include "ui_manager.h" | |
74 #include "ui_playlist.h" | |
75 #include "ui_preferences.h" | |
76 #include "ui_skinselector.h" | |
77 #include "ui_urlopener.h" | |
78 #include "strings.h" | |
79 #include "util.h" | |
80 #include "visualization.h" | |
81 | |
82 #include "ui_skinned_window.h" | |
83 | |
84 static GtkWidget *jump_to_track_win = NULL; | |
85 | |
86 static void | |
87 change_song(guint pos) | |
88 { | |
89 if (playback_get_playing()) | |
90 playback_stop(); | |
91 | |
92 playlist_set_position(playlist_get_active(), pos); | |
93 playback_initiate(); | |
94 } | |
95 | |
96 static void | |
97 ui_jump_to_track_jump(GtkTreeView * treeview) | |
98 { | |
99 GtkTreeModel *model; | |
100 GtkTreeSelection *selection; | |
101 GtkTreeIter iter; | |
102 guint pos; | |
103 | |
104 model = gtk_tree_view_get_model(treeview); | |
105 selection = gtk_tree_view_get_selection(treeview); | |
106 | |
107 if (!gtk_tree_selection_get_selected(selection, NULL, &iter)) | |
108 return; | |
109 | |
110 gtk_tree_model_get(model, &iter, 0, &pos, -1); | |
111 | |
112 change_song(pos - 1); | |
113 | |
114 /* FIXME: should only hide window */ | |
2805
6295535fbf49
[svn] - add toggle button to keep jtf dialog opened on jump.
yaz
parents:
2717
diff
changeset
|
115 if(cfg.close_jtf_dialog){ |
6295535fbf49
[svn] - add toggle button to keep jtf dialog opened on jump.
yaz
parents:
2717
diff
changeset
|
116 gtk_widget_destroy(jump_to_track_win); |
6295535fbf49
[svn] - add toggle button to keep jtf dialog opened on jump.
yaz
parents:
2717
diff
changeset
|
117 jump_to_track_win = NULL; |
6295535fbf49
[svn] - add toggle button to keep jtf dialog opened on jump.
yaz
parents:
2717
diff
changeset
|
118 } |
6295535fbf49
[svn] - add toggle button to keep jtf dialog opened on jump.
yaz
parents:
2717
diff
changeset
|
119 } |
6295535fbf49
[svn] - add toggle button to keep jtf dialog opened on jump.
yaz
parents:
2717
diff
changeset
|
120 |
6295535fbf49
[svn] - add toggle button to keep jtf dialog opened on jump.
yaz
parents:
2717
diff
changeset
|
121 static void |
6295535fbf49
[svn] - add toggle button to keep jtf dialog opened on jump.
yaz
parents:
2717
diff
changeset
|
122 ui_jump_to_track_toggle_cb(GtkWidget * toggle) |
6295535fbf49
[svn] - add toggle button to keep jtf dialog opened on jump.
yaz
parents:
2717
diff
changeset
|
123 { |
6295535fbf49
[svn] - add toggle button to keep jtf dialog opened on jump.
yaz
parents:
2717
diff
changeset
|
124 cfg.close_jtf_dialog = |
6295535fbf49
[svn] - add toggle button to keep jtf dialog opened on jump.
yaz
parents:
2717
diff
changeset
|
125 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle)); |
2500 | 126 } |
127 | |
128 static void | |
129 ui_jump_to_track_jump_cb(GtkTreeView * treeview, | |
130 gpointer data) | |
131 { | |
132 ui_jump_to_track_jump(treeview); | |
133 } | |
134 | |
135 static void | |
136 ui_jump_to_track_set_queue_button_label(GtkButton * button, | |
137 guint pos) | |
138 { | |
139 if (playlist_is_position_queued(playlist_get_active(), pos)) | |
140 gtk_button_set_label(button, _("Un_queue")); | |
141 else | |
142 gtk_button_set_label(button, _("_Queue")); | |
143 } | |
144 | |
145 static void | |
146 ui_jump_to_track_queue_cb(GtkButton * button, | |
147 gpointer data) | |
148 { | |
149 GtkTreeView *treeview; | |
150 GtkTreeModel *model; | |
151 GtkTreeSelection *selection; | |
152 GtkTreeIter iter; | |
153 guint pos; | |
154 | |
155 treeview = GTK_TREE_VIEW(data); | |
156 model = gtk_tree_view_get_model(treeview); | |
157 selection = gtk_tree_view_get_selection(treeview); | |
158 | |
159 if (!gtk_tree_selection_get_selected(selection, NULL, &iter)) | |
160 return; | |
161 | |
162 gtk_tree_model_get(model, &iter, 0, &pos, -1); | |
163 | |
164 playlist_queue_position(playlist_get_active(), (pos - 1)); | |
165 | |
166 ui_jump_to_track_set_queue_button_label(button, (pos - 1)); | |
167 } | |
168 | |
169 static void | |
170 ui_jump_to_track_selection_changed_cb(GtkTreeSelection *treesel, | |
171 gpointer data) | |
172 { | |
173 GtkTreeView *treeview; | |
174 GtkTreeModel *model; | |
175 GtkTreeSelection *selection; | |
176 GtkTreeIter iter; | |
177 guint pos; | |
178 | |
179 treeview = gtk_tree_selection_get_tree_view(treesel); | |
180 model = gtk_tree_view_get_model(treeview); | |
181 selection = gtk_tree_view_get_selection(treeview); | |
182 | |
183 if (!gtk_tree_selection_get_selected(selection, NULL, &iter)) | |
184 return; | |
185 | |
186 gtk_tree_model_get(model, &iter, 0, &pos, -1); | |
187 | |
188 ui_jump_to_track_set_queue_button_label(GTK_BUTTON(data), (pos - 1)); | |
189 } | |
190 | |
191 static gboolean | |
192 ui_jump_to_track_edit_keypress_cb(GtkWidget * object, | |
193 GdkEventKey * event, | |
194 gpointer data) | |
195 { | |
196 switch (event->keyval) { | |
197 case GDK_Return: | |
198 if (gtk_im_context_filter_keypress (GTK_ENTRY (object)->im_context, event)) { | |
199 GTK_ENTRY (object)->need_im_reset = TRUE; | |
200 return TRUE; | |
201 } else { | |
202 ui_jump_to_track_jump(GTK_TREE_VIEW(data)); | |
203 return TRUE; | |
204 } | |
205 default: | |
206 return FALSE; | |
207 } | |
208 } | |
209 | |
210 static gboolean | |
211 ui_jump_to_track_keypress_cb(GtkWidget * object, | |
212 GdkEventKey * event, | |
213 gpointer data) | |
214 { | |
215 switch (event->keyval) { | |
216 case GDK_Escape: | |
217 /* FIXME: show only hide window */ | |
218 gtk_widget_destroy(jump_to_track_win); | |
219 jump_to_track_win = NULL; | |
220 return TRUE; | |
221 case GDK_KP_Enter: | |
222 ui_jump_to_track_queue_cb(NULL, data); | |
223 return TRUE; | |
224 default: | |
225 return FALSE; | |
226 }; | |
227 | |
228 return FALSE; | |
229 } | |
230 | |
231 static gboolean | |
232 ui_jump_to_track_match(const gchar * song, GSList *regex_list) | |
233 { | |
234 gboolean rv = TRUE; | |
235 | |
236 if ( song == NULL ) | |
237 return FALSE; | |
238 | |
239 for ( ; regex_list ; regex_list = g_slist_next(regex_list) ) | |
240 { | |
241 regex_t *regex = regex_list->data; | |
242 if ( regexec( regex , song , 0 , NULL , 0 ) != 0 ) | |
243 { | |
244 rv = FALSE; | |
245 break; | |
246 } | |
247 } | |
248 | |
249 return rv; | |
250 } | |
251 | |
252 /* FIXME: Clear the entry when the list gets updated */ | |
253 void | |
254 ui_jump_to_track_update(GtkWidget * widget, gpointer user_data) | |
255 { | |
256 /* FIXME: Is not in sync with playlist due to delayed extinfo | |
257 * reading */ | |
258 guint row; | |
259 GList *playlist_glist; | |
260 gchar *desc_buf = NULL; | |
261 GtkTreeIter iter; | |
262 GtkTreeSelection *selection; | |
263 Playlist *playlist; | |
264 | |
265 GtkTreeModel *store; | |
266 | |
267 if (!jump_to_track_win) | |
268 return; | |
269 | |
270 store = gtk_tree_view_get_model(GTK_TREE_VIEW(user_data)); | |
271 gtk_list_store_clear(GTK_LIST_STORE(store)); | |
272 | |
273 row = 1; | |
274 playlist = playlist_get_active(); | |
275 for (playlist_glist = playlist->entries; playlist_glist; | |
276 playlist_glist = g_list_next(playlist_glist)) { | |
277 PlaylistEntry *entry = PLAYLIST_ENTRY(playlist_glist->data); | |
278 | |
279 if (entry->title) | |
3096
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
280 desc_buf = g_strdup(entry->title); |
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
281 else { |
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
282 gchar *realfn = NULL; |
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
283 realfn = g_filename_from_uri(entry->filename, NULL, NULL); |
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
284 if (strchr(realfn ? realfn : entry->filename, '/')) |
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
285 desc_buf = str_to_utf8(strrchr(realfn ? realfn : entry->filename, '/') + 1); |
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
286 else |
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
287 desc_buf = str_to_utf8(realfn ? realfn : entry->filename); |
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
288 g_free(realfn); realfn = NULL; |
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
289 } |
2500 | 290 |
291 gtk_list_store_append(GTK_LIST_STORE(store), &iter); | |
292 gtk_list_store_set(GTK_LIST_STORE(store), &iter, | |
293 0, row, 1, desc_buf, -1); | |
294 row++; | |
295 | |
3096
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
296 g_free(desc_buf); |
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
297 desc_buf = NULL; |
2500 | 298 } |
299 | |
300 gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter); | |
301 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(user_data)); | |
302 gtk_tree_selection_select_iter(selection, &iter); | |
303 } | |
304 | |
305 static void | |
306 ui_jump_to_track_edit_cb(GtkEntry * entry, gpointer user_data) | |
307 { | |
308 GtkTreeView *treeview = GTK_TREE_VIEW(user_data); | |
309 GtkTreeSelection *selection; | |
310 GtkTreeIter iter; | |
311 | |
312 GtkListStore *store; | |
313 | |
314 guint song_index = 0; | |
315 gchar **words; | |
316 GList *playlist_glist; | |
317 Playlist *playlist; | |
318 | |
319 gboolean match = FALSE; | |
320 | |
321 GSList *regex_list = NULL, *regex_list_tmp = NULL; | |
322 gint i = -1; | |
323 | |
324 /* Chop the key string into ' '-separated key regex-pattern strings */ | |
325 words = g_strsplit(gtk_entry_get_text(entry), " ", 0); | |
326 | |
327 /* create a list of regex using the regex-pattern strings */ | |
328 while ( words[++i] != NULL ) | |
329 { | |
330 regex_t *regex = g_malloc(sizeof(regex_t)); | |
331 #if defined(USE_REGEX_PCRE) | |
332 if ( regcomp( regex , words[i] , REG_NOSUB | REG_ICASE | REG_UTF8 ) == 0 ) | |
333 #else | |
334 if ( regcomp( regex , words[i] , REG_NOSUB | REG_ICASE ) == 0 ) | |
335 #endif | |
336 regex_list = g_slist_append( regex_list , regex ); | |
337 } | |
338 | |
339 /* FIXME: Remove the connected signals before clearing | |
340 * (row-selected will still eventually arrive once) */ | |
341 store = GTK_LIST_STORE(gtk_tree_view_get_model(treeview)); | |
342 /* detach model from treeview */ | |
343 g_object_ref( store ); | |
344 gtk_tree_view_set_model( GTK_TREE_VIEW(treeview) , NULL ); | |
345 | |
346 gtk_list_store_clear(store); | |
347 | |
348 playlist = playlist_get_active(); | |
349 | |
3468
440877c9360e
Changed PLAYLIST_{UN}LOCK() macros to use playlist itself as argument, not
Matti Hamalainen <ccr@tnsp.org>
parents:
3251
diff
changeset
|
350 PLAYLIST_LOCK(playlist); |
2500 | 351 |
352 for (playlist_glist = playlist->entries; playlist_glist; | |
2546
9fe930a34683
[svn] - run gtk events while iterating through the playlist
nenolod
parents:
2500
diff
changeset
|
353 playlist_glist = g_list_next(playlist_glist)) |
9fe930a34683
[svn] - run gtk events while iterating through the playlist
nenolod
parents:
2500
diff
changeset
|
354 { |
2500 | 355 PlaylistEntry *entry = PLAYLIST_ENTRY(playlist_glist->data); |
3096
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
356 gchar *title = NULL; |
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
357 |
2819
75b12d24b7dc
[svn] match the whole filename when tag isn't available, but i couldnt figure out how to do this all the time because it kept crashing...
majeru
parents:
2805
diff
changeset
|
358 if (entry->title) |
3096
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
359 title = g_strdup(entry->title); |
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
360 else { |
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
361 gchar *realfn = NULL; |
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
362 realfn = g_filename_from_uri(entry->filename, NULL, NULL); |
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
363 title = str_to_utf8(realfn ? realfn : entry->filename); |
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
364 g_free(realfn); realfn = NULL; |
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
365 } |
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
366 |
2819
75b12d24b7dc
[svn] match the whole filename when tag isn't available, but i couldnt figure out how to do this all the time because it kept crashing...
majeru
parents:
2805
diff
changeset
|
367 /*we are matching all the path not just the filename or title*/ |
2500 | 368 |
369 /* Compare the reg.expressions to the string - if all the | |
370 regexp in regex_list match, add to the ListStore */ | |
371 | |
372 /* | |
373 * FIXME: The search string should be adapted to the | |
374 * current display setting, e.g. if the user has set it to | |
375 * "%p - %t" then build the match string like that too, or | |
376 * even better, search for each of the tags seperatly. | |
377 * | |
378 * In any case the string to match should _never_ contain | |
379 * something the user can't actually see in the playlist. | |
380 */ | |
2819
75b12d24b7dc
[svn] match the whole filename when tag isn't available, but i couldnt figure out how to do this all the time because it kept crashing...
majeru
parents:
2805
diff
changeset
|
381 //g_print ("it passed\n"); |
2500 | 382 if (regex_list != NULL) |
2819
75b12d24b7dc
[svn] match the whole filename when tag isn't available, but i couldnt figure out how to do this all the time because it kept crashing...
majeru
parents:
2805
diff
changeset
|
383 match = ui_jump_to_track_match(title, regex_list); |
2500 | 384 else |
2819
75b12d24b7dc
[svn] match the whole filename when tag isn't available, but i couldnt figure out how to do this all the time because it kept crashing...
majeru
parents:
2805
diff
changeset
|
385 match = TRUE; |
2500 | 386 |
387 if (match) { | |
2819
75b12d24b7dc
[svn] match the whole filename when tag isn't available, but i couldnt figure out how to do this all the time because it kept crashing...
majeru
parents:
2805
diff
changeset
|
388 if (entry->title) |
3096
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
389 title = g_strdup(entry->title); |
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
390 else { |
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
391 gchar *realfn = NULL; |
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
392 realfn = g_filename_from_uri(entry->filename, NULL, NULL); |
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
393 if (strchr(realfn ? realfn : entry->filename, '/')) |
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
394 title = str_to_utf8(strrchr(realfn ? realfn : entry->filename, '/') + 1); |
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
395 else |
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
396 title = str_to_utf8(realfn ? realfn : entry->filename); |
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
397 g_free(realfn); realfn = NULL; |
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
398 } |
2819
75b12d24b7dc
[svn] match the whole filename when tag isn't available, but i couldnt figure out how to do this all the time because it kept crashing...
majeru
parents:
2805
diff
changeset
|
399 gtk_list_store_append(store, &iter); |
75b12d24b7dc
[svn] match the whole filename when tag isn't available, but i couldnt figure out how to do this all the time because it kept crashing...
majeru
parents:
2805
diff
changeset
|
400 gtk_list_store_set(store, &iter, 0, song_index + 1 , 1, title, -1); |
2500 | 401 } |
402 song_index++; | |
3096
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
403 g_free(title); title = NULL; |
2500 | 404 } |
405 | |
3468
440877c9360e
Changed PLAYLIST_{UN}LOCK() macros to use playlist itself as argument, not
Matti Hamalainen <ccr@tnsp.org>
parents:
3251
diff
changeset
|
406 PLAYLIST_UNLOCK(playlist); |
2500 | 407 |
408 /* attach the model again to the treeview */ | |
409 gtk_tree_view_set_model( GTK_TREE_VIEW(treeview) , GTK_TREE_MODEL(store) ); | |
410 g_object_unref( store ); | |
411 | |
412 if ( regex_list != NULL ) | |
413 { | |
414 regex_list_tmp = regex_list; | |
415 while ( regex_list != NULL ) | |
416 { | |
417 regex_t *regex = regex_list->data; | |
418 regfree( regex ); | |
419 regex_list = g_slist_next(regex_list); | |
420 } | |
421 g_slist_free( regex_list_tmp ); | |
422 } | |
423 g_strfreev(words); | |
424 | |
425 if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter)) { | |
426 selection = gtk_tree_view_get_selection(treeview); | |
427 gtk_tree_selection_select_iter(selection, &iter); | |
428 } | |
429 } | |
430 | |
2639
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
431 static gboolean |
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
432 ui_jump_to_track_fill(gpointer treeview) |
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
433 { |
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
434 GList *playlist_glist; |
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
435 Playlist *playlist; |
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
436 gchar *desc_buf = NULL; |
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
437 guint row; |
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
438 GtkTreeIter iter; |
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
439 GtkListStore *jtf_store = (GtkListStore*)gtk_tree_view_get_model( GTK_TREE_VIEW(treeview) ); |
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
440 |
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
441 /* detach model from treeview before fill */ |
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
442 g_object_ref(jtf_store); |
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
443 gtk_tree_view_set_model( GTK_TREE_VIEW(treeview), NULL ); |
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
444 |
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
445 gtk_list_store_clear(jtf_store); |
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
446 |
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
447 row = 1; |
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
448 |
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
449 playlist = playlist_get_active(); |
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
450 |
3468
440877c9360e
Changed PLAYLIST_{UN}LOCK() macros to use playlist itself as argument, not
Matti Hamalainen <ccr@tnsp.org>
parents:
3251
diff
changeset
|
451 PLAYLIST_LOCK(playlist); |
2639
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
452 |
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
453 for (playlist_glist = playlist->entries; playlist_glist; |
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
454 playlist_glist = g_list_next(playlist_glist)) { |
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
455 |
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
456 PlaylistEntry *entry = PLAYLIST_ENTRY(playlist_glist->data); |
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
457 |
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
458 if (entry->title) |
3096
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
459 desc_buf = g_strdup(entry->title); |
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
460 else { |
3081
ba2143c1c6f5
unescape url encoded filename where real filename is needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2976
diff
changeset
|
461 gchar *realfn = NULL; |
ba2143c1c6f5
unescape url encoded filename where real filename is needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2976
diff
changeset
|
462 realfn = g_filename_from_uri(entry->filename, NULL, NULL); |
3096
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
463 if (strchr(realfn ? realfn : entry->filename, '/')) |
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
464 desc_buf = str_to_utf8(strrchr(realfn ? realfn : entry->filename, '/') + 1); |
3081
ba2143c1c6f5
unescape url encoded filename where real filename is needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2976
diff
changeset
|
465 else |
3096
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
466 desc_buf = str_to_utf8(realfn ? realfn : entry->filename); |
3081
ba2143c1c6f5
unescape url encoded filename where real filename is needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2976
diff
changeset
|
467 g_free(realfn); realfn = NULL; |
ba2143c1c6f5
unescape url encoded filename where real filename is needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2976
diff
changeset
|
468 } |
2639
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
469 |
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
470 gtk_list_store_append(GTK_LIST_STORE(jtf_store), &iter); |
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
471 gtk_list_store_set(GTK_LIST_STORE(jtf_store), &iter, |
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
472 0, row, 1, desc_buf, -1); |
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
473 row++; |
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
474 |
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
475 if (desc_buf) { |
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
476 g_free(desc_buf); |
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
477 desc_buf = NULL; |
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
478 } |
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
479 } |
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
480 |
3468
440877c9360e
Changed PLAYLIST_{UN}LOCK() macros to use playlist itself as argument, not
Matti Hamalainen <ccr@tnsp.org>
parents:
3251
diff
changeset
|
481 PLAYLIST_UNLOCK(playlist); |
2639
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
482 |
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
483 /* attach liststore to treeview */ |
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
484 gtk_tree_view_set_model(GTK_TREE_VIEW(treeview), GTK_TREE_MODEL(jtf_store)); |
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
485 g_object_unref(jtf_store); |
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
486 return FALSE; |
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
487 } |
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
488 |
2500 | 489 void |
490 ui_jump_to_track(void) | |
491 { | |
492 GtkWidget *scrollwin; | |
493 GtkWidget *vbox, *bbox, *sep; | |
2805
6295535fbf49
[svn] - add toggle button to keep jtf dialog opened on jump.
yaz
parents:
2717
diff
changeset
|
494 GtkWidget *toggle; |
2500 | 495 GtkWidget *jump, *queue, *cancel; |
496 GtkWidget *rescan, *edit; | |
497 GtkWidget *search_label, *hbox; | |
498 | |
499 GtkWidget *treeview; | |
500 GtkListStore *jtf_store; | |
501 | |
502 GtkCellRenderer *renderer; | |
503 GtkTreeViewColumn *column; | |
504 | |
505 if (jump_to_track_win) { | |
506 gtk_window_present(GTK_WINDOW(jump_to_track_win)); | |
507 return; | |
508 } | |
509 | |
510 #if defined(USE_REGEX_ONIGURUMA) | |
511 /* set encoding for Oniguruma regex to UTF-8 */ | |
512 reg_set_encoding( REG_POSIX_ENCODING_UTF8 ); | |
513 onig_set_default_syntax( ONIG_SYNTAX_POSIX_BASIC ); | |
514 #endif | |
515 | |
516 jump_to_track_win = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
517 gtk_window_set_type_hint(GTK_WINDOW(jump_to_track_win), | |
518 GDK_WINDOW_TYPE_HINT_DIALOG); | |
519 | |
520 gtk_window_set_title(GTK_WINDOW(jump_to_track_win), _("Jump to Track")); | |
521 | |
522 gtk_window_set_position(GTK_WINDOW(jump_to_track_win), GTK_WIN_POS_CENTER); | |
523 g_signal_connect(jump_to_track_win, "destroy", | |
524 G_CALLBACK(gtk_widget_destroyed), &jump_to_track_win); | |
525 | |
526 gtk_container_border_width(GTK_CONTAINER(jump_to_track_win), 10); | |
527 gtk_window_set_default_size(GTK_WINDOW(jump_to_track_win), 550, 350); | |
528 | |
529 vbox = gtk_vbox_new(FALSE, 5); | |
530 gtk_container_add(GTK_CONTAINER(jump_to_track_win), vbox); | |
531 | |
532 jtf_store = gtk_list_store_new(2, G_TYPE_UINT, G_TYPE_STRING); | |
533 treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(jtf_store)); | |
534 g_object_unref(jtf_store); | |
535 | |
536 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(treeview), TRUE); | |
537 | |
538 column = gtk_tree_view_column_new(); | |
539 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeview), FALSE); | |
540 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); | |
541 | |
542 renderer = gtk_cell_renderer_text_new(); | |
543 gtk_tree_view_column_pack_start(column, renderer, FALSE); | |
544 gtk_tree_view_column_set_attributes(column, renderer, "text", 0, NULL); | |
545 gtk_tree_view_column_set_spacing(column, 4); | |
546 | |
547 renderer = gtk_cell_renderer_text_new(); | |
548 gtk_tree_view_column_pack_start(column, renderer, FALSE); | |
549 gtk_tree_view_column_set_attributes(column, renderer, "text", 1, NULL); | |
550 gtk_tree_view_column_set_spacing(column, 4); | |
551 gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); | |
552 | |
553 gtk_tree_view_set_search_column(GTK_TREE_VIEW(treeview), 1); | |
554 | |
555 g_signal_connect(treeview, "row-activated", | |
556 G_CALLBACK(ui_jump_to_track_jump), NULL); | |
557 | |
558 hbox = gtk_hbox_new(FALSE, 3); | |
559 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 3); | |
560 | |
561 search_label = gtk_label_new(_("Filter: ")); | |
562 gtk_label_set_markup_with_mnemonic(GTK_LABEL(search_label), _("_Filter:")); | |
563 gtk_box_pack_start(GTK_BOX(hbox), search_label, FALSE, FALSE, 0); | |
564 | |
565 edit = gtk_entry_new(); | |
566 gtk_entry_set_editable(GTK_ENTRY(edit), TRUE); | |
567 gtk_label_set_mnemonic_widget(GTK_LABEL(search_label), edit); | |
568 g_signal_connect(edit, "changed", | |
569 G_CALLBACK(ui_jump_to_track_edit_cb), treeview); | |
570 | |
571 g_signal_connect(edit, "key_press_event", | |
572 G_CALLBACK(ui_jump_to_track_edit_keypress_cb), treeview); | |
573 | |
574 g_signal_connect(jump_to_track_win, "key_press_event", | |
575 G_CALLBACK(ui_jump_to_track_keypress_cb), treeview); | |
576 | |
577 gtk_box_pack_start(GTK_BOX(hbox), edit, TRUE, TRUE, 3); | |
578 | |
579 scrollwin = gtk_scrolled_window_new(NULL, NULL); | |
580 gtk_container_add(GTK_CONTAINER(scrollwin), treeview); | |
581 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollwin), | |
582 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); | |
583 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrollwin), | |
584 GTK_SHADOW_IN); | |
585 gtk_box_pack_start(GTK_BOX(vbox), scrollwin, TRUE, TRUE, 0); | |
586 | |
587 sep = gtk_hseparator_new(); | |
588 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); | |
589 | |
590 bbox = gtk_hbutton_box_new(); | |
591 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); | |
592 gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5); | |
593 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); | |
594 | |
2805
6295535fbf49
[svn] - add toggle button to keep jtf dialog opened on jump.
yaz
parents:
2717
diff
changeset
|
595 /* close dialog toggle */ |
6295535fbf49
[svn] - add toggle button to keep jtf dialog opened on jump.
yaz
parents:
2717
diff
changeset
|
596 toggle = gtk_check_button_new_with_label(_("Close on Jump")); |
6295535fbf49
[svn] - add toggle button to keep jtf dialog opened on jump.
yaz
parents:
2717
diff
changeset
|
597 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), |
6295535fbf49
[svn] - add toggle button to keep jtf dialog opened on jump.
yaz
parents:
2717
diff
changeset
|
598 cfg.close_jtf_dialog ? TRUE : FALSE); |
6295535fbf49
[svn] - add toggle button to keep jtf dialog opened on jump.
yaz
parents:
2717
diff
changeset
|
599 gtk_box_pack_start(GTK_BOX(bbox), toggle, FALSE, FALSE, 0); |
6295535fbf49
[svn] - add toggle button to keep jtf dialog opened on jump.
yaz
parents:
2717
diff
changeset
|
600 g_signal_connect(toggle, "clicked", |
6295535fbf49
[svn] - add toggle button to keep jtf dialog opened on jump.
yaz
parents:
2717
diff
changeset
|
601 G_CALLBACK(ui_jump_to_track_toggle_cb), |
6295535fbf49
[svn] - add toggle button to keep jtf dialog opened on jump.
yaz
parents:
2717
diff
changeset
|
602 toggle); |
6295535fbf49
[svn] - add toggle button to keep jtf dialog opened on jump.
yaz
parents:
2717
diff
changeset
|
603 |
6295535fbf49
[svn] - add toggle button to keep jtf dialog opened on jump.
yaz
parents:
2717
diff
changeset
|
604 |
2500 | 605 queue = gtk_button_new_with_mnemonic(_("_Queue")); |
606 gtk_box_pack_start(GTK_BOX(bbox), queue, FALSE, FALSE, 0); | |
607 GTK_WIDGET_SET_FLAGS(queue, GTK_CAN_DEFAULT); | |
608 g_signal_connect(queue, "clicked", | |
609 G_CALLBACK(ui_jump_to_track_queue_cb), | |
610 treeview); | |
611 g_signal_connect(gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)), "changed", | |
612 G_CALLBACK(ui_jump_to_track_selection_changed_cb), | |
613 queue); | |
614 | |
615 rescan = gtk_button_new_from_stock(GTK_STOCK_REFRESH); | |
616 gtk_box_pack_start(GTK_BOX(bbox), rescan, FALSE, FALSE, 0); | |
617 g_signal_connect(rescan, "clicked", | |
618 G_CALLBACK(ui_jump_to_track_update), treeview); | |
619 GTK_WIDGET_SET_FLAGS(rescan, GTK_CAN_DEFAULT); | |
620 gtk_widget_grab_default(rescan); | |
621 | |
622 jump = gtk_button_new_from_stock(GTK_STOCK_JUMP_TO); | |
623 gtk_box_pack_start(GTK_BOX(bbox), jump, FALSE, FALSE, 0); | |
624 | |
625 g_signal_connect_swapped(jump, "clicked", | |
626 G_CALLBACK(ui_jump_to_track_jump_cb), | |
627 treeview); | |
628 | |
629 GTK_WIDGET_SET_FLAGS(jump, GTK_CAN_DEFAULT); | |
630 gtk_widget_grab_default(jump); | |
631 | |
632 cancel = gtk_button_new_from_stock(GTK_STOCK_CLOSE); | |
633 gtk_box_pack_start(GTK_BOX(bbox), cancel, FALSE, FALSE, 0); | |
634 g_signal_connect_swapped(cancel, "clicked", | |
635 G_CALLBACK(gtk_widget_destroy), | |
636 jump_to_track_win); | |
637 GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT); | |
638 | |
2639
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
639 g_timeout_add(100, (GSourceFunc)ui_jump_to_track_fill, treeview); |
2500 | 640 |
641 gtk_widget_show_all(jump_to_track_win); | |
2639
ed67025aeea5
[svn] - give focus to jump_to_track window before filling it with information; this way user can start typing while huge playlists are loaded
giacomo
parents:
2627
diff
changeset
|
642 gtk_widget_grab_focus(edit); |
2500 | 643 } |
644 |