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