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