Mercurial > audlegacy
annotate src/audacious/ui_manager.c @ 3351:7a4fcf84a34f trunk
Removed the hardcoded Add/Play CD menu entry
author | Calin Crisan ccrisan@gmail.com |
---|---|
date | Mon, 13 Aug 2007 23:24:50 +0300 |
parents | a6a76ab7ce0a |
children | 676bfd7b6586 |
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 url", GTK_STOCK_NETWORK, N_("Add Internet Address..."), "<Ctrl>H", | |
242 N_("Adds a remote track to the playlist."), | |
243 G_CALLBACK(action_playlist_add_url) }, | |
244 | |
245 { "playlist add files", GTK_STOCK_ADD, N_("Add Files..."), "F", | |
246 N_("Adds files to the playlist."), | |
247 G_CALLBACK(action_playlist_add_files) }, | |
248 }; | |
249 | |
250 static GtkActionEntry action_entries_playlist_select[] = { | |
251 { "playlist search and select", GTK_STOCK_FIND, N_("Search and Select"), "<Ctrl>F", | |
252 N_("Searches the playlist and selects playlist entries based on specific criteria."), | |
253 G_CALLBACK(action_playlist_search_and_select) }, | |
254 | |
255 { "playlist invert selection", AUD_STOCK_SELECTINVERT , N_("Invert Selection"), NULL, | |
256 N_("Inverts the selected and unselected entries."), | |
257 G_CALLBACK(action_playlist_invert_selection) }, | |
258 | |
259 { "playlist select all", AUD_STOCK_SELECTALL , N_("Select All"), "<Ctrl>A", | |
260 N_("Selects all of the playlist entries."), | |
261 G_CALLBACK(action_playlist_select_all) }, | |
262 | |
263 { "playlist select none", AUD_STOCK_SELECTNONE , N_("Select None"), "<Shift><Ctrl>A", | |
264 N_("Deselects all of the playlist entries."), | |
265 G_CALLBACK(action_playlist_select_none) }, | |
266 }; | |
267 | |
268 static GtkActionEntry action_entries_playlist_delete[] = { | |
269 { "playlist clear queue", GTK_STOCK_REMOVE, N_("Clear Queue"), "<Shift>Q", | |
270 N_("Clears the queue associated with this playlist."), | |
271 G_CALLBACK(action_playlist_clear_queue) }, | |
272 | |
273 { "playlist remove unavailable", AUD_STOCK_REMOVEUNAVAIL , N_("Remove Unavailable Files"), NULL, | |
274 N_("Removes unavailable files from the playlist."), | |
275 G_CALLBACK(action_playlist_remove_unavailable) }, | |
276 | |
277 { "playlist remove dups menu", AUD_STOCK_REMOVEDUPS , N_("Remove Duplicates") }, | |
278 | |
279 { "playlist remove dups by title", AUD_STOCK_REMOVEDUPS , N_("By Title"), NULL, | |
280 N_("Removes duplicate entries from the playlist by title."), | |
281 G_CALLBACK(action_playlist_remove_dupes_by_title) }, | |
282 | |
283 { "playlist remove dups by filename", AUD_STOCK_REMOVEDUPS , N_("By Filename"), NULL, | |
284 N_("Removes duplicate entries from the playlist by filename."), | |
285 G_CALLBACK(action_playlist_remove_dupes_by_filename) }, | |
286 | |
287 { "playlist remove dups by full path", AUD_STOCK_REMOVEDUPS , N_("By Path + Filename"), NULL, | |
288 N_("Removes duplicate entries from the playlist by their full path."), | |
289 G_CALLBACK(action_playlist_remove_dupes_by_full_path) }, | |
290 | |
291 { "playlist remove all", GTK_STOCK_CLEAR, N_("Remove All"), NULL, | |
292 N_("Removes all entries from the playlist."), | |
293 G_CALLBACK(action_playlist_remove_all) }, | |
294 | |
295 { "playlist remove unselected", GTK_STOCK_REMOVE, N_("Remove Unselected"), NULL, | |
296 N_("Remove unselected entries from the playlist."), | |
297 G_CALLBACK(action_playlist_remove_unselected) }, | |
298 | |
299 { "playlist remove selected", GTK_STOCK_REMOVE, N_("Remove Selected"), "Delete", | |
300 N_("Remove selected entries from the playlist."), | |
301 G_CALLBACK(action_playlist_remove_selected) }, | |
302 }; | |
303 | |
304 static GtkActionEntry action_entries_playlist_sort[] = { | |
305 { "playlist randomize list", AUD_STOCK_RANDOMIZEPL , N_("Randomize List"), "<Ctrl><Shift>R", | |
306 N_("Randomizes the playlist."), | |
307 G_CALLBACK(action_playlist_randomize_list) }, | |
308 | |
309 { "playlist reverse list", AUD_STOCK_INVERTPL , N_("Reverse List"), NULL, | |
310 N_("Reverses the playlist."), | |
311 G_CALLBACK(action_playlist_reverse_list) }, | |
312 | |
313 { "playlist sort menu", AUD_STOCK_SORTBYTITLE , N_("Sort List") }, | |
314 | |
315 { "playlist sort by title", AUD_STOCK_SORTBYTITLE , N_("By Title"), NULL, | |
316 N_("Sorts the list by title."), | |
317 G_CALLBACK(action_playlist_sort_by_title) }, | |
318 | |
319 { "playlist sort by artist", AUD_STOCK_SORTBYARTIST , N_("By Artist"), NULL, | |
320 N_("Sorts the list by artist."), | |
321 G_CALLBACK(action_playlist_sort_by_artist) }, | |
322 | |
323 { "playlist sort by filename", AUD_STOCK_SORTBYFILENAME , N_("By Filename"), NULL, | |
324 N_("Sorts the list by filename."), | |
325 G_CALLBACK(action_playlist_sort_by_filename) }, | |
326 | |
327 { "playlist sort by full path", AUD_STOCK_SORTBYPATHFILE , N_("By Path + Filename"), NULL, | |
328 N_("Sorts the list by full pathname."), | |
329 G_CALLBACK(action_playlist_sort_by_full_path) }, | |
330 | |
331 { "playlist sort by date", AUD_STOCK_SORTBYARTIST , N_("By Date"), NULL, | |
332 N_("Sorts the list by modification time."), | |
333 G_CALLBACK(action_playlist_sort_by_date) }, | |
334 | |
335 { "playlist sort by track number", AUD_STOCK_SORTBYFILENAME , N_("By Track Number"), NULL, | |
336 N_("Sorts the list by track number."), | |
337 G_CALLBACK(action_playlist_sort_by_track_number) }, | |
338 | |
339 { "playlist sort by playlist entry", AUD_STOCK_SORTBYPATHFILE , N_("By Playlist Entry"), NULL, | |
340 N_("Sorts the list by playlist entry."), | |
341 G_CALLBACK(action_playlist_sort_by_playlist_entry) }, | |
342 | |
343 { "playlist sort selected menu", AUD_STOCK_SORTBYTITLE , N_("Sort Selected") }, | |
344 | |
345 { "playlist sort selected by title", AUD_STOCK_SORTBYTITLE , N_("By Title"), NULL, | |
346 N_("Sorts the list by title."), | |
347 G_CALLBACK(action_playlist_sort_selected_by_title) }, | |
348 | |
349 { "playlist sort selected by artist", AUD_STOCK_SORTBYARTIST, N_("By Artist"), NULL, | |
350 N_("Sorts the list by artist."), | |
351 G_CALLBACK(action_playlist_sort_selected_by_artist) }, | |
352 | |
353 { "playlist sort selected by filename", AUD_STOCK_SORTBYFILENAME , N_("By Filename"), NULL, | |
354 N_("Sorts the list by filename."), | |
355 G_CALLBACK(action_playlist_sort_selected_by_filename) }, | |
356 | |
357 { "playlist sort selected by full path", AUD_STOCK_SORTBYPATHFILE , N_("By Path + Filename"), NULL, | |
358 N_("Sorts the list by full pathname."), | |
359 G_CALLBACK(action_playlist_sort_selected_by_full_path) }, | |
360 | |
361 { "playlist sort selected by date", AUD_STOCK_SORTBYARTIST , N_("By Date"), NULL, | |
362 N_("Sorts the list by modification time."), | |
363 G_CALLBACK(action_playlist_sort_selected_by_date) }, | |
364 | |
365 { "playlist sort selected by track number", AUD_STOCK_SORTBYFILENAME , N_("By Track Number"), NULL, | |
366 N_("Sorts the list by track number."), | |
367 G_CALLBACK(action_playlist_sort_selected_by_track_number) }, | |
368 | |
369 { "playlist sort selected by playlist entry", AUD_STOCK_SORTBYPATHFILE, N_("By Playlist Entry"), NULL, | |
370 N_("Sorts the list by playlist entry."), | |
371 G_CALLBACK(action_playlist_sort_selected_by_playlist_entry) }, | |
372 }; | |
373 | |
374 static GtkActionEntry action_entries_others[] = { | |
375 | |
376 { "dummy", NULL, "dummy" }, | |
377 | |
378 { "current track info", AUD_STOCK_INFO , N_("View Track Details"), "I", | |
379 N_("View track details"), G_CALLBACK(action_current_track_info) }, | |
380 | |
381 { "playlist track info", AUD_STOCK_INFO , N_("View Track Details"), "<Alt>I", | |
382 N_("View track details"), G_CALLBACK(action_playlist_track_info) }, | |
383 | |
384 { "about audacious", GTK_STOCK_DIALOG_INFO , N_("About Audacious"), NULL, | |
385 N_("About Audacious"), G_CALLBACK(action_about_audacious) }, | |
386 | |
387 { "play file", GTK_STOCK_OPEN , N_("Play File"), "L", | |
388 N_("Load and play a file"), G_CALLBACK(action_play_file) }, | |
389 | |
390 { "play location", GTK_STOCK_NETWORK , N_("Play Location"), "<Ctrl>L", | |
391 N_("Play media from the selected location"), G_CALLBACK(action_play_location) }, | |
392 | |
3023
49ce30748980
added lastfm GUI stub
Cristi Magherusan <majeru@atheme-project.org>
parents:
2598
diff
changeset
|
393 { "lastfm", NULL, N_("Last.fm radio"), "<Alt>L", |
49ce30748980
added lastfm GUI stub
Cristi Magherusan <majeru@atheme-project.org>
parents:
2598
diff
changeset
|
394 N_("Play Last.fm radio"), G_CALLBACK(action_lastfm) }, |
49ce30748980
added lastfm GUI stub
Cristi Magherusan <majeru@atheme-project.org>
parents:
2598
diff
changeset
|
395 |
3351
7a4fcf84a34f
Removed the hardcoded Add/Play CD menu entry
Calin Crisan ccrisan@gmail.com
parents:
3321
diff
changeset
|
396 { "plugins", NULL , N_("Plugins") }, |
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
|
397 |
2313 | 398 { "preferences", GTK_STOCK_PREFERENCES , N_("Preferences"), "<Ctrl>P", |
399 N_("Open preferences window"), G_CALLBACK(action_preferences) }, | |
400 | |
401 { "quit", GTK_STOCK_QUIT , N_("_Quit"), NULL, | |
402 N_("Quit Audacious"), G_CALLBACK(action_quit) }, | |
403 | |
404 { "ab set", NULL , N_("Set A-B"), "A", | |
405 N_("Set A-B"), G_CALLBACK(action_ab_set) }, | |
406 | |
2598 | 407 { "ab clear", NULL , N_("Clear A-B"), "<Shift>A", |
2313 | 408 N_("Clear A-B"), G_CALLBACK(action_ab_clear) }, |
409 | |
410 { "jump to playlist start", GTK_STOCK_GOTO_TOP , N_("Jump to Playlist Start"), "<Ctrl>Z", | |
411 N_("Jump to Playlist Start"), G_CALLBACK(action_jump_to_playlist_start) }, | |
412 | |
413 { "jump to file", GTK_STOCK_JUMP_TO , N_("Jump to File"), "J", | |
414 N_("Jump to File"), G_CALLBACK(action_jump_to_file) }, | |
415 | |
416 { "jump to time", GTK_STOCK_JUMP_TO , N_("Jump to Time"), "<Ctrl>J", | |
417 N_("Jump to Time"), G_CALLBACK(action_jump_to_time) }, | |
418 | |
419 { "queue toggle", AUD_STOCK_QUEUETOGGLE , N_("Queue Toggle"), "Q", | |
420 N_("Enables/disables the entry in the playlist's queue."), | |
421 G_CALLBACK(action_queue_toggle) }, | |
422 }; | |
423 | |
424 | |
425 static GtkActionEntry action_entries_equalizer[] = { | |
426 | |
427 { "equ preset load menu", NULL, N_("Load") }, | |
428 { "equ preset import menu", NULL, N_("Import") }, | |
429 { "equ preset save menu", NULL, N_("Save") }, | |
430 { "equ preset delete menu", NULL, N_("Delete") }, | |
431 | |
432 { "equ load preset", NULL, N_("Preset"), NULL, | |
433 N_("Load preset"), G_CALLBACK(action_equ_load_preset) }, | |
434 | |
435 { "equ load auto preset", NULL, N_("Auto-load preset"), NULL, | |
436 N_("Load auto-load preset"), G_CALLBACK(action_equ_load_auto_preset) }, | |
437 | |
438 { "equ load default preset", NULL, N_("Default"), NULL, | |
439 N_("Load default preset into equalizer"), G_CALLBACK(action_equ_load_default_preset) }, | |
440 | |
441 { "equ zero preset", NULL, N_("Zero"), NULL, | |
442 N_("Set equalizer preset levels to zero"), G_CALLBACK(action_equ_zero_preset) }, | |
443 | |
444 { "equ load preset file", NULL, N_("From file"), NULL, | |
445 N_("Load preset from file"), G_CALLBACK(action_equ_load_preset_file) }, | |
446 | |
447 { "equ load preset eqf", NULL, N_("From WinAMP EQF file"), NULL, | |
448 N_("Load preset from WinAMP EQF file"), G_CALLBACK(action_equ_load_preset_eqf) }, | |
449 | |
450 { "equ import winamp presets", NULL, N_("WinAMP Presets"), NULL, | |
451 N_("Import WinAMP presets"), G_CALLBACK(action_equ_import_winamp_presets) }, | |
452 | |
453 { "equ save preset", NULL, N_("Preset"), NULL, | |
454 N_("Save preset"), G_CALLBACK(action_equ_save_preset) }, | |
455 | |
456 { "equ save auto preset", NULL, N_("Auto-load preset"), NULL, | |
457 N_("Save auto-load preset"), G_CALLBACK(action_equ_save_auto_preset) }, | |
458 | |
459 { "equ save default preset", NULL, N_("Default"), NULL, | |
460 N_("Save default preset"), G_CALLBACK(action_equ_save_default_preset) }, | |
461 | |
462 { "equ save preset file", NULL, N_("To file"), NULL, | |
463 N_("Save preset to file"), G_CALLBACK(action_equ_save_preset_file) }, | |
464 | |
465 { "equ save preset eqf", NULL, N_("To WinAMP EQF file"), NULL, | |
466 N_("Save preset to WinAMP EQF file"), G_CALLBACK(action_equ_save_preset_eqf) }, | |
467 | |
468 { "equ delete preset", NULL, N_("Preset"), NULL, | |
469 N_("Delete preset"), G_CALLBACK(action_equ_delete_preset) }, | |
470 | |
471 { "equ delete auto preset", NULL, N_("Auto-load preset"), NULL, | |
472 N_("Delete auto-load preset"), G_CALLBACK(action_equ_delete_auto_preset) } | |
473 }; | |
474 | |
475 | |
476 | |
477 /* ***************************** */ | |
478 | |
479 | |
480 static GtkActionGroup * | |
481 ui_manager_new_action_group( const gchar * group_name ) | |
482 { | |
483 GtkActionGroup *group = gtk_action_group_new( group_name ); | |
484 gtk_action_group_set_translation_domain( group , PACKAGE_NAME ); | |
485 return group; | |
486 } | |
487 | |
488 void | |
489 ui_manager_init ( void ) | |
490 { | |
491 /* toggle actions */ | |
492 toggleaction_group_others = ui_manager_new_action_group("toggleaction_others"); | |
493 gtk_action_group_add_toggle_actions( | |
494 toggleaction_group_others , toggleaction_entries_others , | |
495 G_N_ELEMENTS(toggleaction_entries_others) , NULL ); | |
496 | |
497 /* radio actions */ | |
498 radioaction_group_anamode = ui_manager_new_action_group("radioaction_anamode"); | |
499 gtk_action_group_add_radio_actions( | |
500 radioaction_group_anamode , radioaction_entries_anamode , | |
501 G_N_ELEMENTS(radioaction_entries_anamode) , 0 , G_CALLBACK(action_anamode) , NULL ); | |
502 | |
503 radioaction_group_anatype = ui_manager_new_action_group("radioaction_anatype"); | |
504 gtk_action_group_add_radio_actions( | |
505 radioaction_group_anatype , radioaction_entries_anatype , | |
506 G_N_ELEMENTS(radioaction_entries_anatype) , 0 , G_CALLBACK(action_anatype) , NULL ); | |
507 | |
508 radioaction_group_scomode = ui_manager_new_action_group("radioaction_scomode"); | |
509 gtk_action_group_add_radio_actions( | |
510 radioaction_group_scomode , radioaction_entries_scomode , | |
511 G_N_ELEMENTS(radioaction_entries_scomode) , 0 , G_CALLBACK(action_scomode) , NULL ); | |
512 | |
513 radioaction_group_vprmode = ui_manager_new_action_group("radioaction_vprmode"); | |
514 gtk_action_group_add_radio_actions( | |
515 radioaction_group_vprmode , radioaction_entries_vprmode , | |
516 G_N_ELEMENTS(radioaction_entries_vprmode) , 0 , G_CALLBACK(action_vprmode) , NULL ); | |
517 | |
518 radioaction_group_wshmode = ui_manager_new_action_group("radioaction_wshmode"); | |
519 gtk_action_group_add_radio_actions( | |
520 radioaction_group_wshmode , radioaction_entries_wshmode , | |
521 G_N_ELEMENTS(radioaction_entries_wshmode) , 0 , G_CALLBACK(action_wshmode) , NULL ); | |
522 | |
523 radioaction_group_refrate = ui_manager_new_action_group("radioaction_refrate"); | |
524 gtk_action_group_add_radio_actions( | |
525 radioaction_group_refrate , radioaction_entries_refrate , | |
526 G_N_ELEMENTS(radioaction_entries_refrate) , 0 , G_CALLBACK(action_refrate) , NULL ); | |
527 | |
528 radioaction_group_anafoff = ui_manager_new_action_group("radioaction_anafoff"); | |
529 gtk_action_group_add_radio_actions( | |
530 radioaction_group_anafoff , radioaction_entries_anafoff , | |
531 G_N_ELEMENTS(radioaction_entries_anafoff) , 0 , G_CALLBACK(action_anafoff) , NULL ); | |
532 | |
533 radioaction_group_peafoff = ui_manager_new_action_group("radioaction_peafoff"); | |
534 gtk_action_group_add_radio_actions( | |
535 radioaction_group_peafoff , radioaction_entries_peafoff , | |
536 G_N_ELEMENTS(radioaction_entries_peafoff) , 0 , G_CALLBACK(action_peafoff) , NULL ); | |
537 | |
538 radioaction_group_vismode = ui_manager_new_action_group("radioaction_vismode"); | |
539 gtk_action_group_add_radio_actions( | |
540 radioaction_group_vismode , radioaction_entries_vismode , | |
541 G_N_ELEMENTS(radioaction_entries_vismode) , 0 , G_CALLBACK(action_vismode) , NULL ); | |
542 | |
543 radioaction_group_viewtime = ui_manager_new_action_group("radioaction_viewtime"); | |
544 gtk_action_group_add_radio_actions( | |
545 radioaction_group_viewtime , radioaction_entries_viewtime , | |
546 G_N_ELEMENTS(radioaction_entries_viewtime) , 0 , G_CALLBACK(action_viewtime) , NULL ); | |
547 | |
548 /* normal actions */ | |
549 action_group_playback = ui_manager_new_action_group("action_playback"); | |
550 gtk_action_group_add_actions( | |
551 action_group_playback , action_entries_playback , | |
552 G_N_ELEMENTS(action_entries_playback) , NULL ); | |
553 | |
554 action_group_playlist = ui_manager_new_action_group("action_playlist"); | |
555 gtk_action_group_add_actions( | |
556 action_group_playlist , action_entries_playlist , | |
557 G_N_ELEMENTS(action_entries_playlist) , NULL ); | |
558 | |
559 action_group_visualization = ui_manager_new_action_group("action_visualization"); | |
560 gtk_action_group_add_actions( | |
561 action_group_visualization , action_entries_visualization , | |
562 G_N_ELEMENTS(action_entries_visualization) , NULL ); | |
563 | |
564 action_group_view = ui_manager_new_action_group("action_view"); | |
565 gtk_action_group_add_actions( | |
566 action_group_view , action_entries_view , | |
567 G_N_ELEMENTS(action_entries_view) , NULL ); | |
568 | |
569 action_group_others = ui_manager_new_action_group("action_others"); | |
570 gtk_action_group_add_actions( | |
571 action_group_others , action_entries_others , | |
572 G_N_ELEMENTS(action_entries_others) , NULL ); | |
573 | |
574 action_group_playlist_add = ui_manager_new_action_group("action_playlist_add"); | |
575 gtk_action_group_add_actions( | |
576 action_group_playlist_add, action_entries_playlist_add, | |
577 G_N_ELEMENTS(action_entries_playlist_add), NULL ); | |
578 | |
579 action_group_playlist_select = ui_manager_new_action_group("action_playlist_select"); | |
580 gtk_action_group_add_actions( | |
581 action_group_playlist_select, action_entries_playlist_select, | |
582 G_N_ELEMENTS(action_entries_playlist_select), NULL ); | |
583 | |
584 action_group_playlist_delete = ui_manager_new_action_group("action_playlist_delete"); | |
585 gtk_action_group_add_actions( | |
586 action_group_playlist_delete, action_entries_playlist_delete, | |
587 G_N_ELEMENTS(action_entries_playlist_delete), NULL ); | |
588 | |
589 action_group_playlist_sort = ui_manager_new_action_group("action_playlist_sort"); | |
590 gtk_action_group_add_actions( | |
591 action_group_playlist_sort, action_entries_playlist_sort, | |
592 G_N_ELEMENTS(action_entries_playlist_sort), NULL ); | |
593 | |
594 action_group_equalizer = ui_manager_new_action_group("action_equalizer"); | |
595 gtk_action_group_add_actions( | |
596 action_group_equalizer, action_entries_equalizer, | |
597 G_N_ELEMENTS(action_entries_equalizer), NULL); | |
598 | |
599 /* ui */ | |
600 ui_manager = gtk_ui_manager_new(); | |
601 gtk_ui_manager_insert_action_group( ui_manager , toggleaction_group_others , 0 ); | |
602 gtk_ui_manager_insert_action_group( ui_manager , radioaction_group_anamode , 0 ); | |
603 gtk_ui_manager_insert_action_group( ui_manager , radioaction_group_anatype , 0 ); | |
604 gtk_ui_manager_insert_action_group( ui_manager , radioaction_group_scomode , 0 ); | |
605 gtk_ui_manager_insert_action_group( ui_manager , radioaction_group_vprmode , 0 ); | |
606 gtk_ui_manager_insert_action_group( ui_manager , radioaction_group_wshmode , 0 ); | |
607 gtk_ui_manager_insert_action_group( ui_manager , radioaction_group_refrate , 0 ); | |
608 gtk_ui_manager_insert_action_group( ui_manager , radioaction_group_anafoff , 0 ); | |
609 gtk_ui_manager_insert_action_group( ui_manager , radioaction_group_peafoff , 0 ); | |
610 gtk_ui_manager_insert_action_group( ui_manager , radioaction_group_vismode , 0 ); | |
611 gtk_ui_manager_insert_action_group( ui_manager , radioaction_group_viewtime , 0 ); | |
612 gtk_ui_manager_insert_action_group( ui_manager , action_group_playback , 0 ); | |
613 gtk_ui_manager_insert_action_group( ui_manager , action_group_playlist , 0 ); | |
614 gtk_ui_manager_insert_action_group( ui_manager , action_group_visualization , 0 ); | |
615 gtk_ui_manager_insert_action_group( ui_manager , action_group_view , 0 ); | |
616 gtk_ui_manager_insert_action_group( ui_manager , action_group_others , 0 ); | |
617 gtk_ui_manager_insert_action_group( ui_manager , action_group_playlist_add , 0 ); | |
618 gtk_ui_manager_insert_action_group( ui_manager , action_group_playlist_select , 0 ); | |
619 gtk_ui_manager_insert_action_group( ui_manager , action_group_playlist_delete , 0 ); | |
620 gtk_ui_manager_insert_action_group( ui_manager , action_group_playlist_sort , 0 ); | |
621 gtk_ui_manager_insert_action_group( ui_manager , action_group_equalizer , 0 ); | |
622 | |
623 return; | |
624 } | |
625 | |
626 | |
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
|
627 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
|
628 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
|
629 { |
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
|
630 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
|
631 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
|
632 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
|
633 /* 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
|
634 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
|
635 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
|
636 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
|
637 /* 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
|
638 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
|
639 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
|
640 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
|
641 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
|
642 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
|
643 /* 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
|
644 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
|
645 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
|
646 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
|
647 } |
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 |
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 |
2313 | 650 void |
651 ui_manager_create_menus ( void ) | |
652 { | |
653 GError *gerr = NULL; | |
654 | |
655 /* attach xml menu definitions */ | |
656 gtk_ui_manager_add_ui_from_file( ui_manager , DATA_DIR "/ui/mainwin.ui" , &gerr ); | |
657 | |
658 if ( gerr != NULL ) | |
659 { | |
660 g_critical( "Error creating UI<ui/mainwin.ui>: %s" , gerr->message ); | |
661 g_error_free( gerr ); | |
662 return; | |
663 } | |
664 | |
665 /* create GtkMenu widgets using path from xml definitions */ | |
666 mainwin_songname_menu = ui_manager_get_popup_menu( ui_manager , "/mainwin-menus/songname-menu" ); | |
667 mainwin_visualization_menu = ui_manager_get_popup_menu( ui_manager , "/mainwin-menus/main-menu/visualization" ); | |
668 mainwin_playback_menu = ui_manager_get_popup_menu( ui_manager , "/mainwin-menus/main-menu/playback" ); | |
669 mainwin_playlist_menu = ui_manager_get_popup_menu( ui_manager , "/mainwin-menus/main-menu/playlist" ); | |
670 mainwin_view_menu = ui_manager_get_popup_menu( ui_manager , "/mainwin-menus/main-menu/view" ); | |
671 mainwin_general_menu = ui_manager_get_popup_menu( ui_manager , "/mainwin-menus/main-menu" ); | |
672 | |
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
|
673 /* 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
|
674 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
|
675 |
2313 | 676 gtk_ui_manager_add_ui_from_file( ui_manager , DATA_DIR "/ui/playlist.ui" , &gerr ); |
677 | |
678 if ( gerr != NULL ) | |
679 { | |
680 g_critical( "Error creating UI<ui/playlist.ui>: %s" , gerr->message ); | |
681 g_error_free( gerr ); | |
682 return; | |
683 } | |
684 | |
685 playlistwin_popup_menu = ui_manager_get_popup_menu(ui_manager, "/playlist-menus/playlist-rightclick-menu"); | |
686 | |
687 playlistwin_pladd_menu = ui_manager_get_popup_menu(ui_manager, "/playlist-menus/add-menu"); | |
688 playlistwin_pldel_menu = ui_manager_get_popup_menu(ui_manager, "/playlist-menus/del-menu"); | |
689 playlistwin_plsel_menu = ui_manager_get_popup_menu(ui_manager, "/playlist-menus/select-menu"); | |
690 playlistwin_plsort_menu = ui_manager_get_popup_menu(ui_manager, "/playlist-menus/misc-menu"); | |
691 playlistwin_pllist_menu = ui_manager_get_popup_menu(ui_manager, "/playlist-menus/playlist-menu"); | |
692 | |
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
|
693 /* 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
|
694 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
|
695 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
|
696 |
2313 | 697 gtk_ui_manager_add_ui_from_file( ui_manager , DATA_DIR "/ui/equalizer.ui" , &gerr ); |
698 | |
699 if ( gerr != NULL ) | |
700 { | |
701 g_critical( "Error creating UI<ui/equalizer.ui>: %s" , gerr->message ); | |
702 g_error_free( gerr ); | |
703 return; | |
704 } | |
705 | |
706 equalizerwin_presets_menu = ui_manager_get_popup_menu(ui_manager, "/equalizer-menus/preset-menu"); | |
707 | |
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
|
708 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
|
709 |
2313 | 710 return; |
711 } | |
712 | |
713 | |
714 GtkAccelGroup * | |
715 ui_manager_get_accel_group ( void ) | |
716 { | |
717 return gtk_ui_manager_get_accel_group( ui_manager ); | |
718 } | |
719 | |
720 | |
721 GtkWidget * | |
722 ui_manager_get_popup_menu ( GtkUIManager * self , const gchar * path ) | |
723 { | |
724 GtkWidget *menu_item = gtk_ui_manager_get_widget( self , path ); | |
725 | |
726 if (GTK_IS_MENU_ITEM(menu_item)) | |
727 return gtk_menu_item_get_submenu(GTK_MENU_ITEM(menu_item)); | |
728 else | |
729 return NULL; | |
730 } | |
731 | |
732 | |
733 static void | |
734 menu_popup_pos_func (GtkMenu * menu , gint * x , gint * y , gboolean * push_in , gint * point ) | |
735 { | |
736 GtkRequisition requisition; | |
737 gint screen_width; | |
738 gint screen_height; | |
739 | |
740 gtk_widget_size_request(GTK_WIDGET(menu), &requisition); | |
741 | |
742 screen_width = gdk_screen_width(); | |
743 screen_height = gdk_screen_height(); | |
744 | |
745 *x = CLAMP(point[0] - 2, 0, MAX(0, screen_width - requisition.width)); | |
746 *y = CLAMP(point[1] - 2, 0, MAX(0, screen_height - requisition.height)); | |
747 | |
748 *push_in = FALSE; | |
749 } | |
750 | |
751 | |
752 void | |
753 ui_manager_popup_menu_show ( GtkMenu * menu , gint x , gint y , guint button , guint time ) | |
754 { | |
755 gint pos[2]; | |
756 pos[0] = x; | |
757 pos[1] = y; | |
758 | |
759 gtk_menu_popup( menu , NULL , NULL , | |
760 (GtkMenuPositionFunc) menu_popup_pos_func , pos , button , time ); | |
761 } | |
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
|
762 |
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
|
763 |
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
|
764 |
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
|
765 /******************************/ |
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
|
766 /* 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
|
767 |
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
|
768 |
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 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
|
770 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
|
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 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
|
773 { |
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
|
774 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
|
775 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
|
776 |
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
|
777 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
|
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 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
|
780 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
|
781 "/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
|
782 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
|
783 |
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 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
|
785 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
|
786 "/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
|
787 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
|
788 |
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 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
|
790 plugins_menu_item = gtk_ui_manager_get_widget( ui_manager , |
3321
a6a76ab7ce0a
fix uimanager paths for AUDACIOUS_MENU_PLAYLIST_RCLICK
Giacomo Lozito <james@develia.org>
parents:
3320
diff
changeset
|
791 "/playlist-menus/playlist-rightclick-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
|
792 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
|
793 |
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
|
794 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
|
795 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
|
796 } |
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
|
797 |
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 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
|
799 { |
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
|
800 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
|
801 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
|
802 { |
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
|
803 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
|
804 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
|
805 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
|
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 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
|
808 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
|
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 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
|
811 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
|
812 } |
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
|
813 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
|
814 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
|
815 } |
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
|
816 |
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
|
817 |
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
|
818 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
|
819 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
|
820 { |
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 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
|
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 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
|
824 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
|
825 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
|
826 |
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 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
|
828 { |
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 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
|
830 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
|
831 "/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
|
832 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
|
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 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
|
835 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
|
836 "/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
|
837 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
|
838 |
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
|
839 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
|
840 plugins_menu_item = gtk_ui_manager_get_widget( ui_manager , |
3321
a6a76ab7ce0a
fix uimanager paths for AUDACIOUS_MENU_PLAYLIST_RCLICK
Giacomo Lozito <james@develia.org>
parents:
3320
diff
changeset
|
841 "/playlist-menus/playlist-rightclick-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
|
842 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
|
843 |
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 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
|
845 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
|
846 } |
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
|
847 |
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
|
848 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
|
849 { |
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
|
850 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
|
851 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
|
852 { |
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
|
853 /* 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
|
854 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
|
855 /* 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
|
856 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
|
857 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
|
858 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
|
859 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
|
860 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
|
861 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
|
862 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
|
863 } |
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 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
|
865 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
|
866 } |
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
|
867 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
|
868 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
|
869 } |
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
|
870 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
|
871 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
|
872 } |