Mercurial > audlegacy
annotate audacious/ui_playlist.c @ 2163:ac8a7d286616 trunk
[svn] - gdk_image_destroy -> g_object_unref
- gdk_gc_destroy -> g_object_unref
- gdk_pixbuf_render_to_drawable -> gdk_draw_pixbuf
author | nenolod |
---|---|
date | Mon, 18 Dec 2006 09:56:52 -0800 |
parents | ba578fefe36a |
children | 2b033869eb2a |
rev | line source |
---|---|
1653 | 1 /* Audacious - Cross-platform multimedia player |
2 * Copyright (C) 2005-2006 Audacious development team. | |
3 * | |
4 * BMP - Cross-platform multimedia player | |
5 * Copyright (C) 2003-2004 BMP development team. | |
6 * | |
7 * Based on XMMS: | |
8 * Copyright (C) 1998-2003 XMMS development team. | |
9 * | |
10 * This program is free software; you can redistribute it and/or modify | |
11 * it under the terms of the GNU General Public License as published by | |
2105
f18a5b617c34
[svn] - move to GPLv2-only. Based on my interpretation of the license, we are
nenolod
parents:
2095
diff
changeset
|
12 * the Free Software Foundation; under version 2 of the License. |
1653 | 13 * |
14 * This program is distributed in the hope that it will be useful, | |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 * GNU General Public License for more details. | |
18 * | |
19 * You should have received a copy of the GNU General Public License | |
20 * along with this program; if not, write to the Free Software | |
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
22 */ | |
23 | |
24 #include "ui_playlist.h" | |
25 | |
26 #include <glib.h> | |
27 #include <glib/gi18n.h> | |
28 #include <gdk/gdk.h> | |
29 #include <gdk/gdkkeysyms.h> | |
30 #include <gtk/gtk.h> | |
31 #include <string.h> | |
32 | |
33 #include "platform/smartinclude.h" | |
34 | |
35 #include <unistd.h> | |
36 #include <errno.h> | |
37 | |
38 #include "libaudacious/util.h" | |
39 | |
40 #include "dnd.h" | |
41 #include "dock.h" | |
42 #include "equalizer.h" | |
43 #include "hints.h" | |
44 #include "input.h" | |
45 #include "main.h" | |
46 #include "mainwin.h" | |
47 #include "playback.h" | |
48 #include "playlist.h" | |
49 #include "playlist_container.h" | |
50 #include "util.h" | |
51 | |
52 #include "pixmaps.h" | |
53 #include "images/audacious_playlist.xpm" | |
54 | |
55 GtkWidget *playlistwin; | |
56 | |
57 PlayList_List *playlistwin_list = NULL; | |
58 PButton *playlistwin_shade, *playlistwin_close; | |
59 | |
60 static gboolean playlistwin_resizing = FALSE; | |
61 | |
62 static GdkPixmap *playlistwin_bg; | |
63 static GdkBitmap *playlistwin_mask = NULL; | |
64 static GdkGC *playlistwin_gc; | |
65 | |
66 static GtkAccelGroup *playlistwin_accel; | |
67 | |
68 static gboolean playlistwin_hint_flag = FALSE; | |
69 | |
70 static PlaylistSlider *playlistwin_slider = NULL; | |
71 static TextBox *playlistwin_time_min, *playlistwin_time_sec; | |
72 static TextBox *playlistwin_info, *playlistwin_sinfo; | |
73 static SButton *playlistwin_srew, *playlistwin_splay; | |
74 static SButton *playlistwin_spause, *playlistwin_sstop; | |
75 static SButton *playlistwin_sfwd, *playlistwin_seject; | |
76 static SButton *playlistwin_sscroll_up, *playlistwin_sscroll_down; | |
77 | |
78 static GList *playlistwin_wlist = NULL; | |
79 | |
2144
b76039eeb6f0
[svn] - added auto-enqueue option for search-in-playlist
giacomo
parents:
2140
diff
changeset
|
80 static void playlistwin_select_search_cbt_cb( GtkWidget *called_cbt , |
b76039eeb6f0
[svn] - added auto-enqueue option for search-in-playlist
giacomo
parents:
2140
diff
changeset
|
81 gpointer other_cbt ); |
2145
e2c6696c1d9a
[svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents:
2144
diff
changeset
|
82 static gboolean playlistwin_select_search_kp_cb( GtkWidget *entry , GdkEventKey *event , |
e2c6696c1d9a
[svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents:
2144
diff
changeset
|
83 gpointer searchdlg_win ); |
2144
b76039eeb6f0
[svn] - added auto-enqueue option for search-in-playlist
giacomo
parents:
2140
diff
changeset
|
84 |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
85 static void action_new_list(void); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
86 static void action_load_list(void); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
87 static void action_save_list(void); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
88 static void action_save_default_list(void); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
89 static void action_refresh_list(void); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
90 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
91 static void action_search_and_select(void); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
92 static void action_invert_selection(void); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
93 static void action_select_all(void); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
94 static void action_select_none(void); |
1653 | 95 |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
96 static void action_clear_queue(void); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
97 static void action_remove_unavailable(void); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
98 static void action_remove_dupes_by_title(void); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
99 static void action_remove_dupes_by_filename(void); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
100 static void action_remove_dupes_by_full_path(void); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
101 static void action_remove_all(void); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
102 static void action_remove_selected(void); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
103 static void action_remove_unselected(void); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
104 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
105 static void action_add_cd(void); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
106 static void action_add_url(void); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
107 static void action_add_files(void); |
1653 | 108 |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
109 static void action_randomize_list(void); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
110 static void action_reverse_list(void); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
111 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
112 static void action_sort_by_title(void); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
113 static void action_sort_by_artist(void); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
114 static void action_sort_by_filename(void); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
115 static void action_sort_by_full_path(void); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
116 static void action_sort_by_date(void); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
117 static void action_sort_by_track_number(void); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
118 static void action_sort_by_playlist_entry(void); |
1653 | 119 |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
120 static void action_sort_selected_by_title(void); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
121 static void action_sort_selected_by_artist(void); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
122 static void action_sort_selected_by_filename(void); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
123 static void action_sort_selected_by_full_path(void); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
124 static void action_sort_selected_by_date(void); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
125 static void action_sort_selected_by_track_number(void); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
126 static void action_sort_selected_by_playlist_entry(void); |
1653 | 127 |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
128 static void action_view_track_info(void); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
129 static void action_queue_toggle(void); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
130 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
131 static GtkActionEntry playlistwin_actions[] = { |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
132 { "dummy", NULL, "dummy" }, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
133 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
134 /* **************** playlist menu **************** */ |
1653 | 135 |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
136 { "new list", GTK_STOCK_NEW, N_("New List"), "<Shift>N", |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
137 N_("Creates a new playlist."), G_CALLBACK(action_new_list) }, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
138 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
139 { "load list", GTK_STOCK_OPEN, N_("New List"), "O", |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
140 N_("Loads a playlist file into the selected playlist."), G_CALLBACK(action_load_list) }, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
141 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
142 { "save list", GTK_STOCK_SAVE, N_("Save List"), "S", |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
143 N_("Saves the selected playlist."), G_CALLBACK(action_save_list) }, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
144 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
145 { "save default list", GTK_STOCK_SAVE, N_("Save Default List"), "<Shift>S", |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
146 N_("Saves the selected playlist to the default location."), |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
147 G_CALLBACK(action_save_default_list) }, |
1653 | 148 |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
149 { "refresh list", GTK_STOCK_REFRESH, N_("Refresh List"), "F5", |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
150 N_("Refreshes metadata associated with a playlist entry."), |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
151 G_CALLBACK(action_refresh_list) }, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
152 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
153 /* **************** select menu **************** */ |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
154 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
155 { "search and select", GTK_STOCK_FIND, N_("Search and Select"), "<Ctrl>F", |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
156 N_("Searches the playlist and selects playlist entries based on specific criteria."), |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
157 G_CALLBACK(action_search_and_select) }, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
158 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
159 { "invert selection", NULL, N_("Invert Selection"), NULL, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
160 N_("Inverts the selected and unselected entries."), |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
161 G_CALLBACK(action_invert_selection) }, |
1653 | 162 |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
163 { "select all", NULL, N_("Select All"), "<Ctrl>A", |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
164 N_("Selects all of the playlist entries."), |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
165 G_CALLBACK(action_select_all) }, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
166 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
167 { "select none", NULL, N_("Select None"), "<Shift><Ctrl>A", |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
168 N_("Deselects all of the playlist entries."), |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
169 G_CALLBACK(action_select_none) }, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
170 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
171 /* **************** delete menu **************** */ |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
172 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
173 { "clear queue", GTK_STOCK_REMOVE, N_("Clear Queue"), "<Shift>Q", |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
174 N_("Clears the queue associated with this playlist."), |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
175 G_CALLBACK(action_clear_queue) }, |
1653 | 176 |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
177 { "remove unavailable", NULL, N_("Remove Unavailable Files"), NULL, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
178 N_("Removes unavailable files from the playlist."), |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
179 G_CALLBACK(action_remove_unavailable) }, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
180 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
181 { "remove duplicates menu", NULL, N_("Remove Duplicates") }, |
1653 | 182 |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
183 { "remove by title", NULL, N_("By Title"), NULL, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
184 N_("Removes duplicate entries from the playlist by title."), |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
185 G_CALLBACK(action_remove_dupes_by_title) }, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
186 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
187 { "remove by filename", NULL, N_("By Filename"), NULL, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
188 N_("Removes duplicate entries from the playlist by filename."), |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
189 G_CALLBACK(action_remove_dupes_by_filename) }, |
1653 | 190 |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
191 { "remove by full path", NULL, N_("By Path + Filename"), NULL, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
192 N_("Removes duplicate entries from the playlist by their full path."), |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
193 G_CALLBACK(action_remove_dupes_by_full_path) }, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
194 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
195 { "remove all", GTK_STOCK_CLEAR, N_("Remove All"), NULL, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
196 N_("Removes all entries from the playlist."), |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
197 G_CALLBACK(action_remove_all) }, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
198 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
199 { "remove unselected", GTK_STOCK_REMOVE, N_("Remove Unselected"), NULL, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
200 N_("Remove unselected entries from the playlist."), |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
201 G_CALLBACK(action_remove_unselected) }, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
202 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
203 { "remove selected", GTK_STOCK_REMOVE, N_("Remove Selected"), "Delete", |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
204 N_("Remove selected entries from the playlist."), |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
205 G_CALLBACK(action_remove_unselected) }, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
206 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
207 /* **************** add menu **************** */ |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
208 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
209 { "add cd", GTK_STOCK_CDROM, N_("Add CD..."), "<Shift>C", |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
210 N_("Adds a CD to the playlist."), |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
211 G_CALLBACK(action_add_cd) }, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
212 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
213 { "add url", GTK_STOCK_NETWORK, N_("Add Internet Address..."), "<Ctrl>H", |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
214 N_("Adds a remote track to the playlist."), |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
215 G_CALLBACK(action_add_url) }, |
1653 | 216 |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
217 { "add files", GTK_STOCK_ADD, N_("Add Files..."), "F", |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
218 N_("Adds files to the playlist."), |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
219 G_CALLBACK(action_add_files) }, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
220 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
221 /* **************** sort menu **************** */ |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
222 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
223 { "randomize list", NULL, N_("Randomize List"), "<Ctrl><Shift>R", |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
224 N_("Randomizes the playlist."), |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
225 G_CALLBACK(action_randomize_list) }, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
226 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
227 { "reverse list", NULL, N_("Reverse List"), NULL, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
228 N_("Reverses the playlist."), |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
229 G_CALLBACK(action_reverse_list) }, |
1653 | 230 |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
231 { "sort menu", NULL, N_("Sort List") }, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
232 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
233 { "sort by title", NULL, N_("By Title"), NULL, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
234 N_("Sorts the list by title."), |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
235 G_CALLBACK(action_sort_by_title) }, |
1653 | 236 |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
237 { "sort by artist", NULL, N_("By Artist"), NULL, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
238 N_("Sorts the list by artist."), |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
239 G_CALLBACK(action_sort_by_artist) }, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
240 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
241 { "sort by filename", NULL, N_("By Filename"), NULL, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
242 N_("Sorts the list by filename."), |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
243 G_CALLBACK(action_sort_by_filename) }, |
1653 | 244 |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
245 { "sort by full path", NULL, N_("By Path + Filename"), NULL, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
246 N_("Sorts the list by full pathname."), |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
247 G_CALLBACK(action_sort_by_full_path) }, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
248 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
249 { "sort by date", NULL, N_("By Date"), NULL, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
250 N_("Sorts the list by modification time."), |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
251 G_CALLBACK(action_sort_by_date) }, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
252 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
253 { "sort by track number", NULL, N_("By Track Number"), NULL, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
254 N_("Sorts the list by track number."), |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
255 G_CALLBACK(action_sort_by_track_number) }, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
256 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
257 { "sort by playlist entry", NULL, N_("By Playlist Entry"), NULL, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
258 N_("Sorts the list by playlist entry."), |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
259 G_CALLBACK(action_sort_by_playlist_entry) }, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
260 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
261 { "sort selected menu", NULL, N_("Sort Selected") }, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
262 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
263 { "sort selected by title", NULL, N_("By Title"), NULL, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
264 N_("Sorts the list by title."), |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
265 G_CALLBACK(action_sort_selected_by_title) }, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
266 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
267 { "sort selected by artist", NULL, N_("By Artist"), NULL, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
268 N_("Sorts the list by artist."), |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
269 G_CALLBACK(action_sort_selected_by_artist) }, |
1653 | 270 |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
271 { "sort selected by filename", NULL, N_("By Filename"), NULL, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
272 N_("Sorts the list by filename."), |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
273 G_CALLBACK(action_sort_selected_by_filename) }, |
1653 | 274 |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
275 { "sort selected by full path", NULL, N_("By Path + Filename"), NULL, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
276 N_("Sorts the list by full pathname."), |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
277 G_CALLBACK(action_sort_selected_by_full_path) }, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
278 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
279 { "sort selected by date", NULL, N_("By Date"), NULL, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
280 N_("Sorts the list by modification time."), |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
281 G_CALLBACK(action_sort_selected_by_date) }, |
1653 | 282 |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
283 { "sort selected by track number", NULL, N_("By Track Number"), NULL, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
284 N_("Sorts the list by track number."), |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
285 G_CALLBACK(action_sort_selected_by_track_number) }, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
286 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
287 { "sort selected by playlist entry", NULL, N_("By Playlist Entry"), NULL, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
288 N_("Sorts the list by playlist entry."), |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
289 G_CALLBACK(action_sort_selected_by_playlist_entry) }, |
1653 | 290 |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
291 /* stuff used in rightclick menu, but not yet covered */ |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
292 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
293 { "view track info", NULL, N_("View Track Details"), "<Alt>I", |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
294 N_("Displays track information."), |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
295 G_CALLBACK(action_view_track_info) }, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
296 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
297 { "queue toggle", NULL, N_("Queue Toggle"), "Q", |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
298 N_("Enables/disables the entry in the playlist's queue."), |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
299 G_CALLBACK(action_queue_toggle) }, |
1653 | 300 }; |
301 | |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
302 static GtkWidget *pladd_menu, *pldel_menu, *plsel_menu, *plsort_menu, *pllist_menu; |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
303 static GtkWidget *playlistwin_popup_menu; |
1653 | 304 |
305 static void playlistwin_draw_frame(void); | |
306 | |
307 | |
308 gboolean | |
309 playlistwin_is_shaded(void) | |
310 { | |
311 return cfg.playlist_shaded; | |
312 } | |
313 | |
314 gint | |
315 playlistwin_get_width(void) | |
316 { | |
317 cfg.playlist_width /= PLAYLISTWIN_WIDTH_SNAP; | |
318 cfg.playlist_width *= PLAYLISTWIN_WIDTH_SNAP; | |
319 return cfg.playlist_width; | |
320 } | |
321 | |
322 gint | |
323 playlistwin_get_height_unshaded(void) | |
324 { | |
2055 | 325 gint height; |
1653 | 326 cfg.playlist_height /= PLAYLISTWIN_HEIGHT_SNAP; |
327 cfg.playlist_height *= PLAYLISTWIN_HEIGHT_SNAP; | |
2055 | 328 height = cfg.playlist_height; |
1653 | 329 return height; |
330 } | |
331 | |
332 gint | |
333 playlistwin_get_height_shaded(void) | |
334 { | |
335 return PLAYLISTWIN_SHADED_HEIGHT; | |
336 } | |
337 | |
338 gint | |
339 playlistwin_get_height(void) | |
340 { | |
341 if (playlistwin_is_shaded()) | |
342 return playlistwin_get_height_shaded(); | |
343 else | |
344 return playlistwin_get_height_unshaded(); | |
345 } | |
346 | |
347 void | |
348 playlistwin_get_size(gint * width, gint * height) | |
349 { | |
350 if (width) | |
351 *width = playlistwin_get_width(); | |
352 | |
353 if (height) | |
354 *height = playlistwin_get_height(); | |
355 } | |
356 | |
357 static void | |
2140
299651a8f107
[svn] - made playlistwin_update_list depend on passed Playlist* instead of blindly using playlist_get_active(); this solves many locking issues with multiple playlists, but SHOULD be reviewed in every place playlistwin_update_list is used; added a playlist_new_from_selected() call too
giacomo
parents:
2139
diff
changeset
|
358 playlistwin_update_info(Playlist *playlist) |
1653 | 359 { |
360 gchar *text, *sel_text, *tot_text; | |
361 gulong selection, total; | |
362 gboolean selection_more, total_more; | |
363 | |
2140
299651a8f107
[svn] - made playlistwin_update_list depend on passed Playlist* instead of blindly using playlist_get_active(); this solves many locking issues with multiple playlists, but SHOULD be reviewed in every place playlistwin_update_list is used; added a playlist_new_from_selected() call too
giacomo
parents:
2139
diff
changeset
|
364 playlist_get_total_time(playlist, &total, &selection, &total_more, &selection_more); |
1653 | 365 |
366 if (selection > 0 || (selection == 0 && !selection_more)) { | |
367 if (selection > 3600) | |
368 sel_text = | |
369 g_strdup_printf("%lu:%-2.2lu:%-2.2lu%s", selection / 3600, | |
370 (selection / 60) % 60, selection % 60, | |
371 (selection_more ? "+" : "")); | |
372 else | |
373 sel_text = | |
374 g_strdup_printf("%lu:%-2.2lu%s", selection / 60, | |
375 selection % 60, (selection_more ? "+" : "")); | |
376 } | |
377 else | |
378 sel_text = g_strdup("?"); | |
379 if (total > 0 || (total == 0 && !total_more)) { | |
380 if (total > 3600) | |
381 tot_text = | |
382 g_strdup_printf("%lu:%-2.2lu:%-2.2lu%s", total / 3600, | |
383 (total / 60) % 60, total % 60, | |
384 total_more ? "+" : ""); | |
385 else | |
386 tot_text = | |
387 g_strdup_printf("%lu:%-2.2lu%s", total / 60, total % 60, | |
388 total_more ? "+" : ""); | |
389 } | |
390 else | |
391 tot_text = g_strdup("?"); | |
392 text = g_strconcat(sel_text, "/", tot_text, NULL); | |
1775 | 393 textbox_set_text(playlistwin_info, text ? text : ""); |
1653 | 394 g_free(text); |
395 g_free(tot_text); | |
396 g_free(sel_text); | |
397 } | |
398 | |
399 static void | |
2140
299651a8f107
[svn] - made playlistwin_update_list depend on passed Playlist* instead of blindly using playlist_get_active(); this solves many locking issues with multiple playlists, but SHOULD be reviewed in every place playlistwin_update_list is used; added a playlist_new_from_selected() call too
giacomo
parents:
2139
diff
changeset
|
400 playlistwin_update_sinfo(Playlist *playlist) |
1653 | 401 { |
1775 | 402 gchar *posstr, *timestr, *title, *info; |
1653 | 403 gint pos, time; |
404 | |
2095 | 405 pos = playlist_get_position(playlist); |
406 title = playlist_get_songtitle(playlist, pos); | |
1653 | 407 |
408 if (!title) { | |
409 textbox_set_text(playlistwin_sinfo, ""); | |
410 return; | |
411 } | |
412 | |
1775 | 413 convert_title_text(title); |
414 | |
2095 | 415 time = playlist_get_songtime(playlist, pos); |
1775 | 416 |
1653 | 417 if (cfg.show_numbers_in_pl) |
418 posstr = g_strdup_printf("%d. ", pos + 1); | |
419 else | |
420 posstr = g_strdup(""); | |
421 | |
422 if (time != -1) { | |
1800
61f531908dd0
[svn] - Put ()'s around the time in the shaded playlist text.
nhjm449
parents:
1775
diff
changeset
|
423 timestr = g_strdup_printf(" (%d:%-2.2d)", time / 60000, |
1775 | 424 (time / 1000) % 60); |
1653 | 425 } |
426 else | |
427 timestr = g_strdup(""); | |
428 | |
1775 | 429 info = g_strdup_printf("%s%s%s", posstr, title, timestr); |
1653 | 430 |
431 g_free(posstr); | |
432 g_free(title); | |
433 g_free(timestr); | |
434 | |
1775 | 435 textbox_set_text(playlistwin_sinfo, info ? info : ""); |
1653 | 436 g_free(info); |
437 } | |
438 | |
439 gboolean | |
440 playlistwin_item_visible(gint index) | |
441 { | |
442 if (index >= playlistwin_list->pl_first | |
443 && index < | |
444 (playlistwin_list->pl_first + playlistwin_list->pl_num_visible)) | |
445 return TRUE; | |
446 return FALSE; | |
447 } | |
448 | |
449 gint | |
450 playlistwin_get_toprow(void) | |
451 { | |
452 if (playlistwin_list) | |
453 return (playlistwin_list->pl_first); | |
454 return (-1); | |
455 } | |
456 | |
457 void | |
458 playlistwin_set_toprow(gint toprow) | |
459 { | |
460 if (playlistwin_list) | |
461 playlistwin_list->pl_first = toprow; | |
2140
299651a8f107
[svn] - made playlistwin_update_list depend on passed Playlist* instead of blindly using playlist_get_active(); this solves many locking issues with multiple playlists, but SHOULD be reviewed in every place playlistwin_update_list is used; added a playlist_new_from_selected() call too
giacomo
parents:
2139
diff
changeset
|
462 playlistwin_update_list(playlist_get_active()); |
1653 | 463 } |
464 | |
465 void | |
2140
299651a8f107
[svn] - made playlistwin_update_list depend on passed Playlist* instead of blindly using playlist_get_active(); this solves many locking issues with multiple playlists, but SHOULD be reviewed in every place playlistwin_update_list is used; added a playlist_new_from_selected() call too
giacomo
parents:
2139
diff
changeset
|
466 playlistwin_update_list(Playlist *playlist) |
1653 | 467 { |
468 g_return_if_fail(playlistwin_list != NULL); | |
469 | |
470 widget_draw(WIDGET(playlistwin_list)); | |
471 widget_draw(WIDGET(playlistwin_slider)); | |
2140
299651a8f107
[svn] - made playlistwin_update_list depend on passed Playlist* instead of blindly using playlist_get_active(); this solves many locking issues with multiple playlists, but SHOULD be reviewed in every place playlistwin_update_list is used; added a playlist_new_from_selected() call too
giacomo
parents:
2139
diff
changeset
|
472 playlistwin_update_info(playlist); |
299651a8f107
[svn] - made playlistwin_update_list depend on passed Playlist* instead of blindly using playlist_get_active(); this solves many locking issues with multiple playlists, but SHOULD be reviewed in every place playlistwin_update_list is used; added a playlist_new_from_selected() call too
giacomo
parents:
2139
diff
changeset
|
473 playlistwin_update_sinfo(playlist); |
1653 | 474 /* mainwin_update_jtf(); */ |
475 } | |
476 | |
477 #if 0 | |
478 static void | |
479 playlistwin_redraw_list(void) | |
480 { | |
481 g_return_if_fail(playlistwin_list != NULL); | |
482 | |
483 draw_widget(playlistwin_list); | |
484 draw_widget(playlistwin_slider); | |
485 } | |
486 #endif | |
487 | |
488 static void | |
489 playlistwin_set_mask(void) | |
490 { | |
491 GdkGC *gc; | |
492 GdkColor pattern; | |
493 | |
494 if (playlistwin_mask) | |
495 g_object_unref(playlistwin_mask); | |
496 | |
497 playlistwin_mask = | |
498 gdk_pixmap_new(playlistwin->window, playlistwin_get_width(), | |
499 playlistwin_get_height(), 1); | |
500 gc = gdk_gc_new(playlistwin_mask); | |
501 pattern.pixel = 1; | |
502 gdk_gc_set_foreground(gc, &pattern); | |
503 gdk_draw_rectangle(playlistwin_mask, gc, TRUE, 0, 0, | |
504 playlistwin_get_width(), playlistwin_get_height()); | |
2163 | 505 g_object_unref(gc); |
1653 | 506 |
507 gtk_widget_shape_combine_mask(playlistwin, playlistwin_mask, 0, 0); | |
508 } | |
509 | |
510 static void | |
511 playlistwin_set_geometry_hints(gboolean shaded) | |
512 { | |
513 GdkGeometry geometry; | |
514 GdkWindowHints mask; | |
515 | |
516 geometry.min_width = PLAYLISTWIN_MIN_WIDTH; | |
517 geometry.max_width = G_MAXUINT16; | |
518 | |
519 geometry.width_inc = PLAYLISTWIN_WIDTH_SNAP; | |
520 geometry.height_inc = PLAYLISTWIN_HEIGHT_SNAP; | |
521 | |
522 if (shaded) { | |
523 geometry.min_height = PLAYLISTWIN_SHADED_HEIGHT; | |
524 geometry.max_height = PLAYLISTWIN_SHADED_HEIGHT; | |
525 geometry.base_height = PLAYLISTWIN_SHADED_HEIGHT; | |
526 } | |
527 else { | |
528 geometry.min_height = PLAYLISTWIN_MIN_HEIGHT; | |
529 geometry.max_height = G_MAXUINT16; | |
530 } | |
531 | |
532 mask = GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE | GDK_HINT_RESIZE_INC; | |
533 | |
534 gtk_window_set_geometry_hints(GTK_WINDOW(playlistwin), | |
535 playlistwin, &geometry, mask); | |
536 } | |
537 | |
538 void | |
1775 | 539 playlistwin_set_sinfo_font(gchar *font) |
540 { | |
541 gchar *tmp = NULL, *tmp2 = NULL; | |
542 | |
543 if(!font) | |
544 return; | |
545 | |
546 tmp = g_strdup(font); | |
547 if(!tmp) | |
548 return; | |
549 | |
550 *strrchr(tmp, ' ') = '\0'; | |
551 tmp2 = g_strdup_printf("%s 8", tmp); | |
552 if(!tmp2) | |
553 return; | |
554 textbox_set_xfont(playlistwin_sinfo, cfg.mainwin_use_xfont, tmp2); | |
555 | |
556 g_free(tmp); g_free(tmp2); | |
557 } | |
558 | |
559 void | |
560 playlistwin_set_sinfo_scroll(gboolean scroll) | |
561 { | |
562 GtkWidget *item; | |
563 | |
564 if(playlistwin_is_shaded()) | |
565 textbox_set_scroll(playlistwin_sinfo, cfg.autoscroll); | |
566 else | |
567 textbox_set_scroll(playlistwin_sinfo, FALSE); | |
568 } | |
569 | |
570 void | |
1653 | 571 playlistwin_set_shade(gboolean shaded) |
572 { | |
573 cfg.playlist_shaded = shaded; | |
574 | |
575 if (shaded) { | |
1775 | 576 playlistwin_set_sinfo_font(cfg.playlist_font); |
577 playlistwin_set_sinfo_scroll(cfg.autoscroll); | |
1653 | 578 widget_show(WIDGET(playlistwin_sinfo)); |
579 playlistwin_shade->pb_nx = 128; | |
580 playlistwin_shade->pb_ny = 45; | |
581 playlistwin_shade->pb_px = 150; | |
582 playlistwin_shade->pb_py = 42; | |
583 playlistwin_close->pb_nx = 138; | |
584 playlistwin_close->pb_ny = 45; | |
585 } | |
586 else { | |
587 widget_hide(WIDGET(playlistwin_sinfo)); | |
1775 | 588 playlistwin_set_sinfo_scroll(FALSE); |
1653 | 589 playlistwin_shade->pb_nx = 157; |
590 playlistwin_shade->pb_ny = 3; | |
591 playlistwin_shade->pb_px = 62; | |
592 playlistwin_shade->pb_py = 42; | |
593 playlistwin_close->pb_nx = 167; | |
594 playlistwin_close->pb_ny = 3; | |
595 } | |
596 | |
597 dock_shade(dock_window_list, GTK_WINDOW(playlistwin), | |
598 playlistwin_get_height()); | |
599 | |
600 playlistwin_set_geometry_hints(cfg.playlist_shaded); | |
601 | |
602 gtk_window_resize(GTK_WINDOW(playlistwin), | |
603 playlistwin_get_width(), | |
604 playlistwin_get_height()); | |
605 | |
606 playlistwin_set_mask(); | |
607 | |
608 widget_draw(WIDGET(playlistwin_list)); | |
609 widget_draw(WIDGET(playlistwin_slider)); | |
610 | |
611 draw_playlist_window(TRUE); | |
612 } | |
613 | |
614 static void | |
615 playlistwin_set_shade_menu(gboolean shaded) | |
616 { | |
617 GtkWidget *item; | |
618 | |
619 item = gtk_item_factory_get_widget(mainwin_view_menu, | |
620 "/Roll up Playlist Editor"); | |
621 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), shaded); | |
622 | |
623 playlistwin_set_shade(shaded); | |
2140
299651a8f107
[svn] - made playlistwin_update_list depend on passed Playlist* instead of blindly using playlist_get_active(); this solves many locking issues with multiple playlists, but SHOULD be reviewed in every place playlistwin_update_list is used; added a playlist_new_from_selected() call too
giacomo
parents:
2139
diff
changeset
|
624 playlistwin_update_list(playlist_get_active()); |
1653 | 625 } |
626 | |
627 void | |
628 playlistwin_shade_toggle(void) | |
629 { | |
630 playlistwin_set_shade_menu(!cfg.playlist_shaded); | |
631 } | |
632 | |
633 static void | |
634 playlistwin_release(GtkWidget * widget, | |
635 GdkEventButton * event, | |
636 gpointer callback_data) | |
637 { | |
638 if (event->button == 3) | |
639 return; | |
640 | |
641 gdk_pointer_ungrab(GDK_CURRENT_TIME); | |
642 playlistwin_resizing = FALSE; | |
643 gdk_flush(); | |
644 | |
645 if (dock_is_moving(GTK_WINDOW(playlistwin))) | |
646 { | |
647 dock_move_release(GTK_WINDOW(playlistwin)); | |
648 | |
649 if (cfg.playlist_transparent) | |
2140
299651a8f107
[svn] - made playlistwin_update_list depend on passed Playlist* instead of blindly using playlist_get_active(); this solves many locking issues with multiple playlists, but SHOULD be reviewed in every place playlistwin_update_list is used; added a playlist_new_from_selected() call too
giacomo
parents:
2139
diff
changeset
|
650 playlistwin_update_list(playlist_get_active()); |
1653 | 651 } |
652 else | |
653 { | |
654 handle_release_cb(playlistwin_wlist, widget, event); | |
655 draw_playlist_window(FALSE); | |
656 } | |
657 } | |
658 | |
659 void | |
660 playlistwin_scroll(gint num) | |
661 { | |
662 playlistwin_list->pl_first += num; | |
2140
299651a8f107
[svn] - made playlistwin_update_list depend on passed Playlist* instead of blindly using playlist_get_active(); this solves many locking issues with multiple playlists, but SHOULD be reviewed in every place playlistwin_update_list is used; added a playlist_new_from_selected() call too
giacomo
parents:
2139
diff
changeset
|
663 playlistwin_update_list(playlist_get_active()); |
1653 | 664 } |
665 | |
666 void | |
667 playlistwin_scroll_up_pushed(void) | |
668 { | |
2026 | 669 playlistwin_scroll(-3); |
1653 | 670 } |
671 | |
672 void | |
673 playlistwin_scroll_down_pushed(void) | |
674 { | |
2026 | 675 playlistwin_scroll(3); |
1653 | 676 } |
677 | |
678 static void | |
2139
fcd1f54efdb9
[svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents:
2129
diff
changeset
|
679 playlistwin_select_all(void) |
fcd1f54efdb9
[svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents:
2129
diff
changeset
|
680 { |
fcd1f54efdb9
[svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents:
2129
diff
changeset
|
681 Playlist *playlist = playlist_get_active(); |
fcd1f54efdb9
[svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents:
2129
diff
changeset
|
682 |
fcd1f54efdb9
[svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents:
2129
diff
changeset
|
683 playlist_select_all(playlist, TRUE); |
fcd1f54efdb9
[svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents:
2129
diff
changeset
|
684 playlistwin_list->pl_prev_selected = 0; |
fcd1f54efdb9
[svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents:
2129
diff
changeset
|
685 playlistwin_list->pl_prev_min = 0; |
fcd1f54efdb9
[svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents:
2129
diff
changeset
|
686 playlistwin_list->pl_prev_max = playlist_get_length(playlist) - 1; |
2140
299651a8f107
[svn] - made playlistwin_update_list depend on passed Playlist* instead of blindly using playlist_get_active(); this solves many locking issues with multiple playlists, but SHOULD be reviewed in every place playlistwin_update_list is used; added a playlist_new_from_selected() call too
giacomo
parents:
2139
diff
changeset
|
687 playlistwin_update_list(playlist); |
2139
fcd1f54efdb9
[svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents:
2129
diff
changeset
|
688 } |
fcd1f54efdb9
[svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents:
2129
diff
changeset
|
689 |
fcd1f54efdb9
[svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents:
2129
diff
changeset
|
690 static void |
fcd1f54efdb9
[svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents:
2129
diff
changeset
|
691 playlistwin_select_none(void) |
fcd1f54efdb9
[svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents:
2129
diff
changeset
|
692 { |
fcd1f54efdb9
[svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents:
2129
diff
changeset
|
693 playlist_select_all(playlist_get_active(), FALSE); |
fcd1f54efdb9
[svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents:
2129
diff
changeset
|
694 playlistwin_list->pl_prev_selected = -1; |
fcd1f54efdb9
[svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents:
2129
diff
changeset
|
695 playlistwin_list->pl_prev_min = -1; |
2140
299651a8f107
[svn] - made playlistwin_update_list depend on passed Playlist* instead of blindly using playlist_get_active(); this solves many locking issues with multiple playlists, but SHOULD be reviewed in every place playlistwin_update_list is used; added a playlist_new_from_selected() call too
giacomo
parents:
2139
diff
changeset
|
696 playlistwin_update_list(playlist_get_active()); |
2139
fcd1f54efdb9
[svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents:
2129
diff
changeset
|
697 } |
fcd1f54efdb9
[svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents:
2129
diff
changeset
|
698 |
fcd1f54efdb9
[svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents:
2129
diff
changeset
|
699 static void |
2129
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
700 playlistwin_select_search(void) |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
701 { |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
702 Playlist *playlist = playlist_get_active(); |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
703 GtkWidget *searchdlg_win, *searchdlg_table; |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
704 GtkWidget *searchdlg_hbox, *searchdlg_logo, *searchdlg_helptext; |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
705 GtkWidget *searchdlg_entry_track_name, *searchdlg_label_track_name; |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
706 GtkWidget *searchdlg_entry_album_name, *searchdlg_label_album_name; |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
707 GtkWidget *searchdlg_entry_file_name, *searchdlg_label_file_name; |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
708 GtkWidget *searchdlg_entry_performer, *searchdlg_label_performer; |
2139
fcd1f54efdb9
[svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents:
2129
diff
changeset
|
709 GtkWidget *searchdlg_checkbt_clearprevsel; |
fcd1f54efdb9
[svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents:
2129
diff
changeset
|
710 GtkWidget *searchdlg_checkbt_newplaylist; |
2144
b76039eeb6f0
[svn] - added auto-enqueue option for search-in-playlist
giacomo
parents:
2140
diff
changeset
|
711 GtkWidget *searchdlg_checkbt_autoenqueue; |
2129
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
712 gint result; |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
713 |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
714 /* create dialog */ |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
715 searchdlg_win = gtk_dialog_new_with_buttons( |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
716 "Search entries in active playlist" , GTK_WINDOW(mainwin) , |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
717 GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT , |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
718 GTK_STOCK_CANCEL , GTK_RESPONSE_REJECT , GTK_STOCK_OK , GTK_RESPONSE_ACCEPT , NULL ); |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
719 /* help text and logo */ |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
720 searchdlg_hbox = gtk_hbox_new( FALSE , 4 ); |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
721 searchdlg_logo = gtk_image_new_from_stock( GTK_STOCK_FIND , GTK_ICON_SIZE_DIALOG ); |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
722 searchdlg_helptext = gtk_label_new( _("Select entries in playlist by filling one or more " |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
723 "fields. Fields use regular expressions syntax, case-insensitive. If you don't know how " |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
724 "regular expressions work, simply insert a literal portion of what you're searching for.") ); |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
725 gtk_label_set_line_wrap( GTK_LABEL(searchdlg_helptext) , TRUE ); |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
726 gtk_box_pack_start( GTK_BOX(searchdlg_hbox) , searchdlg_logo , FALSE , FALSE , 0 ); |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
727 gtk_box_pack_start( GTK_BOX(searchdlg_hbox) , searchdlg_helptext , FALSE , FALSE , 0 ); |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
728 /* track name */ |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
729 searchdlg_label_track_name = gtk_label_new( _("Track name: ") ); |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
730 searchdlg_entry_track_name = gtk_entry_new(); |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
731 gtk_misc_set_alignment( GTK_MISC(searchdlg_label_track_name) , 0 , 0.5 ); |
2145
e2c6696c1d9a
[svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents:
2144
diff
changeset
|
732 g_signal_connect( G_OBJECT(searchdlg_entry_track_name) , "key-press-event" , |
e2c6696c1d9a
[svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents:
2144
diff
changeset
|
733 G_CALLBACK(playlistwin_select_search_kp_cb) , searchdlg_win ); |
2129
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
734 /* album name */ |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
735 searchdlg_label_album_name = gtk_label_new( _("Album name: ") ); |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
736 searchdlg_entry_album_name = gtk_entry_new(); |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
737 gtk_misc_set_alignment( GTK_MISC(searchdlg_label_album_name) , 0 , 0.5 ); |
2145
e2c6696c1d9a
[svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents:
2144
diff
changeset
|
738 g_signal_connect( G_OBJECT(searchdlg_entry_album_name) , "key-press-event" , |
e2c6696c1d9a
[svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents:
2144
diff
changeset
|
739 G_CALLBACK(playlistwin_select_search_kp_cb) , searchdlg_win ); |
2129
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
740 /* artist */ |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
741 searchdlg_label_performer = gtk_label_new( _("Artist: ") ); |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
742 searchdlg_entry_performer = gtk_entry_new(); |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
743 gtk_misc_set_alignment( GTK_MISC(searchdlg_label_performer) , 0 , 0.5 ); |
2145
e2c6696c1d9a
[svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents:
2144
diff
changeset
|
744 g_signal_connect( G_OBJECT(searchdlg_entry_performer) , "key-press-event" , |
e2c6696c1d9a
[svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents:
2144
diff
changeset
|
745 G_CALLBACK(playlistwin_select_search_kp_cb) , searchdlg_win ); |
2129
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
746 /* file name */ |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
747 searchdlg_label_file_name = gtk_label_new( _("Filename: ") ); |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
748 searchdlg_entry_file_name = gtk_entry_new(); |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
749 gtk_misc_set_alignment( GTK_MISC(searchdlg_label_file_name) , 0 , 0.5 ); |
2145
e2c6696c1d9a
[svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents:
2144
diff
changeset
|
750 g_signal_connect( G_OBJECT(searchdlg_entry_file_name) , "key-press-event" , |
e2c6696c1d9a
[svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents:
2144
diff
changeset
|
751 G_CALLBACK(playlistwin_select_search_kp_cb) , searchdlg_win ); |
2139
fcd1f54efdb9
[svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents:
2129
diff
changeset
|
752 /* some options that control behaviour */ |
fcd1f54efdb9
[svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents:
2129
diff
changeset
|
753 searchdlg_checkbt_clearprevsel = gtk_check_button_new_with_label( |
fcd1f54efdb9
[svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents:
2129
diff
changeset
|
754 _("Clear previous selection before searching") ); |
fcd1f54efdb9
[svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents:
2129
diff
changeset
|
755 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(searchdlg_checkbt_clearprevsel) , TRUE ); |
2144
b76039eeb6f0
[svn] - added auto-enqueue option for search-in-playlist
giacomo
parents:
2140
diff
changeset
|
756 searchdlg_checkbt_autoenqueue = gtk_check_button_new_with_label( |
b76039eeb6f0
[svn] - added auto-enqueue option for search-in-playlist
giacomo
parents:
2140
diff
changeset
|
757 _("Automatically toggle queue for matching entries") ); |
b76039eeb6f0
[svn] - added auto-enqueue option for search-in-playlist
giacomo
parents:
2140
diff
changeset
|
758 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(searchdlg_checkbt_autoenqueue) , FALSE ); |
2139
fcd1f54efdb9
[svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents:
2129
diff
changeset
|
759 searchdlg_checkbt_newplaylist = gtk_check_button_new_with_label( |
fcd1f54efdb9
[svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents:
2129
diff
changeset
|
760 _("Create a new playlist with matching entries") ); |
fcd1f54efdb9
[svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents:
2129
diff
changeset
|
761 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(searchdlg_checkbt_newplaylist) , FALSE ); |
2144
b76039eeb6f0
[svn] - added auto-enqueue option for search-in-playlist
giacomo
parents:
2140
diff
changeset
|
762 g_signal_connect( G_OBJECT(searchdlg_checkbt_autoenqueue) , "clicked" , |
b76039eeb6f0
[svn] - added auto-enqueue option for search-in-playlist
giacomo
parents:
2140
diff
changeset
|
763 G_CALLBACK(playlistwin_select_search_cbt_cb) , searchdlg_checkbt_newplaylist ); |
b76039eeb6f0
[svn] - added auto-enqueue option for search-in-playlist
giacomo
parents:
2140
diff
changeset
|
764 g_signal_connect( G_OBJECT(searchdlg_checkbt_newplaylist) , "clicked" , |
b76039eeb6f0
[svn] - added auto-enqueue option for search-in-playlist
giacomo
parents:
2140
diff
changeset
|
765 G_CALLBACK(playlistwin_select_search_cbt_cb) , searchdlg_checkbt_autoenqueue ); |
2129
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
766 /* place fields in searchdlg_table */ |
2144
b76039eeb6f0
[svn] - added auto-enqueue option for search-in-playlist
giacomo
parents:
2140
diff
changeset
|
767 searchdlg_table = gtk_table_new( 8 , 2 , FALSE ); |
2129
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
768 gtk_table_set_row_spacing( GTK_TABLE(searchdlg_table) , 0 , 8 ); |
2139
fcd1f54efdb9
[svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents:
2129
diff
changeset
|
769 gtk_table_set_row_spacing( GTK_TABLE(searchdlg_table) , 4 , 8 ); |
2129
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
770 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_hbox , |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
771 0 , 2 , 0 , 1 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 2 ); |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
772 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_label_track_name , |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
773 0 , 1 , 1 , 2 , GTK_FILL , GTK_FILL | GTK_EXPAND , 0 , 2 ); |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
774 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_entry_track_name , |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
775 1 , 2 , 1 , 2 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 2 ); |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
776 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_label_album_name , |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
777 0 , 1 , 2 , 3 , GTK_FILL , GTK_FILL | GTK_EXPAND , 0 , 2 ); |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
778 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_entry_album_name , |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
779 1 , 2 , 2 , 3 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 2 ); |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
780 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_label_performer , |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
781 0 , 1 , 3 , 4 , GTK_FILL , GTK_FILL | GTK_EXPAND , 0 , 2 ); |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
782 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_entry_performer , |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
783 1 , 2 , 3 , 4 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 2 ); |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
784 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_label_file_name , |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
785 0 , 1 , 4 , 5 , GTK_FILL , GTK_FILL | GTK_EXPAND , 0 , 2 ); |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
786 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_entry_file_name , |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
787 1 , 2 , 4 , 5 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 2 ); |
2139
fcd1f54efdb9
[svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents:
2129
diff
changeset
|
788 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_checkbt_clearprevsel , |
fcd1f54efdb9
[svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents:
2129
diff
changeset
|
789 0 , 2 , 5 , 6 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 1 ); |
2144
b76039eeb6f0
[svn] - added auto-enqueue option for search-in-playlist
giacomo
parents:
2140
diff
changeset
|
790 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_checkbt_autoenqueue , |
b76039eeb6f0
[svn] - added auto-enqueue option for search-in-playlist
giacomo
parents:
2140
diff
changeset
|
791 0 , 2 , 6 , 7 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 1 ); |
2139
fcd1f54efdb9
[svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents:
2129
diff
changeset
|
792 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_checkbt_newplaylist , |
2144
b76039eeb6f0
[svn] - added auto-enqueue option for search-in-playlist
giacomo
parents:
2140
diff
changeset
|
793 0 , 2 , 7 , 8 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 1 ); |
2129
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
794 |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
795 gtk_container_set_border_width( GTK_CONTAINER(searchdlg_table) , 5 ); |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
796 gtk_container_add( GTK_CONTAINER(GTK_DIALOG(searchdlg_win)->vbox) , searchdlg_table ); |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
797 gtk_widget_show_all( searchdlg_win ); |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
798 result = gtk_dialog_run( GTK_DIALOG(searchdlg_win) ); |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
799 switch(result) |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
800 { |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
801 case GTK_RESPONSE_ACCEPT: |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
802 { |
2139
fcd1f54efdb9
[svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents:
2129
diff
changeset
|
803 gint matched_entries_num = 0; |
2129
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
804 /* create a TitleInput tuple with user search data */ |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
805 TitleInput *tuple = g_malloc(sizeof(TitleInput)); |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
806 gchar *searchdata = NULL; |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
807 searchdata = (gchar*)gtk_entry_get_text( GTK_ENTRY(searchdlg_entry_track_name) ); |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
808 tuple->track_name = ( strcmp(searchdata,"") ) ? g_strdup(searchdata) : NULL; |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
809 searchdata = (gchar*)gtk_entry_get_text( GTK_ENTRY(searchdlg_entry_album_name) ); |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
810 tuple->album_name = ( strcmp(searchdata,"") ) ? g_strdup(searchdata) : NULL; |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
811 searchdata = (gchar*)gtk_entry_get_text( GTK_ENTRY(searchdlg_entry_performer) ); |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
812 tuple->performer = ( strcmp(searchdata,"") ) ? g_strdup(searchdata) : NULL; |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
813 searchdata = (gchar*)gtk_entry_get_text( GTK_ENTRY(searchdlg_entry_file_name) ); |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
814 tuple->file_name = ( strcmp(searchdata,"") ) ? g_strdup(searchdata) : NULL; |
2139
fcd1f54efdb9
[svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents:
2129
diff
changeset
|
815 /* check if previous selection should be cleared before searching */ |
fcd1f54efdb9
[svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents:
2129
diff
changeset
|
816 if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(searchdlg_checkbt_clearprevsel)) == TRUE ) |
fcd1f54efdb9
[svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents:
2129
diff
changeset
|
817 playlistwin_select_none(); |
2129
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
818 /* now send this tuple to the real search function */ |
2139
fcd1f54efdb9
[svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents:
2129
diff
changeset
|
819 matched_entries_num = playlist_select_search( playlist , tuple , 0 ); |
2129
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
820 /* we do not need the tuple and its data anymore */ |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
821 if ( tuple->track_name != NULL ) g_free( tuple->track_name ); |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
822 if ( tuple->album_name != NULL ) g_free( tuple->album_name ); |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
823 if ( tuple->performer != NULL ) g_free( tuple->performer ); |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
824 if ( tuple->file_name != NULL ) g_free( tuple->file_name ); |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
825 g_free( tuple ); |
2140
299651a8f107
[svn] - made playlistwin_update_list depend on passed Playlist* instead of blindly using playlist_get_active(); this solves many locking issues with multiple playlists, but SHOULD be reviewed in every place playlistwin_update_list is used; added a playlist_new_from_selected() call too
giacomo
parents:
2139
diff
changeset
|
826 playlistwin_update_list(playlist_get_active()); |
2139
fcd1f54efdb9
[svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents:
2129
diff
changeset
|
827 /* check if a new playlist should be created after searching */ |
fcd1f54efdb9
[svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents:
2129
diff
changeset
|
828 if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(searchdlg_checkbt_newplaylist)) == TRUE ) |
fcd1f54efdb9
[svn] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
giacomo
parents:
2129
diff
changeset
|
829 playlist_new_from_selected(); |
2144
b76039eeb6f0
[svn] - added auto-enqueue option for search-in-playlist
giacomo
parents:
2140
diff
changeset
|
830 /* check if matched entries should be queued */ |
b76039eeb6f0
[svn] - added auto-enqueue option for search-in-playlist
giacomo
parents:
2140
diff
changeset
|
831 else if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(searchdlg_checkbt_autoenqueue)) == TRUE ) |
b76039eeb6f0
[svn] - added auto-enqueue option for search-in-playlist
giacomo
parents:
2140
diff
changeset
|
832 playlist_queue(playlist_get_active()); |
2129
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
833 break; |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
834 } |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
835 default: |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
836 break; |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
837 } |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
838 /* done here :) */ |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
839 gtk_widget_destroy( searchdlg_win ); |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
840 } |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
841 |
0d845907c0b9
[svn] added a regex-based search option in playlist that allows to select playlist entries using multiple match criteria
giacomo
parents:
2105
diff
changeset
|
842 static void |
1653 | 843 playlistwin_inverse_selection(void) |
844 { | |
2095 | 845 playlist_select_invert_all(playlist_get_active()); |
1653 | 846 playlistwin_list->pl_prev_selected = -1; |
847 playlistwin_list->pl_prev_min = -1; | |
2140
299651a8f107
[svn] - made playlistwin_update_list depend on passed Playlist* instead of blindly using playlist_get_active(); this solves many locking issues with multiple playlists, but SHOULD be reviewed in every place playlistwin_update_list is used; added a playlist_new_from_selected() call too
giacomo
parents:
2139
diff
changeset
|
848 playlistwin_update_list(playlist_get_active()); |
1653 | 849 } |
850 | |
851 static void | |
852 playlistwin_resize(gint width, gint height) | |
853 { | |
854 gboolean redraw; | |
855 | |
856 g_return_if_fail(width > 0 && height > 0); | |
857 | |
858 cfg.playlist_width = width; | |
859 | |
860 if (!cfg.playlist_shaded) | |
861 cfg.playlist_height = height; | |
862 else | |
863 height = cfg.playlist_height; | |
864 | |
865 /* FIXME: why the fsck are we doing this manually? */ | |
866 /* adjust widget positions and sizes */ | |
867 | |
868 widget_resize(WIDGET(playlistwin_list), width - 31, height - 58); | |
869 | |
870 widget_move(WIDGET(playlistwin_slider), width - 15, 20); | |
871 widget_resize(WIDGET(playlistwin_slider), 8, height - 58); | |
872 | |
873 widget_resize(WIDGET(playlistwin_sinfo), width - 35, 14); | |
2140
299651a8f107
[svn] - made playlistwin_update_list depend on passed Playlist* instead of blindly using playlist_get_active(); this solves many locking issues with multiple playlists, but SHOULD be reviewed in every place playlistwin_update_list is used; added a playlist_new_from_selected() call too
giacomo
parents:
2139
diff
changeset
|
874 playlistwin_update_sinfo(playlist_get_active()); |
1653 | 875 |
876 widget_move(WIDGET(playlistwin_shade), width - 21, 3); | |
877 widget_move(WIDGET(playlistwin_close), width - 11, 3); | |
878 widget_move(WIDGET(playlistwin_time_min), width - 82, height - 15); | |
879 widget_move(WIDGET(playlistwin_time_sec), width - 64, height - 15); | |
880 widget_move(WIDGET(playlistwin_info), width - 143, height - 28); | |
881 widget_move(WIDGET(playlistwin_srew), width - 144, height - 16); | |
882 widget_move(WIDGET(playlistwin_splay), width - 138, height - 16); | |
883 widget_move(WIDGET(playlistwin_spause), width - 128, height - 16); | |
884 widget_move(WIDGET(playlistwin_sstop), width - 118, height - 16); | |
885 widget_move(WIDGET(playlistwin_sfwd), width - 109, height - 16); | |
886 widget_move(WIDGET(playlistwin_seject), width - 100, height - 16); | |
887 widget_move(WIDGET(playlistwin_sscroll_up), width - 14, height - 35); | |
888 widget_move(WIDGET(playlistwin_sscroll_down), width - 14, height - 30); | |
889 | |
890 g_object_unref(playlistwin_bg); | |
891 playlistwin_bg = gdk_pixmap_new(playlistwin->window, width, height, -1); | |
892 playlistwin_set_mask(); | |
893 | |
894 widget_list_lock(playlistwin_wlist); | |
895 | |
896 widget_list_change_pixmap(playlistwin_wlist, playlistwin_bg); | |
897 playlistwin_draw_frame(); | |
898 widget_list_draw(playlistwin_wlist, &redraw, TRUE); | |
899 widget_list_clear_redraw(playlistwin_wlist); | |
900 | |
901 widget_list_unlock(playlistwin_wlist); | |
902 | |
903 gdk_window_set_back_pixmap(playlistwin->window, playlistwin_bg, 0); | |
904 gdk_window_clear(playlistwin->window); | |
905 } | |
906 | |
907 | |
908 | |
909 static void | |
910 playlistwin_motion(GtkWidget * widget, | |
911 GdkEventMotion * event, | |
912 gpointer callback_data) | |
913 { | |
914 GdkEvent *gevent; | |
915 | |
916 if (dock_is_moving(GTK_WINDOW(playlistwin))) { | |
917 dock_move_motion(GTK_WINDOW(playlistwin), event); | |
918 } | |
919 else { | |
920 handle_motion_cb(playlistwin_wlist, widget, event); | |
921 draw_playlist_window(FALSE); | |
922 } | |
923 gdk_flush(); | |
924 | |
925 while ((gevent = gdk_event_get()) != NULL) gdk_event_free(gevent); | |
926 } | |
927 | |
928 static void | |
929 playlistwin_enter(GtkWidget * widget, | |
930 GdkEventMotion * event, | |
931 gpointer callback_data) | |
932 { | |
933 playlistwin_list->pl_tooltips = TRUE; | |
934 } | |
935 | |
936 static void | |
937 playlistwin_leave(GtkWidget * widget, | |
938 GdkEventMotion * event, | |
939 gpointer callback_data) | |
940 { | |
941 playlistwin_list->pl_tooltips = FALSE; | |
942 } | |
943 | |
944 static void | |
945 playlistwin_show_filebrowser(void) | |
946 { | |
947 util_run_filebrowser(NO_PLAY_BUTTON); | |
948 } | |
949 | |
950 #if 0 | |
951 static void | |
952 playlistwin_add_dir_handler(const gchar * dir) | |
953 { | |
954 g_free(cfg.filesel_path); | |
955 cfg.filesel_path = g_strdup(dir); | |
956 playlist_add_dir(dir); | |
957 } | |
958 #endif | |
959 | |
960 static void | |
961 playlistwin_fileinfo(void) | |
962 { | |
2095 | 963 Playlist *playlist = playlist_get_active(); |
964 | |
1653 | 965 /* Show the first selected file, or the current file if nothing is |
966 * selected */ | |
2095 | 967 GList *list = playlist_get_selected(playlist); |
1653 | 968 if (list) { |
2095 | 969 playlist_fileinfo(playlist, GPOINTER_TO_INT(list->data)); |
1653 | 970 g_list_free(list); |
971 } | |
972 else | |
2095 | 973 playlist_fileinfo_current(playlist); |
1653 | 974 } |
975 | |
976 static void | |
977 menu_set_item_sensitive(GtkItemFactory * item_factory, | |
978 const gchar * path, | |
979 gboolean sensitive) | |
980 { | |
981 GtkWidget *item = gtk_item_factory_get_widget(item_factory, path); | |
982 gtk_widget_set_sensitive(item, sensitive); | |
983 } | |
984 | |
985 static void | |
986 show_playlist_save_error(GtkWindow * parent, | |
987 const gchar * filename) | |
988 { | |
989 GtkWidget *dialog; | |
990 | |
991 g_return_if_fail(GTK_IS_WINDOW(parent)); | |
992 g_return_if_fail(filename != NULL); | |
993 | |
994 dialog = gtk_message_dialog_new(GTK_WINDOW(parent), | |
995 GTK_DIALOG_DESTROY_WITH_PARENT, | |
996 GTK_MESSAGE_ERROR, | |
997 GTK_BUTTONS_OK, | |
998 _("Error writing playlist \"%s\": %s"), | |
999 filename, strerror(errno)); | |
1000 | |
1001 gtk_dialog_run(GTK_DIALOG(dialog)); | |
1002 gtk_widget_destroy(dialog); | |
1003 } | |
1004 | |
1005 static gboolean | |
1006 show_playlist_overwrite_prompt(GtkWindow * parent, | |
1007 const gchar * filename) | |
1008 { | |
1009 GtkWidget *dialog; | |
1010 gint result; | |
1011 | |
1012 g_return_val_if_fail(GTK_IS_WINDOW(parent), FALSE); | |
1013 g_return_val_if_fail(filename != NULL, FALSE); | |
1014 | |
1015 dialog = gtk_message_dialog_new(GTK_WINDOW(parent), | |
1016 GTK_DIALOG_DESTROY_WITH_PARENT, | |
1017 GTK_MESSAGE_QUESTION, | |
1018 GTK_BUTTONS_YES_NO, | |
1019 _("%s already exist. Continue?"), | |
1020 filename); | |
1021 | |
1022 result = gtk_dialog_run(GTK_DIALOG(dialog)); | |
1023 gtk_widget_destroy(dialog); | |
1024 | |
1025 return (result == GTK_RESPONSE_YES); | |
1026 } | |
1027 | |
1028 static void | |
1029 show_playlist_save_format_error(GtkWindow * parent, | |
1030 const gchar * filename) | |
1031 { | |
1032 const gchar *markup = | |
1033 N_("<b><big>Unable to save playlist.</big></b>\n\n" | |
1034 "Unknown file type for '%s'.\n"); | |
1035 | |
1036 GtkWidget *dialog; | |
1037 | |
1038 g_return_if_fail(GTK_IS_WINDOW(parent)); | |
1039 g_return_if_fail(filename != NULL); | |
1040 | |
1041 dialog = | |
1042 gtk_message_dialog_new_with_markup(GTK_WINDOW(parent), | |
1043 GTK_DIALOG_DESTROY_WITH_PARENT, | |
1044 GTK_MESSAGE_ERROR, | |
1045 GTK_BUTTONS_OK, | |
1046 _(markup), | |
1047 filename); | |
1048 gtk_dialog_run(GTK_DIALOG(dialog)); | |
1049 gtk_widget_destroy(dialog); | |
1050 } | |
1051 | |
1052 static void | |
1053 playlistwin_save_playlist(const gchar * filename) | |
1054 { | |
1055 PlaylistContainer *plc; | |
1056 gchar *ext = strrchr(filename, '.') + 1; | |
1057 | |
1058 plc = playlist_container_find(ext); | |
1059 if (plc == NULL) { | |
1060 show_playlist_save_format_error(GTK_WINDOW(playlistwin), filename); | |
1061 return; | |
1062 } | |
1063 | |
1064 str_replace_in(&cfg.playlist_path, g_path_get_dirname(filename)); | |
1065 | |
1066 if (g_file_test(filename, G_FILE_TEST_IS_REGULAR)) | |
1067 if (!show_playlist_overwrite_prompt(GTK_WINDOW(playlistwin), filename)) | |
1068 return; | |
1069 | |
2095 | 1070 if (!playlist_save(playlist_get_active(), filename)) |
1653 | 1071 show_playlist_save_error(GTK_WINDOW(playlistwin), filename); |
1072 } | |
1073 | |
1074 #if 0 | |
1075 static void | |
1076 playlistwin_save_current(void) | |
1077 { | |
1078 const gchar *filename; | |
1079 | |
1080 if (!(filename = playlist_get_current_name())) | |
1081 return; | |
1082 | |
1083 playlistwin_save_playlist(filename); | |
1084 } | |
1085 #endif | |
1086 | |
1087 static void | |
1088 playlistwin_load_playlist(const gchar * filename) | |
1089 { | |
2095 | 1090 Playlist *playlist = playlist_get_active(); |
1091 | |
1653 | 1092 g_return_if_fail(filename != NULL); |
1093 | |
1094 str_replace_in(&cfg.playlist_path, g_strdup(filename)); | |
1095 | |
2095 | 1096 playlist_clear(playlist); |
1653 | 1097 mainwin_clear_song_info(); |
1098 mainwin_set_info_text(); | |
1099 | |
2095 | 1100 playlist_load(playlist, filename); |
1101 playlist_set_current_name(playlist, filename); | |
1653 | 1102 } |
1103 | |
1104 static gchar * | |
1762
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1105 playlist_file_selection_load(const gchar * title, |
1653 | 1106 const gchar * default_filename) |
1107 { | |
1762
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1108 static GtkWidget *dialog = NULL; |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1109 GtkWidget *button; |
1653 | 1110 gchar *filename; |
1111 | |
1112 g_return_val_if_fail(title != NULL, NULL); | |
1113 | |
1762
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1114 if(!dialog) { |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1115 dialog = gtk_file_chooser_dialog_new(title, GTK_WINDOW(mainwin), |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1116 GTK_FILE_CHOOSER_ACTION_OPEN, NULL, NULL); |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1117 |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1118 if (default_filename) |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1119 gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog), |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1120 default_filename); |
1653 | 1121 |
1762
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1122 button = gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CANCEL, |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1123 GTK_RESPONSE_REJECT); |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1124 gtk_button_set_use_stock(GTK_BUTTON(button), TRUE); |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1125 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); |
1653 | 1126 |
1762
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1127 button = gtk_dialog_add_button(GTK_DIALOG(dialog), |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1128 GTK_STOCK_OPEN, |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1129 GTK_RESPONSE_ACCEPT); |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1130 gtk_button_set_use_stock(GTK_BUTTON(button), TRUE); |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1131 gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1132 } |
1653 | 1133 |
1134 if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) | |
1135 filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); | |
1136 else | |
1137 filename = NULL; | |
1138 | |
1762
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1139 gtk_widget_hide(dialog); |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1140 return filename; |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1141 } |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1142 |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1143 static gchar * |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1144 playlist_file_selection_save(const gchar * title, |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1145 const gchar * default_filename) |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1146 { |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1147 static GtkWidget *dialog = NULL; |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1148 GtkWidget *button; |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1149 gchar *filename; |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1150 |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1151 g_return_val_if_fail(title != NULL, NULL); |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1152 |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1153 if(!dialog) { |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1154 dialog = gtk_file_chooser_dialog_new(title, GTK_WINDOW(mainwin), |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1155 GTK_FILE_CHOOSER_ACTION_SAVE, NULL, NULL); |
1653 | 1156 |
1762
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1157 if (default_filename) |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1158 gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog), |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1159 default_filename); |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1160 |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1161 button = gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CANCEL, |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1162 GTK_RESPONSE_REJECT); |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1163 gtk_button_set_use_stock(GTK_BUTTON(button), TRUE); |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1164 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1165 |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1166 button = gtk_dialog_add_button(GTK_DIALOG(dialog), |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1167 GTK_STOCK_SAVE, |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1168 GTK_RESPONSE_ACCEPT); |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1169 gtk_button_set_use_stock(GTK_BUTTON(button), TRUE); |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1170 gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1171 } |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1172 |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1173 if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1174 filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1175 else |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1176 filename = NULL; |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1177 |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1178 gtk_widget_hide(dialog); |
1653 | 1179 return filename; |
1180 } | |
1181 | |
1182 void | |
1183 playlistwin_select_playlist_to_load(const gchar * default_filename) | |
1184 { | |
1185 gchar *filename = | |
1762
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1186 playlist_file_selection_load(_("Load Playlist"), default_filename); |
1653 | 1187 |
1188 if (filename) { | |
1189 playlistwin_load_playlist(filename); | |
1190 g_free(filename); | |
1191 } | |
1192 } | |
1193 | |
1194 static void | |
1195 playlistwin_select_playlist_to_save(const gchar * default_filename) | |
1196 { | |
1762
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1197 gchar *dot = NULL, *basename = NULL; |
1653 | 1198 gchar *filename = |
1762
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1199 playlist_file_selection_save(_("Save Playlist"), default_filename); |
1653 | 1200 |
1201 if (filename) { | |
1762
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1202 /* Default to xspf if no filename has extension */ |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1203 basename = g_path_get_basename(filename); |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1204 dot = strrchr(basename, '.'); |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1205 if( dot == NULL || dot == basename) { |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1206 gchar *oldname = filename; |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1207 filename = g_strconcat(oldname, ".xspf", NULL); |
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1208 g_free(oldname); |
1653 | 1209 } |
1762
5170463d8cc9
[svn] - gtk+-2.10's gtk_widget_destroy() sometimes causes an UI freeze. as a workaround, reuse allocated dialog.
yaz
parents:
1653
diff
changeset
|
1210 g_free(basename); |
1653 | 1211 |
1212 playlistwin_save_playlist(filename); | |
1213 g_free(filename); | |
1214 } | |
1215 } | |
1216 | |
1217 static gboolean | |
1218 inside_sensitive_widgets(gint x, gint y) | |
1219 { | |
1220 return (widget_contains(WIDGET(playlistwin_list), x, y) || | |
1221 widget_contains(WIDGET(playlistwin_slider), x, y) || | |
1222 widget_contains(WIDGET(playlistwin_close), x, y) || | |
1223 widget_contains(WIDGET(playlistwin_shade), x, y) || | |
1224 widget_contains(WIDGET(playlistwin_time_min), x, y) || | |
1225 widget_contains(WIDGET(playlistwin_time_sec), x, y) || | |
1226 widget_contains(WIDGET(playlistwin_info), x, y) || | |
1227 widget_contains(WIDGET(playlistwin_srew), x, y) || | |
1228 widget_contains(WIDGET(playlistwin_splay), x, y) || | |
1229 widget_contains(WIDGET(playlistwin_spause), x, y) || | |
1230 widget_contains(WIDGET(playlistwin_sstop), x, y) || | |
1231 widget_contains(WIDGET(playlistwin_sfwd), x, y) || | |
1232 widget_contains(WIDGET(playlistwin_seject), x, y) || | |
1233 widget_contains(WIDGET(playlistwin_sscroll_up), x, y) || | |
1234 widget_contains(WIDGET(playlistwin_sscroll_down), x, y)); | |
1235 } | |
1236 | |
1237 #define REGION_L(x1,x2,y1,y2) \ | |
1238 (event->x >= (x1) && event->x < (x2) && \ | |
1239 event->y >= cfg.playlist_height - (y1) && \ | |
1240 event->y < cfg.playlist_height - (y2)) | |
1241 | |
1242 #define REGION_R(x1,x2,y1,y2) \ | |
1243 (event->x >= playlistwin_get_width() - (x1) && \ | |
1244 event->x < playlistwin_get_width() - (x2) && \ | |
1245 event->y >= cfg.playlist_height - (y1) && \ | |
1246 event->y < cfg.playlist_height - (y2)) | |
1247 | |
1248 static void | |
1249 playlistwin_scrolled(GtkWidget * widget, | |
1250 GdkEventScroll * event, | |
1251 gpointer callback_data) | |
1252 { | |
1253 | |
1254 if (event->direction == GDK_SCROLL_DOWN) | |
1255 playlistwin_scroll(cfg.scroll_pl_by); | |
1256 | |
1257 if (event->direction == GDK_SCROLL_UP) | |
1258 playlistwin_scroll(-cfg.scroll_pl_by); | |
1259 | |
2028 | 1260 g_cond_signal(cond_scan); |
1261 | |
1653 | 1262 } |
1263 | |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1264 static void |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1265 menu_popup_pos_func(GtkMenu * menu, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1266 gint * x, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1267 gint * y, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1268 gboolean * push_in, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1269 gint * point) |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1270 { |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1271 *x = point[0]; |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1272 *y = point[1]; |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1273 *push_in = FALSE; |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1274 } |
1653 | 1275 |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1276 static void |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1277 menu_popup(GtkMenu * menu, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1278 gint x, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1279 gint y, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1280 guint button, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1281 guint time) |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1282 { |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1283 gint pos[2]; |
1653 | 1284 |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1285 pos[0] = x; |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1286 pos[1] = y; |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1287 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1288 gtk_menu_popup(menu, NULL, NULL, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1289 (GtkMenuPositionFunc) menu_popup_pos_func, pos, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1290 button, time); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1291 } |
1653 | 1292 |
1293 static gboolean | |
1294 playlistwin_press(GtkWidget * widget, | |
1295 GdkEventButton * event, | |
1296 gpointer callback_data) | |
1297 { | |
1298 gboolean grab = TRUE; | |
1299 gint xpos, ypos; | |
1300 GtkWidget *_menu; | |
1301 GtkRequisition req; | |
1302 | |
1303 gtk_window_get_position(GTK_WINDOW(playlistwin), &xpos, &ypos); | |
1304 | |
1305 if (event->button == 1 && !cfg.show_wm_decorations && | |
1306 ((!cfg.playlist_shaded && | |
1307 event->x > playlistwin_get_width() - 20 && | |
1308 event->y > cfg.playlist_height - 20) || | |
1309 (cfg.playlist_shaded && | |
1310 event->x >= playlistwin_get_width() - 31 && | |
1311 event->x < playlistwin_get_width() - 22))) { | |
1312 | |
1313 /* NOTE: Workaround for bug #214 */ | |
1314 if (event->type != GDK_2BUTTON_PRESS && | |
1315 event->type != GDK_3BUTTON_PRESS) { | |
1316 /* resize area */ | |
1317 playlistwin_resizing = TRUE; | |
1318 gtk_window_begin_resize_drag(GTK_WINDOW(widget), | |
1319 GDK_WINDOW_EDGE_SOUTH_EAST, | |
1320 event->button, | |
1321 event->x + xpos, event->y + ypos, | |
1322 event->time); | |
1323 } | |
1324 grab = FALSE; | |
1325 } | |
1326 else if (event->button == 1 && REGION_L(12, 37, 29, 11)) { | |
1327 /* ADD button menu */ | |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1328 gtk_widget_size_request(pladd_menu, &req); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1329 menu_popup(GTK_MENU(pladd_menu), |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1330 xpos + 12, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1331 (ypos + playlistwin_get_height()) - 8 - req.height, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1332 event->button, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1333 event->time); |
1653 | 1334 grab = FALSE; |
1335 } | |
1336 else if (event->button == 1 && REGION_L(41, 66, 29, 11)) { | |
1337 /* SUB button menu */ | |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1338 gtk_widget_size_request(pldel_menu, &req); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1339 menu_popup(GTK_MENU(pldel_menu), |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1340 xpos + 40, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1341 (ypos + playlistwin_get_height()) - 8 - req.height, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1342 event->button, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1343 event->time); |
1653 | 1344 grab = FALSE; |
1345 } | |
1346 else if (event->button == 1 && REGION_L(70, 95, 29, 11)) { | |
1347 /* SEL button menu */ | |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1348 gtk_widget_size_request(plsel_menu, &req); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1349 menu_popup(GTK_MENU(plsel_menu), |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1350 xpos + 68, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1351 (ypos + playlistwin_get_height()) - 8 - req.height, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1352 event->button, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1353 event->time); |
1653 | 1354 grab = FALSE; |
1355 } | |
1356 else if (event->button == 1 && REGION_L(99, 124, 29, 11)) { | |
1357 /* MISC button menu */ | |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1358 gtk_widget_size_request(plsort_menu, &req); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1359 menu_popup(GTK_MENU(plsort_menu), |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1360 xpos + 100, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1361 (ypos + playlistwin_get_height()) - 8 - req.height, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1362 event->button, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1363 event->time); |
1653 | 1364 grab = FALSE; |
1365 } | |
1366 else if (event->button == 1 && REGION_R(46, 23, 29, 11)) { | |
1367 /* LIST button menu */ | |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1368 gtk_widget_size_request(pllist_menu, &req); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1369 menu_popup(GTK_MENU(pllist_menu), |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1370 xpos + playlistwin_get_width() - req.width - 12, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1371 (ypos + playlistwin_get_height()) - 8 - req.height, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1372 event->button, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1373 event->time); |
1653 | 1374 grab = FALSE; |
1375 } | |
1376 else if (event->button == 1 && REGION_R(82, 54, 15, 9)) { | |
1377 if (cfg.timer_mode == TIMER_ELAPSED) | |
1378 cfg.timer_mode = TIMER_REMAINING; | |
1379 else | |
1380 cfg.timer_mode = TIMER_ELAPSED; | |
1381 } | |
1382 else if (event->button == 2 && (event->type == GDK_BUTTON_PRESS) && | |
1383 widget_contains(WIDGET(playlistwin_list), event->x, event->y)) { | |
1384 gtk_selection_convert(widget, GDK_SELECTION_PRIMARY, | |
1385 GDK_TARGET_STRING, event->time); | |
1386 } | |
1387 else if (event->button == 1 && event->type == GDK_BUTTON_PRESS && | |
1938 | 1388 !inside_sensitive_widgets(event->x, event->y) && (cfg.easy_move || event->y < 14)) |
1653 | 1389 { |
1390 dock_move_press(dock_window_list, GTK_WINDOW(playlistwin), event, | |
1391 FALSE); | |
1392 gtk_window_present(GTK_WINDOW(playlistwin)); | |
1393 } | |
1394 else if (event->button == 1 && event->type == GDK_2BUTTON_PRESS && | |
1395 !inside_sensitive_widgets(event->x, event->y) | |
1396 && event->y < 14) { | |
1397 /* double click on title bar */ | |
1398 playlistwin_shade_toggle(); | |
1399 if (dock_is_moving(GTK_WINDOW(playlistwin))) | |
1400 dock_move_release(GTK_WINDOW(playlistwin)); | |
1401 return TRUE; | |
1402 } | |
1403 else if (event->button == 3 && | |
1404 !(widget_contains(WIDGET(playlistwin_list), event->x, event->y) || | |
1405 (event->y >= cfg.playlist_height - 29 && | |
1406 event->y < cfg.playlist_height - 11 && | |
1407 ((event->x >= 12 && event->x < 37) || | |
1408 (event->x >= 41 && event->x < 66) || | |
1409 (event->x >= 70 && event->x < 95) || | |
1410 (event->x >= 99 && event->x < 124) || | |
1411 (event->x >= playlistwin_get_width() - 46 && | |
1412 event->x < playlistwin_get_width() - 23))))) { | |
1413 /* | |
1414 * Pop up the main menu a few pixels down to avoid | |
1415 * anything to be selected initially. | |
1416 */ | |
1417 util_item_factory_popup(mainwin_general_menu, event->x_root, | |
1418 event->y_root + 2, 3, event->time); | |
1419 grab = FALSE; | |
1420 } | |
1421 else if (event->button == 3 && | |
1422 widget_contains(WIDGET(playlistwin_list), event->x, event->y)) { | |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1423 menu_popup(GTK_MENU(playlistwin_popup_menu), |
1653 | 1424 event->x_root, event->y_root + 5, |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
1425 event->button, event->time); |
1653 | 1426 grab = FALSE; |
1427 } | |
1428 else { | |
1429 handle_press_cb(playlistwin_wlist, widget, event); | |
1430 draw_playlist_window(FALSE); | |
1431 } | |
1432 | |
1433 if (grab) | |
1434 gdk_pointer_grab(playlistwin->window, FALSE, | |
1435 GDK_BUTTON_MOTION_MASK | GDK_BUTTON_RELEASE_MASK | | |
1436 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | | |
1437 GDK_BUTTON1_MOTION_MASK, NULL, NULL, | |
1438 GDK_CURRENT_TIME); | |
1439 | |
1440 return FALSE; | |
1441 } | |
1442 | |
1443 static gboolean | |
1444 playlistwin_focus_in(GtkWidget * widget, GdkEvent * event, gpointer data) | |
1445 { | |
1446 playlistwin_close->pb_allow_draw = TRUE; | |
1447 playlistwin_shade->pb_allow_draw = TRUE; | |
1448 draw_playlist_window(TRUE); | |
1449 return FALSE; | |
1450 } | |
1451 | |
1452 static gboolean | |
1453 playlistwin_focus_out(GtkWidget * widget, | |
1454 GdkEventButton * event, gpointer data) | |
1455 { | |
1456 playlistwin_close->pb_allow_draw = FALSE; | |
1457 playlistwin_shade->pb_allow_draw = FALSE; | |
1458 draw_playlist_window(TRUE); | |
1459 return FALSE; | |
1460 } | |
1461 | |
1462 static gboolean | |
1463 playlistwin_configure(GtkWidget * window, | |
1464 GdkEventConfigure * event, gpointer data) | |
1465 { | |
1466 if (!GTK_WIDGET_VISIBLE(window)) | |
1467 return FALSE; | |
1468 | |
1469 cfg.playlist_x = event->x; | |
1470 cfg.playlist_y = event->y; | |
1471 | |
1472 if (playlistwin_resizing) { | |
1473 if (event->width != playlistwin_get_width() || | |
1474 event->height != playlistwin_get_height()) | |
1475 playlistwin_resize(event->width, event->height); | |
1476 } | |
1477 return TRUE; | |
1478 } | |
1479 | |
1480 void | |
1481 playlistwin_set_back_pixmap(void) | |
1482 { | |
1483 gdk_window_set_back_pixmap(playlistwin->window, playlistwin_bg, 0); | |
1484 gdk_window_clear(playlistwin->window); | |
1485 } | |
1486 | |
1487 static gboolean | |
1488 playlistwin_delete(GtkWidget * w, gpointer data) | |
1489 { | |
1490 playlistwin_hide(); | |
1491 return TRUE; | |
1492 } | |
1493 | |
1494 static void | |
1495 playlistwin_keypress_up_down_handler(PlayList_List * pl, | |
1496 gboolean up, guint state) | |
1497 { | |
2095 | 1498 Playlist *playlist = playlist_get_active(); |
1499 | |
1653 | 1500 if ((state & GDK_MOD1_MASK) && (state & GDK_SHIFT_MASK)) |
1501 return; | |
1502 if (!(state & GDK_MOD1_MASK)) | |
2095 | 1503 playlist_select_all(playlist, FALSE); |
1653 | 1504 |
1505 if (pl->pl_prev_selected == -1 || | |
1506 (!playlistwin_item_visible(pl->pl_prev_selected) && | |
1507 !(state & GDK_SHIFT_MASK && pl->pl_prev_min != -1))) { | |
1508 pl->pl_prev_selected = pl->pl_first; | |
1509 } | |
1510 else if (state & GDK_SHIFT_MASK) { | |
1511 if (pl->pl_prev_min == -1) { | |
1512 pl->pl_prev_max = pl->pl_prev_selected; | |
1513 pl->pl_prev_min = pl->pl_prev_selected; | |
1514 } | |
1515 pl->pl_prev_max += (up ? -1 : 1); | |
1516 pl->pl_prev_max = | |
2095 | 1517 CLAMP(pl->pl_prev_max, 0, playlist_get_length(playlist) - 1); |
1653 | 1518 |
1519 pl->pl_first = MIN(pl->pl_first, pl->pl_prev_max); | |
1520 pl->pl_first = MAX(pl->pl_first, pl->pl_prev_max - | |
1521 pl->pl_num_visible + 1); | |
2095 | 1522 playlist_select_range(playlist, pl->pl_prev_min, pl->pl_prev_max, TRUE); |
1653 | 1523 return; |
1524 } | |
1525 else if (state & GDK_MOD1_MASK) { | |
1526 if (up) | |
1527 playlist_list_move_up(pl); | |
1528 else | |
1529 playlist_list_move_down(pl); | |
1530 if (pl->pl_prev_min < pl->pl_first) | |
1531 pl->pl_first = pl->pl_prev_min; | |
1532 else if (pl->pl_prev_max >= (pl->pl_first + pl->pl_num_visible)) | |
1533 pl->pl_first = pl->pl_prev_max - pl->pl_num_visible + 1; | |
1534 return; | |
1535 } | |
1536 else if (up) | |
1537 pl->pl_prev_selected--; | |
1538 else | |
1539 pl->pl_prev_selected++; | |
1540 | |
1541 pl->pl_prev_selected = | |
2095 | 1542 CLAMP(pl->pl_prev_selected, 0, playlist_get_length(playlist) - 1); |
1653 | 1543 |
1544 if (pl->pl_prev_selected < pl->pl_first) | |
1545 pl->pl_first--; | |
1546 else if (pl->pl_prev_selected >= (pl->pl_first + pl->pl_num_visible)) | |
1547 pl->pl_first++; | |
1548 | |
2095 | 1549 playlist_select_range(playlist, pl->pl_prev_selected, pl->pl_prev_selected, TRUE); |
1653 | 1550 pl->pl_prev_min = -1; |
1551 } | |
1552 | |
1553 /* FIXME: Handle the keys through menu */ | |
1554 | |
1555 static gboolean | |
1556 playlistwin_keypress(GtkWidget * w, GdkEventKey * event, gpointer data) | |
1557 { | |
2095 | 1558 Playlist *playlist = playlist_get_active(); |
1559 | |
1653 | 1560 guint keyval; |
1561 gboolean refresh = FALSE; | |
1562 | |
1563 if (cfg.playlist_shaded) | |
1564 return FALSE; | |
1565 | |
1566 switch (keyval = event->keyval) { | |
1567 case GDK_KP_Up: | |
1568 case GDK_KP_Down: | |
1569 case GDK_Up: | |
1570 case GDK_Down: | |
1571 playlistwin_keypress_up_down_handler(playlistwin_list, | |
1572 keyval == GDK_Up | |
1573 || keyval == GDK_KP_Up, | |
1574 event->state); | |
1575 refresh = TRUE; | |
1576 break; | |
1577 case GDK_Page_Up: | |
1578 playlistwin_scroll(-playlistwin_list->pl_num_visible); | |
1579 refresh = TRUE; | |
1580 break; | |
1581 case GDK_Page_Down: | |
1582 playlistwin_scroll(playlistwin_list->pl_num_visible); | |
1583 refresh = TRUE; | |
1584 break; | |
1585 case GDK_Home: | |
1586 playlistwin_list->pl_first = 0; | |
1587 refresh = TRUE; | |
1588 break; | |
1589 case GDK_End: | |
1590 playlistwin_list->pl_first = | |
2095 | 1591 playlist_get_length(playlist) - playlistwin_list->pl_num_visible; |
1653 | 1592 refresh = TRUE; |
1593 break; | |
1594 case GDK_Return: | |
1595 if (playlistwin_list->pl_prev_selected > -1 | |
1596 && playlistwin_item_visible(playlistwin_list->pl_prev_selected)) { | |
2095 | 1597 playlist_set_position(playlist, playlistwin_list->pl_prev_selected); |
1653 | 1598 if (!bmp_playback_get_playing()) |
1599 bmp_playback_initiate(); | |
1600 } | |
1601 break; | |
1602 case GDK_3: | |
1603 if (event->state & GDK_CONTROL_MASK) | |
1604 playlistwin_fileinfo(); | |
1605 break; | |
1606 case GDK_Delete: | |
1607 if (event->state & GDK_CONTROL_MASK) | |
2095 | 1608 playlist_delete(playlist, TRUE); |
1653 | 1609 else |
2095 | 1610 playlist_delete(playlist, FALSE); |
1653 | 1611 break; |
1612 case GDK_Insert: | |
1613 if (event->state & GDK_MOD1_MASK) | |
1614 mainwin_show_add_url_window(); | |
1615 else | |
1616 playlistwin_show_filebrowser(); | |
1617 break; | |
1618 case GDK_Left: | |
1619 case GDK_KP_Left: | |
1620 case GDK_KP_7: | |
2095 | 1621 if (playlist_get_current_length(playlist) != -1) |
1653 | 1622 bmp_playback_seek(CLAMP |
2043
e211d52a3626
[svn] Seek controls (left and right) now seek 5 seconds like the main window
nazca
parents:
2028
diff
changeset
|
1623 (bmp_playback_get_time() - 5000, 0, |
2095 | 1624 playlist_get_current_length(playlist)) / 1000); |
1653 | 1625 break; |
1626 case GDK_Right: | |
1627 case GDK_KP_Right: | |
1628 case GDK_KP_9: | |
2095 | 1629 if (playlist_get_current_length(playlist) != -1) |
1653 | 1630 bmp_playback_seek(CLAMP |
2043
e211d52a3626
[svn] Seek controls (left and right) now seek 5 seconds like the main window
nazca
parents:
2028
diff
changeset
|
1631 (bmp_playback_get_time() + 5000, 0, |
2095 | 1632 playlist_get_current_length(playlist)) / 1000); |
1653 | 1633 break; |
2048
7bc2489db782
[svn] Numpad 4 and 6 liked to prev and next respectively to be more consistant with the main window
nazca
parents:
2043
diff
changeset
|
1634 case GDK_KP_4: |
2095 | 1635 playlist_prev(playlist); |
2048
7bc2489db782
[svn] Numpad 4 and 6 liked to prev and next respectively to be more consistant with the main window
nazca
parents:
2043
diff
changeset
|
1636 break; |
7bc2489db782
[svn] Numpad 4 and 6 liked to prev and next respectively to be more consistant with the main window
nazca
parents:
2043
diff
changeset
|
1637 case GDK_KP_6: |
2095 | 1638 playlist_next(playlist); |
2048
7bc2489db782
[svn] Numpad 4 and 6 liked to prev and next respectively to be more consistant with the main window
nazca
parents:
2043
diff
changeset
|
1639 break; |
1653 | 1640 |
1641 case GDK_Escape: | |
1642 mainwin_minimize_cb(); | |
1643 break; | |
1644 default: | |
1645 return FALSE; | |
1646 } | |
1647 | |
2026 | 1648 if (refresh) { |
1649 g_cond_signal(cond_scan); | |
2140
299651a8f107
[svn] - made playlistwin_update_list depend on passed Playlist* instead of blindly using playlist_get_active(); this solves many locking issues with multiple playlists, but SHOULD be reviewed in every place playlistwin_update_list is used; added a playlist_new_from_selected() call too
giacomo
parents:
2139
diff
changeset
|
1650 playlistwin_update_list(playlist_get_active()); |
2026 | 1651 } |
1653 | 1652 |
1653 return TRUE; | |
1654 } | |
1655 | |
1656 static void | |
1657 playlistwin_draw_frame(void) | |
1658 { | |
1659 gboolean focus = | |
1660 gtk_window_has_toplevel_focus(GTK_WINDOW(playlistwin)) || | |
1661 !cfg.dim_titlebar; | |
1662 | |
1663 if (cfg.playlist_shaded) { | |
1664 skin_draw_playlistwin_shaded(bmp_active_skin, | |
1665 playlistwin_bg, playlistwin_gc, | |
1666 playlistwin_get_width(), focus); | |
1667 } | |
1668 else { | |
1669 skin_draw_playlistwin_frame(bmp_active_skin, | |
1670 playlistwin_bg, playlistwin_gc, | |
1671 playlistwin_get_width(), | |
1672 cfg.playlist_height, focus); | |
1673 } | |
1674 } | |
1675 | |
1676 void | |
1677 draw_playlist_window(gboolean force) | |
1678 { | |
1679 gboolean redraw; | |
1680 GList *wl; | |
1681 Widget *w; | |
1682 | |
1683 if (force) | |
1684 playlistwin_draw_frame(); | |
1685 | |
1686 widget_list_lock(playlistwin_wlist); | |
1687 widget_list_draw(playlistwin_wlist, &redraw, force); | |
1688 | |
1689 if (redraw || force) { | |
1690 if (force) { | |
1691 gdk_window_clear(playlistwin->window); | |
1692 } | |
1693 else { | |
1694 for (wl = playlistwin_wlist; wl; wl = g_list_next(wl)) { | |
1695 w = WIDGET(wl->data); | |
1696 if (w->redraw && w->visible) { | |
1697 gdk_window_clear_area(playlistwin->window, w->x, w->y, | |
1698 w->width, w->height); | |
1699 w->redraw = FALSE; | |
1700 } | |
1701 } | |
1702 } | |
1703 | |
1704 gdk_flush(); | |
1705 } | |
1706 | |
1707 widget_list_unlock(playlistwin_wlist); | |
1708 } | |
1709 | |
1710 | |
1711 void | |
1712 playlistwin_hide_timer(void) | |
1713 { | |
1714 textbox_set_text(playlistwin_time_min, " "); | |
1715 textbox_set_text(playlistwin_time_sec, " "); | |
1716 } | |
1717 | |
1718 void | |
1719 playlistwin_set_time(gint time, gint length, TimerMode mode) | |
1720 { | |
1721 gchar *text, sign; | |
1722 | |
1723 if (mode == TIMER_REMAINING && length != -1) { | |
1724 time = length - time; | |
1725 sign = '-'; | |
1726 } | |
1727 else | |
1728 sign = ' '; | |
1729 | |
1730 time /= 1000; | |
1731 | |
1732 if (time < 0) | |
1733 time = 0; | |
1734 if (time > 99 * 60) | |
1735 time /= 60; | |
1736 | |
1737 text = g_strdup_printf("%c%-2.2d", sign, time / 60); | |
1738 textbox_set_text(playlistwin_time_min, text); | |
1739 g_free(text); | |
1740 | |
1741 text = g_strdup_printf("%-2.2d", time % 60); | |
1742 textbox_set_text(playlistwin_time_sec, text); | |
1743 g_free(text); | |
1744 } | |
1745 | |
1746 static void | |
1747 playlistwin_drag_motion(GtkWidget * widget, | |
1748 GdkDragContext * context, | |
1749 gint x, gint y, | |
1750 GtkSelectionData * selection_data, | |
1751 guint info, guint time, gpointer user_data) | |
1752 { | |
1753 playlistwin_list->pl_drag_motion = TRUE; | |
1754 playlistwin_list->drag_motion_x = x; | |
1755 playlistwin_list->drag_motion_y = y; | |
2140
299651a8f107
[svn] - made playlistwin_update_list depend on passed Playlist* instead of blindly using playlist_get_active(); this solves many locking issues with multiple playlists, but SHOULD be reviewed in every place playlistwin_update_list is used; added a playlist_new_from_selected() call too
giacomo
parents:
2139
diff
changeset
|
1756 playlistwin_update_list(playlist_get_active()); |
1653 | 1757 playlistwin_hint_flag = TRUE; |
1758 } | |
1759 | |
1760 static void | |
1761 playlistwin_drag_end(GtkWidget * widget, | |
1762 GdkDragContext * context, gpointer user_data) | |
1763 { | |
1764 playlistwin_list->pl_drag_motion = FALSE; | |
1765 playlistwin_hint_flag = FALSE; | |
2140
299651a8f107
[svn] - made playlistwin_update_list depend on passed Playlist* instead of blindly using playlist_get_active(); this solves many locking issues with multiple playlists, but SHOULD be reviewed in every place playlistwin_update_list is used; added a playlist_new_from_selected() call too
giacomo
parents:
2139
diff
changeset
|
1766 playlistwin_update_list(playlist_get_active()); |
1653 | 1767 } |
1768 | |
1769 static void | |
1770 playlistwin_drag_data_received(GtkWidget * widget, | |
1771 GdkDragContext * context, | |
1772 gint x, gint y, | |
1773 GtkSelectionData * | |
1774 selection_data, guint info, | |
1775 guint time, gpointer user_data) | |
1776 { | |
1777 gint pos; | |
2095 | 1778 Playlist *playlist = playlist_get_active(); |
1653 | 1779 |
1780 g_return_if_fail(selection_data != NULL); | |
1781 | |
1782 if (!selection_data->data) { | |
1783 g_message("Received no DND data!"); | |
1784 return; | |
1785 } | |
1786 | |
1787 if (widget_contains(WIDGET(playlistwin_list), x, y)) { | |
1788 pos = (y - WIDGET(playlistwin_list)->y) / | |
1789 playlistwin_list->pl_fheight + playlistwin_list->pl_first; | |
1790 | |
2095 | 1791 pos = MIN(pos, playlist_get_length(playlist)); |
1792 playlist_ins_url(playlist, (gchar *) selection_data->data, pos); | |
1653 | 1793 } |
1794 else | |
2095 | 1795 playlist_add_url(playlist, (gchar *) selection_data->data); |
1796 } | |
1797 | |
1798 static void | |
1799 local_playlist_prev(void) | |
1800 { | |
1801 playlist_prev(playlist_get_active()); | |
1802 } | |
1803 | |
1804 static void | |
1805 local_playlist_next(void) | |
1806 { | |
1807 playlist_next(playlist_get_active()); | |
1653 | 1808 } |
1809 | |
1810 static void | |
1811 playlistwin_create_widgets(void) | |
1812 { | |
1775 | 1813 gchar *font = NULL, *tmp = NULL; |
1653 | 1814 /* This function creates the custom widgets used by the playlist editor */ |
1815 | |
1816 /* text box for displaying song title in shaded mode */ | |
1817 playlistwin_sinfo = | |
1818 create_textbox(&playlistwin_wlist, playlistwin_bg, playlistwin_gc, | |
1775 | 1819 4, 4, playlistwin_get_width() - 35, TRUE, SKIN_TEXT); |
1820 | |
1821 playlistwin_set_sinfo_font(cfg.playlist_font); | |
1653 | 1822 |
1823 if (!cfg.playlist_shaded) | |
1824 widget_hide(WIDGET(playlistwin_sinfo)); | |
1825 | |
1826 /* shade/unshade window push button */ | |
1827 if (cfg.playlist_shaded) | |
1828 playlistwin_shade = | |
1829 create_pbutton(&playlistwin_wlist, playlistwin_bg, | |
1830 playlistwin_gc, playlistwin_get_width() - 21, 3, | |
1831 9, 9, 128, 45, 150, 42, | |
1832 playlistwin_shade_toggle, SKIN_PLEDIT); | |
1833 else | |
1834 playlistwin_shade = | |
1835 create_pbutton(&playlistwin_wlist, playlistwin_bg, | |
1836 playlistwin_gc, playlistwin_get_width() - 21, 3, | |
1837 9, 9, 157, 3, 62, 42, playlistwin_shade_toggle, | |
1838 SKIN_PLEDIT); | |
1839 | |
1840 playlistwin_shade->pb_allow_draw = FALSE; | |
1841 | |
1842 /* close window push button */ | |
1843 playlistwin_close = | |
1844 create_pbutton(&playlistwin_wlist, playlistwin_bg, playlistwin_gc, | |
1845 playlistwin_get_width() - 11, 3, 9, 9, | |
1846 cfg.playlist_shaded ? 138 : 167, | |
1847 cfg.playlist_shaded ? 45 : 3, 52, 42, | |
1848 playlistwin_hide, SKIN_PLEDIT); | |
1849 playlistwin_close->pb_allow_draw = FALSE; | |
1850 | |
1851 /* playlist list box */ | |
1852 playlistwin_list = | |
1853 create_playlist_list(&playlistwin_wlist, playlistwin_bg, | |
1854 playlistwin_gc, 12, 20, | |
1855 playlistwin_get_width() - 31, | |
1856 cfg.playlist_height - 58); | |
1857 playlist_list_set_font(cfg.playlist_font); | |
1858 | |
1859 /* playlist list box slider */ | |
1860 playlistwin_slider = | |
1861 create_playlistslider(&playlistwin_wlist, playlistwin_bg, | |
1862 playlistwin_gc, playlistwin_get_width() - 15, | |
1863 20, cfg.playlist_height - 58, playlistwin_list); | |
1864 /* track time (minute) */ | |
1865 playlistwin_time_min = | |
1866 create_textbox(&playlistwin_wlist, playlistwin_bg, playlistwin_gc, | |
1867 playlistwin_get_width() - 82, | |
1868 cfg.playlist_height - 15, 15, FALSE, SKIN_TEXT); | |
1869 | |
1870 /* track time (second) */ | |
1871 playlistwin_time_sec = | |
1872 create_textbox(&playlistwin_wlist, playlistwin_bg, playlistwin_gc, | |
1873 playlistwin_get_width() - 64, | |
1874 cfg.playlist_height - 15, 10, FALSE, SKIN_TEXT); | |
1875 | |
1876 /* playlist information (current track length / total track length) */ | |
1877 playlistwin_info = | |
1878 create_textbox(&playlistwin_wlist, playlistwin_bg, playlistwin_gc, | |
1879 playlistwin_get_width() - 143, | |
1880 cfg.playlist_height - 28, 90, FALSE, SKIN_TEXT); | |
1881 | |
1882 /* mini play control buttons at right bottom corner */ | |
1883 | |
1884 /* rewind button */ | |
1885 playlistwin_srew = | |
1886 create_sbutton(&playlistwin_wlist, playlistwin_bg, playlistwin_gc, | |
1887 playlistwin_get_width() - 144, | |
2095 | 1888 cfg.playlist_height - 16, 8, 7, local_playlist_prev); |
1653 | 1889 |
1890 /* play button */ | |
1891 playlistwin_splay = | |
1892 create_sbutton(&playlistwin_wlist, playlistwin_bg, playlistwin_gc, | |
1893 playlistwin_get_width() - 138, | |
1894 cfg.playlist_height - 16, 10, 7, mainwin_play_pushed); | |
1895 | |
1896 /* pause button */ | |
1897 playlistwin_spause = | |
1898 create_sbutton(&playlistwin_wlist, playlistwin_bg, playlistwin_gc, | |
1899 playlistwin_get_width() - 128, | |
1900 cfg.playlist_height - 16, 10, 7, bmp_playback_pause); | |
1901 | |
1902 /* stop button */ | |
1903 playlistwin_sstop = | |
1904 create_sbutton(&playlistwin_wlist, playlistwin_bg, playlistwin_gc, | |
1905 playlistwin_get_width() - 118, | |
1906 cfg.playlist_height - 16, 9, 7, mainwin_stop_pushed); | |
1907 | |
1908 /* forward button */ | |
1909 playlistwin_sfwd = | |
1910 create_sbutton(&playlistwin_wlist, playlistwin_bg, playlistwin_gc, | |
1911 playlistwin_get_width() - 109, | |
2095 | 1912 cfg.playlist_height - 16, 8, 7, local_playlist_next); |
1653 | 1913 |
1914 /* eject button */ | |
1915 playlistwin_seject = | |
1916 create_sbutton(&playlistwin_wlist, playlistwin_bg, playlistwin_gc, | |
1917 playlistwin_get_width() - 100, | |
1918 cfg.playlist_height - 16, 9, 7, mainwin_eject_pushed); | |
1919 | |
1920 | |
1921 playlistwin_sscroll_up = | |
1922 create_sbutton(&playlistwin_wlist, playlistwin_bg, playlistwin_gc, | |
1923 playlistwin_get_width() - 14, | |
1924 cfg.playlist_height - 35, 8, 5, | |
1925 playlistwin_scroll_up_pushed); | |
1926 playlistwin_sscroll_down = | |
1927 create_sbutton(&playlistwin_wlist, playlistwin_bg, playlistwin_gc, | |
1928 playlistwin_get_width() - 14, | |
1929 cfg.playlist_height - 30, 8, 5, | |
1930 playlistwin_scroll_down_pushed); | |
1931 | |
1932 } | |
1933 | |
1934 static void | |
1935 selection_received(GtkWidget * widget, | |
1936 GtkSelectionData * selection_data, gpointer data) | |
1937 { | |
1938 if (selection_data->type == GDK_SELECTION_TYPE_STRING && | |
1939 selection_data->length > 0) | |
2095 | 1940 playlist_add_url(playlist_get_active(), (gchar *) selection_data->data); |
1653 | 1941 } |
1942 | |
1943 static void | |
1944 playlistwin_create_window(void) | |
1945 { | |
1946 GdkPixbuf *icon; | |
1947 | |
1948 playlistwin = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
1949 gtk_window_set_title(GTK_WINDOW(playlistwin), _("Audacious Playlist Editor")); | |
1950 gtk_window_set_wmclass(GTK_WINDOW(playlistwin), "playlist", "Audacious"); | |
1951 gtk_window_set_role(GTK_WINDOW(playlistwin), "playlist"); | |
1952 gtk_window_set_default_size(GTK_WINDOW(playlistwin), | |
1953 playlistwin_get_width(), | |
1954 playlistwin_get_height()); | |
1955 gtk_window_set_resizable(GTK_WINDOW(playlistwin), TRUE); | |
1956 playlistwin_set_geometry_hints(cfg.playlist_shaded); | |
1957 dock_window_list = dock_window_set_decorated(dock_window_list, | |
1958 GTK_WINDOW(playlistwin), | |
1959 cfg.show_wm_decorations); | |
1960 | |
1961 gtk_window_set_transient_for(GTK_WINDOW(playlistwin), | |
1962 GTK_WINDOW(mainwin)); | |
1963 gtk_window_set_skip_taskbar_hint(GTK_WINDOW(playlistwin), TRUE); | |
1964 | |
1965 icon = gdk_pixbuf_new_from_xpm_data((const gchar **) bmp_playlist_icon); | |
1966 gtk_window_set_icon(GTK_WINDOW(playlistwin), icon); | |
1967 g_object_unref(icon); | |
1968 | |
1969 gtk_widget_set_app_paintable(playlistwin, TRUE); | |
1970 | |
1971 if (cfg.playlist_x != -1 && cfg.save_window_position) | |
1972 gtk_window_move(GTK_WINDOW(playlistwin), | |
1973 cfg.playlist_x, cfg.playlist_y); | |
1974 | |
1975 gtk_widget_add_events(playlistwin, GDK_POINTER_MOTION_MASK | | |
1976 GDK_FOCUS_CHANGE_MASK | GDK_BUTTON_MOTION_MASK | | |
1977 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | | |
1978 GDK_SCROLL_MASK | GDK_VISIBILITY_NOTIFY_MASK); | |
1979 gtk_widget_realize(playlistwin); | |
1980 | |
1981 util_set_cursor(playlistwin); | |
1982 | |
1983 g_signal_connect(playlistwin, "delete_event", | |
1984 G_CALLBACK(playlistwin_delete), NULL); | |
1985 g_signal_connect(playlistwin, "button_press_event", | |
1986 G_CALLBACK(playlistwin_press), NULL); | |
1987 g_signal_connect(playlistwin, "button_release_event", | |
1988 G_CALLBACK(playlistwin_release), NULL); | |
1989 g_signal_connect(playlistwin, "scroll_event", | |
1990 G_CALLBACK(playlistwin_scrolled), NULL); | |
1991 g_signal_connect(playlistwin, "motion_notify_event", | |
1992 G_CALLBACK(playlistwin_motion), NULL); | |
1993 g_signal_connect(playlistwin, "enter_notify_event", | |
1994 G_CALLBACK(playlistwin_enter), NULL); | |
1995 g_signal_connect(playlistwin, "leave_notify_event", | |
1996 G_CALLBACK(playlistwin_leave), NULL); | |
1997 g_signal_connect_after(playlistwin, "focus_in_event", | |
1998 G_CALLBACK(playlistwin_focus_in), NULL); | |
1999 g_signal_connect_after(playlistwin, "focus_out_event", | |
2000 G_CALLBACK(playlistwin_focus_out), NULL); | |
2001 g_signal_connect(playlistwin, "configure_event", | |
2002 G_CALLBACK(playlistwin_configure), NULL); | |
2003 g_signal_connect(playlistwin, "style_set", | |
2004 G_CALLBACK(playlistwin_set_back_pixmap), NULL); | |
2005 | |
2006 bmp_drag_dest_set(playlistwin); | |
2007 | |
2008 /* DnD stuff */ | |
2009 g_signal_connect(playlistwin, "drag-leave", | |
2010 G_CALLBACK(playlistwin_drag_end), NULL); | |
2011 g_signal_connect(playlistwin, "drag-data-delete", | |
2012 G_CALLBACK(playlistwin_drag_end), NULL); | |
2013 g_signal_connect(playlistwin, "drag-end", | |
2014 G_CALLBACK(playlistwin_drag_end), NULL); | |
2015 g_signal_connect(playlistwin, "drag-drop", | |
2016 G_CALLBACK(playlistwin_drag_end), NULL); | |
2017 g_signal_connect(playlistwin, "drag-data-received", | |
2018 G_CALLBACK(playlistwin_drag_data_received), NULL); | |
2019 g_signal_connect(playlistwin, "drag-motion", | |
2020 G_CALLBACK(playlistwin_drag_motion), NULL); | |
2021 | |
2022 g_signal_connect(playlistwin, "key_press_event", | |
2023 G_CALLBACK(playlistwin_keypress), NULL); | |
2024 g_signal_connect(playlistwin, "selection_received", | |
2025 G_CALLBACK(selection_received), NULL); | |
2026 | |
2027 playlistwin_set_mask(); | |
2028 } | |
2029 | |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2030 static GtkWidget * |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2031 ui_manager_get_popup(GtkUIManager * self, const gchar * path) |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2032 { |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2033 GtkWidget *menu_item; |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2034 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2035 menu_item = gtk_ui_manager_get_widget(self, path); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2036 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2037 if (GTK_IS_MENU_ITEM(menu_item)) |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2038 return gtk_menu_item_get_submenu(GTK_MENU_ITEM(menu_item)); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2039 else |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2040 return NULL; |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2041 } |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2042 |
1653 | 2043 void |
2044 playlistwin_create_popup_menus(void) | |
2045 { | |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2046 GtkUIManager *ui_manager; |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2047 GtkActionGroup *action_group; |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2048 GError *error = NULL; |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2049 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2050 action_group = gtk_action_group_new("playlistwin"); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2051 gtk_action_group_add_actions(action_group, playlistwin_actions, |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2052 G_N_ELEMENTS(playlistwin_actions), NULL); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2053 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2054 ui_manager = gtk_ui_manager_new(); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2055 gtk_ui_manager_add_ui_from_file(ui_manager, DATA_DIR "/ui/playlist.ui", &error); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2056 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2057 if (error) |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2058 { |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2059 g_critical("Error creating UI<ui/playlist.ui>: %s", error->message); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2060 return; |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2061 } |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2062 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2063 gtk_ui_manager_insert_action_group(ui_manager, action_group, 0); |
1653 | 2064 |
2065 /* playlist window popup menu */ | |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2066 playlistwin_popup_menu = ui_manager_get_popup(ui_manager, "/playlist-menus/playlist-rightclick-menu"); |
1653 | 2067 |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2068 pladd_menu = ui_manager_get_popup(ui_manager, "/playlist-menus/add-menu"); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2069 pldel_menu = ui_manager_get_popup(ui_manager, "/playlist-menus/del-menu"); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2070 plsel_menu = ui_manager_get_popup(ui_manager, "/playlist-menus/select-menu"); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2071 plsort_menu = ui_manager_get_popup(ui_manager, "/playlist-menus/misc-menu"); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2072 pllist_menu = ui_manager_get_popup(ui_manager, "/playlist-menus/playlist-menu"); |
1653 | 2073 |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2074 gtk_window_add_accel_group(GTK_WINDOW(playlistwin), |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2075 gtk_ui_manager_get_accel_group(ui_manager)); |
1653 | 2076 } |
2077 | |
2078 void | |
2079 playlistwin_create(void) | |
2080 { | |
2140
299651a8f107
[svn] - made playlistwin_update_list depend on passed Playlist* instead of blindly using playlist_get_active(); this solves many locking issues with multiple playlists, but SHOULD be reviewed in every place playlistwin_update_list is used; added a playlist_new_from_selected() call too
giacomo
parents:
2139
diff
changeset
|
2081 Playlist *playlist; |
1653 | 2082 playlistwin_create_window(); |
2083 playlistwin_create_popup_menus(); | |
2084 | |
2085 /* create GC and back pixmap for custom widget to draw on */ | |
2086 playlistwin_gc = gdk_gc_new(playlistwin->window); | |
2087 playlistwin_bg = gdk_pixmap_new(playlistwin->window, | |
2088 playlistwin_get_width(), | |
2089 playlistwin_get_height_unshaded(), -1); | |
2090 gdk_window_set_back_pixmap(playlistwin->window, playlistwin_bg, 0); | |
2091 | |
2092 playlistwin_create_widgets(); | |
2140
299651a8f107
[svn] - made playlistwin_update_list depend on passed Playlist* instead of blindly using playlist_get_active(); this solves many locking issues with multiple playlists, but SHOULD be reviewed in every place playlistwin_update_list is used; added a playlist_new_from_selected() call too
giacomo
parents:
2139
diff
changeset
|
2093 playlistwin_update_info(playlist_get_active()); |
1653 | 2094 |
2095 gtk_window_add_accel_group(GTK_WINDOW(playlistwin), mainwin_accel); | |
2096 } | |
2097 | |
2098 | |
2099 void | |
2100 playlistwin_show(void) | |
2101 { | |
2102 GtkWidget *item; | |
2103 | |
2104 item = gtk_item_factory_get_widget(mainwin_view_menu, | |
2105 "/Show Playlist Editor"); | |
2106 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE); | |
2107 | |
2108 tbutton_set_toggled(mainwin_pl, TRUE); | |
2109 cfg.playlist_visible = TRUE; | |
2110 | |
2111 playlistwin_set_toprow(0); | |
2095 | 2112 playlist_check_pos_current(playlist_get_active()); |
1653 | 2113 |
2114 gtk_widget_show(playlistwin); | |
2115 } | |
2116 | |
2117 void | |
2118 playlistwin_hide(void) | |
2119 { | |
2120 GtkWidget *item; | |
2121 | |
2122 item = gtk_item_factory_get_widget(mainwin_view_menu, | |
2123 "/Show Playlist Editor"); | |
2124 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), FALSE); | |
2125 | |
2126 gtk_widget_hide(playlistwin); | |
2127 tbutton_set_toggled(mainwin_pl, FALSE); | |
2128 cfg.playlist_visible = FALSE; | |
2129 | |
2130 gtk_window_present(GTK_WINDOW(mainwin)); | |
2131 gtk_widget_grab_focus(mainwin); | |
2132 } | |
2133 | |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2134 static void action_view_track_info(void) |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2135 { |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2136 playlistwin_fileinfo(); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2137 } |
1653 | 2138 |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2139 static void action_queue_toggle(void) |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2140 { |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2141 playlist_queue(playlist_get_active()); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2142 } |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2143 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2144 static void action_sort_by_playlist_entry(void) |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2145 { |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2146 Playlist *playlist = playlist_get_active(); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2147 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2148 playlist_sort(playlist, PLAYLIST_SORT_PLAYLIST); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2149 playlistwin_update_list(playlist); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2150 } |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2151 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2152 static void action_sort_by_track_number(void) |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2153 { |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2154 Playlist *playlist = playlist_get_active(); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2155 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2156 playlist_sort(playlist, PLAYLIST_SORT_TRACK); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2157 playlistwin_update_list(playlist); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2158 } |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2159 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2160 static void action_sort_by_title(void) |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2161 { |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2162 Playlist *playlist = playlist_get_active(); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2163 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2164 playlist_sort(playlist, PLAYLIST_SORT_TITLE); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2165 playlistwin_update_list(playlist); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2166 } |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2167 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2168 static void action_sort_by_artist(void) |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2169 { |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2170 Playlist *playlist = playlist_get_active(); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2171 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2172 playlist_sort(playlist, PLAYLIST_SORT_ARTIST); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2173 playlistwin_update_list(playlist); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2174 } |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2175 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2176 static void action_sort_by_full_path(void) |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2177 { |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2178 Playlist *playlist = playlist_get_active(); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2179 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2180 playlist_sort(playlist, PLAYLIST_SORT_PATH); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2181 playlistwin_update_list(playlist); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2182 } |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2183 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2184 static void action_sort_by_date(void) |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2185 { |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2186 Playlist *playlist = playlist_get_active(); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2187 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2188 playlist_sort(playlist, PLAYLIST_SORT_DATE); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2189 playlistwin_update_list(playlist); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2190 } |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2191 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2192 static void action_sort_by_filename(void) |
1653 | 2193 { |
2095 | 2194 Playlist *playlist = playlist_get_active(); |
2195 | |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2196 playlist_sort(playlist, PLAYLIST_SORT_FILENAME); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2197 playlistwin_update_list(playlist); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2198 } |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2199 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2200 static void action_sort_selected_by_playlist_entry(void) |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2201 { |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2202 Playlist *playlist = playlist_get_active(); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2203 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2204 playlist_sort_selected(playlist, PLAYLIST_SORT_PLAYLIST); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2205 playlistwin_update_list(playlist); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2206 } |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2207 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2208 static void action_sort_selected_by_track_number(void) |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2209 { |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2210 Playlist *playlist = playlist_get_active(); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2211 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2212 playlist_sort_selected(playlist, PLAYLIST_SORT_TRACK); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2213 playlistwin_update_list(playlist); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2214 } |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2215 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2216 static void action_sort_selected_by_title(void) |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2217 { |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2218 Playlist *playlist = playlist_get_active(); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2219 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2220 playlist_sort_selected(playlist, PLAYLIST_SORT_TITLE); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2221 playlistwin_update_list(playlist); |
1653 | 2222 } |
2223 | |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2224 static void action_sort_selected_by_artist(void) |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2225 { |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2226 Playlist *playlist = playlist_get_active(); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2227 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2228 playlist_sort_selected(playlist, PLAYLIST_SORT_ARTIST); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2229 playlistwin_update_list(playlist); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2230 } |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2231 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2232 static void action_sort_selected_by_full_path(void) |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2233 { |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2234 Playlist *playlist = playlist_get_active(); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2235 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2236 playlist_sort_selected(playlist, PLAYLIST_SORT_PATH); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2237 playlistwin_update_list(playlist); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2238 } |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2239 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2240 static void action_sort_selected_by_date(void) |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2241 { |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2242 Playlist *playlist = playlist_get_active(); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2243 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2244 playlist_sort_selected(playlist, PLAYLIST_SORT_DATE); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2245 playlistwin_update_list(playlist); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2246 } |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2247 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2248 static void action_sort_selected_by_filename(void) |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2249 { |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2250 Playlist *playlist = playlist_get_active(); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2251 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2252 playlist_sort_selected(playlist, PLAYLIST_SORT_FILENAME); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2253 playlistwin_update_list(playlist); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2254 } |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2255 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2256 static void action_randomize_list(void) |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2257 { |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2258 Playlist *playlist = playlist_get_active(); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2259 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2260 playlist_random(playlist); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2261 playlistwin_update_list(playlist); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2262 } |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2263 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2264 static void action_reverse_list(void) |
1653 | 2265 { |
2095 | 2266 Playlist *playlist = playlist_get_active(); |
2267 | |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2268 playlist_reverse(playlist); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2269 playlistwin_update_list(playlist); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2270 } |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2271 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2272 static void |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2273 action_clear_queue(void) |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2274 { |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2275 playlist_clear_queue(playlist_get_active()); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2276 } |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2277 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2278 static void |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2279 action_remove_unavailable(void) |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2280 { |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2281 playlist_remove_dead_files(playlist_get_active()); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2282 } |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2283 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2284 static void |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2285 action_remove_dupes_by_title(void) |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2286 { |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2287 playlist_remove_duplicates(playlist_get_active(), PLAYLIST_DUPS_TITLE); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2288 } |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2289 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2290 static void |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2291 action_remove_dupes_by_filename(void) |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2292 { |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2293 playlist_remove_duplicates(playlist_get_active(), PLAYLIST_DUPS_FILENAME); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2294 } |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2295 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2296 static void |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2297 action_remove_dupes_by_full_path(void) |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2298 { |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2299 playlist_remove_duplicates(playlist_get_active(), PLAYLIST_DUPS_PATH); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2300 } |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2301 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2302 static void |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2303 action_remove_all(void) |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2304 { |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2305 playlist_clear(playlist_get_active()); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2306 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2307 /* XXX -- should this really be coupled here? -nenolod */ |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2308 mainwin_clear_song_info(); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2309 mainwin_set_info_text(); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2310 } |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2311 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2312 static void |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2313 action_remove_selected(void) |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2314 { |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2315 playlist_delete(playlist_get_active(), FALSE); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2316 } |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2317 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2318 static void |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2319 action_remove_unselected(void) |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2320 { |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2321 playlist_delete(playlist_get_active(), TRUE); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2322 } |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2323 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2324 static void |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2325 action_add_files(void) |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2326 { |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2327 util_run_filebrowser(NO_PLAY_BUTTON); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2328 } |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2329 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2330 void add_medium(void); /* XXX */ |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2331 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2332 static void |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2333 action_add_cd(void) |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2334 { |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2335 add_medium(); |
1653 | 2336 } |
2337 | |
2338 static void | |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2339 action_add_url(void) |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2340 { |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2341 mainwin_show_add_url_window(); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2342 } |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2343 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2344 static void |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2345 action_new_list(void) |
1653 | 2346 { |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2347 Playlist *playlist = playlist_get_active(); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2348 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2349 playlist_set_current_name(playlist, NULL); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2350 playlist_clear(playlist); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2351 mainwin_clear_song_info(); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2352 mainwin_set_info_text(); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2353 } |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2354 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2355 static void |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2356 action_save_list(void) |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2357 { |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2358 Playlist *playlist = playlist_get_active(); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2359 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2360 playlistwin_select_playlist_to_save(playlist_get_current_name(playlist)); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2361 } |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2362 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2363 static void |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2364 action_save_default_list(void) |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2365 { |
2095 | 2366 Playlist *playlist = playlist_get_active(); |
1653 | 2367 |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2368 playlist_save(playlist, bmp_paths[BMP_PATH_PLAYLIST_FILE]); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2369 } |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2370 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2371 static void |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2372 action_load_list(void) |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2373 { |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2374 Playlist *playlist = playlist_get_active(); |
1653 | 2375 |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2376 playlistwin_select_playlist_to_load(playlist_get_current_name(playlist)); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2377 } |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2378 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2379 static void |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2380 action_refresh_list(void) |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2381 { |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2382 Playlist *playlist = playlist_get_active(); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2383 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2384 playlist_read_info_selection(playlist); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2385 playlistwin_update_list(playlist); |
1653 | 2386 } |
2144
b76039eeb6f0
[svn] - added auto-enqueue option for search-in-playlist
giacomo
parents:
2140
diff
changeset
|
2387 |
2153
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2388 static void |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2389 action_search_and_select(void) |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2390 { |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2391 playlistwin_select_search(); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2392 } |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2393 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2394 static void |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2395 action_invert_selection(void) |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2396 { |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2397 playlistwin_inverse_selection(); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2398 } |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2399 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2400 static void |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2401 action_select_none(void) |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2402 { |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2403 playlistwin_select_none(); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2404 } |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2405 |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2406 static void |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2407 action_select_all(void) |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2408 { |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2409 playlistwin_select_all(); |
ba578fefe36a
[svn] - port playlist editor to XML interface description
nenolod
parents:
2145
diff
changeset
|
2410 } |
2144
b76039eeb6f0
[svn] - added auto-enqueue option for search-in-playlist
giacomo
parents:
2140
diff
changeset
|
2411 |
b76039eeb6f0
[svn] - added auto-enqueue option for search-in-playlist
giacomo
parents:
2140
diff
changeset
|
2412 /* playlistwin_select_search callback functions |
b76039eeb6f0
[svn] - added auto-enqueue option for search-in-playlist
giacomo
parents:
2140
diff
changeset
|
2413 placed here to avoid making the code messier :) */ |
b76039eeb6f0
[svn] - added auto-enqueue option for search-in-playlist
giacomo
parents:
2140
diff
changeset
|
2414 static void |
b76039eeb6f0
[svn] - added auto-enqueue option for search-in-playlist
giacomo
parents:
2140
diff
changeset
|
2415 playlistwin_select_search_cbt_cb( GtkWidget *called_cbt , gpointer other_cbt ) |
b76039eeb6f0
[svn] - added auto-enqueue option for search-in-playlist
giacomo
parents:
2140
diff
changeset
|
2416 { |
b76039eeb6f0
[svn] - added auto-enqueue option for search-in-playlist
giacomo
parents:
2140
diff
changeset
|
2417 if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(called_cbt) ) == TRUE ) |
b76039eeb6f0
[svn] - added auto-enqueue option for search-in-playlist
giacomo
parents:
2140
diff
changeset
|
2418 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(other_cbt) , FALSE ); |
b76039eeb6f0
[svn] - added auto-enqueue option for search-in-playlist
giacomo
parents:
2140
diff
changeset
|
2419 return; |
b76039eeb6f0
[svn] - added auto-enqueue option for search-in-playlist
giacomo
parents:
2140
diff
changeset
|
2420 } |
2145
e2c6696c1d9a
[svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents:
2144
diff
changeset
|
2421 |
e2c6696c1d9a
[svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents:
2144
diff
changeset
|
2422 static gboolean |
e2c6696c1d9a
[svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents:
2144
diff
changeset
|
2423 playlistwin_select_search_kp_cb( GtkWidget *entry , GdkEventKey *event , |
e2c6696c1d9a
[svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents:
2144
diff
changeset
|
2424 gpointer searchdlg_win ) |
e2c6696c1d9a
[svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents:
2144
diff
changeset
|
2425 { |
e2c6696c1d9a
[svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents:
2144
diff
changeset
|
2426 switch (event->keyval) |
e2c6696c1d9a
[svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents:
2144
diff
changeset
|
2427 { |
e2c6696c1d9a
[svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents:
2144
diff
changeset
|
2428 case GDK_Return: |
e2c6696c1d9a
[svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents:
2144
diff
changeset
|
2429 gtk_dialog_response( GTK_DIALOG(searchdlg_win) , GTK_RESPONSE_ACCEPT ); |
e2c6696c1d9a
[svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents:
2144
diff
changeset
|
2430 return TRUE; |
e2c6696c1d9a
[svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents:
2144
diff
changeset
|
2431 default: |
e2c6696c1d9a
[svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents:
2144
diff
changeset
|
2432 return FALSE; |
e2c6696c1d9a
[svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents:
2144
diff
changeset
|
2433 } |
e2c6696c1d9a
[svn] added enter keypress shortcut for search-in-playlist dialog
giacomo
parents:
2144
diff
changeset
|
2434 } |