annotate src/audacious/ui_jumptotrack.c @ 2686:3994b40acc99 trunk

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