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