annotate src/audacious/ui_jumptotrack.c @ 4789:0b44f32ea243

It is idiotic to exclude that printf out of the #ifdefs if it uses variables defined only inside the #ifdef... Fixed.
author Jonathan Schleifer <js-audacious@webkeks.org>
date Thu, 02 Oct 2008 23:20:04 +0200
parents b87f8c707b7f
children 885c21b8684e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4700
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
1 /* Audacious - Cross-platform multimedia player
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
2 * Copyright (C) 2005-2006 Audacious development team.
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
3 *
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
4 * BMP - Cross-platform multimedia player
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
5 * Copyright (C) 2003-2004 BMP development team.
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
6 *
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
7 * Based on XMMS:
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
8 * Copyright (C) 1998-2003 XMMS development team.
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
9 *
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
10 * This program is free software; you can redistribute it and/or modify
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
11 * it under the terms of the GNU General Public License as published by
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
12 * the Free Software Foundation; under version 3 of the License.
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
13 *
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful,
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
17 * GNU General Public License for more details.
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
18 *
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
20 * along with this program. If not, see <http://www.gnu.org/licenses>.
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
21 *
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
22 * The Audacious team does not consider modular code linking to
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
23 * Audacious or using our public API to be a derived work.
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
24 */
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
25
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
26 #ifdef HAVE_CONFIG_H
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
27 # include "config.h"
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
28 #endif
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
29
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
30
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
31 #include <glib.h>
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
32 #include <glib/gi18n.h>
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
33 #include <glib/gprintf.h>
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
34 #include <gtk/gtk.h>
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
35 #include <gtk/gtkmessagedialog.h>
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
36
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
37 /* GDK including */
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
38 #include "platform/smartinclude.h"
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
39
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
40 #include <math.h>
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
41 #include <stdlib.h>
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
42 #include <string.h>
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
43
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
44 #include <sys/types.h>
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
45
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
46 #if defined(USE_REGEX_ONIGURUMA)
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
47 #include <onigposix.h>
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
48 #elif defined(USE_REGEX_PCRE)
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
49 #include <pcreposix.h>
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
50 #else
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
51 #include <regex.h>
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
52 #endif
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
53
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
54 #include "icons-stock.h"
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
55
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
56 #include "actions-mainwin.h"
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
57
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
58 #include "main.h"
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
59
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
60 #include "dnd.h"
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
61 #include "input.h"
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
62 #include "playback.h"
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
63 #include "playlist.h"
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
64 #include "pluginenum.h"
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
65 #include "ui_credits.h"
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
66 #include "ui_fileopener.h"
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
67 #include "ui_preferences.h"
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
68 #include "strings.h"
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
69 #include "util.h"
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
70 #include "visualization.h"
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
71
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
72 #include "ui_jumptotrack_cache.h"
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
73
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
74 static GtkWidget *jump_to_track_win = NULL;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
75 static gulong serial = 0;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
76
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
77 static JumpToTrackCache* cache = NULL;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
78
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
79 static void
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
80 change_song(guint pos)
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
81 {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
82 if (playback_get_playing())
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
83 playback_stop();
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
84
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
85 playlist_set_position(playlist_get_active(), pos);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
86 playback_initiate();
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
87 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
88
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
89 void
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
90 ui_jump_to_track_hide(void)
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
91 {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
92 g_return_if_fail(jump_to_track_win != NULL);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
93 gtk_widget_hide(jump_to_track_win);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
94 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
95
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
96 static void
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
97 ui_jump_to_track_jump(GtkTreeView * treeview)
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
98 {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
99 GtkTreeModel *model;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
100 GtkTreeSelection *selection;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
101 GtkTreeIter iter;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
102 guint pos;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
103
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
104 model = gtk_tree_view_get_model(treeview);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
105 selection = gtk_tree_view_get_selection(treeview);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
106
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
107 if (!gtk_tree_selection_get_selected(selection, NULL, &iter))
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
108 return;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
109
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
110 gtk_tree_model_get(model, &iter, 0, &pos, -1);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
111
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
112 change_song(pos - 1);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
113
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
114 if(cfg.close_jtf_dialog)
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
115 ui_jump_to_track_hide();
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
116 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
117
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
118 static void
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
119 ui_jump_to_track_toggle_cb(GtkWidget * toggle)
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
120 {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
121 cfg.close_jtf_dialog =
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
122 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle));
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
123 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
124
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
125 static void
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
126 ui_jump_to_track_toggle2_cb(GtkWidget * toggle)
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
127 {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
128 cfg.remember_jtf_entry =
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
129 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle));
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
130 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
131
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
132 static void
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
133 ui_jump_to_track_jump_cb(GtkTreeView * treeview,
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
134 gpointer data)
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
135 {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
136 ui_jump_to_track_jump(treeview);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
137 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
138
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
139 static void
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
140 ui_jump_to_track_set_queue_button_label(GtkButton * button,
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
141 guint pos)
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
142 {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
143 if (playlist_is_position_queued(playlist_get_active(), pos))
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
144 gtk_button_set_label(button, _("Un_queue"));
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
145 else
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
146 gtk_button_set_label(button, _("_Queue"));
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
147 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
148
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
149 static void
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
150 ui_jump_to_track_queue_cb(GtkButton * button,
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
151 gpointer data)
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
152 {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
153 GtkTreeView *treeview;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
154 GtkTreeModel *model;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
155 GtkTreeSelection *selection;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
156 GtkTreeIter iter;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
157 guint pos;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
158
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
159 treeview = GTK_TREE_VIEW(data);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
160 model = gtk_tree_view_get_model(treeview);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
161 selection = gtk_tree_view_get_selection(treeview);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
162
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
163 if (!gtk_tree_selection_get_selected(selection, NULL, &iter))
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
164 return;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
165
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
166 gtk_tree_model_get(model, &iter, 0, &pos, -1);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
167
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
168 playlist_queue_position(playlist_get_active(), (pos - 1));
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
169
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
170 ui_jump_to_track_set_queue_button_label(button, (pos - 1));
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
171 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
172
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
173 static void
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
174 ui_jump_to_track_selection_changed_cb(GtkTreeSelection *treesel,
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
175 gpointer data)
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
176 {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
177 GtkTreeView *treeview;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
178 GtkTreeModel *model;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
179 GtkTreeSelection *selection;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
180 GtkTreeIter iter;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
181 guint pos;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
182
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
183 treeview = gtk_tree_selection_get_tree_view(treesel);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
184 model = gtk_tree_view_get_model(treeview);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
185 selection = gtk_tree_view_get_selection(treeview);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
186
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
187 if (!gtk_tree_selection_get_selected(selection, NULL, &iter))
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
188 return;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
189
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
190 gtk_tree_model_get(model, &iter, 0, &pos, -1);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
191
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
192 ui_jump_to_track_set_queue_button_label(GTK_BUTTON(data), (pos - 1));
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
193 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
194
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
195 static gboolean
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
196 ui_jump_to_track_edit_keypress_cb(GtkWidget * object,
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
197 GdkEventKey * event,
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
198 gpointer data)
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
199 {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
200 switch (event->keyval) {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
201 case GDK_Return:
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
202 if (gtk_im_context_filter_keypress (GTK_ENTRY (object)->im_context, event)) {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
203 GTK_ENTRY (object)->need_im_reset = TRUE;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
204 return TRUE;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
205 } else {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
206 ui_jump_to_track_jump(GTK_TREE_VIEW(data));
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
207 return TRUE;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
208 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
209 default:
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
210 return FALSE;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
211 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
212 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
213
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
214 static gboolean
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
215 ui_jump_to_track_keypress_cb(GtkWidget * object,
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
216 GdkEventKey * event,
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
217 gpointer data)
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
218 {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
219 switch (event->keyval) {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
220 case GDK_Escape:
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
221 ui_jump_to_track_hide();
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
222 return TRUE;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
223 case GDK_KP_Enter:
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
224 ui_jump_to_track_queue_cb(NULL, data);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
225 return TRUE;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
226 default:
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
227 return FALSE;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
228 };
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
229
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
230 return FALSE;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
231 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
232
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
233 void
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
234 ui_jump_to_track_update(GtkWidget * widget, gpointer user_data)
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
235 {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
236 guint row;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
237 GList *playlist_glist;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
238 gchar *desc_buf = NULL;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
239 GtkTreeIter iter;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
240 GtkTreeSelection *selection;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
241 Playlist *playlist;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
242
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
243 GtkTreeModel *store;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
244
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
245 GtkTreeView *tree = GTK_TREE_VIEW(g_object_get_data(user_data, "treeview"));
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
246 GtkEntry *edit = g_object_get_data(user_data, "edit");
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
247
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
248 if (!jump_to_track_win)
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
249 return;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
250
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
251 /* clear edit widget */
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
252 if(edit){
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
253 gtk_entry_set_text(edit, "");
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
254 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
255
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
256 store = gtk_tree_view_get_model(tree);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
257 gtk_list_store_clear(GTK_LIST_STORE(store));
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
258
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
259 row = 1;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
260 playlist = playlist_get_active();
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
261 for (playlist_glist = playlist->entries; playlist_glist;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
262 playlist_glist = g_list_next(playlist_glist)) {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
263 PlaylistEntry *entry = PLAYLIST_ENTRY(playlist_glist->data);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
264
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
265 if (entry->title)
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
266 desc_buf = g_strdup(entry->title);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
267 else {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
268 gchar *realfn = NULL;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
269 realfn = g_filename_from_uri(entry->filename, NULL, NULL);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
270 if (strchr(realfn ? realfn : entry->filename, '/'))
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
271 desc_buf = str_assert_utf8(strrchr(realfn ? realfn : entry->filename, '/') + 1);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
272 else
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
273 desc_buf = str_assert_utf8(realfn ? realfn : entry->filename);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
274 g_free(realfn); realfn = NULL;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
275 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
276
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
277 gtk_list_store_append(GTK_LIST_STORE(store), &iter);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
278 gtk_list_store_set(GTK_LIST_STORE(store), &iter,
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
279 0, row, 1, desc_buf, -1);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
280 row++;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
281
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
282 g_free(desc_buf);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
283 desc_buf = NULL;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
284 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
285
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
286 gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
287 selection = gtk_tree_view_get_selection(tree);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
288 gtk_tree_selection_select_iter(selection, &iter);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
289 serial = playlist->serial; // important. --yaz
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
290 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
291
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
292 static void
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
293 ui_jump_to_track_edit_cb(GtkEntry * entry, gpointer user_data)
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
294 {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
295 GtkTreeView *treeview = GTK_TREE_VIEW(user_data);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
296 GtkTreeSelection *selection;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
297 GtkTreeIter iter;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
298
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
299 GtkListStore *store;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
300
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
301 const GArray *search_matches;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
302 Playlist *playlist;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
303 int i;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
304
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
305 if (cache == NULL) {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
306 cache = ui_jump_to_track_cache_new();
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
307 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
308
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
309 /* FIXME: Remove the connected signals before clearing
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
310 * (row-selected will still eventually arrive once) */
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
311 store = GTK_LIST_STORE(gtk_tree_view_get_model(treeview));
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
312 /* detach model from treeview */
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
313 g_object_ref( store );
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
314 gtk_tree_view_set_model( GTK_TREE_VIEW(treeview) , NULL );
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
315
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
316 gtk_list_store_clear(store);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
317
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
318 playlist = playlist_get_active();
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
319
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
320 PLAYLIST_LOCK(playlist);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
321
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
322 search_matches = ui_jump_to_track_cache_search(cache,
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
323 playlist,
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
324 gtk_entry_get_text(entry));
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
325
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
326 for (i = 0; i < search_matches->len; i++)
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
327 {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
328 JumpToTrackEntry *jttentry = g_array_index(search_matches, JumpToTrackEntry*, i);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
329 PlaylistEntry* entry = jttentry->entry;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
330 gchar *title = NULL;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
331
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
332 if (entry->title)
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
333 title = g_strdup(entry->title);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
334 else {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
335 gchar *realfn = NULL;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
336 realfn = g_filename_from_uri(entry->filename, NULL, NULL);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
337 if (strchr(realfn ? realfn : entry->filename, '/'))
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
338 title = str_assert_utf8(strrchr(realfn ? realfn : entry->filename, '/') + 1);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
339 else
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
340 title = str_assert_utf8(realfn ? realfn : entry->filename);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
341 g_free(realfn); realfn = NULL;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
342 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
343 gtk_list_store_append(store, &iter);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
344 gtk_list_store_set(store, &iter, 0, jttentry->playlist_position + 1 , 1, title, -1);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
345 g_free(title);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
346 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
347
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
348 PLAYLIST_UNLOCK(playlist);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
349
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
350 /* attach the model again to the treeview */
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
351 gtk_tree_view_set_model( GTK_TREE_VIEW(treeview) , GTK_TREE_MODEL(store) );
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
352 g_object_unref( store );
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
353
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
354 if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter)) {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
355 selection = gtk_tree_view_get_selection(treeview);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
356 gtk_tree_selection_select_iter(selection, &iter);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
357 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
358 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
359
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
360 static gboolean
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
361 ui_jump_to_track_fill(gpointer treeview)
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
362 {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
363 GList *playlist_glist;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
364 Playlist *playlist;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
365 gchar *desc_buf = NULL;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
366 guint row;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
367 GtkTreeIter iter;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
368 GtkListStore *jtf_store = (GtkListStore*)gtk_tree_view_get_model( GTK_TREE_VIEW(treeview) );
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
369
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
370 /* detach model from treeview before fill */
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
371 g_object_ref(jtf_store);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
372 gtk_tree_view_set_model( GTK_TREE_VIEW(treeview), NULL );
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
373
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
374 gtk_list_store_clear(jtf_store);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
375
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
376 row = 1;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
377 playlist = playlist_get_active();
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
378
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
379 PLAYLIST_LOCK(playlist);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
380 for (playlist_glist = playlist->entries; playlist_glist;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
381 playlist_glist = g_list_next(playlist_glist)) {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
382
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
383 PlaylistEntry *entry = PLAYLIST_ENTRY(playlist_glist->data);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
384
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
385 if (entry->title)
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
386 desc_buf = g_strdup(entry->title);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
387 else {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
388 gchar *realfn = NULL;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
389 realfn = g_filename_from_uri(entry->filename, NULL, NULL);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
390 if (strchr(realfn ? realfn : entry->filename, '/'))
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
391 desc_buf = str_assert_utf8(strrchr(realfn ? realfn : entry->filename, '/') + 1);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
392 else
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
393 desc_buf = str_assert_utf8(realfn ? realfn : entry->filename);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
394 g_free(realfn); realfn = NULL;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
395 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
396
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
397 gtk_list_store_append(GTK_LIST_STORE(jtf_store), &iter);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
398 gtk_list_store_set(GTK_LIST_STORE(jtf_store), &iter,
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
399 0, row, 1, desc_buf, -1);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
400 row++;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
401
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
402 g_free(desc_buf);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
403 desc_buf = NULL;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
404 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
405 PLAYLIST_UNLOCK(playlist);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
406
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
407 /* attach liststore to treeview */
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
408 gtk_tree_view_set_model(GTK_TREE_VIEW(treeview), GTK_TREE_MODEL(jtf_store));
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
409 g_object_unref(jtf_store);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
410 serial = playlist->serial;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
411 return FALSE;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
412 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
413
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
414 static gboolean
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
415 watchdog(gpointer storage)
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
416 {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
417 GtkWidget *widget;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
418 Playlist *playlist = playlist_get_active();
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
419
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
420 if(serial == playlist->serial)
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
421 return TRUE;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
422
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
423 widget = g_object_get_data(storage, "widget");
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
424 ui_jump_to_track_update(widget, storage);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
425 return TRUE;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
426 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
427
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
428 void
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
429 ui_jump_to_track(void)
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
430 {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
431 GtkWidget *scrollwin;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
432 GtkWidget *vbox, *bbox, *sep;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
433 GtkWidget *toggle, *toggle2;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
434 GtkWidget *jump, *queue, *close;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
435 GtkWidget *rescan;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
436 GtkWidget *search_label, *hbox;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
437 static GtkWidget *edit;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
438
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
439 GtkWidget *treeview = NULL;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
440 GtkListStore *jtf_store;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
441
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
442 GtkCellRenderer *renderer;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
443 GtkTreeViewColumn *column;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
444
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
445 gpointer storage;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
446
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
447 if (jump_to_track_win) {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
448 gtk_window_present(GTK_WINDOW(jump_to_track_win));
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
449
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
450 if(!cfg.remember_jtf_entry)
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
451 gtk_entry_set_text(GTK_ENTRY(edit), "");
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
452
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
453 gtk_widget_grab_focus(edit);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
454 gtk_editable_select_region(GTK_EDITABLE(edit), 0, -1);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
455 return;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
456 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
457
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
458 #if defined(USE_REGEX_ONIGURUMA)
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
459 /* set encoding for Oniguruma regex to UTF-8 */
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
460 reg_set_encoding( REG_POSIX_ENCODING_UTF8 );
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
461 onig_set_default_syntax( ONIG_SYNTAX_POSIX_BASIC );
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
462 #endif
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
463
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
464 jump_to_track_win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
465 gtk_window_set_type_hint(GTK_WINDOW(jump_to_track_win),
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
466 GDK_WINDOW_TYPE_HINT_DIALOG);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
467
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
468 gtk_window_set_title(GTK_WINDOW(jump_to_track_win), _("Jump to Track"));
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
469
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
470 gtk_window_set_position(GTK_WINDOW(jump_to_track_win), GTK_WIN_POS_CENTER);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
471 g_signal_connect(jump_to_track_win, "destroy",
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
472 G_CALLBACK(gtk_widget_destroyed), &jump_to_track_win);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
473
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
474 gtk_container_border_width(GTK_CONTAINER(jump_to_track_win), 10);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
475 gtk_window_set_default_size(GTK_WINDOW(jump_to_track_win), 600, 500);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
476
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
477 vbox = gtk_vbox_new(FALSE, 5);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
478 gtk_container_add(GTK_CONTAINER(jump_to_track_win), vbox);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
479
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
480 jtf_store = gtk_list_store_new(2, G_TYPE_UINT, G_TYPE_STRING);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
481 treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(jtf_store));
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
482 g_object_unref(jtf_store);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
483
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
484 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(treeview), TRUE);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
485
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
486 column = gtk_tree_view_column_new();
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
487 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeview), FALSE);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
488 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
489
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
490 renderer = gtk_cell_renderer_text_new();
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
491 gtk_tree_view_column_pack_start(column, renderer, FALSE);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
492 gtk_tree_view_column_set_attributes(column, renderer, "text", 0, NULL);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
493 gtk_tree_view_column_set_spacing(column, 4);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
494
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
495 renderer = gtk_cell_renderer_text_new();
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
496 gtk_tree_view_column_pack_start(column, renderer, FALSE);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
497 gtk_tree_view_column_set_attributes(column, renderer, "text", 1, NULL);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
498 gtk_tree_view_column_set_spacing(column, 4);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
499 gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
500
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
501 gtk_tree_view_set_search_column(GTK_TREE_VIEW(treeview), 1);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
502
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
503 g_signal_connect(treeview, "row-activated",
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
504 G_CALLBACK(ui_jump_to_track_jump), NULL);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
505
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
506 hbox = gtk_hbox_new(FALSE, 3);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
507 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 3);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
508
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
509
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
510 /* filter box */
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
511 search_label = gtk_label_new(_("Filter: "));
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
512 gtk_label_set_markup_with_mnemonic(GTK_LABEL(search_label), _("_Filter:"));
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
513 gtk_box_pack_start(GTK_BOX(hbox), search_label, FALSE, FALSE, 0);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
514
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
515 edit = gtk_entry_new();
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
516 gtk_entry_set_editable(GTK_ENTRY(edit), TRUE);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
517 gtk_label_set_mnemonic_widget(GTK_LABEL(search_label), edit);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
518 g_signal_connect(edit, "changed",
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
519 G_CALLBACK(ui_jump_to_track_edit_cb), treeview);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
520
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
521 g_signal_connect(edit, "key_press_event",
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
522 G_CALLBACK(ui_jump_to_track_edit_keypress_cb), treeview);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
523
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
524 g_signal_connect(jump_to_track_win, "key_press_event",
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
525 G_CALLBACK(ui_jump_to_track_keypress_cb), treeview);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
526
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
527 gtk_box_pack_start(GTK_BOX(hbox), edit, TRUE, TRUE, 3);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
528
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
529 /* remember text entry */
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
530 toggle2 = gtk_check_button_new_with_label(_("Remember"));
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
531 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle2),
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
532 cfg.remember_jtf_entry ? TRUE : FALSE);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
533 gtk_box_pack_start(GTK_BOX(hbox), toggle2, FALSE, FALSE, 0);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
534 g_signal_connect(toggle2, "clicked",
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
535 G_CALLBACK(ui_jump_to_track_toggle2_cb),
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
536 toggle2);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
537
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
538 /* clear button */
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
539 rescan = gtk_button_new_from_stock(GTK_STOCK_CLEAR);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
540 gtk_box_pack_start(GTK_BOX(hbox), rescan, FALSE, FALSE, 0);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
541
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
542
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
543 /* pack to container */
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
544 storage = g_object_new(G_TYPE_OBJECT, NULL);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
545 g_object_set_data(storage, "widget", rescan);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
546 g_object_set_data(storage, "treeview", treeview);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
547 g_object_set_data(storage, "edit", edit);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
548
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
549 g_signal_connect(rescan, "clicked",
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
550 G_CALLBACK(ui_jump_to_track_update), storage);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
551
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
552 GTK_WIDGET_SET_FLAGS(rescan, GTK_CAN_DEFAULT);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
553 gtk_widget_grab_default(rescan);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
554
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
555 scrollwin = gtk_scrolled_window_new(NULL, NULL);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
556 gtk_container_add(GTK_CONTAINER(scrollwin), treeview);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
557 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollwin),
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
558 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
559 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrollwin),
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
560 GTK_SHADOW_IN);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
561 gtk_box_pack_start(GTK_BOX(vbox), scrollwin, TRUE, TRUE, 0);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
562
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
563 sep = gtk_hseparator_new();
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
564 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
565
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
566 bbox = gtk_hbutton_box_new();
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
567 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
568 gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 4);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
569 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
570
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
571 /* close dialog toggle */
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
572 toggle = gtk_check_button_new_with_label(_("Close on Jump"));
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
573 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle),
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
574 cfg.close_jtf_dialog ? TRUE : FALSE);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
575 gtk_box_pack_start(GTK_BOX(bbox), toggle, FALSE, FALSE, 0);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
576 g_signal_connect(toggle, "clicked",
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
577 G_CALLBACK(ui_jump_to_track_toggle_cb),
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
578 toggle);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
579
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
580 queue = gtk_button_new_with_mnemonic(_("_Queue"));
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
581 gtk_button_set_image(GTK_BUTTON(queue),
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
582 gtk_image_new_from_stock(AUD_STOCK_QUEUETOGGLE, GTK_ICON_SIZE_BUTTON));
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
583 gtk_box_pack_start(GTK_BOX(bbox), queue, FALSE, FALSE, 0);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
584 GTK_WIDGET_SET_FLAGS(queue, GTK_CAN_DEFAULT);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
585 g_signal_connect(queue, "clicked",
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
586 G_CALLBACK(ui_jump_to_track_queue_cb),
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
587 treeview);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
588 g_signal_connect(gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)), "changed",
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
589 G_CALLBACK(ui_jump_to_track_selection_changed_cb),
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
590 queue);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
591
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
592 jump = gtk_button_new_from_stock(GTK_STOCK_JUMP_TO);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
593 gtk_box_pack_start(GTK_BOX(bbox), jump, FALSE, FALSE, 0);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
594
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
595 g_signal_connect_swapped(jump, "clicked",
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
596 G_CALLBACK(ui_jump_to_track_jump_cb),
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
597 treeview);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
598
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
599 GTK_WIDGET_SET_FLAGS(jump, GTK_CAN_DEFAULT);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
600 gtk_widget_grab_default(jump);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
601
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
602 close = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
603 gtk_box_pack_start(GTK_BOX(bbox), close, FALSE, FALSE, 0);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
604 g_signal_connect_swapped(close, "clicked",
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
605 G_CALLBACK(gtk_widget_hide),
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
606 jump_to_track_win); // just hide --yaz
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
607 GTK_WIDGET_SET_FLAGS(close, GTK_CAN_DEFAULT);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
608
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
609 g_timeout_add(100, (GSourceFunc)ui_jump_to_track_fill, treeview);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
610 g_timeout_add(500, (GSourceFunc)watchdog, storage);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
611
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
612 gtk_widget_show_all(jump_to_track_win);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
613 gtk_widget_grab_focus(edit);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
614 }