Mercurial > audlegacy
annotate src/audacious/ui_manager.c @ 3481:308e5fb348db trunk
Save extra playlists on exit
author | Kieran Clancy <clancy.kieran+audacious@gmail.com> |
---|---|
date | Mon, 10 Sep 2007 14:42:59 +0930 |
parents | 47d6fb3884fb |
children | 24ae9b303a9d |
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 | |
3419
47d6fb3884fb
Connect menu to Carbon.
William Pitcock <nenolod@atheme.org>
parents:
3418
diff
changeset
|
38 #include "sync-menu.h" |
2313 | 39 |
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
|
40 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
|
41 static gboolean menu_created = FALSE; |
2313 | 42 |
43 | |
44 /* toggle action entries */ | |
45 | |
46 static GtkToggleActionEntry toggleaction_entries_others[] = { | |
47 | |
48 { "autoscroll songname", NULL , N_("Autoscroll Songname"), NULL, | |
49 N_("Autoscroll Songname"), G_CALLBACK(action_autoscroll_songname) , FALSE }, | |
50 | |
51 { "stop after current song", NULL , N_("Stop after Current Song"), "<Ctrl>M", | |
52 N_("Stop after Current Song"), G_CALLBACK(action_stop_after_current_song) , FALSE }, | |
53 | |
54 { "anamode peaks", NULL , N_("Peaks"), NULL, | |
55 N_("Peaks"), G_CALLBACK(action_anamode_peaks) , FALSE }, | |
56 | |
57 { "playback repeat", NULL , N_("Repeat"), "R", | |
58 N_("Repeat"), G_CALLBACK(action_playback_repeat) , FALSE }, | |
59 | |
60 { "playback shuffle", NULL , N_("Shuffle"), "S", | |
61 N_("Shuffle"), G_CALLBACK(action_playback_shuffle) , FALSE }, | |
62 | |
63 { "playback no playlist advance", NULL , N_("No Playlist Advance"), "<Ctrl>N", | |
64 N_("No Playlist Advance"), G_CALLBACK(action_playback_noplaylistadvance) , FALSE }, | |
65 | |
66 { "show player", NULL , N_("Show Player"), "<Alt>M", | |
67 N_("Show Player"), G_CALLBACK(action_show_player) , FALSE }, | |
68 | |
69 { "show playlist editor", NULL , N_("Show Playlist Editor"), "<Alt>E", | |
70 N_("Show Playlist Editor"), G_CALLBACK(action_show_playlist_editor) , FALSE }, | |
71 | |
72 { "show equalizer", NULL , N_("Show Equalizer"), "<Alt>G", | |
73 N_("Show Equalizer"), G_CALLBACK(action_show_equalizer) , FALSE }, | |
74 | |
75 { "view always on top", NULL , N_("Always on Top"), "<Ctrl>O", | |
76 N_("Always on Top"), G_CALLBACK(action_view_always_on_top) , FALSE }, | |
77 | |
78 { "view put on all workspaces", NULL , N_("Put on All Workspaces"), "<Ctrl>S", | |
79 N_("Put on All Workspaces"), G_CALLBACK(action_view_on_all_workspaces) , FALSE }, | |
80 | |
81 { "roll up player", NULL , N_("Roll up Player"), "<Ctrl>W", | |
82 N_("Roll up Player"), G_CALLBACK(action_roll_up_player) , FALSE }, | |
83 | |
84 { "roll up playlist editor", NULL , N_("Roll up Playlist Editor"), "<Shift><Ctrl>W", | |
85 N_("Roll up Playlist Editor"), G_CALLBACK(action_roll_up_playlist_editor) , FALSE }, | |
86 | |
87 { "roll up equalizer", NULL , N_("Roll up Equalizer"), "<Ctrl><Alt>W", | |
88 N_("Roll up Equalizer"), G_CALLBACK(action_roll_up_equalizer) , FALSE }, | |
89 | |
90 { "view doublesize", NULL , N_("DoubleSize"), "<Ctrl>D", | |
91 N_("DoubleSize"), G_CALLBACK(action_view_doublesize) , FALSE }, | |
92 | |
93 { "view easy move", NULL , N_("Easy Move"), "<Ctrl>E", | |
94 N_("Easy Move"), G_CALLBACK(action_view_easymove) , FALSE } | |
95 }; | |
96 | |
97 | |
98 | |
99 /* radio action entries */ | |
100 | |
101 static GtkRadioActionEntry radioaction_entries_vismode[] = { | |
102 { "vismode analyzer", NULL , N_("Analyzer"), NULL, N_("Analyzer"), VIS_ANALYZER }, | |
103 { "vismode scope", NULL , N_("Scope"), NULL, N_("Scope"), VIS_SCOPE }, | |
104 { "vismode voiceprint", NULL , N_("Voiceprint"), NULL, N_("Voiceprint"), VIS_VOICEPRINT }, | |
105 { "vismode off", NULL , N_("Off"), NULL, N_("Off"), VIS_OFF } | |
106 }; | |
107 | |
108 static GtkRadioActionEntry radioaction_entries_anamode[] = { | |
109 { "anamode normal", NULL , N_("Normal"), NULL, N_("Normal"), ANALYZER_NORMAL }, | |
110 { "anamode fire", NULL , N_("Fire"), NULL, N_("Fire"), ANALYZER_FIRE }, | |
111 { "anamode vertical lines", NULL , N_("Vertical Lines"), NULL, N_("Vertical Lines"), ANALYZER_VLINES } | |
112 }; | |
113 | |
114 static GtkRadioActionEntry radioaction_entries_anatype[] = { | |
115 { "anatype lines", NULL , N_("Lines"), NULL, N_("Lines"), ANALYZER_LINES }, | |
116 { "anatype bars", NULL , N_("Bars"), NULL, N_("Bars"), ANALYZER_BARS } | |
117 }; | |
118 | |
119 static GtkRadioActionEntry radioaction_entries_scomode[] = { | |
120 { "scomode dot", NULL , N_("Dot Scope"), NULL, N_("Dot Scope"), SCOPE_DOT }, | |
121 { "scomode line", NULL , N_("Line Scope"), NULL, N_("Line Scope"), SCOPE_LINE }, | |
122 { "scomode solid", NULL , N_("Solid Scope"), NULL, N_("Solid Scope"), SCOPE_SOLID } | |
123 }; | |
124 | |
125 static GtkRadioActionEntry radioaction_entries_vprmode[] = { | |
126 { "vprmode normal", NULL , N_("Normal"), NULL, N_("Normal"), VOICEPRINT_NORMAL }, | |
127 { "vprmode fire", NULL , N_("Fire"), NULL, N_("Fire"), VOICEPRINT_FIRE }, | |
128 { "vprmode ice", NULL , N_("Ice"), NULL, N_("Ice"), VOICEPRINT_ICE } | |
129 }; | |
130 | |
131 static GtkRadioActionEntry radioaction_entries_wshmode[] = { | |
132 { "wshmode normal", NULL , N_("Normal"), NULL, N_("Normal"), VU_NORMAL }, | |
133 { "wshmode smooth", NULL , N_("Smooth"), NULL, N_("Smooth"), VU_SMOOTH } | |
134 }; | |
135 | |
136 static GtkRadioActionEntry radioaction_entries_refrate[] = { | |
137 { "refrate full", NULL , N_("Full (~50 fps)"), NULL, N_("Full (~50 fps)"), REFRESH_FULL }, | |
138 { "refrate half", NULL , N_("Half (~25 fps)"), NULL, N_("Half (~25 fps)"), REFRESH_HALF }, | |
139 { "refrate quarter", NULL , N_("Quarter (~13 fps)"), NULL, N_("Quarter (~13 fps)"), REFRESH_QUARTER }, | |
140 { "refrate eighth", NULL , N_("Eighth (~6 fps)"), NULL, N_("Eighth (~6 fps)"), REFRESH_EIGTH } | |
141 }; | |
142 | |
143 static GtkRadioActionEntry radioaction_entries_anafoff[] = { | |
144 { "anafoff slowest", NULL , N_("Slowest"), NULL, N_("Slowest"), FALLOFF_SLOWEST }, | |
145 { "anafoff slow", NULL , N_("Slow"), NULL, N_("Slow"), FALLOFF_SLOW }, | |
146 { "anafoff medium", NULL , N_("Medium"), NULL, N_("Medium"), FALLOFF_MEDIUM }, | |
147 { "anafoff fast", NULL , N_("Fast"), NULL, N_("Fast"), FALLOFF_FAST }, | |
148 { "anafoff fastest", NULL , N_("Fastest"), NULL, N_("Fastest"), FALLOFF_FASTEST } | |
149 }; | |
150 | |
151 static GtkRadioActionEntry radioaction_entries_peafoff[] = { | |
152 { "peafoff slowest", NULL , N_("Slowest"), NULL, N_("Slowest"), FALLOFF_SLOWEST }, | |
153 { "peafoff slow", NULL , N_("Slow"), NULL, N_("Slow"), FALLOFF_SLOW }, | |
154 { "peafoff medium", NULL , N_("Medium"), NULL, N_("Medium"), FALLOFF_MEDIUM }, | |
155 { "peafoff fast", NULL , N_("Fast"), NULL, N_("Fast"), FALLOFF_FAST }, | |
156 { "peafoff fastest", NULL , N_("Fastest"), NULL, N_("Fastest"), FALLOFF_FASTEST } | |
157 }; | |
158 | |
159 static GtkRadioActionEntry radioaction_entries_viewtime[] = { | |
160 { "view time elapsed", NULL , N_("Time Elapsed"), "<Ctrl>E", N_("Time Elapsed"), TIMER_ELAPSED }, | |
161 { "view time remaining", NULL , N_("Time Remaining"), "<Ctrl>R", N_("Time Remaining"), TIMER_REMAINING } | |
162 }; | |
163 | |
164 | |
165 | |
166 /* normal actions */ | |
167 | |
168 static GtkActionEntry action_entries_playback[] = { | |
169 | |
170 { "playback", NULL, N_("Playback") }, | |
3023
49ce30748980
added lastfm GUI stub
Cristi Magherusan <majeru@atheme-project.org>
parents:
2598
diff
changeset
|
171 |
2313 | 172 { "playback play", GTK_STOCK_MEDIA_PLAY , N_("Play"), "X", |
173 N_("Play"), G_CALLBACK(action_playback_play) }, | |
174 | |
175 { "playback pause", GTK_STOCK_MEDIA_PAUSE , N_("Pause"), "C", | |
176 N_("Pause"), G_CALLBACK(action_playback_pause) }, | |
177 | |
178 { "playback stop", GTK_STOCK_MEDIA_STOP , N_("Stop"), "V", | |
179 N_("Stop"), G_CALLBACK(action_playback_stop) }, | |
180 | |
181 { "playback previous", GTK_STOCK_MEDIA_PREVIOUS , N_("Previous"), "Z", | |
182 N_("Previous"), G_CALLBACK(action_playback_previous) }, | |
183 | |
184 { "playback next", GTK_STOCK_MEDIA_NEXT , N_("Next"), "B", | |
185 N_("Next"), G_CALLBACK(action_playback_next) } | |
186 }; | |
187 | |
188 | |
189 static GtkActionEntry action_entries_visualization[] = { | |
190 { "visualization", NULL, N_("Visualization") }, | |
191 { "vismode", NULL, N_("Visualization Mode") }, | |
192 { "anamode", NULL, N_("Analyzer Mode") }, | |
193 { "scomode", NULL, N_("Scope Mode") }, | |
194 { "vprmode", NULL, N_("Voiceprint Mode") }, | |
195 { "wshmode", NULL, N_("WindowShade VU Mode") }, | |
196 { "refrate", NULL, N_("Refresh Rate") }, | |
197 { "anafoff", NULL, N_("Analyzer Falloff") }, | |
198 { "peafoff", NULL, N_("Peaks Falloff") } | |
199 }; | |
200 | |
201 static GtkActionEntry action_entries_playlist[] = { | |
202 | |
203 { "playlist", NULL, N_("Playlist") }, | |
204 | |
205 { "playlist new", GTK_STOCK_NEW , N_("New Playlist"), "<Shift>N", | |
206 N_("New Playlist"), G_CALLBACK(action_playlist_new) }, | |
207 | |
208 { "playlist select next", GTK_STOCK_MEDIA_NEXT, N_("Select Next Playlist"), "<Shift>P", | |
209 N_("Select Next Playlist"), G_CALLBACK(action_playlist_next) }, | |
210 | |
211 { "playlist select previous", GTK_STOCK_MEDIA_PREVIOUS, N_("Select Previous Playlist"), "<Shift><Ctrl>P", | |
212 N_("Select Previous Playlist"), G_CALLBACK(action_playlist_prev) }, | |
213 | |
214 { "playlist delete", GTK_STOCK_DELETE , N_("Delete Playlist"), "<Shift>D", | |
215 N_("Delete Playlist"), G_CALLBACK(action_playlist_delete) }, | |
216 | |
217 { "playlist load", GTK_STOCK_OPEN, N_("Load List"), "O", | |
218 N_("Loads a playlist file into the selected playlist."), G_CALLBACK(action_playlist_load_list) }, | |
219 | |
220 { "playlist save", GTK_STOCK_SAVE, N_("Save List"), "<Shift>S", | |
221 N_("Saves the selected playlist."), G_CALLBACK(action_playlist_save_list) }, | |
222 | |
223 { "playlist save default", GTK_STOCK_SAVE, N_("Save Default List"), "<Alt>S", | |
224 N_("Saves the selected playlist to the default location."), | |
225 G_CALLBACK(action_playlist_save_default_list) }, | |
226 | |
227 { "playlist refresh", GTK_STOCK_REFRESH, N_("Refresh List"), "F5", | |
228 N_("Refreshes metadata associated with a playlist entry."), | |
229 G_CALLBACK(action_playlist_refresh_list) }, | |
230 | |
231 { "playlist manager", AUD_STOCK_PLAYLIST , N_("List Manager"), "P", | |
232 N_("Opens the playlist manager."), | |
233 G_CALLBACK(action_open_list_manager) } | |
234 }; | |
235 | |
236 static GtkActionEntry action_entries_view[] = { | |
237 | |
238 { "view", NULL, N_("View") } | |
239 }; | |
240 | |
241 static GtkActionEntry action_entries_playlist_add[] = { | |
242 { "playlist add url", GTK_STOCK_NETWORK, N_("Add Internet Address..."), "<Ctrl>H", | |
243 N_("Adds a remote track to the playlist."), | |
244 G_CALLBACK(action_playlist_add_url) }, | |
245 | |
246 { "playlist add files", GTK_STOCK_ADD, N_("Add Files..."), "F", | |
247 N_("Adds files to the playlist."), | |
248 G_CALLBACK(action_playlist_add_files) }, | |
249 }; | |
250 | |
251 static GtkActionEntry action_entries_playlist_select[] = { | |
252 { "playlist search and select", GTK_STOCK_FIND, N_("Search and Select"), "<Ctrl>F", | |
253 N_("Searches the playlist and selects playlist entries based on specific criteria."), | |
254 G_CALLBACK(action_playlist_search_and_select) }, | |
255 | |
256 { "playlist invert selection", AUD_STOCK_SELECTINVERT , N_("Invert Selection"), NULL, | |
257 N_("Inverts the selected and unselected entries."), | |
258 G_CALLBACK(action_playlist_invert_selection) }, | |
259 | |
260 { "playlist select all", AUD_STOCK_SELECTALL , N_("Select All"), "<Ctrl>A", | |
261 N_("Selects all of the playlist entries."), | |
262 G_CALLBACK(action_playlist_select_all) }, | |
263 | |
264 { "playlist select none", AUD_STOCK_SELECTNONE , N_("Select None"), "<Shift><Ctrl>A", | |
265 N_("Deselects all of the playlist entries."), | |
266 G_CALLBACK(action_playlist_select_none) }, | |
267 }; | |
268 | |
269 static GtkActionEntry action_entries_playlist_delete[] = { | |
270 { "playlist clear queue", GTK_STOCK_REMOVE, N_("Clear Queue"), "<Shift>Q", | |
271 N_("Clears the queue associated with this playlist."), | |
272 G_CALLBACK(action_playlist_clear_queue) }, | |
273 | |
274 { "playlist remove unavailable", AUD_STOCK_REMOVEUNAVAIL , N_("Remove Unavailable Files"), NULL, | |
275 N_("Removes unavailable files from the playlist."), | |
276 G_CALLBACK(action_playlist_remove_unavailable) }, | |
277 | |
278 { "playlist remove dups menu", AUD_STOCK_REMOVEDUPS , N_("Remove Duplicates") }, | |
279 | |
280 { "playlist remove dups by title", AUD_STOCK_REMOVEDUPS , N_("By Title"), NULL, | |
281 N_("Removes duplicate entries from the playlist by title."), | |
282 G_CALLBACK(action_playlist_remove_dupes_by_title) }, | |
283 | |
284 { "playlist remove dups by filename", AUD_STOCK_REMOVEDUPS , N_("By Filename"), NULL, | |
285 N_("Removes duplicate entries from the playlist by filename."), | |
286 G_CALLBACK(action_playlist_remove_dupes_by_filename) }, | |
287 | |
288 { "playlist remove dups by full path", AUD_STOCK_REMOVEDUPS , N_("By Path + Filename"), NULL, | |
289 N_("Removes duplicate entries from the playlist by their full path."), | |
290 G_CALLBACK(action_playlist_remove_dupes_by_full_path) }, | |
291 | |
292 { "playlist remove all", GTK_STOCK_CLEAR, N_("Remove All"), NULL, | |
293 N_("Removes all entries from the playlist."), | |
294 G_CALLBACK(action_playlist_remove_all) }, | |
295 | |
296 { "playlist remove unselected", GTK_STOCK_REMOVE, N_("Remove Unselected"), NULL, | |
297 N_("Remove unselected entries from the playlist."), | |
298 G_CALLBACK(action_playlist_remove_unselected) }, | |
299 | |
300 { "playlist remove selected", GTK_STOCK_REMOVE, N_("Remove Selected"), "Delete", | |
301 N_("Remove selected entries from the playlist."), | |
302 G_CALLBACK(action_playlist_remove_selected) }, | |
303 }; | |
304 | |
305 static GtkActionEntry action_entries_playlist_sort[] = { | |
306 { "playlist randomize list", AUD_STOCK_RANDOMIZEPL , N_("Randomize List"), "<Ctrl><Shift>R", | |
307 N_("Randomizes the playlist."), | |
308 G_CALLBACK(action_playlist_randomize_list) }, | |
309 | |
310 { "playlist reverse list", AUD_STOCK_INVERTPL , N_("Reverse List"), NULL, | |
311 N_("Reverses the playlist."), | |
312 G_CALLBACK(action_playlist_reverse_list) }, | |
313 | |
314 { "playlist sort menu", AUD_STOCK_SORTBYTITLE , N_("Sort List") }, | |
315 | |
316 { "playlist sort by title", AUD_STOCK_SORTBYTITLE , N_("By Title"), NULL, | |
317 N_("Sorts the list by title."), | |
318 G_CALLBACK(action_playlist_sort_by_title) }, | |
319 | |
320 { "playlist sort by artist", AUD_STOCK_SORTBYARTIST , N_("By Artist"), NULL, | |
321 N_("Sorts the list by artist."), | |
322 G_CALLBACK(action_playlist_sort_by_artist) }, | |
323 | |
324 { "playlist sort by filename", AUD_STOCK_SORTBYFILENAME , N_("By Filename"), NULL, | |
325 N_("Sorts the list by filename."), | |
326 G_CALLBACK(action_playlist_sort_by_filename) }, | |
327 | |
328 { "playlist sort by full path", AUD_STOCK_SORTBYPATHFILE , N_("By Path + Filename"), NULL, | |
329 N_("Sorts the list by full pathname."), | |
330 G_CALLBACK(action_playlist_sort_by_full_path) }, | |
331 | |
332 { "playlist sort by date", AUD_STOCK_SORTBYARTIST , N_("By Date"), NULL, | |
333 N_("Sorts the list by modification time."), | |
334 G_CALLBACK(action_playlist_sort_by_date) }, | |
335 | |
336 { "playlist sort by track number", AUD_STOCK_SORTBYFILENAME , N_("By Track Number"), NULL, | |
337 N_("Sorts the list by track number."), | |
338 G_CALLBACK(action_playlist_sort_by_track_number) }, | |
339 | |
340 { "playlist sort by playlist entry", AUD_STOCK_SORTBYPATHFILE , N_("By Playlist Entry"), NULL, | |
341 N_("Sorts the list by playlist entry."), | |
342 G_CALLBACK(action_playlist_sort_by_playlist_entry) }, | |
343 | |
344 { "playlist sort selected menu", AUD_STOCK_SORTBYTITLE , N_("Sort Selected") }, | |
345 | |
346 { "playlist sort selected by title", AUD_STOCK_SORTBYTITLE , N_("By Title"), NULL, | |
347 N_("Sorts the list by title."), | |
348 G_CALLBACK(action_playlist_sort_selected_by_title) }, | |
349 | |
350 { "playlist sort selected by artist", AUD_STOCK_SORTBYARTIST, N_("By Artist"), NULL, | |
351 N_("Sorts the list by artist."), | |
352 G_CALLBACK(action_playlist_sort_selected_by_artist) }, | |
353 | |
354 { "playlist sort selected by filename", AUD_STOCK_SORTBYFILENAME , N_("By Filename"), NULL, | |
355 N_("Sorts the list by filename."), | |
356 G_CALLBACK(action_playlist_sort_selected_by_filename) }, | |
357 | |
358 { "playlist sort selected by full path", AUD_STOCK_SORTBYPATHFILE , N_("By Path + Filename"), NULL, | |
359 N_("Sorts the list by full pathname."), | |
360 G_CALLBACK(action_playlist_sort_selected_by_full_path) }, | |
361 | |
362 { "playlist sort selected by date", AUD_STOCK_SORTBYARTIST , N_("By Date"), NULL, | |
363 N_("Sorts the list by modification time."), | |
364 G_CALLBACK(action_playlist_sort_selected_by_date) }, | |
365 | |
366 { "playlist sort selected by track number", AUD_STOCK_SORTBYFILENAME , N_("By Track Number"), NULL, | |
367 N_("Sorts the list by track number."), | |
368 G_CALLBACK(action_playlist_sort_selected_by_track_number) }, | |
369 | |
370 { "playlist sort selected by playlist entry", AUD_STOCK_SORTBYPATHFILE, N_("By Playlist Entry"), NULL, | |
371 N_("Sorts the list by playlist entry."), | |
372 G_CALLBACK(action_playlist_sort_selected_by_playlist_entry) }, | |
373 }; | |
374 | |
375 static GtkActionEntry action_entries_others[] = { | |
376 | |
377 { "dummy", NULL, "dummy" }, | |
378 | |
3418
c27b1b544026
macos: carbon menubar, try 1
William Pitcock <nenolod@atheme.org>
parents:
3411
diff
changeset
|
379 /* XXX Carbon support */ |
c27b1b544026
macos: carbon menubar, try 1
William Pitcock <nenolod@atheme.org>
parents:
3411
diff
changeset
|
380 { "file", NULL, N_("File") }, |
c27b1b544026
macos: carbon menubar, try 1
William Pitcock <nenolod@atheme.org>
parents:
3411
diff
changeset
|
381 { "help", NULL, N_("Help") }, |
c27b1b544026
macos: carbon menubar, try 1
William Pitcock <nenolod@atheme.org>
parents:
3411
diff
changeset
|
382 |
3411
e451f5027d00
"Plugins" -> "Plugin Services", this helps to clarify what the menu is for.
William Pitcock <nenolod@atheme-project.org>
parents:
3372
diff
changeset
|
383 { "plugins-menu", NULL, N_("Plugin Services") }, |
3369
676bfd7b6586
simplified the custom plugin menuentries system, expecially for ui files
Giacomo Lozito <james@develia.org>
parents:
3351
diff
changeset
|
384 |
2313 | 385 { "current track info", AUD_STOCK_INFO , N_("View Track Details"), "I", |
386 N_("View track details"), G_CALLBACK(action_current_track_info) }, | |
387 | |
388 { "playlist track info", AUD_STOCK_INFO , N_("View Track Details"), "<Alt>I", | |
389 N_("View track details"), G_CALLBACK(action_playlist_track_info) }, | |
390 | |
391 { "about audacious", GTK_STOCK_DIALOG_INFO , N_("About Audacious"), NULL, | |
392 N_("About Audacious"), G_CALLBACK(action_about_audacious) }, | |
393 | |
394 { "play file", GTK_STOCK_OPEN , N_("Play File"), "L", | |
395 N_("Load and play a file"), G_CALLBACK(action_play_file) }, | |
396 | |
397 { "play location", GTK_STOCK_NETWORK , N_("Play Location"), "<Ctrl>L", | |
398 N_("Play media from the selected location"), G_CALLBACK(action_play_location) }, | |
399 | |
3023
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 |
3351
7a4fcf84a34f
Removed the hardcoded Add/Play CD menu entry
Calin Crisan ccrisan@gmail.com
parents:
3321
diff
changeset
|
403 { "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
|
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 | |
3418
c27b1b544026
macos: carbon menubar, try 1
William Pitcock <nenolod@atheme.org>
parents:
3411
diff
changeset
|
633 #ifdef GDK_WINDOWING_QUARTZ |
c27b1b544026
macos: carbon menubar, try 1
William Pitcock <nenolod@atheme.org>
parents:
3411
diff
changeset
|
634 static GtkWidget *carbon_menubar; |
c27b1b544026
macos: carbon menubar, try 1
William Pitcock <nenolod@atheme.org>
parents:
3411
diff
changeset
|
635 #endif |
2313 | 636 |
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
|
637 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
|
638 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
|
639 { |
3371
973cf1ae043a
it's now possible to add plugin menuentries in playlist add, del, select and misc popup menus
Giacomo Lozito <james@develia.org>
parents:
3369
diff
changeset
|
640 GtkWidget *plugins_menu_item = gtk_ui_manager_get_widget( ui_manager , path ); |
973cf1ae043a
it's now possible to add plugin menuentries in playlist add, del, select and misc popup menus
Giacomo Lozito <james@develia.org>
parents:
3369
diff
changeset
|
641 if ( plugins_menu_item ) |
973cf1ae043a
it's now possible to add plugin menuentries in playlist add, del, select and misc popup menus
Giacomo Lozito <james@develia.org>
parents:
3369
diff
changeset
|
642 { |
973cf1ae043a
it's now possible to add plugin menuentries in playlist add, del, select and misc popup menus
Giacomo Lozito <james@develia.org>
parents:
3369
diff
changeset
|
643 /* initially set count of items under plugins_menu_item to 0 */ |
973cf1ae043a
it's now possible to add plugin menuentries in playlist add, del, select and misc popup menus
Giacomo Lozito <james@develia.org>
parents:
3369
diff
changeset
|
644 g_object_set_data( G_OBJECT(plugins_menu_item) , "ic" , GINT_TO_POINTER(0) ); |
973cf1ae043a
it's now possible to add plugin menuentries in playlist add, del, select and misc popup menus
Giacomo Lozito <james@develia.org>
parents:
3369
diff
changeset
|
645 /* and since it's 0, hide the plugins_menu_item */ |
973cf1ae043a
it's now possible to add plugin menuentries in playlist add, del, select and misc popup menus
Giacomo Lozito <james@develia.org>
parents:
3369
diff
changeset
|
646 gtk_widget_hide( plugins_menu_item ); |
973cf1ae043a
it's now possible to add plugin menuentries in playlist add, del, select and misc popup menus
Giacomo Lozito <james@develia.org>
parents:
3369
diff
changeset
|
647 } |
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
|
648 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
|
649 } |
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 |
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 |
2313 | 652 void |
653 ui_manager_create_menus ( void ) | |
654 { | |
655 GError *gerr = NULL; | |
656 | |
657 /* attach xml menu definitions */ | |
658 gtk_ui_manager_add_ui_from_file( ui_manager , DATA_DIR "/ui/mainwin.ui" , &gerr ); | |
659 | |
660 if ( gerr != NULL ) | |
661 { | |
662 g_critical( "Error creating UI<ui/mainwin.ui>: %s" , gerr->message ); | |
663 g_error_free( gerr ); | |
664 return; | |
665 } | |
666 | |
667 /* create GtkMenu widgets using path from xml definitions */ | |
668 mainwin_songname_menu = ui_manager_get_popup_menu( ui_manager , "/mainwin-menus/songname-menu" ); | |
669 mainwin_visualization_menu = ui_manager_get_popup_menu( ui_manager , "/mainwin-menus/main-menu/visualization" ); | |
670 mainwin_playback_menu = ui_manager_get_popup_menu( ui_manager , "/mainwin-menus/main-menu/playback" ); | |
671 mainwin_playlist_menu = ui_manager_get_popup_menu( ui_manager , "/mainwin-menus/main-menu/playlist" ); | |
672 mainwin_view_menu = ui_manager_get_popup_menu( ui_manager , "/mainwin-menus/main-menu/view" ); | |
673 mainwin_general_menu = ui_manager_get_popup_menu( ui_manager , "/mainwin-menus/main-menu" ); | |
674 | |
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
|
675 /* 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
|
676 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
|
677 |
3418
c27b1b544026
macos: carbon menubar, try 1
William Pitcock <nenolod@atheme.org>
parents:
3411
diff
changeset
|
678 #ifdef GDK_WINDOWING_QUARTZ |
c27b1b544026
macos: carbon menubar, try 1
William Pitcock <nenolod@atheme.org>
parents:
3411
diff
changeset
|
679 gtk_ui_manager_add_ui_from_file( ui_manager , DATA_DIR "/ui/carbon-menubar.ui" , &gerr ); |
c27b1b544026
macos: carbon menubar, try 1
William Pitcock <nenolod@atheme.org>
parents:
3411
diff
changeset
|
680 |
c27b1b544026
macos: carbon menubar, try 1
William Pitcock <nenolod@atheme.org>
parents:
3411
diff
changeset
|
681 if ( gerr != NULL ) |
c27b1b544026
macos: carbon menubar, try 1
William Pitcock <nenolod@atheme.org>
parents:
3411
diff
changeset
|
682 { |
c27b1b544026
macos: carbon menubar, try 1
William Pitcock <nenolod@atheme.org>
parents:
3411
diff
changeset
|
683 g_critical( "Error creating UI<ui/carbon-menubar.ui>: %s" , gerr->message ); |
c27b1b544026
macos: carbon menubar, try 1
William Pitcock <nenolod@atheme.org>
parents:
3411
diff
changeset
|
684 g_error_free( gerr ); |
c27b1b544026
macos: carbon menubar, try 1
William Pitcock <nenolod@atheme.org>
parents:
3411
diff
changeset
|
685 return; |
c27b1b544026
macos: carbon menubar, try 1
William Pitcock <nenolod@atheme.org>
parents:
3411
diff
changeset
|
686 } |
c27b1b544026
macos: carbon menubar, try 1
William Pitcock <nenolod@atheme.org>
parents:
3411
diff
changeset
|
687 |
c27b1b544026
macos: carbon menubar, try 1
William Pitcock <nenolod@atheme.org>
parents:
3411
diff
changeset
|
688 carbon_menubar = ui_manager_get_popup_menu( ui_manager , "/carbon-menubar/main-menu" ); |
3419
47d6fb3884fb
Connect menu to Carbon.
William Pitcock <nenolod@atheme.org>
parents:
3418
diff
changeset
|
689 sync_menu_takeover_menu(GTK_MENU_SHELL(carbon_menubar)); |
3418
c27b1b544026
macos: carbon menubar, try 1
William Pitcock <nenolod@atheme.org>
parents:
3411
diff
changeset
|
690 #endif |
c27b1b544026
macos: carbon menubar, try 1
William Pitcock <nenolod@atheme.org>
parents:
3411
diff
changeset
|
691 |
2313 | 692 gtk_ui_manager_add_ui_from_file( ui_manager , DATA_DIR "/ui/playlist.ui" , &gerr ); |
693 | |
694 if ( gerr != NULL ) | |
695 { | |
696 g_critical( "Error creating UI<ui/playlist.ui>: %s" , gerr->message ); | |
697 g_error_free( gerr ); | |
698 return; | |
699 } | |
700 | |
701 playlistwin_popup_menu = ui_manager_get_popup_menu(ui_manager, "/playlist-menus/playlist-rightclick-menu"); | |
702 | |
703 playlistwin_pladd_menu = ui_manager_get_popup_menu(ui_manager, "/playlist-menus/add-menu"); | |
704 playlistwin_pldel_menu = ui_manager_get_popup_menu(ui_manager, "/playlist-menus/del-menu"); | |
705 playlistwin_plsel_menu = ui_manager_get_popup_menu(ui_manager, "/playlist-menus/select-menu"); | |
706 playlistwin_plsort_menu = ui_manager_get_popup_menu(ui_manager, "/playlist-menus/misc-menu"); | |
707 playlistwin_pllist_menu = ui_manager_get_popup_menu(ui_manager, "/playlist-menus/playlist-menu"); | |
708 | |
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
|
709 /* 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
|
710 ui_manager_create_menus_init_pmenu( "/playlist-menus/playlist-menu/plugins-menu" ); |
3371
973cf1ae043a
it's now possible to add plugin menuentries in playlist add, del, select and misc popup menus
Giacomo Lozito <james@develia.org>
parents:
3369
diff
changeset
|
711 ui_manager_create_menus_init_pmenu( "/playlist-menus/add-menu/plugins-menu" ); |
973cf1ae043a
it's now possible to add plugin menuentries in playlist add, del, select and misc popup menus
Giacomo Lozito <james@develia.org>
parents:
3369
diff
changeset
|
712 ui_manager_create_menus_init_pmenu( "/playlist-menus/del-menu/plugins-menu" ); |
973cf1ae043a
it's now possible to add plugin menuentries in playlist add, del, select and misc popup menus
Giacomo Lozito <james@develia.org>
parents:
3369
diff
changeset
|
713 ui_manager_create_menus_init_pmenu( "/playlist-menus/select-menu/plugins-menu" ); |
973cf1ae043a
it's now possible to add plugin menuentries in playlist add, del, select and misc popup menus
Giacomo Lozito <james@develia.org>
parents:
3369
diff
changeset
|
714 ui_manager_create_menus_init_pmenu( "/playlist-menus/misc-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
|
715 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
|
716 |
2313 | 717 gtk_ui_manager_add_ui_from_file( ui_manager , DATA_DIR "/ui/equalizer.ui" , &gerr ); |
718 | |
719 if ( gerr != NULL ) | |
720 { | |
721 g_critical( "Error creating UI<ui/equalizer.ui>: %s" , gerr->message ); | |
722 g_error_free( gerr ); | |
723 return; | |
724 } | |
725 | |
726 equalizerwin_presets_menu = ui_manager_get_popup_menu(ui_manager, "/equalizer-menus/preset-menu"); | |
727 | |
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
|
728 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
|
729 |
2313 | 730 return; |
731 } | |
732 | |
733 | |
734 GtkAccelGroup * | |
735 ui_manager_get_accel_group ( void ) | |
736 { | |
737 return gtk_ui_manager_get_accel_group( ui_manager ); | |
738 } | |
739 | |
740 | |
741 GtkWidget * | |
742 ui_manager_get_popup_menu ( GtkUIManager * self , const gchar * path ) | |
743 { | |
744 GtkWidget *menu_item = gtk_ui_manager_get_widget( self , path ); | |
745 | |
746 if (GTK_IS_MENU_ITEM(menu_item)) | |
747 return gtk_menu_item_get_submenu(GTK_MENU_ITEM(menu_item)); | |
748 else | |
749 return NULL; | |
750 } | |
751 | |
752 | |
753 static void | |
754 menu_popup_pos_func (GtkMenu * menu , gint * x , gint * y , gboolean * push_in , gint * point ) | |
755 { | |
756 GtkRequisition requisition; | |
757 gint screen_width; | |
758 gint screen_height; | |
759 | |
760 gtk_widget_size_request(GTK_WIDGET(menu), &requisition); | |
761 | |
762 screen_width = gdk_screen_width(); | |
763 screen_height = gdk_screen_height(); | |
764 | |
765 *x = CLAMP(point[0] - 2, 0, MAX(0, screen_width - requisition.width)); | |
766 *y = CLAMP(point[1] - 2, 0, MAX(0, screen_height - requisition.height)); | |
767 | |
768 *push_in = FALSE; | |
769 } | |
770 | |
771 | |
772 void | |
773 ui_manager_popup_menu_show ( GtkMenu * menu , gint x , gint y , guint button , guint time ) | |
774 { | |
775 gint pos[2]; | |
776 pos[0] = x; | |
777 pos[1] = y; | |
778 | |
779 gtk_menu_popup( menu , NULL , NULL , | |
780 (GtkMenuPositionFunc) menu_popup_pos_func , pos , button , time ); | |
781 } | |
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
|
782 |
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 |
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 /* 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
|
787 |
3371
973cf1ae043a
it's now possible to add plugin menuentries in playlist add, del, select and misc popup menus
Giacomo Lozito <james@develia.org>
parents:
3369
diff
changeset
|
788 #define _MP_GWID(y) gtk_ui_manager_get_widget( ui_manager , y ) |
973cf1ae043a
it's now possible to add plugin menuentries in playlist add, del, select and misc popup menus
Giacomo Lozito <james@develia.org>
parents:
3369
diff
changeset
|
789 |
973cf1ae043a
it's now possible to add plugin menuentries in playlist add, del, select and misc popup menus
Giacomo Lozito <james@develia.org>
parents:
3369
diff
changeset
|
790 static GtkWidget* |
973cf1ae043a
it's now possible to add plugin menuentries in playlist add, del, select and misc popup menus
Giacomo Lozito <james@develia.org>
parents:
3369
diff
changeset
|
791 audacious_menu_plugin_menuwid( menu_id ) |
973cf1ae043a
it's now possible to add plugin menuentries in playlist add, del, select and misc popup menus
Giacomo Lozito <james@develia.org>
parents:
3369
diff
changeset
|
792 { |
973cf1ae043a
it's now possible to add plugin menuentries in playlist add, del, select and misc popup menus
Giacomo Lozito <james@develia.org>
parents:
3369
diff
changeset
|
793 switch (menu_id) |
973cf1ae043a
it's now possible to add plugin menuentries in playlist add, del, select and misc popup menus
Giacomo Lozito <james@develia.org>
parents:
3369
diff
changeset
|
794 { |
973cf1ae043a
it's now possible to add plugin menuentries in playlist add, del, select and misc popup menus
Giacomo Lozito <james@develia.org>
parents:
3369
diff
changeset
|
795 case AUDACIOUS_MENU_MAIN: |
973cf1ae043a
it's now possible to add plugin menuentries in playlist add, del, select and misc popup menus
Giacomo Lozito <james@develia.org>
parents:
3369
diff
changeset
|
796 return _MP_GWID("/mainwin-menus/main-menu/plugins-menu"); |
973cf1ae043a
it's now possible to add plugin menuentries in playlist add, del, select and misc popup menus
Giacomo Lozito <james@develia.org>
parents:
3369
diff
changeset
|
797 case AUDACIOUS_MENU_PLAYLIST: |
973cf1ae043a
it's now possible to add plugin menuentries in playlist add, del, select and misc popup menus
Giacomo Lozito <james@develia.org>
parents:
3369
diff
changeset
|
798 return _MP_GWID("/playlist-menus/playlist-menu/plugins-menu"); |
973cf1ae043a
it's now possible to add plugin menuentries in playlist add, del, select and misc popup menus
Giacomo Lozito <james@develia.org>
parents:
3369
diff
changeset
|
799 case AUDACIOUS_MENU_PLAYLIST_RCLICK: |
973cf1ae043a
it's now possible to add plugin menuentries in playlist add, del, select and misc popup menus
Giacomo Lozito <james@develia.org>
parents:
3369
diff
changeset
|
800 return _MP_GWID("/playlist-menus/playlist-rightclick-menu/plugins-menu"); |
973cf1ae043a
it's now possible to add plugin menuentries in playlist add, del, select and misc popup menus
Giacomo Lozito <james@develia.org>
parents:
3369
diff
changeset
|
801 case AUDACIOUS_MENU_PLAYLIST_ADD: |
973cf1ae043a
it's now possible to add plugin menuentries in playlist add, del, select and misc popup menus
Giacomo Lozito <james@develia.org>
parents:
3369
diff
changeset
|
802 return _MP_GWID("/playlist-menus/add-menu/plugins-menu"); |
973cf1ae043a
it's now possible to add plugin menuentries in playlist add, del, select and misc popup menus
Giacomo Lozito <james@develia.org>
parents:
3369
diff
changeset
|
803 case AUDACIOUS_MENU_PLAYLIST_REMOVE: |
973cf1ae043a
it's now possible to add plugin menuentries in playlist add, del, select and misc popup menus
Giacomo Lozito <james@develia.org>
parents:
3369
diff
changeset
|
804 return _MP_GWID("/playlist-menus/del-menu/plugins-menu"); |
973cf1ae043a
it's now possible to add plugin menuentries in playlist add, del, select and misc popup menus
Giacomo Lozito <james@develia.org>
parents:
3369
diff
changeset
|
805 case AUDACIOUS_MENU_PLAYLIST_SELECT: |
973cf1ae043a
it's now possible to add plugin menuentries in playlist add, del, select and misc popup menus
Giacomo Lozito <james@develia.org>
parents:
3369
diff
changeset
|
806 return _MP_GWID("/playlist-menus/select-menu/plugins-menu"); |
973cf1ae043a
it's now possible to add plugin menuentries in playlist add, del, select and misc popup menus
Giacomo Lozito <james@develia.org>
parents:
3369
diff
changeset
|
807 case AUDACIOUS_MENU_PLAYLIST_MISC: |
973cf1ae043a
it's now possible to add plugin menuentries in playlist add, del, select and misc popup menus
Giacomo Lozito <james@develia.org>
parents:
3369
diff
changeset
|
808 return _MP_GWID("/playlist-menus/misc-menu/plugins-menu"); |
973cf1ae043a
it's now possible to add plugin menuentries in playlist add, del, select and misc popup menus
Giacomo Lozito <james@develia.org>
parents:
3369
diff
changeset
|
809 default: |
973cf1ae043a
it's now possible to add plugin menuentries in playlist add, del, select and misc popup menus
Giacomo Lozito <james@develia.org>
parents:
3369
diff
changeset
|
810 return NULL; |
973cf1ae043a
it's now possible to add plugin menuentries in playlist add, del, select and misc popup menus
Giacomo Lozito <james@develia.org>
parents:
3369
diff
changeset
|
811 } |
973cf1ae043a
it's now possible to add plugin menuentries in playlist add, del, select and misc popup menus
Giacomo Lozito <james@develia.org>
parents:
3369
diff
changeset
|
812 } |
973cf1ae043a
it's now possible to add plugin menuentries in playlist add, del, select and misc popup menus
Giacomo Lozito <james@develia.org>
parents:
3369
diff
changeset
|
813 |
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
|
814 |
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 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
|
816 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
|
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 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
|
819 { |
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
|
820 GtkWidget *plugins_menu = NULL; |
3371
973cf1ae043a
it's now possible to add plugin menuentries in playlist add, del, select and misc popup menus
Giacomo Lozito <james@develia.org>
parents:
3369
diff
changeset
|
821 GtkWidget *plugins_menu_item = audacious_menu_plugin_menuwid( menu_id ); |
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
|
822 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
|
823 { |
3369
676bfd7b6586
simplified the custom plugin menuentries system, expecially for ui files
Giacomo Lozito <james@develia.org>
parents:
3351
diff
changeset
|
824 gint ic = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(plugins_menu_item),"ic")); |
676bfd7b6586
simplified the custom plugin menuentries system, expecially for ui files
Giacomo Lozito <james@develia.org>
parents:
3351
diff
changeset
|
825 if ( ic == 0 ) /* no items under plugins_menu_item, create the submenu */ |
676bfd7b6586
simplified the custom plugin menuentries system, expecially for ui files
Giacomo Lozito <james@develia.org>
parents:
3351
diff
changeset
|
826 { |
676bfd7b6586
simplified the custom plugin menuentries system, expecially for ui files
Giacomo Lozito <james@develia.org>
parents:
3351
diff
changeset
|
827 plugins_menu = gtk_menu_new(); |
676bfd7b6586
simplified the custom plugin menuentries system, expecially for ui files
Giacomo Lozito <james@develia.org>
parents:
3351
diff
changeset
|
828 gtk_menu_item_set_submenu( GTK_MENU_ITEM(plugins_menu_item), plugins_menu ); |
676bfd7b6586
simplified the custom plugin menuentries system, expecially for ui files
Giacomo Lozito <james@develia.org>
parents:
3351
diff
changeset
|
829 } |
676bfd7b6586
simplified the custom plugin menuentries system, expecially for ui files
Giacomo Lozito <james@develia.org>
parents:
3351
diff
changeset
|
830 else /* items available under plugins_menu_item, pick the existing submenu */ |
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
|
831 { |
3369
676bfd7b6586
simplified the custom plugin menuentries system, expecially for ui files
Giacomo Lozito <james@develia.org>
parents:
3351
diff
changeset
|
832 plugins_menu = gtk_menu_item_get_submenu( GTK_MENU_ITEM(plugins_menu_item) ); |
676bfd7b6586
simplified the custom plugin menuentries system, expecially for ui files
Giacomo Lozito <james@develia.org>
parents:
3351
diff
changeset
|
833 if ( !plugins_menu ) return -1; |
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
|
834 } |
3369
676bfd7b6586
simplified the custom plugin menuentries system, expecially for ui files
Giacomo Lozito <james@develia.org>
parents:
3351
diff
changeset
|
835 gtk_menu_shell_append( GTK_MENU_SHELL(plugins_menu) , item ); |
676bfd7b6586
simplified the custom plugin menuentries system, expecially for ui files
Giacomo Lozito <james@develia.org>
parents:
3351
diff
changeset
|
836 gtk_widget_show( plugins_menu_item ); |
676bfd7b6586
simplified the custom plugin menuentries system, expecially for ui files
Giacomo Lozito <james@develia.org>
parents:
3351
diff
changeset
|
837 g_object_set_data( G_OBJECT(plugins_menu_item) , "ic" , GINT_TO_POINTER(++ic) ); |
676bfd7b6586
simplified the custom plugin menuentries system, expecially for ui files
Giacomo Lozito <james@develia.org>
parents:
3351
diff
changeset
|
838 return 0; /* success */ |
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
|
839 } |
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
|
840 } |
3372 | 841 return -1; /* failure */ |
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
|
842 } |
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 |
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 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
|
846 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
|
847 { |
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
|
848 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
|
849 { |
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 GtkWidget *plugins_menu = NULL; |
3371
973cf1ae043a
it's now possible to add plugin menuentries in playlist add, del, select and misc popup menus
Giacomo Lozito <james@develia.org>
parents:
3369
diff
changeset
|
851 GtkWidget *plugins_menu_item = audacious_menu_plugin_menuwid( menu_id ); |
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
|
852 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
|
853 { |
3369
676bfd7b6586
simplified the custom plugin menuentries system, expecially for ui files
Giacomo Lozito <james@develia.org>
parents:
3351
diff
changeset
|
854 gint ic = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(plugins_menu_item),"ic")); |
676bfd7b6586
simplified the custom plugin menuentries system, expecially for ui files
Giacomo Lozito <james@develia.org>
parents:
3351
diff
changeset
|
855 if ( ic > 0 ) |
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
|
856 { |
3369
676bfd7b6586
simplified the custom plugin menuentries system, expecially for ui files
Giacomo Lozito <james@develia.org>
parents:
3351
diff
changeset
|
857 plugins_menu = gtk_menu_item_get_submenu( GTK_MENU_ITEM(plugins_menu_item) ); |
676bfd7b6586
simplified the custom plugin menuentries system, expecially for ui files
Giacomo Lozito <james@develia.org>
parents:
3351
diff
changeset
|
858 if ( plugins_menu ) |
676bfd7b6586
simplified the custom plugin menuentries system, expecially for ui files
Giacomo Lozito <james@develia.org>
parents:
3351
diff
changeset
|
859 { |
676bfd7b6586
simplified the custom plugin menuentries system, expecially for ui files
Giacomo Lozito <james@develia.org>
parents:
3351
diff
changeset
|
860 /* remove the plugin-added entry */ |
676bfd7b6586
simplified the custom plugin menuentries system, expecially for ui files
Giacomo Lozito <james@develia.org>
parents:
3351
diff
changeset
|
861 gtk_container_remove( GTK_CONTAINER(plugins_menu) , item ); |
676bfd7b6586
simplified the custom plugin menuentries system, expecially for ui files
Giacomo Lozito <james@develia.org>
parents:
3351
diff
changeset
|
862 g_object_set_data( G_OBJECT(plugins_menu_item) , "ic" , GINT_TO_POINTER(--ic) ); |
676bfd7b6586
simplified the custom plugin menuentries system, expecially for ui files
Giacomo Lozito <james@develia.org>
parents:
3351
diff
changeset
|
863 if ( ic == 0 ) /* if the menu is empty now, destroy it */ |
676bfd7b6586
simplified the custom plugin menuentries system, expecially for ui files
Giacomo Lozito <james@develia.org>
parents:
3351
diff
changeset
|
864 { |
676bfd7b6586
simplified the custom plugin menuentries system, expecially for ui files
Giacomo Lozito <james@develia.org>
parents:
3351
diff
changeset
|
865 gtk_menu_item_remove_submenu( GTK_MENU_ITEM(plugins_menu_item) ); |
676bfd7b6586
simplified the custom plugin menuentries system, expecially for ui files
Giacomo Lozito <james@develia.org>
parents:
3351
diff
changeset
|
866 gtk_widget_destroy( plugins_menu ); |
676bfd7b6586
simplified the custom plugin menuentries system, expecially for ui files
Giacomo Lozito <james@develia.org>
parents:
3351
diff
changeset
|
867 gtk_widget_hide( plugins_menu_item ); |
676bfd7b6586
simplified the custom plugin menuentries system, expecially for ui files
Giacomo Lozito <james@develia.org>
parents:
3351
diff
changeset
|
868 } |
676bfd7b6586
simplified the custom plugin menuentries system, expecially for ui files
Giacomo Lozito <james@develia.org>
parents:
3351
diff
changeset
|
869 return 0; /* success */ |
676bfd7b6586
simplified the custom plugin menuentries system, expecially for ui files
Giacomo Lozito <james@develia.org>
parents:
3351
diff
changeset
|
870 } |
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
|
871 } |
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
|
872 } |
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 } |
3372 | 874 return -1; /* failure */ |
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
|
875 } |