Mercurial > audlegacy
annotate src/audacious/ui_jumptotrack.c @ 4227:206378f34610
update titles when formatter template changes even if tuples is up to date
author | Eugene Zagidullin <e.asphyx@gmail.com> |
---|---|
date | Wed, 30 Jan 2008 19:41:03 +0300 |
parents | aca0dd668f7b |
children | ca077e01ed3a |
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; | |
3920
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
83 static gulong serial = 0; |
2500 | 84 |
85 static void | |
86 change_song(guint pos) | |
87 { | |
88 if (playback_get_playing()) | |
89 playback_stop(); | |
90 | |
91 playlist_set_position(playlist_get_active(), pos); | |
92 playback_initiate(); | |
93 } | |
94 | |
3920
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
95 void |
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
96 ui_jump_to_track_hide(void) |
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
97 { |
4115
e99284bb7936
Reset the text entry box to nothing when the jump to track window is requested.
William Pitcock <nenolod@atheme.org>
parents:
4085
diff
changeset
|
98 g_return_if_fail(jump_to_track_win != NULL); |
3920
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
99 gtk_widget_hide(jump_to_track_win); |
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
100 } |
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
101 |
2500 | 102 static void |
103 ui_jump_to_track_jump(GtkTreeView * treeview) | |
104 { | |
105 GtkTreeModel *model; | |
106 GtkTreeSelection *selection; | |
107 GtkTreeIter iter; | |
108 guint pos; | |
109 | |
110 model = gtk_tree_view_get_model(treeview); | |
111 selection = gtk_tree_view_get_selection(treeview); | |
112 | |
113 if (!gtk_tree_selection_get_selected(selection, NULL, &iter)) | |
114 return; | |
115 | |
116 gtk_tree_model_get(model, &iter, 0, &pos, -1); | |
117 | |
118 change_song(pos - 1); | |
119 | |
3920
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
120 if(cfg.close_jtf_dialog) |
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
121 ui_jump_to_track_hide(); |
3917 | 122 } |
123 | |
2805
6295535fbf49
[svn] - add toggle button to keep jtf dialog opened on jump.
yaz
parents:
2717
diff
changeset
|
124 static void |
6295535fbf49
[svn] - add toggle button to keep jtf dialog opened on jump.
yaz
parents:
2717
diff
changeset
|
125 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
|
126 { |
6295535fbf49
[svn] - add toggle button to keep jtf dialog opened on jump.
yaz
parents:
2717
diff
changeset
|
127 cfg.close_jtf_dialog = |
6295535fbf49
[svn] - add toggle button to keep jtf dialog opened on jump.
yaz
parents:
2717
diff
changeset
|
128 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle)); |
2500 | 129 } |
130 | |
131 static void | |
4116
5853d43e539a
remember filter entry in jtf dialog is extremely useful when jtf deals with large playlist. now this feature is configurable.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
4115
diff
changeset
|
132 ui_jump_to_track_toggle2_cb(GtkWidget * toggle) |
5853d43e539a
remember filter entry in jtf dialog is extremely useful when jtf deals with large playlist. now this feature is configurable.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
4115
diff
changeset
|
133 { |
5853d43e539a
remember filter entry in jtf dialog is extremely useful when jtf deals with large playlist. now this feature is configurable.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
4115
diff
changeset
|
134 cfg.remember_jtf_entry = |
5853d43e539a
remember filter entry in jtf dialog is extremely useful when jtf deals with large playlist. now this feature is configurable.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
4115
diff
changeset
|
135 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle)); |
5853d43e539a
remember filter entry in jtf dialog is extremely useful when jtf deals with large playlist. now this feature is configurable.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
4115
diff
changeset
|
136 } |
5853d43e539a
remember filter entry in jtf dialog is extremely useful when jtf deals with large playlist. now this feature is configurable.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
4115
diff
changeset
|
137 |
5853d43e539a
remember filter entry in jtf dialog is extremely useful when jtf deals with large playlist. now this feature is configurable.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
4115
diff
changeset
|
138 static void |
2500 | 139 ui_jump_to_track_jump_cb(GtkTreeView * treeview, |
140 gpointer data) | |
141 { | |
142 ui_jump_to_track_jump(treeview); | |
143 } | |
144 | |
145 static void | |
146 ui_jump_to_track_set_queue_button_label(GtkButton * button, | |
147 guint pos) | |
148 { | |
149 if (playlist_is_position_queued(playlist_get_active(), pos)) | |
150 gtk_button_set_label(button, _("Un_queue")); | |
151 else | |
152 gtk_button_set_label(button, _("_Queue")); | |
153 } | |
154 | |
155 static void | |
156 ui_jump_to_track_queue_cb(GtkButton * button, | |
157 gpointer data) | |
158 { | |
159 GtkTreeView *treeview; | |
160 GtkTreeModel *model; | |
161 GtkTreeSelection *selection; | |
162 GtkTreeIter iter; | |
163 guint pos; | |
164 | |
165 treeview = GTK_TREE_VIEW(data); | |
166 model = gtk_tree_view_get_model(treeview); | |
167 selection = gtk_tree_view_get_selection(treeview); | |
168 | |
169 if (!gtk_tree_selection_get_selected(selection, NULL, &iter)) | |
170 return; | |
171 | |
172 gtk_tree_model_get(model, &iter, 0, &pos, -1); | |
173 | |
174 playlist_queue_position(playlist_get_active(), (pos - 1)); | |
175 | |
176 ui_jump_to_track_set_queue_button_label(button, (pos - 1)); | |
177 } | |
178 | |
179 static void | |
180 ui_jump_to_track_selection_changed_cb(GtkTreeSelection *treesel, | |
181 gpointer data) | |
182 { | |
183 GtkTreeView *treeview; | |
184 GtkTreeModel *model; | |
185 GtkTreeSelection *selection; | |
186 GtkTreeIter iter; | |
187 guint pos; | |
188 | |
189 treeview = gtk_tree_selection_get_tree_view(treesel); | |
190 model = gtk_tree_view_get_model(treeview); | |
191 selection = gtk_tree_view_get_selection(treeview); | |
192 | |
193 if (!gtk_tree_selection_get_selected(selection, NULL, &iter)) | |
194 return; | |
195 | |
196 gtk_tree_model_get(model, &iter, 0, &pos, -1); | |
197 | |
198 ui_jump_to_track_set_queue_button_label(GTK_BUTTON(data), (pos - 1)); | |
199 } | |
200 | |
201 static gboolean | |
202 ui_jump_to_track_edit_keypress_cb(GtkWidget * object, | |
203 GdkEventKey * event, | |
204 gpointer data) | |
205 { | |
206 switch (event->keyval) { | |
207 case GDK_Return: | |
208 if (gtk_im_context_filter_keypress (GTK_ENTRY (object)->im_context, event)) { | |
209 GTK_ENTRY (object)->need_im_reset = TRUE; | |
210 return TRUE; | |
211 } else { | |
212 ui_jump_to_track_jump(GTK_TREE_VIEW(data)); | |
213 return TRUE; | |
214 } | |
215 default: | |
216 return FALSE; | |
217 } | |
218 } | |
219 | |
220 static gboolean | |
221 ui_jump_to_track_keypress_cb(GtkWidget * object, | |
222 GdkEventKey * event, | |
223 gpointer data) | |
224 { | |
225 switch (event->keyval) { | |
226 case GDK_Escape: | |
3920
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
227 ui_jump_to_track_hide(); |
2500 | 228 return TRUE; |
229 case GDK_KP_Enter: | |
230 ui_jump_to_track_queue_cb(NULL, data); | |
231 return TRUE; | |
232 default: | |
233 return FALSE; | |
234 }; | |
235 | |
236 return FALSE; | |
237 } | |
238 | |
239 static gboolean | |
240 ui_jump_to_track_match(const gchar * song, GSList *regex_list) | |
241 { | |
242 if ( song == NULL ) | |
243 return FALSE; | |
244 | |
245 for ( ; regex_list ; regex_list = g_slist_next(regex_list) ) | |
246 { | |
247 regex_t *regex = regex_list->data; | |
248 if ( regexec( regex , song , 0 , NULL , 0 ) != 0 ) | |
4179
aca0dd668f7b
Jump to Track leaks memory when matching songs. (Bugzilla #81)
Jussi Judin <jjudin+audacious@iki.fi>
parents:
4178
diff
changeset
|
249 return FALSE; |
2500 | 250 } |
251 | |
4179
aca0dd668f7b
Jump to Track leaks memory when matching songs. (Bugzilla #81)
Jussi Judin <jjudin+audacious@iki.fi>
parents:
4178
diff
changeset
|
252 return TRUE; |
2500 | 253 } |
254 | |
255 void | |
256 ui_jump_to_track_update(GtkWidget * widget, gpointer user_data) | |
257 { | |
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 | |
3920
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
267 GtkTreeView *tree = GTK_TREE_VIEW(g_object_get_data(user_data, "treeview")); |
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
268 GtkEntry *edit = g_object_get_data(user_data, "edit"); |
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
269 |
2500 | 270 if (!jump_to_track_win) |
271 return; | |
272 | |
3920
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
273 /* clear edit widget */ |
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
274 if(edit){ |
4116
5853d43e539a
remember filter entry in jtf dialog is extremely useful when jtf deals with large playlist. now this feature is configurable.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
4115
diff
changeset
|
275 gtk_entry_set_text(edit, ""); |
3920
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
276 } |
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
277 |
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
278 store = gtk_tree_view_get_model(tree); |
2500 | 279 gtk_list_store_clear(GTK_LIST_STORE(store)); |
280 | |
281 row = 1; | |
282 playlist = playlist_get_active(); | |
283 for (playlist_glist = playlist->entries; playlist_glist; | |
284 playlist_glist = g_list_next(playlist_glist)) { | |
285 PlaylistEntry *entry = PLAYLIST_ENTRY(playlist_glist->data); | |
286 | |
287 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
|
288 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
|
289 else { |
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
290 gchar *realfn = NULL; |
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
291 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
|
292 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
|
293 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
|
294 else |
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
295 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
|
296 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
|
297 } |
2500 | 298 |
299 gtk_list_store_append(GTK_LIST_STORE(store), &iter); | |
300 gtk_list_store_set(GTK_LIST_STORE(store), &iter, | |
301 0, row, 1, desc_buf, -1); | |
302 row++; | |
303 | |
3096
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
304 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
|
305 desc_buf = NULL; |
2500 | 306 } |
307 | |
308 gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter); | |
3920
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
309 selection = gtk_tree_view_get_selection(tree); |
2500 | 310 gtk_tree_selection_select_iter(selection, &iter); |
3920
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
311 serial = playlist->serial; // important. --yaz |
2500 | 312 } |
313 | |
4160
472aaaca02c0
Make "jump to track" feature to normalize search and match strings (Bugzilla #20)
Jussi Judin <jjudin+audacious@iki.fi>
parents:
4116
diff
changeset
|
314 |
472aaaca02c0
Make "jump to track" feature to normalize search and match strings (Bugzilla #20)
Jussi Judin <jjudin+audacious@iki.fi>
parents:
4116
diff
changeset
|
315 /** |
472aaaca02c0
Make "jump to track" feature to normalize search and match strings (Bugzilla #20)
Jussi Judin <jjudin+audacious@iki.fi>
parents:
4116
diff
changeset
|
316 * Normalizes an UTF-8 string to be used in case-insensitive searches. |
472aaaca02c0
Make "jump to track" feature to normalize search and match strings (Bugzilla #20)
Jussi Judin <jjudin+audacious@iki.fi>
parents:
4116
diff
changeset
|
317 * |
472aaaca02c0
Make "jump to track" feature to normalize search and match strings (Bugzilla #20)
Jussi Judin <jjudin+audacious@iki.fi>
parents:
4116
diff
changeset
|
318 * Returned string should be freed. |
472aaaca02c0
Make "jump to track" feature to normalize search and match strings (Bugzilla #20)
Jussi Judin <jjudin+audacious@iki.fi>
parents:
4116
diff
changeset
|
319 */ |
472aaaca02c0
Make "jump to track" feature to normalize search and match strings (Bugzilla #20)
Jussi Judin <jjudin+audacious@iki.fi>
parents:
4116
diff
changeset
|
320 static gchar * |
472aaaca02c0
Make "jump to track" feature to normalize search and match strings (Bugzilla #20)
Jussi Judin <jjudin+audacious@iki.fi>
parents:
4116
diff
changeset
|
321 normalize_search_string(const gchar * string) |
472aaaca02c0
Make "jump to track" feature to normalize search and match strings (Bugzilla #20)
Jussi Judin <jjudin+audacious@iki.fi>
parents:
4116
diff
changeset
|
322 { |
472aaaca02c0
Make "jump to track" feature to normalize search and match strings (Bugzilla #20)
Jussi Judin <jjudin+audacious@iki.fi>
parents:
4116
diff
changeset
|
323 gchar* normalized_string = g_utf8_normalize(string, -1, G_NORMALIZE_NFKD); |
472aaaca02c0
Make "jump to track" feature to normalize search and match strings (Bugzilla #20)
Jussi Judin <jjudin+audacious@iki.fi>
parents:
4116
diff
changeset
|
324 gchar* folded_string = g_utf8_casefold(normalized_string, -1); |
472aaaca02c0
Make "jump to track" feature to normalize search and match strings (Bugzilla #20)
Jussi Judin <jjudin+audacious@iki.fi>
parents:
4116
diff
changeset
|
325 g_free(normalized_string); |
472aaaca02c0
Make "jump to track" feature to normalize search and match strings (Bugzilla #20)
Jussi Judin <jjudin+audacious@iki.fi>
parents:
4116
diff
changeset
|
326 return folded_string; |
472aaaca02c0
Make "jump to track" feature to normalize search and match strings (Bugzilla #20)
Jussi Judin <jjudin+audacious@iki.fi>
parents:
4116
diff
changeset
|
327 } |
472aaaca02c0
Make "jump to track" feature to normalize search and match strings (Bugzilla #20)
Jussi Judin <jjudin+audacious@iki.fi>
parents:
4116
diff
changeset
|
328 |
2500 | 329 static void |
330 ui_jump_to_track_edit_cb(GtkEntry * entry, gpointer user_data) | |
331 { | |
332 GtkTreeView *treeview = GTK_TREE_VIEW(user_data); | |
333 GtkTreeSelection *selection; | |
334 GtkTreeIter iter; | |
335 | |
336 GtkListStore *store; | |
337 | |
338 guint song_index = 0; | |
339 gchar **words; | |
340 GList *playlist_glist; | |
341 Playlist *playlist; | |
342 | |
343 gboolean match = FALSE; | |
344 | |
345 GSList *regex_list = NULL, *regex_list_tmp = NULL; | |
346 gint i = -1; | |
347 | |
348 /* Chop the key string into ' '-separated key regex-pattern strings */ | |
4160
472aaaca02c0
Make "jump to track" feature to normalize search and match strings (Bugzilla #20)
Jussi Judin <jjudin+audacious@iki.fi>
parents:
4116
diff
changeset
|
349 gchar *search_text = normalize_search_string(gtk_entry_get_text(entry)); |
472aaaca02c0
Make "jump to track" feature to normalize search and match strings (Bugzilla #20)
Jussi Judin <jjudin+audacious@iki.fi>
parents:
4116
diff
changeset
|
350 words = g_strsplit(search_text, " ", 0); |
472aaaca02c0
Make "jump to track" feature to normalize search and match strings (Bugzilla #20)
Jussi Judin <jjudin+audacious@iki.fi>
parents:
4116
diff
changeset
|
351 g_free(search_text); |
2500 | 352 |
353 /* create a list of regex using the regex-pattern strings */ | |
354 while ( words[++i] != NULL ) | |
355 { | |
356 regex_t *regex = g_malloc(sizeof(regex_t)); | |
357 #if defined(USE_REGEX_PCRE) | |
4160
472aaaca02c0
Make "jump to track" feature to normalize search and match strings (Bugzilla #20)
Jussi Judin <jjudin+audacious@iki.fi>
parents:
4116
diff
changeset
|
358 if ( regcomp( regex , words[i] , REG_NOSUB | REG_UTF8 ) == 0 ) |
2500 | 359 #else |
4160
472aaaca02c0
Make "jump to track" feature to normalize search and match strings (Bugzilla #20)
Jussi Judin <jjudin+audacious@iki.fi>
parents:
4116
diff
changeset
|
360 if ( regcomp( regex , words[i] , REG_NOSUB ) == 0 ) |
2500 | 361 #endif |
362 regex_list = g_slist_append( regex_list , regex ); | |
4179
aca0dd668f7b
Jump to Track leaks memory when matching songs. (Bugzilla #81)
Jussi Judin <jjudin+audacious@iki.fi>
parents:
4178
diff
changeset
|
363 else |
aca0dd668f7b
Jump to Track leaks memory when matching songs. (Bugzilla #81)
Jussi Judin <jjudin+audacious@iki.fi>
parents:
4178
diff
changeset
|
364 g_free( regex ); |
2500 | 365 } |
366 | |
367 /* FIXME: Remove the connected signals before clearing | |
368 * (row-selected will still eventually arrive once) */ | |
369 store = GTK_LIST_STORE(gtk_tree_view_get_model(treeview)); | |
370 /* detach model from treeview */ | |
371 g_object_ref( store ); | |
372 gtk_tree_view_set_model( GTK_TREE_VIEW(treeview) , NULL ); | |
373 | |
374 gtk_list_store_clear(store); | |
375 | |
376 playlist = playlist_get_active(); | |
377 | |
3468
440877c9360e
Changed PLAYLIST_{UN}LOCK() macros to use playlist itself as argument, not
Matti Hamalainen <ccr@tnsp.org>
parents:
3251
diff
changeset
|
378 PLAYLIST_LOCK(playlist); |
2500 | 379 |
380 for (playlist_glist = playlist->entries; playlist_glist; | |
2546
9fe930a34683
[svn] - run gtk events while iterating through the playlist
nenolod
parents:
2500
diff
changeset
|
381 playlist_glist = g_list_next(playlist_glist)) |
9fe930a34683
[svn] - run gtk events while iterating through the playlist
nenolod
parents:
2500
diff
changeset
|
382 { |
2500 | 383 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
|
384 gchar *title = NULL; |
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
385 |
4160
472aaaca02c0
Make "jump to track" feature to normalize search and match strings (Bugzilla #20)
Jussi Judin <jjudin+audacious@iki.fi>
parents:
4116
diff
changeset
|
386 if (entry->title) { |
472aaaca02c0
Make "jump to track" feature to normalize search and match strings (Bugzilla #20)
Jussi Judin <jjudin+audacious@iki.fi>
parents:
4116
diff
changeset
|
387 title = normalize_search_string(entry->title); |
472aaaca02c0
Make "jump to track" feature to normalize search and match strings (Bugzilla #20)
Jussi Judin <jjudin+audacious@iki.fi>
parents:
4116
diff
changeset
|
388 } else { |
3096
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); |
4160
472aaaca02c0
Make "jump to track" feature to normalize search and match strings (Bugzilla #20)
Jussi Judin <jjudin+audacious@iki.fi>
parents:
4116
diff
changeset
|
391 gchar *tmp_title = str_to_utf8(realfn ? realfn : entry->filename); |
472aaaca02c0
Make "jump to track" feature to normalize search and match strings (Bugzilla #20)
Jussi Judin <jjudin+audacious@iki.fi>
parents:
4116
diff
changeset
|
392 title = normalize_search_string(tmp_title); |
472aaaca02c0
Make "jump to track" feature to normalize search and match strings (Bugzilla #20)
Jussi Judin <jjudin+audacious@iki.fi>
parents:
4116
diff
changeset
|
393 g_free(tmp_title); |
3096
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
394 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
|
395 } |
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 /*we are matching all the path not just the filename or title*/ |
2500 | 398 |
399 /* Compare the reg.expressions to the string - if all the | |
400 regexp in regex_list match, add to the ListStore */ | |
401 | |
402 /* | |
403 * FIXME: The search string should be adapted to the | |
404 * current display setting, e.g. if the user has set it to | |
405 * "%p - %t" then build the match string like that too, or | |
406 * even better, search for each of the tags seperatly. | |
407 * | |
408 * In any case the string to match should _never_ contain | |
409 * something the user can't actually see in the playlist. | |
410 */ | |
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
|
411 //g_print ("it passed\n"); |
2500 | 412 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
|
413 match = ui_jump_to_track_match(title, regex_list); |
2500 | 414 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
|
415 match = TRUE; |
2500 | 416 |
4160
472aaaca02c0
Make "jump to track" feature to normalize search and match strings (Bugzilla #20)
Jussi Judin <jjudin+audacious@iki.fi>
parents:
4116
diff
changeset
|
417 g_free(title); title = NULL; |
472aaaca02c0
Make "jump to track" feature to normalize search and match strings (Bugzilla #20)
Jussi Judin <jjudin+audacious@iki.fi>
parents:
4116
diff
changeset
|
418 |
2500 | 419 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
|
420 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
|
421 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
|
422 else { |
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
423 gchar *realfn = NULL; |
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
424 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
|
425 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
|
426 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
|
427 else |
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
428 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
|
429 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
|
430 } |
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
|
431 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
|
432 gtk_list_store_set(store, &iter, 0, song_index + 1 , 1, title, -1); |
2500 | 433 } |
434 song_index++; | |
3096
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
435 g_free(title); title = NULL; |
2500 | 436 } |
437 | |
3468
440877c9360e
Changed PLAYLIST_{UN}LOCK() macros to use playlist itself as argument, not
Matti Hamalainen <ccr@tnsp.org>
parents:
3251
diff
changeset
|
438 PLAYLIST_UNLOCK(playlist); |
2500 | 439 |
440 /* attach the model again to the treeview */ | |
441 gtk_tree_view_set_model( GTK_TREE_VIEW(treeview) , GTK_TREE_MODEL(store) ); | |
442 g_object_unref( store ); | |
443 | |
444 if ( regex_list != NULL ) | |
445 { | |
446 regex_list_tmp = regex_list; | |
447 while ( regex_list != NULL ) | |
448 { | |
449 regex_t *regex = regex_list->data; | |
450 regfree( regex ); | |
4179
aca0dd668f7b
Jump to Track leaks memory when matching songs. (Bugzilla #81)
Jussi Judin <jjudin+audacious@iki.fi>
parents:
4178
diff
changeset
|
451 g_free( regex ); |
2500 | 452 regex_list = g_slist_next(regex_list); |
453 } | |
454 g_slist_free( regex_list_tmp ); | |
455 } | |
456 g_strfreev(words); | |
457 | |
458 if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter)) { | |
459 selection = gtk_tree_view_get_selection(treeview); | |
460 gtk_tree_selection_select_iter(selection, &iter); | |
461 } | |
462 } | |
463 | |
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
|
464 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
|
465 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
|
466 { |
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 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
|
468 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
|
469 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
|
470 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
|
471 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
|
472 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
|
473 |
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 /* 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
|
475 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
|
476 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
|
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 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
|
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 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
|
481 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
|
482 |
3468
440877c9360e
Changed PLAYLIST_{UN}LOCK() macros to use playlist itself as argument, not
Matti Hamalainen <ccr@tnsp.org>
parents:
3251
diff
changeset
|
483 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
|
484 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
|
485 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
|
486 |
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 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
|
488 |
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 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
|
490 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
|
491 else { |
3081
ba2143c1c6f5
unescape url encoded filename where real filename is needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2976
diff
changeset
|
492 gchar *realfn = NULL; |
ba2143c1c6f5
unescape url encoded filename where real filename is needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2976
diff
changeset
|
493 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
|
494 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
|
495 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
|
496 else |
3096
8e4da6a4ab91
- make jump to track more friendly to file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3092
diff
changeset
|
497 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
|
498 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
|
499 } |
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
|
500 |
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
|
501 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
|
502 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
|
503 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
|
504 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
|
505 |
3920
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
506 g_free(desc_buf); |
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
507 desc_buf = NULL; |
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
|
508 } |
3468
440877c9360e
Changed PLAYLIST_{UN}LOCK() macros to use playlist itself as argument, not
Matti Hamalainen <ccr@tnsp.org>
parents:
3251
diff
changeset
|
509 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
|
510 |
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
|
511 /* 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
|
512 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
|
513 g_object_unref(jtf_store); |
3920
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
514 serial = playlist->serial; |
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
|
515 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
|
516 } |
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
|
517 |
3920
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
518 static gboolean |
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
519 watchdog(gpointer storage) |
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
520 { |
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
521 GtkWidget *widget; |
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
522 Playlist *playlist = playlist_get_active(); |
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
523 |
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
524 if(serial == playlist->serial) |
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
525 return TRUE; |
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
526 |
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
527 widget = g_object_get_data(storage, "widget"); |
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
528 ui_jump_to_track_update(widget, storage); |
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
529 return TRUE; |
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
530 } |
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
531 |
2500 | 532 void |
533 ui_jump_to_track(void) | |
534 { | |
535 GtkWidget *scrollwin; | |
536 GtkWidget *vbox, *bbox, *sep; | |
4116
5853d43e539a
remember filter entry in jtf dialog is extremely useful when jtf deals with large playlist. now this feature is configurable.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
4115
diff
changeset
|
537 GtkWidget *toggle, *toggle2; |
3920
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
538 GtkWidget *jump, *queue, *close; |
4085
008708425c83
make filter field in jtf dialog always grab focus on appearance.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3920
diff
changeset
|
539 GtkWidget *rescan; |
4115
e99284bb7936
Reset the text entry box to nothing when the jump to track window is requested.
William Pitcock <nenolod@atheme.org>
parents:
4085
diff
changeset
|
540 GtkWidget *search_label, *hbox; |
4085
008708425c83
make filter field in jtf dialog always grab focus on appearance.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3920
diff
changeset
|
541 static GtkWidget *edit; |
2500 | 542 |
3920
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
543 GtkWidget *treeview = NULL; |
2500 | 544 GtkListStore *jtf_store; |
545 | |
546 GtkCellRenderer *renderer; | |
547 GtkTreeViewColumn *column; | |
548 | |
3920
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
549 gpointer storage; |
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
550 |
2500 | 551 if (jump_to_track_win) { |
552 gtk_window_present(GTK_WINDOW(jump_to_track_win)); | |
4116
5853d43e539a
remember filter entry in jtf dialog is extremely useful when jtf deals with large playlist. now this feature is configurable.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
4115
diff
changeset
|
553 |
5853d43e539a
remember filter entry in jtf dialog is extremely useful when jtf deals with large playlist. now this feature is configurable.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
4115
diff
changeset
|
554 if(!cfg.remember_jtf_entry) |
5853d43e539a
remember filter entry in jtf dialog is extremely useful when jtf deals with large playlist. now this feature is configurable.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
4115
diff
changeset
|
555 gtk_entry_set_text(GTK_ENTRY(edit), ""); |
5853d43e539a
remember filter entry in jtf dialog is extremely useful when jtf deals with large playlist. now this feature is configurable.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
4115
diff
changeset
|
556 |
4085
008708425c83
make filter field in jtf dialog always grab focus on appearance.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3920
diff
changeset
|
557 gtk_widget_grab_focus(edit); |
4116
5853d43e539a
remember filter entry in jtf dialog is extremely useful when jtf deals with large playlist. now this feature is configurable.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
4115
diff
changeset
|
558 gtk_editable_select_region(GTK_EDITABLE(edit), 0, -1); |
2500 | 559 return; |
560 } | |
561 | |
562 #if defined(USE_REGEX_ONIGURUMA) | |
563 /* set encoding for Oniguruma regex to UTF-8 */ | |
564 reg_set_encoding( REG_POSIX_ENCODING_UTF8 ); | |
565 onig_set_default_syntax( ONIG_SYNTAX_POSIX_BASIC ); | |
566 #endif | |
567 | |
568 jump_to_track_win = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
569 gtk_window_set_type_hint(GTK_WINDOW(jump_to_track_win), | |
570 GDK_WINDOW_TYPE_HINT_DIALOG); | |
571 | |
572 gtk_window_set_title(GTK_WINDOW(jump_to_track_win), _("Jump to Track")); | |
573 | |
574 gtk_window_set_position(GTK_WINDOW(jump_to_track_win), GTK_WIN_POS_CENTER); | |
575 g_signal_connect(jump_to_track_win, "destroy", | |
576 G_CALLBACK(gtk_widget_destroyed), &jump_to_track_win); | |
577 | |
578 gtk_container_border_width(GTK_CONTAINER(jump_to_track_win), 10); | |
4177
948d373a513c
just a little bigger
Cristi Magherusan <majeru@atheme-project.org>
parents:
4176
diff
changeset
|
579 gtk_window_set_default_size(GTK_WINDOW(jump_to_track_win), 600, 500); |
2500 | 580 |
581 vbox = gtk_vbox_new(FALSE, 5); | |
582 gtk_container_add(GTK_CONTAINER(jump_to_track_win), vbox); | |
583 | |
584 jtf_store = gtk_list_store_new(2, G_TYPE_UINT, G_TYPE_STRING); | |
585 treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(jtf_store)); | |
586 g_object_unref(jtf_store); | |
587 | |
588 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(treeview), TRUE); | |
589 | |
590 column = gtk_tree_view_column_new(); | |
591 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeview), FALSE); | |
592 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); | |
593 | |
594 renderer = gtk_cell_renderer_text_new(); | |
595 gtk_tree_view_column_pack_start(column, renderer, FALSE); | |
596 gtk_tree_view_column_set_attributes(column, renderer, "text", 0, NULL); | |
597 gtk_tree_view_column_set_spacing(column, 4); | |
598 | |
599 renderer = gtk_cell_renderer_text_new(); | |
600 gtk_tree_view_column_pack_start(column, renderer, FALSE); | |
601 gtk_tree_view_column_set_attributes(column, renderer, "text", 1, NULL); | |
602 gtk_tree_view_column_set_spacing(column, 4); | |
603 gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); | |
604 | |
605 gtk_tree_view_set_search_column(GTK_TREE_VIEW(treeview), 1); | |
606 | |
607 g_signal_connect(treeview, "row-activated", | |
608 G_CALLBACK(ui_jump_to_track_jump), NULL); | |
609 | |
610 hbox = gtk_hbox_new(FALSE, 3); | |
611 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 3); | |
612 | |
4178
cb0952a41f7b
- removed genres that appeared twice in the file info dialog
mf0102 <0102@gmx.at>
parents:
4177
diff
changeset
|
613 |
cb0952a41f7b
- removed genres that appeared twice in the file info dialog
mf0102 <0102@gmx.at>
parents:
4177
diff
changeset
|
614 /* filter box */ |
2500 | 615 search_label = gtk_label_new(_("Filter: ")); |
616 gtk_label_set_markup_with_mnemonic(GTK_LABEL(search_label), _("_Filter:")); | |
617 gtk_box_pack_start(GTK_BOX(hbox), search_label, FALSE, FALSE, 0); | |
618 | |
619 edit = gtk_entry_new(); | |
620 gtk_entry_set_editable(GTK_ENTRY(edit), TRUE); | |
621 gtk_label_set_mnemonic_widget(GTK_LABEL(search_label), edit); | |
622 g_signal_connect(edit, "changed", | |
623 G_CALLBACK(ui_jump_to_track_edit_cb), treeview); | |
624 | |
625 g_signal_connect(edit, "key_press_event", | |
626 G_CALLBACK(ui_jump_to_track_edit_keypress_cb), treeview); | |
627 | |
628 g_signal_connect(jump_to_track_win, "key_press_event", | |
629 G_CALLBACK(ui_jump_to_track_keypress_cb), treeview); | |
630 | |
631 gtk_box_pack_start(GTK_BOX(hbox), edit, TRUE, TRUE, 3); | |
632 | |
4174
6425fbe741f1
reorganized the JTF dialog, it's not so wide anymore
Cristi Magherusan <majeru@atheme-project.org>
parents:
4160
diff
changeset
|
633 /* remember text entry */ |
6425fbe741f1
reorganized the JTF dialog, it's not so wide anymore
Cristi Magherusan <majeru@atheme-project.org>
parents:
4160
diff
changeset
|
634 toggle2 = gtk_check_button_new_with_label(_("Remember")); |
6425fbe741f1
reorganized the JTF dialog, it's not so wide anymore
Cristi Magherusan <majeru@atheme-project.org>
parents:
4160
diff
changeset
|
635 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle2), |
6425fbe741f1
reorganized the JTF dialog, it's not so wide anymore
Cristi Magherusan <majeru@atheme-project.org>
parents:
4160
diff
changeset
|
636 cfg.remember_jtf_entry ? TRUE : FALSE); |
6425fbe741f1
reorganized the JTF dialog, it's not so wide anymore
Cristi Magherusan <majeru@atheme-project.org>
parents:
4160
diff
changeset
|
637 gtk_box_pack_start(GTK_BOX(hbox), toggle2, FALSE, FALSE, 0); |
6425fbe741f1
reorganized the JTF dialog, it's not so wide anymore
Cristi Magherusan <majeru@atheme-project.org>
parents:
4160
diff
changeset
|
638 g_signal_connect(toggle2, "clicked", |
6425fbe741f1
reorganized the JTF dialog, it's not so wide anymore
Cristi Magherusan <majeru@atheme-project.org>
parents:
4160
diff
changeset
|
639 G_CALLBACK(ui_jump_to_track_toggle2_cb), |
6425fbe741f1
reorganized the JTF dialog, it's not so wide anymore
Cristi Magherusan <majeru@atheme-project.org>
parents:
4160
diff
changeset
|
640 toggle2); |
4178
cb0952a41f7b
- removed genres that appeared twice in the file info dialog
mf0102 <0102@gmx.at>
parents:
4177
diff
changeset
|
641 |
cb0952a41f7b
- removed genres that appeared twice in the file info dialog
mf0102 <0102@gmx.at>
parents:
4177
diff
changeset
|
642 /* clear button */ |
4174
6425fbe741f1
reorganized the JTF dialog, it's not so wide anymore
Cristi Magherusan <majeru@atheme-project.org>
parents:
4160
diff
changeset
|
643 rescan = gtk_button_new_from_stock(GTK_STOCK_CLEAR); |
6425fbe741f1
reorganized the JTF dialog, it's not so wide anymore
Cristi Magherusan <majeru@atheme-project.org>
parents:
4160
diff
changeset
|
644 gtk_box_pack_start(GTK_BOX(hbox), rescan, FALSE, FALSE, 0); |
6425fbe741f1
reorganized the JTF dialog, it's not so wide anymore
Cristi Magherusan <majeru@atheme-project.org>
parents:
4160
diff
changeset
|
645 |
4178
cb0952a41f7b
- removed genres that appeared twice in the file info dialog
mf0102 <0102@gmx.at>
parents:
4177
diff
changeset
|
646 |
4174
6425fbe741f1
reorganized the JTF dialog, it's not so wide anymore
Cristi Magherusan <majeru@atheme-project.org>
parents:
4160
diff
changeset
|
647 /* pack to container */ |
6425fbe741f1
reorganized the JTF dialog, it's not so wide anymore
Cristi Magherusan <majeru@atheme-project.org>
parents:
4160
diff
changeset
|
648 storage = g_object_new(G_TYPE_OBJECT, NULL); |
6425fbe741f1
reorganized the JTF dialog, it's not so wide anymore
Cristi Magherusan <majeru@atheme-project.org>
parents:
4160
diff
changeset
|
649 g_object_set_data(storage, "widget", rescan); |
6425fbe741f1
reorganized the JTF dialog, it's not so wide anymore
Cristi Magherusan <majeru@atheme-project.org>
parents:
4160
diff
changeset
|
650 g_object_set_data(storage, "treeview", treeview); |
6425fbe741f1
reorganized the JTF dialog, it's not so wide anymore
Cristi Magherusan <majeru@atheme-project.org>
parents:
4160
diff
changeset
|
651 g_object_set_data(storage, "edit", edit); |
6425fbe741f1
reorganized the JTF dialog, it's not so wide anymore
Cristi Magherusan <majeru@atheme-project.org>
parents:
4160
diff
changeset
|
652 |
6425fbe741f1
reorganized the JTF dialog, it's not so wide anymore
Cristi Magherusan <majeru@atheme-project.org>
parents:
4160
diff
changeset
|
653 g_signal_connect(rescan, "clicked", |
6425fbe741f1
reorganized the JTF dialog, it's not so wide anymore
Cristi Magherusan <majeru@atheme-project.org>
parents:
4160
diff
changeset
|
654 G_CALLBACK(ui_jump_to_track_update), storage); |
6425fbe741f1
reorganized the JTF dialog, it's not so wide anymore
Cristi Magherusan <majeru@atheme-project.org>
parents:
4160
diff
changeset
|
655 |
6425fbe741f1
reorganized the JTF dialog, it's not so wide anymore
Cristi Magherusan <majeru@atheme-project.org>
parents:
4160
diff
changeset
|
656 GTK_WIDGET_SET_FLAGS(rescan, GTK_CAN_DEFAULT); |
6425fbe741f1
reorganized the JTF dialog, it's not so wide anymore
Cristi Magherusan <majeru@atheme-project.org>
parents:
4160
diff
changeset
|
657 gtk_widget_grab_default(rescan); |
6425fbe741f1
reorganized the JTF dialog, it's not so wide anymore
Cristi Magherusan <majeru@atheme-project.org>
parents:
4160
diff
changeset
|
658 |
2500 | 659 scrollwin = gtk_scrolled_window_new(NULL, NULL); |
660 gtk_container_add(GTK_CONTAINER(scrollwin), treeview); | |
661 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollwin), | |
662 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); | |
663 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrollwin), | |
664 GTK_SHADOW_IN); | |
665 gtk_box_pack_start(GTK_BOX(vbox), scrollwin, TRUE, TRUE, 0); | |
666 | |
667 sep = gtk_hseparator_new(); | |
668 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); | |
669 | |
670 bbox = gtk_hbutton_box_new(); | |
671 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); | |
4174
6425fbe741f1
reorganized the JTF dialog, it's not so wide anymore
Cristi Magherusan <majeru@atheme-project.org>
parents:
4160
diff
changeset
|
672 gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 4); |
2500 | 673 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); |
674 | |
2805
6295535fbf49
[svn] - add toggle button to keep jtf dialog opened on jump.
yaz
parents:
2717
diff
changeset
|
675 /* close dialog toggle */ |
6295535fbf49
[svn] - add toggle button to keep jtf dialog opened on jump.
yaz
parents:
2717
diff
changeset
|
676 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
|
677 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
|
678 cfg.close_jtf_dialog ? TRUE : FALSE); |
6295535fbf49
[svn] - add toggle button to keep jtf dialog opened on jump.
yaz
parents:
2717
diff
changeset
|
679 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
|
680 g_signal_connect(toggle, "clicked", |
6295535fbf49
[svn] - add toggle button to keep jtf dialog opened on jump.
yaz
parents:
2717
diff
changeset
|
681 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
|
682 toggle); |
4176
75188b91097e
added the GTK_STOCK_ADD pixmap to the queue button
Cristi Magherusan <majeru@atheme-project.org>
parents:
4174
diff
changeset
|
683 |
2500 | 684 queue = gtk_button_new_with_mnemonic(_("_Queue")); |
4176
75188b91097e
added the GTK_STOCK_ADD pixmap to the queue button
Cristi Magherusan <majeru@atheme-project.org>
parents:
4174
diff
changeset
|
685 gtk_button_set_image(GTK_BUTTON(queue), |
4178
cb0952a41f7b
- removed genres that appeared twice in the file info dialog
mf0102 <0102@gmx.at>
parents:
4177
diff
changeset
|
686 gtk_image_new_from_stock(AUD_STOCK_QUEUETOGGLE, GTK_ICON_SIZE_BUTTON)); |
2500 | 687 gtk_box_pack_start(GTK_BOX(bbox), queue, FALSE, FALSE, 0); |
688 GTK_WIDGET_SET_FLAGS(queue, GTK_CAN_DEFAULT); | |
689 g_signal_connect(queue, "clicked", | |
690 G_CALLBACK(ui_jump_to_track_queue_cb), | |
691 treeview); | |
692 g_signal_connect(gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)), "changed", | |
693 G_CALLBACK(ui_jump_to_track_selection_changed_cb), | |
694 queue); | |
695 | |
696 jump = gtk_button_new_from_stock(GTK_STOCK_JUMP_TO); | |
697 gtk_box_pack_start(GTK_BOX(bbox), jump, FALSE, FALSE, 0); | |
698 | |
699 g_signal_connect_swapped(jump, "clicked", | |
700 G_CALLBACK(ui_jump_to_track_jump_cb), | |
701 treeview); | |
702 | |
703 GTK_WIDGET_SET_FLAGS(jump, GTK_CAN_DEFAULT); | |
704 gtk_widget_grab_default(jump); | |
705 | |
3920
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
706 close = gtk_button_new_from_stock(GTK_STOCK_CLOSE); |
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
707 gtk_box_pack_start(GTK_BOX(bbox), close, FALSE, FALSE, 0); |
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
708 g_signal_connect_swapped(close, "clicked", |
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
709 G_CALLBACK(gtk_widget_hide), |
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
710 jump_to_track_win); // just hide --yaz |
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
711 GTK_WIDGET_SET_FLAGS(close, GTK_CAN_DEFAULT); |
2500 | 712 |
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
|
713 g_timeout_add(100, (GSourceFunc)ui_jump_to_track_fill, treeview); |
3920
c2b2828186ba
- serial number has been added to playlist structure so that changes of the current playlist can be notified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3917
diff
changeset
|
714 g_timeout_add(500, (GSourceFunc)watchdog, storage); |
2500 | 715 |
716 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
|
717 gtk_widget_grab_focus(edit); |
2500 | 718 } |