Mercurial > audlegacy
annotate src/audacious/ui_manager.c @ 3236:74a999f3f4d2
Unbreak XMMS/GTK1 file selector.
Pointed out by ccr.
author | William Pitcock <nenolod@atheme-project.org> |
---|---|
date | Fri, 03 Aug 2007 22:17:41 -0500 |
parents | f1c756f39e6c |
children | f02623377013 |
rev | line source |
---|---|
2313 | 1 /* Audacious - Cross-platform multimedia player |
2 * Copyright (C) 2005-2007 Audacious development team. | |
3 * | |
4 * This program is free software; you can redistribute it and/or modify | |
5 * it under the terms of the GNU General Public License as published by | |
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
3113
diff
changeset
|
6 * the Free Software Foundation; under version 3 of the License. |
2313 | 7 * |
8 * This program is distributed in the hope that it will be useful, | |
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
11 * GNU General Public License for more details. | |
12 * | |
13 * You should have received a copy of the GNU General Public License | |
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
3113
diff
changeset
|
14 * along with this program. If not, see <http://www.gnu.org/licenses>. |
3123
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
15 * |
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
16 * The Audacious team does not consider modular code linking to |
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
17 * Audacious or using our public API to be a derived work. |
2313 | 18 */ |
19 | |
20 #ifdef HAVE_CONFIG_H | |
21 # include "config.h" | |
22 #endif | |
23 | |
24 #include "ui_manager.h" | |
25 #include "actions-mainwin.h" | |
26 #include "actions-playlist.h" | |
27 #include "actions-equalizer.h" | |
28 | |
29 /* TODO ui_main.h is only included because ui_manager.c needs the values of | |
30 TimerMode enum; move that enum elsewhere so we can get rid of this include */ | |
31 #include "ui_main.h" | |
32 /* we need this to define values of visualization radio-actions */ | |
33 #include "widgets/widgetcore.h" | |
34 | |
35 #include "icons-stock.h" | |
36 | |
37 | |
38 static GtkUIManager *ui_manager; | |
39 | |
40 | |
41 /* toggle action entries */ | |
42 | |
43 static GtkToggleActionEntry toggleaction_entries_others[] = { | |
44 | |
45 { "autoscroll songname", NULL , N_("Autoscroll Songname"), NULL, | |
46 N_("Autoscroll Songname"), G_CALLBACK(action_autoscroll_songname) , FALSE }, | |
47 | |
48 { "stop after current song", NULL , N_("Stop after Current Song"), "<Ctrl>M", | |
49 N_("Stop after Current Song"), G_CALLBACK(action_stop_after_current_song) , FALSE }, | |
50 | |
51 { "anamode peaks", NULL , N_("Peaks"), NULL, | |
52 N_("Peaks"), G_CALLBACK(action_anamode_peaks) , FALSE }, | |
53 | |
54 { "playback repeat", NULL , N_("Repeat"), "R", | |
55 N_("Repeat"), G_CALLBACK(action_playback_repeat) , FALSE }, | |
56 | |
57 { "playback shuffle", NULL , N_("Shuffle"), "S", | |
58 N_("Shuffle"), G_CALLBACK(action_playback_shuffle) , FALSE }, | |
59 | |
60 { "playback no playlist advance", NULL , N_("No Playlist Advance"), "<Ctrl>N", | |
61 N_("No Playlist Advance"), G_CALLBACK(action_playback_noplaylistadvance) , FALSE }, | |
62 | |
63 { "show player", NULL , N_("Show Player"), "<Alt>M", | |
64 N_("Show Player"), G_CALLBACK(action_show_player) , FALSE }, | |
65 | |
66 { "show playlist editor", NULL , N_("Show Playlist Editor"), "<Alt>E", | |
67 N_("Show Playlist Editor"), G_CALLBACK(action_show_playlist_editor) , FALSE }, | |
68 | |
69 { "show equalizer", NULL , N_("Show Equalizer"), "<Alt>G", | |
70 N_("Show Equalizer"), G_CALLBACK(action_show_equalizer) , FALSE }, | |
71 | |
72 { "view always on top", NULL , N_("Always on Top"), "<Ctrl>O", | |
73 N_("Always on Top"), G_CALLBACK(action_view_always_on_top) , FALSE }, | |
74 | |
75 { "view put on all workspaces", NULL , N_("Put on All Workspaces"), "<Ctrl>S", | |
76 N_("Put on All Workspaces"), G_CALLBACK(action_view_on_all_workspaces) , FALSE }, | |
77 | |
78 { "roll up player", NULL , N_("Roll up Player"), "<Ctrl>W", | |
79 N_("Roll up Player"), G_CALLBACK(action_roll_up_player) , FALSE }, | |
80 | |
81 { "roll up playlist editor", NULL , N_("Roll up Playlist Editor"), "<Shift><Ctrl>W", | |
82 N_("Roll up Playlist Editor"), G_CALLBACK(action_roll_up_playlist_editor) , FALSE }, | |
83 | |
84 { "roll up equalizer", NULL , N_("Roll up Equalizer"), "<Ctrl><Alt>W", | |
85 N_("Roll up Equalizer"), G_CALLBACK(action_roll_up_equalizer) , FALSE }, | |
86 | |
87 { "view doublesize", NULL , N_("DoubleSize"), "<Ctrl>D", | |
88 N_("DoubleSize"), G_CALLBACK(action_view_doublesize) , FALSE }, | |
89 | |
90 { "view easy move", NULL , N_("Easy Move"), "<Ctrl>E", | |
91 N_("Easy Move"), G_CALLBACK(action_view_easymove) , FALSE } | |
92 }; | |
93 | |
94 | |
95 | |
96 /* radio action entries */ | |
97 | |
98 static GtkRadioActionEntry radioaction_entries_vismode[] = { | |
99 { "vismode analyzer", NULL , N_("Analyzer"), NULL, N_("Analyzer"), VIS_ANALYZER }, | |
100 { "vismode scope", NULL , N_("Scope"), NULL, N_("Scope"), VIS_SCOPE }, | |
101 { "vismode voiceprint", NULL , N_("Voiceprint"), NULL, N_("Voiceprint"), VIS_VOICEPRINT }, | |
102 { "vismode off", NULL , N_("Off"), NULL, N_("Off"), VIS_OFF } | |
103 }; | |
104 | |
105 static GtkRadioActionEntry radioaction_entries_anamode[] = { | |
106 { "anamode normal", NULL , N_("Normal"), NULL, N_("Normal"), ANALYZER_NORMAL }, | |
107 { "anamode fire", NULL , N_("Fire"), NULL, N_("Fire"), ANALYZER_FIRE }, | |
108 { "anamode vertical lines", NULL , N_("Vertical Lines"), NULL, N_("Vertical Lines"), ANALYZER_VLINES } | |
109 }; | |
110 | |
111 static GtkRadioActionEntry radioaction_entries_anatype[] = { | |
112 { "anatype lines", NULL , N_("Lines"), NULL, N_("Lines"), ANALYZER_LINES }, | |
113 { "anatype bars", NULL , N_("Bars"), NULL, N_("Bars"), ANALYZER_BARS } | |
114 }; | |
115 | |
116 static GtkRadioActionEntry radioaction_entries_scomode[] = { | |
117 { "scomode dot", NULL , N_("Dot Scope"), NULL, N_("Dot Scope"), SCOPE_DOT }, | |
118 { "scomode line", NULL , N_("Line Scope"), NULL, N_("Line Scope"), SCOPE_LINE }, | |
119 { "scomode solid", NULL , N_("Solid Scope"), NULL, N_("Solid Scope"), SCOPE_SOLID } | |
120 }; | |
121 | |
122 static GtkRadioActionEntry radioaction_entries_vprmode[] = { | |
123 { "vprmode normal", NULL , N_("Normal"), NULL, N_("Normal"), VOICEPRINT_NORMAL }, | |
124 { "vprmode fire", NULL , N_("Fire"), NULL, N_("Fire"), VOICEPRINT_FIRE }, | |
125 { "vprmode ice", NULL , N_("Ice"), NULL, N_("Ice"), VOICEPRINT_ICE } | |
126 }; | |
127 | |
128 static GtkRadioActionEntry radioaction_entries_wshmode[] = { | |
129 { "wshmode normal", NULL , N_("Normal"), NULL, N_("Normal"), VU_NORMAL }, | |
130 { "wshmode smooth", NULL , N_("Smooth"), NULL, N_("Smooth"), VU_SMOOTH } | |
131 }; | |
132 | |
133 static GtkRadioActionEntry radioaction_entries_refrate[] = { | |
134 { "refrate full", NULL , N_("Full (~50 fps)"), NULL, N_("Full (~50 fps)"), REFRESH_FULL }, | |
135 { "refrate half", NULL , N_("Half (~25 fps)"), NULL, N_("Half (~25 fps)"), REFRESH_HALF }, | |
136 { "refrate quarter", NULL , N_("Quarter (~13 fps)"), NULL, N_("Quarter (~13 fps)"), REFRESH_QUARTER }, | |
137 { "refrate eighth", NULL , N_("Eighth (~6 fps)"), NULL, N_("Eighth (~6 fps)"), REFRESH_EIGTH } | |
138 }; | |
139 | |
140 static GtkRadioActionEntry radioaction_entries_anafoff[] = { | |
141 { "anafoff slowest", NULL , N_("Slowest"), NULL, N_("Slowest"), FALLOFF_SLOWEST }, | |
142 { "anafoff slow", NULL , N_("Slow"), NULL, N_("Slow"), FALLOFF_SLOW }, | |
143 { "anafoff medium", NULL , N_("Medium"), NULL, N_("Medium"), FALLOFF_MEDIUM }, | |
144 { "anafoff fast", NULL , N_("Fast"), NULL, N_("Fast"), FALLOFF_FAST }, | |
145 { "anafoff fastest", NULL , N_("Fastest"), NULL, N_("Fastest"), FALLOFF_FASTEST } | |
146 }; | |
147 | |
148 static GtkRadioActionEntry radioaction_entries_peafoff[] = { | |
149 { "peafoff slowest", NULL , N_("Slowest"), NULL, N_("Slowest"), FALLOFF_SLOWEST }, | |
150 { "peafoff slow", NULL , N_("Slow"), NULL, N_("Slow"), FALLOFF_SLOW }, | |
151 { "peafoff medium", NULL , N_("Medium"), NULL, N_("Medium"), FALLOFF_MEDIUM }, | |
152 { "peafoff fast", NULL , N_("Fast"), NULL, N_("Fast"), FALLOFF_FAST }, | |
153 { "peafoff fastest", NULL , N_("Fastest"), NULL, N_("Fastest"), FALLOFF_FASTEST } | |
154 }; | |
155 | |
156 static GtkRadioActionEntry radioaction_entries_viewtime[] = { | |
157 { "view time elapsed", NULL , N_("Time Elapsed"), "<Ctrl>E", N_("Time Elapsed"), TIMER_ELAPSED }, | |
158 { "view time remaining", NULL , N_("Time Remaining"), "<Ctrl>R", N_("Time Remaining"), TIMER_REMAINING } | |
159 }; | |
160 | |
161 | |
162 | |
163 /* normal actions */ | |
164 | |
165 static GtkActionEntry action_entries_playback[] = { | |
166 | |
167 { "playback", NULL, N_("Playback") }, | |
3023
49ce30748980
added lastfm GUI stub
Cristi Magherusan <majeru@atheme-project.org>
parents:
2598
diff
changeset
|
168 |
2313 | 169 { "playback play", GTK_STOCK_MEDIA_PLAY , N_("Play"), "X", |
170 N_("Play"), G_CALLBACK(action_playback_play) }, | |
171 | |
172 { "playback pause", GTK_STOCK_MEDIA_PAUSE , N_("Pause"), "C", | |
173 N_("Pause"), G_CALLBACK(action_playback_pause) }, | |
174 | |
175 { "playback stop", GTK_STOCK_MEDIA_STOP , N_("Stop"), "V", | |
176 N_("Stop"), G_CALLBACK(action_playback_stop) }, | |
177 | |
178 { "playback previous", GTK_STOCK_MEDIA_PREVIOUS , N_("Previous"), "Z", | |
179 N_("Previous"), G_CALLBACK(action_playback_previous) }, | |
180 | |
181 { "playback next", GTK_STOCK_MEDIA_NEXT , N_("Next"), "B", | |
182 N_("Next"), G_CALLBACK(action_playback_next) } | |
183 }; | |
184 | |
185 | |
186 static GtkActionEntry action_entries_visualization[] = { | |
187 { "visualization", NULL, N_("Visualization") }, | |
188 { "vismode", NULL, N_("Visualization Mode") }, | |
189 { "anamode", NULL, N_("Analyzer Mode") }, | |
190 { "scomode", NULL, N_("Scope Mode") }, | |
191 { "vprmode", NULL, N_("Voiceprint Mode") }, | |
192 { "wshmode", NULL, N_("WindowShade VU Mode") }, | |
193 { "refrate", NULL, N_("Refresh Rate") }, | |
194 { "anafoff", NULL, N_("Analyzer Falloff") }, | |
195 { "peafoff", NULL, N_("Peaks Falloff") } | |
196 }; | |
197 | |
198 static GtkActionEntry action_entries_playlist[] = { | |
199 | |
200 { "playlist", NULL, N_("Playlist") }, | |
201 | |
202 { "playlist new", GTK_STOCK_NEW , N_("New Playlist"), "<Shift>N", | |
203 N_("New Playlist"), G_CALLBACK(action_playlist_new) }, | |
204 | |
205 { "playlist select next", GTK_STOCK_MEDIA_NEXT, N_("Select Next Playlist"), "<Shift>P", | |
206 N_("Select Next Playlist"), G_CALLBACK(action_playlist_next) }, | |
207 | |
208 { "playlist select previous", GTK_STOCK_MEDIA_PREVIOUS, N_("Select Previous Playlist"), "<Shift><Ctrl>P", | |
209 N_("Select Previous Playlist"), G_CALLBACK(action_playlist_prev) }, | |
210 | |
211 { "playlist delete", GTK_STOCK_DELETE , N_("Delete Playlist"), "<Shift>D", | |
212 N_("Delete Playlist"), G_CALLBACK(action_playlist_delete) }, | |
213 | |
214 { "playlist load", GTK_STOCK_OPEN, N_("Load List"), "O", | |
215 N_("Loads a playlist file into the selected playlist."), G_CALLBACK(action_playlist_load_list) }, | |
216 | |
217 { "playlist save", GTK_STOCK_SAVE, N_("Save List"), "<Shift>S", | |
218 N_("Saves the selected playlist."), G_CALLBACK(action_playlist_save_list) }, | |
219 | |
220 { "playlist save default", GTK_STOCK_SAVE, N_("Save Default List"), "<Alt>S", | |
221 N_("Saves the selected playlist to the default location."), | |
222 G_CALLBACK(action_playlist_save_default_list) }, | |
223 | |
224 { "playlist refresh", GTK_STOCK_REFRESH, N_("Refresh List"), "F5", | |
225 N_("Refreshes metadata associated with a playlist entry."), | |
226 G_CALLBACK(action_playlist_refresh_list) }, | |
227 | |
228 { "playlist manager", AUD_STOCK_PLAYLIST , N_("List Manager"), "P", | |
229 N_("Opens the playlist manager."), | |
230 G_CALLBACK(action_open_list_manager) } | |
231 }; | |
232 | |
233 static GtkActionEntry action_entries_view[] = { | |
234 | |
235 { "view", NULL, N_("View") } | |
236 }; | |
237 | |
238 static GtkActionEntry action_entries_playlist_add[] = { | |
239 { "playlist add cd", GTK_STOCK_CDROM, N_("Add CD..."), "<Shift>C", | |
240 N_("Adds a CD to the playlist."), | |
241 G_CALLBACK(action_playlist_add_cd) }, | |
242 | |
243 { "playlist add url", GTK_STOCK_NETWORK, N_("Add Internet Address..."), "<Ctrl>H", | |
244 N_("Adds a remote track to the playlist."), | |
245 G_CALLBACK(action_playlist_add_url) }, | |
246 | |
247 { "playlist add files", GTK_STOCK_ADD, N_("Add Files..."), "F", | |
248 N_("Adds files to the playlist."), | |
249 G_CALLBACK(action_playlist_add_files) }, | |
250 }; | |
251 | |
252 static GtkActionEntry action_entries_playlist_select[] = { | |
253 { "playlist search and select", GTK_STOCK_FIND, N_("Search and Select"), "<Ctrl>F", | |
254 N_("Searches the playlist and selects playlist entries based on specific criteria."), | |
255 G_CALLBACK(action_playlist_search_and_select) }, | |
256 | |
257 { "playlist invert selection", AUD_STOCK_SELECTINVERT , N_("Invert Selection"), NULL, | |
258 N_("Inverts the selected and unselected entries."), | |
259 G_CALLBACK(action_playlist_invert_selection) }, | |
260 | |
261 { "playlist select all", AUD_STOCK_SELECTALL , N_("Select All"), "<Ctrl>A", | |
262 N_("Selects all of the playlist entries."), | |
263 G_CALLBACK(action_playlist_select_all) }, | |
264 | |
265 { "playlist select none", AUD_STOCK_SELECTNONE , N_("Select None"), "<Shift><Ctrl>A", | |
266 N_("Deselects all of the playlist entries."), | |
267 G_CALLBACK(action_playlist_select_none) }, | |
268 }; | |
269 | |
270 static GtkActionEntry action_entries_playlist_delete[] = { | |
271 { "playlist clear queue", GTK_STOCK_REMOVE, N_("Clear Queue"), "<Shift>Q", | |
272 N_("Clears the queue associated with this playlist."), | |
273 G_CALLBACK(action_playlist_clear_queue) }, | |
274 | |
275 { "playlist remove unavailable", AUD_STOCK_REMOVEUNAVAIL , N_("Remove Unavailable Files"), NULL, | |
276 N_("Removes unavailable files from the playlist."), | |
277 G_CALLBACK(action_playlist_remove_unavailable) }, | |
278 | |
279 { "playlist remove dups menu", AUD_STOCK_REMOVEDUPS , N_("Remove Duplicates") }, | |
280 | |
281 { "playlist remove dups by title", AUD_STOCK_REMOVEDUPS , N_("By Title"), NULL, | |
282 N_("Removes duplicate entries from the playlist by title."), | |
283 G_CALLBACK(action_playlist_remove_dupes_by_title) }, | |
284 | |
285 { "playlist remove dups by filename", AUD_STOCK_REMOVEDUPS , N_("By Filename"), NULL, | |
286 N_("Removes duplicate entries from the playlist by filename."), | |
287 G_CALLBACK(action_playlist_remove_dupes_by_filename) }, | |
288 | |
289 { "playlist remove dups by full path", AUD_STOCK_REMOVEDUPS , N_("By Path + Filename"), NULL, | |
290 N_("Removes duplicate entries from the playlist by their full path."), | |
291 G_CALLBACK(action_playlist_remove_dupes_by_full_path) }, | |
292 | |
293 { "playlist remove all", GTK_STOCK_CLEAR, N_("Remove All"), NULL, | |
294 N_("Removes all entries from the playlist."), | |
295 G_CALLBACK(action_playlist_remove_all) }, | |
296 | |
297 { "playlist remove unselected", GTK_STOCK_REMOVE, N_("Remove Unselected"), NULL, | |
298 N_("Remove unselected entries from the playlist."), | |
299 G_CALLBACK(action_playlist_remove_unselected) }, | |
300 | |
301 { "playlist remove selected", GTK_STOCK_REMOVE, N_("Remove Selected"), "Delete", | |
302 N_("Remove selected entries from the playlist."), | |
303 G_CALLBACK(action_playlist_remove_selected) }, | |
304 }; | |
305 | |
306 static GtkActionEntry action_entries_playlist_sort[] = { | |
307 { "playlist randomize list", AUD_STOCK_RANDOMIZEPL , N_("Randomize List"), "<Ctrl><Shift>R", | |
308 N_("Randomizes the playlist."), | |
309 G_CALLBACK(action_playlist_randomize_list) }, | |
310 | |
311 { "playlist reverse list", AUD_STOCK_INVERTPL , N_("Reverse List"), NULL, | |
312 N_("Reverses the playlist."), | |
313 G_CALLBACK(action_playlist_reverse_list) }, | |
314 | |
315 { "playlist sort menu", AUD_STOCK_SORTBYTITLE , N_("Sort List") }, | |
316 | |
317 { "playlist sort by title", AUD_STOCK_SORTBYTITLE , N_("By Title"), NULL, | |
318 N_("Sorts the list by title."), | |
319 G_CALLBACK(action_playlist_sort_by_title) }, | |
320 | |
321 { "playlist sort by artist", AUD_STOCK_SORTBYARTIST , N_("By Artist"), NULL, | |
322 N_("Sorts the list by artist."), | |
323 G_CALLBACK(action_playlist_sort_by_artist) }, | |
324 | |
325 { "playlist sort by filename", AUD_STOCK_SORTBYFILENAME , N_("By Filename"), NULL, | |
326 N_("Sorts the list by filename."), | |
327 G_CALLBACK(action_playlist_sort_by_filename) }, | |
328 | |
329 { "playlist sort by full path", AUD_STOCK_SORTBYPATHFILE , N_("By Path + Filename"), NULL, | |
330 N_("Sorts the list by full pathname."), | |
331 G_CALLBACK(action_playlist_sort_by_full_path) }, | |
332 | |
333 { "playlist sort by date", AUD_STOCK_SORTBYARTIST , N_("By Date"), NULL, | |
334 N_("Sorts the list by modification time."), | |
335 G_CALLBACK(action_playlist_sort_by_date) }, | |
336 | |
337 { "playlist sort by track number", AUD_STOCK_SORTBYFILENAME , N_("By Track Number"), NULL, | |
338 N_("Sorts the list by track number."), | |
339 G_CALLBACK(action_playlist_sort_by_track_number) }, | |
340 | |
341 { "playlist sort by playlist entry", AUD_STOCK_SORTBYPATHFILE , N_("By Playlist Entry"), NULL, | |
342 N_("Sorts the list by playlist entry."), | |
343 G_CALLBACK(action_playlist_sort_by_playlist_entry) }, | |
344 | |
345 { "playlist sort selected menu", AUD_STOCK_SORTBYTITLE , N_("Sort Selected") }, | |
346 | |
347 { "playlist sort selected by title", AUD_STOCK_SORTBYTITLE , N_("By Title"), NULL, | |
348 N_("Sorts the list by title."), | |
349 G_CALLBACK(action_playlist_sort_selected_by_title) }, | |
350 | |
351 { "playlist sort selected by artist", AUD_STOCK_SORTBYARTIST, N_("By Artist"), NULL, | |
352 N_("Sorts the list by artist."), | |
353 G_CALLBACK(action_playlist_sort_selected_by_artist) }, | |
354 | |
355 { "playlist sort selected by filename", AUD_STOCK_SORTBYFILENAME , N_("By Filename"), NULL, | |
356 N_("Sorts the list by filename."), | |
357 G_CALLBACK(action_playlist_sort_selected_by_filename) }, | |
358 | |
359 { "playlist sort selected by full path", AUD_STOCK_SORTBYPATHFILE , N_("By Path + Filename"), NULL, | |
360 N_("Sorts the list by full pathname."), | |
361 G_CALLBACK(action_playlist_sort_selected_by_full_path) }, | |
362 | |
363 { "playlist sort selected by date", AUD_STOCK_SORTBYARTIST , N_("By Date"), NULL, | |
364 N_("Sorts the list by modification time."), | |
365 G_CALLBACK(action_playlist_sort_selected_by_date) }, | |
366 | |
367 { "playlist sort selected by track number", AUD_STOCK_SORTBYFILENAME , N_("By Track Number"), NULL, | |
368 N_("Sorts the list by track number."), | |
369 G_CALLBACK(action_playlist_sort_selected_by_track_number) }, | |
370 | |
371 { "playlist sort selected by playlist entry", AUD_STOCK_SORTBYPATHFILE, N_("By Playlist Entry"), NULL, | |
372 N_("Sorts the list by playlist entry."), | |
373 G_CALLBACK(action_playlist_sort_selected_by_playlist_entry) }, | |
374 }; | |
375 | |
376 static GtkActionEntry action_entries_others[] = { | |
377 | |
378 { "dummy", NULL, "dummy" }, | |
379 | |
380 { "current track info", AUD_STOCK_INFO , N_("View Track Details"), "I", | |
381 N_("View track details"), G_CALLBACK(action_current_track_info) }, | |
382 | |
383 { "playlist track info", AUD_STOCK_INFO , N_("View Track Details"), "<Alt>I", | |
384 N_("View track details"), G_CALLBACK(action_playlist_track_info) }, | |
385 | |
386 { "about audacious", GTK_STOCK_DIALOG_INFO , N_("About Audacious"), NULL, | |
387 N_("About Audacious"), G_CALLBACK(action_about_audacious) }, | |
388 | |
389 { "play file", GTK_STOCK_OPEN , N_("Play File"), "L", | |
390 N_("Load and play a file"), G_CALLBACK(action_play_file) }, | |
391 | |
392 { "play location", GTK_STOCK_NETWORK , N_("Play Location"), "<Ctrl>L", | |
393 N_("Play media from the selected location"), G_CALLBACK(action_play_location) }, | |
394 | |
3023
49ce30748980
added lastfm GUI stub
Cristi Magherusan <majeru@atheme-project.org>
parents:
2598
diff
changeset
|
395 { "playback play cd", GTK_STOCK_CDROM , N_("Play CD"), "<Alt>C", |
49ce30748980
added lastfm GUI stub
Cristi Magherusan <majeru@atheme-project.org>
parents:
2598
diff
changeset
|
396 N_("Play CD"), G_CALLBACK(action_playback_playcd) }, |
49ce30748980
added lastfm GUI stub
Cristi Magherusan <majeru@atheme-project.org>
parents:
2598
diff
changeset
|
397 |
49ce30748980
added lastfm GUI stub
Cristi Magherusan <majeru@atheme-project.org>
parents:
2598
diff
changeset
|
398 { "lastfm", NULL, N_("Last.fm radio"), "<Alt>L", |
49ce30748980
added lastfm GUI stub
Cristi Magherusan <majeru@atheme-project.org>
parents:
2598
diff
changeset
|
399 N_("Play Last.fm radio"), G_CALLBACK(action_lastfm) }, |
49ce30748980
added lastfm GUI stub
Cristi Magherusan <majeru@atheme-project.org>
parents:
2598
diff
changeset
|
400 |
2313 | 401 { "preferences", GTK_STOCK_PREFERENCES , N_("Preferences"), "<Ctrl>P", |
402 N_("Open preferences window"), G_CALLBACK(action_preferences) }, | |
403 | |
404 { "quit", GTK_STOCK_QUIT , N_("_Quit"), NULL, | |
405 N_("Quit Audacious"), G_CALLBACK(action_quit) }, | |
406 | |
407 { "ab set", NULL , N_("Set A-B"), "A", | |
408 N_("Set A-B"), G_CALLBACK(action_ab_set) }, | |
409 | |
2598 | 410 { "ab clear", NULL , N_("Clear A-B"), "<Shift>A", |
2313 | 411 N_("Clear A-B"), G_CALLBACK(action_ab_clear) }, |
412 | |
413 { "jump to playlist start", GTK_STOCK_GOTO_TOP , N_("Jump to Playlist Start"), "<Ctrl>Z", | |
414 N_("Jump to Playlist Start"), G_CALLBACK(action_jump_to_playlist_start) }, | |
415 | |
416 { "jump to file", GTK_STOCK_JUMP_TO , N_("Jump to File"), "J", | |
417 N_("Jump to File"), G_CALLBACK(action_jump_to_file) }, | |
418 | |
419 { "jump to time", GTK_STOCK_JUMP_TO , N_("Jump to Time"), "<Ctrl>J", | |
420 N_("Jump to Time"), G_CALLBACK(action_jump_to_time) }, | |
421 | |
422 { "queue toggle", AUD_STOCK_QUEUETOGGLE , N_("Queue Toggle"), "Q", | |
423 N_("Enables/disables the entry in the playlist's queue."), | |
424 G_CALLBACK(action_queue_toggle) }, | |
425 }; | |
426 | |
427 | |
428 static GtkActionEntry action_entries_equalizer[] = { | |
429 | |
430 { "equ preset load menu", NULL, N_("Load") }, | |
431 { "equ preset import menu", NULL, N_("Import") }, | |
432 { "equ preset save menu", NULL, N_("Save") }, | |
433 { "equ preset delete menu", NULL, N_("Delete") }, | |
434 | |
435 { "equ load preset", NULL, N_("Preset"), NULL, | |
436 N_("Load preset"), G_CALLBACK(action_equ_load_preset) }, | |
437 | |
438 { "equ load auto preset", NULL, N_("Auto-load preset"), NULL, | |
439 N_("Load auto-load preset"), G_CALLBACK(action_equ_load_auto_preset) }, | |
440 | |
441 { "equ load default preset", NULL, N_("Default"), NULL, | |
442 N_("Load default preset into equalizer"), G_CALLBACK(action_equ_load_default_preset) }, | |
443 | |
444 { "equ zero preset", NULL, N_("Zero"), NULL, | |
445 N_("Set equalizer preset levels to zero"), G_CALLBACK(action_equ_zero_preset) }, | |
446 | |
447 { "equ load preset file", NULL, N_("From file"), NULL, | |
448 N_("Load preset from file"), G_CALLBACK(action_equ_load_preset_file) }, | |
449 | |
450 { "equ load preset eqf", NULL, N_("From WinAMP EQF file"), NULL, | |
451 N_("Load preset from WinAMP EQF file"), G_CALLBACK(action_equ_load_preset_eqf) }, | |
452 | |
453 { "equ import winamp presets", NULL, N_("WinAMP Presets"), NULL, | |
454 N_("Import WinAMP presets"), G_CALLBACK(action_equ_import_winamp_presets) }, | |
455 | |
456 { "equ save preset", NULL, N_("Preset"), NULL, | |
457 N_("Save preset"), G_CALLBACK(action_equ_save_preset) }, | |
458 | |
459 { "equ save auto preset", NULL, N_("Auto-load preset"), NULL, | |
460 N_("Save auto-load preset"), G_CALLBACK(action_equ_save_auto_preset) }, | |
461 | |
462 { "equ save default preset", NULL, N_("Default"), NULL, | |
463 N_("Save default preset"), G_CALLBACK(action_equ_save_default_preset) }, | |
464 | |
465 { "equ save preset file", NULL, N_("To file"), NULL, | |
466 N_("Save preset to file"), G_CALLBACK(action_equ_save_preset_file) }, | |
467 | |
468 { "equ save preset eqf", NULL, N_("To WinAMP EQF file"), NULL, | |
469 N_("Save preset to WinAMP EQF file"), G_CALLBACK(action_equ_save_preset_eqf) }, | |
470 | |
471 { "equ delete preset", NULL, N_("Preset"), NULL, | |
472 N_("Delete preset"), G_CALLBACK(action_equ_delete_preset) }, | |
473 | |
474 { "equ delete auto preset", NULL, N_("Auto-load preset"), NULL, | |
475 N_("Delete auto-load preset"), G_CALLBACK(action_equ_delete_auto_preset) } | |
476 }; | |
477 | |
478 | |
479 | |
480 /* ***************************** */ | |
481 | |
482 | |
483 static GtkActionGroup * | |
484 ui_manager_new_action_group( const gchar * group_name ) | |
485 { | |
486 GtkActionGroup *group = gtk_action_group_new( group_name ); | |
487 gtk_action_group_set_translation_domain( group , PACKAGE_NAME ); | |
488 return group; | |
489 } | |
490 | |
491 void | |
492 ui_manager_init ( void ) | |
493 { | |
494 /* toggle actions */ | |
495 toggleaction_group_others = ui_manager_new_action_group("toggleaction_others"); | |
496 gtk_action_group_add_toggle_actions( | |
497 toggleaction_group_others , toggleaction_entries_others , | |
498 G_N_ELEMENTS(toggleaction_entries_others) , NULL ); | |
499 | |
500 /* radio actions */ | |
501 radioaction_group_anamode = ui_manager_new_action_group("radioaction_anamode"); | |
502 gtk_action_group_add_radio_actions( | |
503 radioaction_group_anamode , radioaction_entries_anamode , | |
504 G_N_ELEMENTS(radioaction_entries_anamode) , 0 , G_CALLBACK(action_anamode) , NULL ); | |
505 | |
506 radioaction_group_anatype = ui_manager_new_action_group("radioaction_anatype"); | |
507 gtk_action_group_add_radio_actions( | |
508 radioaction_group_anatype , radioaction_entries_anatype , | |
509 G_N_ELEMENTS(radioaction_entries_anatype) , 0 , G_CALLBACK(action_anatype) , NULL ); | |
510 | |
511 radioaction_group_scomode = ui_manager_new_action_group("radioaction_scomode"); | |
512 gtk_action_group_add_radio_actions( | |
513 radioaction_group_scomode , radioaction_entries_scomode , | |
514 G_N_ELEMENTS(radioaction_entries_scomode) , 0 , G_CALLBACK(action_scomode) , NULL ); | |
515 | |
516 radioaction_group_vprmode = ui_manager_new_action_group("radioaction_vprmode"); | |
517 gtk_action_group_add_radio_actions( | |
518 radioaction_group_vprmode , radioaction_entries_vprmode , | |
519 G_N_ELEMENTS(radioaction_entries_vprmode) , 0 , G_CALLBACK(action_vprmode) , NULL ); | |
520 | |
521 radioaction_group_wshmode = ui_manager_new_action_group("radioaction_wshmode"); | |
522 gtk_action_group_add_radio_actions( | |
523 radioaction_group_wshmode , radioaction_entries_wshmode , | |
524 G_N_ELEMENTS(radioaction_entries_wshmode) , 0 , G_CALLBACK(action_wshmode) , NULL ); | |
525 | |
526 radioaction_group_refrate = ui_manager_new_action_group("radioaction_refrate"); | |
527 gtk_action_group_add_radio_actions( | |
528 radioaction_group_refrate , radioaction_entries_refrate , | |
529 G_N_ELEMENTS(radioaction_entries_refrate) , 0 , G_CALLBACK(action_refrate) , NULL ); | |
530 | |
531 radioaction_group_anafoff = ui_manager_new_action_group("radioaction_anafoff"); | |
532 gtk_action_group_add_radio_actions( | |
533 radioaction_group_anafoff , radioaction_entries_anafoff , | |
534 G_N_ELEMENTS(radioaction_entries_anafoff) , 0 , G_CALLBACK(action_anafoff) , NULL ); | |
535 | |
536 radioaction_group_peafoff = ui_manager_new_action_group("radioaction_peafoff"); | |
537 gtk_action_group_add_radio_actions( | |
538 radioaction_group_peafoff , radioaction_entries_peafoff , | |
539 G_N_ELEMENTS(radioaction_entries_peafoff) , 0 , G_CALLBACK(action_peafoff) , NULL ); | |
540 | |
541 radioaction_group_vismode = ui_manager_new_action_group("radioaction_vismode"); | |
542 gtk_action_group_add_radio_actions( | |
543 radioaction_group_vismode , radioaction_entries_vismode , | |
544 G_N_ELEMENTS(radioaction_entries_vismode) , 0 , G_CALLBACK(action_vismode) , NULL ); | |
545 | |
546 radioaction_group_viewtime = ui_manager_new_action_group("radioaction_viewtime"); | |
547 gtk_action_group_add_radio_actions( | |
548 radioaction_group_viewtime , radioaction_entries_viewtime , | |
549 G_N_ELEMENTS(radioaction_entries_viewtime) , 0 , G_CALLBACK(action_viewtime) , NULL ); | |
550 | |
551 /* normal actions */ | |
552 action_group_playback = ui_manager_new_action_group("action_playback"); | |
553 gtk_action_group_add_actions( | |
554 action_group_playback , action_entries_playback , | |
555 G_N_ELEMENTS(action_entries_playback) , NULL ); | |
556 | |
557 action_group_playlist = ui_manager_new_action_group("action_playlist"); | |
558 gtk_action_group_add_actions( | |
559 action_group_playlist , action_entries_playlist , | |
560 G_N_ELEMENTS(action_entries_playlist) , NULL ); | |
561 | |
562 action_group_visualization = ui_manager_new_action_group("action_visualization"); | |
563 gtk_action_group_add_actions( | |
564 action_group_visualization , action_entries_visualization , | |
565 G_N_ELEMENTS(action_entries_visualization) , NULL ); | |
566 | |
567 action_group_view = ui_manager_new_action_group("action_view"); | |
568 gtk_action_group_add_actions( | |
569 action_group_view , action_entries_view , | |
570 G_N_ELEMENTS(action_entries_view) , NULL ); | |
571 | |
572 action_group_others = ui_manager_new_action_group("action_others"); | |
573 gtk_action_group_add_actions( | |
574 action_group_others , action_entries_others , | |
575 G_N_ELEMENTS(action_entries_others) , NULL ); | |
576 | |
577 action_group_playlist_add = ui_manager_new_action_group("action_playlist_add"); | |
578 gtk_action_group_add_actions( | |
579 action_group_playlist_add, action_entries_playlist_add, | |
580 G_N_ELEMENTS(action_entries_playlist_add), NULL ); | |
581 | |
582 action_group_playlist_select = ui_manager_new_action_group("action_playlist_select"); | |
583 gtk_action_group_add_actions( | |
584 action_group_playlist_select, action_entries_playlist_select, | |
585 G_N_ELEMENTS(action_entries_playlist_select), NULL ); | |
586 | |
587 action_group_playlist_delete = ui_manager_new_action_group("action_playlist_delete"); | |
588 gtk_action_group_add_actions( | |
589 action_group_playlist_delete, action_entries_playlist_delete, | |
590 G_N_ELEMENTS(action_entries_playlist_delete), NULL ); | |
591 | |
592 action_group_playlist_sort = ui_manager_new_action_group("action_playlist_sort"); | |
593 gtk_action_group_add_actions( | |
594 action_group_playlist_sort, action_entries_playlist_sort, | |
595 G_N_ELEMENTS(action_entries_playlist_sort), NULL ); | |
596 | |
597 action_group_equalizer = ui_manager_new_action_group("action_equalizer"); | |
598 gtk_action_group_add_actions( | |
599 action_group_equalizer, action_entries_equalizer, | |
600 G_N_ELEMENTS(action_entries_equalizer), NULL); | |
601 | |
602 /* ui */ | |
603 ui_manager = gtk_ui_manager_new(); | |
604 gtk_ui_manager_insert_action_group( ui_manager , toggleaction_group_others , 0 ); | |
605 gtk_ui_manager_insert_action_group( ui_manager , radioaction_group_anamode , 0 ); | |
606 gtk_ui_manager_insert_action_group( ui_manager , radioaction_group_anatype , 0 ); | |
607 gtk_ui_manager_insert_action_group( ui_manager , radioaction_group_scomode , 0 ); | |
608 gtk_ui_manager_insert_action_group( ui_manager , radioaction_group_vprmode , 0 ); | |
609 gtk_ui_manager_insert_action_group( ui_manager , radioaction_group_wshmode , 0 ); | |
610 gtk_ui_manager_insert_action_group( ui_manager , radioaction_group_refrate , 0 ); | |
611 gtk_ui_manager_insert_action_group( ui_manager , radioaction_group_anafoff , 0 ); | |
612 gtk_ui_manager_insert_action_group( ui_manager , radioaction_group_peafoff , 0 ); | |
613 gtk_ui_manager_insert_action_group( ui_manager , radioaction_group_vismode , 0 ); | |
614 gtk_ui_manager_insert_action_group( ui_manager , radioaction_group_viewtime , 0 ); | |
615 gtk_ui_manager_insert_action_group( ui_manager , action_group_playback , 0 ); | |
616 gtk_ui_manager_insert_action_group( ui_manager , action_group_playlist , 0 ); | |
617 gtk_ui_manager_insert_action_group( ui_manager , action_group_visualization , 0 ); | |
618 gtk_ui_manager_insert_action_group( ui_manager , action_group_view , 0 ); | |
619 gtk_ui_manager_insert_action_group( ui_manager , action_group_others , 0 ); | |
620 gtk_ui_manager_insert_action_group( ui_manager , action_group_playlist_add , 0 ); | |
621 gtk_ui_manager_insert_action_group( ui_manager , action_group_playlist_select , 0 ); | |
622 gtk_ui_manager_insert_action_group( ui_manager , action_group_playlist_delete , 0 ); | |
623 gtk_ui_manager_insert_action_group( ui_manager , action_group_playlist_sort , 0 ); | |
624 gtk_ui_manager_insert_action_group( ui_manager , action_group_equalizer , 0 ); | |
625 | |
626 return; | |
627 } | |
628 | |
629 | |
630 void | |
631 ui_manager_create_menus ( void ) | |
632 { | |
633 GError *gerr = NULL; | |
634 | |
635 /* attach xml menu definitions */ | |
636 gtk_ui_manager_add_ui_from_file( ui_manager , DATA_DIR "/ui/mainwin.ui" , &gerr ); | |
637 | |
638 if ( gerr != NULL ) | |
639 { | |
640 g_critical( "Error creating UI<ui/mainwin.ui>: %s" , gerr->message ); | |
641 g_error_free( gerr ); | |
642 return; | |
643 } | |
644 | |
645 /* create GtkMenu widgets using path from xml definitions */ | |
646 mainwin_songname_menu = ui_manager_get_popup_menu( ui_manager , "/mainwin-menus/songname-menu" ); | |
647 mainwin_visualization_menu = ui_manager_get_popup_menu( ui_manager , "/mainwin-menus/main-menu/visualization" ); | |
648 mainwin_playback_menu = ui_manager_get_popup_menu( ui_manager , "/mainwin-menus/main-menu/playback" ); | |
649 mainwin_playlist_menu = ui_manager_get_popup_menu( ui_manager , "/mainwin-menus/main-menu/playlist" ); | |
650 mainwin_view_menu = ui_manager_get_popup_menu( ui_manager , "/mainwin-menus/main-menu/view" ); | |
651 mainwin_general_menu = ui_manager_get_popup_menu( ui_manager , "/mainwin-menus/main-menu" ); | |
652 | |
653 gtk_ui_manager_add_ui_from_file( ui_manager , DATA_DIR "/ui/playlist.ui" , &gerr ); | |
654 | |
655 if ( gerr != NULL ) | |
656 { | |
657 g_critical( "Error creating UI<ui/playlist.ui>: %s" , gerr->message ); | |
658 g_error_free( gerr ); | |
659 return; | |
660 } | |
661 | |
662 playlistwin_popup_menu = ui_manager_get_popup_menu(ui_manager, "/playlist-menus/playlist-rightclick-menu"); | |
663 | |
664 playlistwin_pladd_menu = ui_manager_get_popup_menu(ui_manager, "/playlist-menus/add-menu"); | |
665 playlistwin_pldel_menu = ui_manager_get_popup_menu(ui_manager, "/playlist-menus/del-menu"); | |
666 playlistwin_plsel_menu = ui_manager_get_popup_menu(ui_manager, "/playlist-menus/select-menu"); | |
667 playlistwin_plsort_menu = ui_manager_get_popup_menu(ui_manager, "/playlist-menus/misc-menu"); | |
668 playlistwin_pllist_menu = ui_manager_get_popup_menu(ui_manager, "/playlist-menus/playlist-menu"); | |
669 | |
670 gtk_ui_manager_add_ui_from_file( ui_manager , DATA_DIR "/ui/equalizer.ui" , &gerr ); | |
671 | |
672 if ( gerr != NULL ) | |
673 { | |
674 g_critical( "Error creating UI<ui/equalizer.ui>: %s" , gerr->message ); | |
675 g_error_free( gerr ); | |
676 return; | |
677 } | |
678 | |
679 equalizerwin_presets_menu = ui_manager_get_popup_menu(ui_manager, "/equalizer-menus/preset-menu"); | |
680 | |
681 return; | |
682 } | |
683 | |
684 | |
685 GtkAccelGroup * | |
686 ui_manager_get_accel_group ( void ) | |
687 { | |
688 return gtk_ui_manager_get_accel_group( ui_manager ); | |
689 } | |
690 | |
691 | |
692 GtkWidget * | |
693 ui_manager_get_popup_menu ( GtkUIManager * self , const gchar * path ) | |
694 { | |
695 GtkWidget *menu_item = gtk_ui_manager_get_widget( self , path ); | |
696 | |
697 if (GTK_IS_MENU_ITEM(menu_item)) | |
698 return gtk_menu_item_get_submenu(GTK_MENU_ITEM(menu_item)); | |
699 else | |
700 return NULL; | |
701 } | |
702 | |
703 | |
704 static void | |
705 menu_popup_pos_func (GtkMenu * menu , gint * x , gint * y , gboolean * push_in , gint * point ) | |
706 { | |
707 GtkRequisition requisition; | |
708 gint screen_width; | |
709 gint screen_height; | |
710 | |
711 gtk_widget_size_request(GTK_WIDGET(menu), &requisition); | |
712 | |
713 screen_width = gdk_screen_width(); | |
714 screen_height = gdk_screen_height(); | |
715 | |
716 *x = CLAMP(point[0] - 2, 0, MAX(0, screen_width - requisition.width)); | |
717 *y = CLAMP(point[1] - 2, 0, MAX(0, screen_height - requisition.height)); | |
718 | |
719 *push_in = FALSE; | |
720 } | |
721 | |
722 | |
723 void | |
724 ui_manager_popup_menu_show ( GtkMenu * menu , gint x , gint y , guint button , guint time ) | |
725 { | |
726 gint pos[2]; | |
727 pos[0] = x; | |
728 pos[1] = y; | |
729 | |
730 gtk_menu_popup( menu , NULL , NULL , | |
731 (GtkMenuPositionFunc) menu_popup_pos_func , pos , button , time ); | |
732 } |