Mercurial > audlegacy
annotate src/audacious/ui_manager.c @ 4011:c19c8d47e221
vseparator in fileinfo came back
| author | Eugene Zagidullin <e.asphyx@gmail.com> |
|---|---|
| date | Sun, 25 Nov 2007 04:44:40 +0300 |
| parents | 0fb35f6cc4b7 |
| children | d3b549e75380 |
| 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 | |
|
3599
24ae9b303a9d
removed lastfm from the core, rewriting it as a plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
3419
diff
changeset
|
400 { "plugins", NULL , N_("Plugin services") }, |
|
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
|
401 |
| 2313 | 402 { "preferences", GTK_STOCK_PREFERENCES , N_("Preferences"), "<Ctrl>P", |
| 403 N_("Open preferences window"), G_CALLBACK(action_preferences) }, | |
| 404 | |
| 405 { "quit", GTK_STOCK_QUIT , N_("_Quit"), NULL, | |
| 406 N_("Quit Audacious"), G_CALLBACK(action_quit) }, | |
| 407 | |
| 408 { "ab set", NULL , N_("Set A-B"), "A", | |
| 409 N_("Set A-B"), G_CALLBACK(action_ab_set) }, | |
| 410 | |
| 2598 | 411 { "ab clear", NULL , N_("Clear A-B"), "<Shift>A", |
| 2313 | 412 N_("Clear A-B"), G_CALLBACK(action_ab_clear) }, |
| 413 | |
| 414 { "jump to playlist start", GTK_STOCK_GOTO_TOP , N_("Jump to Playlist Start"), "<Ctrl>Z", | |
| 415 N_("Jump to Playlist Start"), G_CALLBACK(action_jump_to_playlist_start) }, | |
| 416 | |
| 417 { "jump to file", GTK_STOCK_JUMP_TO , N_("Jump to File"), "J", | |
| 418 N_("Jump to File"), G_CALLBACK(action_jump_to_file) }, | |
| 419 | |
| 420 { "jump to time", GTK_STOCK_JUMP_TO , N_("Jump to Time"), "<Ctrl>J", | |
| 421 N_("Jump to Time"), G_CALLBACK(action_jump_to_time) }, | |
| 422 | |
| 423 { "queue toggle", AUD_STOCK_QUEUETOGGLE , N_("Queue Toggle"), "Q", | |
| 424 N_("Enables/disables the entry in the playlist's queue."), | |
| 425 G_CALLBACK(action_queue_toggle) }, | |
| 426 }; | |
| 427 | |
| 428 | |
| 429 static GtkActionEntry action_entries_equalizer[] = { | |
| 430 | |
| 431 { "equ preset load menu", NULL, N_("Load") }, | |
| 432 { "equ preset import menu", NULL, N_("Import") }, | |
| 433 { "equ preset save menu", NULL, N_("Save") }, | |
| 434 { "equ preset delete menu", NULL, N_("Delete") }, | |
| 435 | |
| 436 { "equ load preset", NULL, N_("Preset"), NULL, | |
| 437 N_("Load preset"), G_CALLBACK(action_equ_load_preset) }, | |
| 438 | |
| 439 { "equ load auto preset", NULL, N_("Auto-load preset"), NULL, | |
| 440 N_("Load auto-load preset"), G_CALLBACK(action_equ_load_auto_preset) }, | |
| 441 | |
| 442 { "equ load default preset", NULL, N_("Default"), NULL, | |
| 443 N_("Load default preset into equalizer"), G_CALLBACK(action_equ_load_default_preset) }, | |
| 444 | |
| 445 { "equ zero preset", NULL, N_("Zero"), NULL, | |
| 446 N_("Set equalizer preset levels to zero"), G_CALLBACK(action_equ_zero_preset) }, | |
| 447 | |
| 448 { "equ load preset file", NULL, N_("From file"), NULL, | |
| 449 N_("Load preset from file"), G_CALLBACK(action_equ_load_preset_file) }, | |
| 450 | |
| 451 { "equ load preset eqf", NULL, N_("From WinAMP EQF file"), NULL, | |
| 452 N_("Load preset from WinAMP EQF file"), G_CALLBACK(action_equ_load_preset_eqf) }, | |
| 453 | |
| 454 { "equ import winamp presets", NULL, N_("WinAMP Presets"), NULL, | |
| 455 N_("Import WinAMP presets"), G_CALLBACK(action_equ_import_winamp_presets) }, | |
| 456 | |
| 457 { "equ save preset", NULL, N_("Preset"), NULL, | |
| 458 N_("Save preset"), G_CALLBACK(action_equ_save_preset) }, | |
| 459 | |
| 460 { "equ save auto preset", NULL, N_("Auto-load preset"), NULL, | |
| 461 N_("Save auto-load preset"), G_CALLBACK(action_equ_save_auto_preset) }, | |
| 462 | |
| 463 { "equ save default preset", NULL, N_("Default"), NULL, | |
| 464 N_("Save default preset"), G_CALLBACK(action_equ_save_default_preset) }, | |
| 465 | |
| 466 { "equ save preset file", NULL, N_("To file"), NULL, | |
| 467 N_("Save preset to file"), G_CALLBACK(action_equ_save_preset_file) }, | |
| 468 | |
| 469 { "equ save preset eqf", NULL, N_("To WinAMP EQF file"), NULL, | |
| 470 N_("Save preset to WinAMP EQF file"), G_CALLBACK(action_equ_save_preset_eqf) }, | |
| 471 | |
| 472 { "equ delete preset", NULL, N_("Preset"), NULL, | |
| 473 N_("Delete preset"), G_CALLBACK(action_equ_delete_preset) }, | |
| 474 | |
| 475 { "equ delete auto preset", NULL, N_("Auto-load preset"), NULL, | |
| 476 N_("Delete auto-load preset"), G_CALLBACK(action_equ_delete_auto_preset) } | |
| 477 }; | |
| 478 | |
| 479 | |
| 480 | |
| 481 /* ***************************** */ | |
| 482 | |
| 483 | |
| 484 static GtkActionGroup * | |
| 485 ui_manager_new_action_group( const gchar * group_name ) | |
| 486 { | |
| 487 GtkActionGroup *group = gtk_action_group_new( group_name ); | |
| 488 gtk_action_group_set_translation_domain( group , PACKAGE_NAME ); | |
| 489 return group; | |
| 490 } | |
| 491 | |
| 492 void | |
| 493 ui_manager_init ( void ) | |
| 494 { | |
| 495 /* toggle actions */ | |
| 496 toggleaction_group_others = ui_manager_new_action_group("toggleaction_others"); | |
| 497 gtk_action_group_add_toggle_actions( | |
| 498 toggleaction_group_others , toggleaction_entries_others , | |
| 499 G_N_ELEMENTS(toggleaction_entries_others) , NULL ); | |
| 500 | |
| 501 /* radio actions */ | |
| 502 radioaction_group_anamode = ui_manager_new_action_group("radioaction_anamode"); | |
| 503 gtk_action_group_add_radio_actions( | |
| 504 radioaction_group_anamode , radioaction_entries_anamode , | |
| 505 G_N_ELEMENTS(radioaction_entries_anamode) , 0 , G_CALLBACK(action_anamode) , NULL ); | |
| 506 | |
| 507 radioaction_group_anatype = ui_manager_new_action_group("radioaction_anatype"); | |
| 508 gtk_action_group_add_radio_actions( | |
| 509 radioaction_group_anatype , radioaction_entries_anatype , | |
| 510 G_N_ELEMENTS(radioaction_entries_anatype) , 0 , G_CALLBACK(action_anatype) , NULL ); | |
| 511 | |
| 512 radioaction_group_scomode = ui_manager_new_action_group("radioaction_scomode"); | |
| 513 gtk_action_group_add_radio_actions( | |
| 514 radioaction_group_scomode , radioaction_entries_scomode , | |
| 515 G_N_ELEMENTS(radioaction_entries_scomode) , 0 , G_CALLBACK(action_scomode) , NULL ); | |
| 516 | |
| 517 radioaction_group_vprmode = ui_manager_new_action_group("radioaction_vprmode"); | |
| 518 gtk_action_group_add_radio_actions( | |
| 519 radioaction_group_vprmode , radioaction_entries_vprmode , | |
| 520 G_N_ELEMENTS(radioaction_entries_vprmode) , 0 , G_CALLBACK(action_vprmode) , NULL ); | |
| 521 | |
| 522 radioaction_group_wshmode = ui_manager_new_action_group("radioaction_wshmode"); | |
| 523 gtk_action_group_add_radio_actions( | |
| 524 radioaction_group_wshmode , radioaction_entries_wshmode , | |
| 525 G_N_ELEMENTS(radioaction_entries_wshmode) , 0 , G_CALLBACK(action_wshmode) , NULL ); | |
| 526 | |
| 527 radioaction_group_refrate = ui_manager_new_action_group("radioaction_refrate"); | |
| 528 gtk_action_group_add_radio_actions( | |
| 529 radioaction_group_refrate , radioaction_entries_refrate , | |
| 530 G_N_ELEMENTS(radioaction_entries_refrate) , 0 , G_CALLBACK(action_refrate) , NULL ); | |
| 531 | |
| 532 radioaction_group_anafoff = ui_manager_new_action_group("radioaction_anafoff"); | |
| 533 gtk_action_group_add_radio_actions( | |
| 534 radioaction_group_anafoff , radioaction_entries_anafoff , | |
| 535 G_N_ELEMENTS(radioaction_entries_anafoff) , 0 , G_CALLBACK(action_anafoff) , NULL ); | |
| 536 | |
| 537 radioaction_group_peafoff = ui_manager_new_action_group("radioaction_peafoff"); | |
| 538 gtk_action_group_add_radio_actions( | |
| 539 radioaction_group_peafoff , radioaction_entries_peafoff , | |
| 540 G_N_ELEMENTS(radioaction_entries_peafoff) , 0 , G_CALLBACK(action_peafoff) , NULL ); | |
| 541 | |
| 542 radioaction_group_vismode = ui_manager_new_action_group("radioaction_vismode"); | |
| 543 gtk_action_group_add_radio_actions( | |
| 544 radioaction_group_vismode , radioaction_entries_vismode , | |
| 545 G_N_ELEMENTS(radioaction_entries_vismode) , 0 , G_CALLBACK(action_vismode) , NULL ); | |
| 546 | |
| 547 radioaction_group_viewtime = ui_manager_new_action_group("radioaction_viewtime"); | |
| 548 gtk_action_group_add_radio_actions( | |
| 549 radioaction_group_viewtime , radioaction_entries_viewtime , | |
| 550 G_N_ELEMENTS(radioaction_entries_viewtime) , 0 , G_CALLBACK(action_viewtime) , NULL ); | |
| 551 | |
| 552 /* normal actions */ | |
| 553 action_group_playback = ui_manager_new_action_group("action_playback"); | |
| 554 gtk_action_group_add_actions( | |
| 555 action_group_playback , action_entries_playback , | |
| 556 G_N_ELEMENTS(action_entries_playback) , NULL ); | |
| 557 | |
| 558 action_group_playlist = ui_manager_new_action_group("action_playlist"); | |
| 559 gtk_action_group_add_actions( | |
| 560 action_group_playlist , action_entries_playlist , | |
| 561 G_N_ELEMENTS(action_entries_playlist) , NULL ); | |
| 562 | |
| 563 action_group_visualization = ui_manager_new_action_group("action_visualization"); | |
| 564 gtk_action_group_add_actions( | |
| 565 action_group_visualization , action_entries_visualization , | |
| 566 G_N_ELEMENTS(action_entries_visualization) , NULL ); | |
| 567 | |
| 568 action_group_view = ui_manager_new_action_group("action_view"); | |
| 569 gtk_action_group_add_actions( | |
| 570 action_group_view , action_entries_view , | |
| 571 G_N_ELEMENTS(action_entries_view) , NULL ); | |
| 572 | |
| 573 action_group_others = ui_manager_new_action_group("action_others"); | |
| 574 gtk_action_group_add_actions( | |
| 575 action_group_others , action_entries_others , | |
| 576 G_N_ELEMENTS(action_entries_others) , NULL ); | |
| 577 | |
| 578 action_group_playlist_add = ui_manager_new_action_group("action_playlist_add"); | |
| 579 gtk_action_group_add_actions( | |
| 580 action_group_playlist_add, action_entries_playlist_add, | |
| 581 G_N_ELEMENTS(action_entries_playlist_add), NULL ); | |
| 582 | |
| 583 action_group_playlist_select = ui_manager_new_action_group("action_playlist_select"); | |
| 584 gtk_action_group_add_actions( | |
| 585 action_group_playlist_select, action_entries_playlist_select, | |
| 586 G_N_ELEMENTS(action_entries_playlist_select), NULL ); | |
| 587 | |
| 588 action_group_playlist_delete = ui_manager_new_action_group("action_playlist_delete"); | |
| 589 gtk_action_group_add_actions( | |
| 590 action_group_playlist_delete, action_entries_playlist_delete, | |
| 591 G_N_ELEMENTS(action_entries_playlist_delete), NULL ); | |
| 592 | |
| 593 action_group_playlist_sort = ui_manager_new_action_group("action_playlist_sort"); | |
| 594 gtk_action_group_add_actions( | |
| 595 action_group_playlist_sort, action_entries_playlist_sort, | |
| 596 G_N_ELEMENTS(action_entries_playlist_sort), NULL ); | |
| 597 | |
| 598 action_group_equalizer = ui_manager_new_action_group("action_equalizer"); | |
| 599 gtk_action_group_add_actions( | |
| 600 action_group_equalizer, action_entries_equalizer, | |
| 601 G_N_ELEMENTS(action_entries_equalizer), NULL); | |
| 602 | |
| 603 /* ui */ | |
| 604 ui_manager = gtk_ui_manager_new(); | |
| 605 gtk_ui_manager_insert_action_group( ui_manager , toggleaction_group_others , 0 ); | |
| 606 gtk_ui_manager_insert_action_group( ui_manager , radioaction_group_anamode , 0 ); | |
| 607 gtk_ui_manager_insert_action_group( ui_manager , radioaction_group_anatype , 0 ); | |
| 608 gtk_ui_manager_insert_action_group( ui_manager , radioaction_group_scomode , 0 ); | |
| 609 gtk_ui_manager_insert_action_group( ui_manager , radioaction_group_vprmode , 0 ); | |
| 610 gtk_ui_manager_insert_action_group( ui_manager , radioaction_group_wshmode , 0 ); | |
| 611 gtk_ui_manager_insert_action_group( ui_manager , radioaction_group_refrate , 0 ); | |
| 612 gtk_ui_manager_insert_action_group( ui_manager , radioaction_group_anafoff , 0 ); | |
| 613 gtk_ui_manager_insert_action_group( ui_manager , radioaction_group_peafoff , 0 ); | |
| 614 gtk_ui_manager_insert_action_group( ui_manager , radioaction_group_vismode , 0 ); | |
| 615 gtk_ui_manager_insert_action_group( ui_manager , radioaction_group_viewtime , 0 ); | |
| 616 gtk_ui_manager_insert_action_group( ui_manager , action_group_playback , 0 ); | |
| 617 gtk_ui_manager_insert_action_group( ui_manager , action_group_playlist , 0 ); | |
| 618 gtk_ui_manager_insert_action_group( ui_manager , action_group_visualization , 0 ); | |
| 619 gtk_ui_manager_insert_action_group( ui_manager , action_group_view , 0 ); | |
| 620 gtk_ui_manager_insert_action_group( ui_manager , action_group_others , 0 ); | |
| 621 gtk_ui_manager_insert_action_group( ui_manager , action_group_playlist_add , 0 ); | |
| 622 gtk_ui_manager_insert_action_group( ui_manager , action_group_playlist_select , 0 ); | |
| 623 gtk_ui_manager_insert_action_group( ui_manager , action_group_playlist_delete , 0 ); | |
| 624 gtk_ui_manager_insert_action_group( ui_manager , action_group_playlist_sort , 0 ); | |
| 625 gtk_ui_manager_insert_action_group( ui_manager , action_group_equalizer , 0 ); | |
| 626 | |
| 627 return; | |
| 628 } | |
| 629 | |
|
3418
c27b1b544026
macos: carbon menubar, try 1
William Pitcock <nenolod@atheme.org>
parents:
3411
diff
changeset
|
630 #ifdef GDK_WINDOWING_QUARTZ |
|
c27b1b544026
macos: carbon menubar, try 1
William Pitcock <nenolod@atheme.org>
parents:
3411
diff
changeset
|
631 static GtkWidget *carbon_menubar; |
|
c27b1b544026
macos: carbon menubar, try 1
William Pitcock <nenolod@atheme.org>
parents:
3411
diff
changeset
|
632 #endif |
| 2313 | 633 |
|
3306
404ffedef3e1
added support for plugin-customizable menus; plugins can add their own entries (and even submenus) in main and playlist popup menus
Giacomo Lozito <james@develia.org>
parents:
3251
diff
changeset
|
634 static void |
|
404ffedef3e1
added support for plugin-customizable menus; plugins can add their own entries (and even submenus) in main and playlist popup menus
Giacomo Lozito <james@develia.org>
parents:
3251
diff
changeset
|
635 ui_manager_create_menus_init_pmenu( gchar * path ) |
|
404ffedef3e1
added support for plugin-customizable menus; plugins can add their own entries (and even submenus) in main and playlist popup menus
Giacomo Lozito <james@develia.org>
parents:
3251
diff
changeset
|
636 { |
|
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
|
637 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
|
638 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
|
639 { |
|
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 /* 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
|
641 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
|
642 /* 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
|
643 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
|
644 } |
|
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
|
645 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
|
646 } |
|
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 |
| 2313 | 649 void |
| 650 ui_manager_create_menus ( void ) | |
| 651 { | |
| 652 GError *gerr = NULL; | |
| 653 | |
| 654 /* attach xml menu definitions */ | |
| 655 gtk_ui_manager_add_ui_from_file( ui_manager , DATA_DIR "/ui/mainwin.ui" , &gerr ); | |
| 656 | |
| 657 if ( gerr != NULL ) | |
| 658 { | |
| 659 g_critical( "Error creating UI<ui/mainwin.ui>: %s" , gerr->message ); | |
| 660 g_error_free( gerr ); | |
| 661 return; | |
| 662 } | |
| 663 | |
| 664 /* create GtkMenu widgets using path from xml definitions */ | |
| 665 mainwin_songname_menu = ui_manager_get_popup_menu( ui_manager , "/mainwin-menus/songname-menu" ); | |
| 666 mainwin_visualization_menu = ui_manager_get_popup_menu( ui_manager , "/mainwin-menus/main-menu/visualization" ); | |
| 667 mainwin_playback_menu = ui_manager_get_popup_menu( ui_manager , "/mainwin-menus/main-menu/playback" ); | |
| 668 mainwin_playlist_menu = ui_manager_get_popup_menu( ui_manager , "/mainwin-menus/main-menu/playlist" ); | |
| 669 mainwin_view_menu = ui_manager_get_popup_menu( ui_manager , "/mainwin-menus/main-menu/view" ); | |
| 670 mainwin_general_menu = ui_manager_get_popup_menu( ui_manager , "/mainwin-menus/main-menu" ); | |
| 671 | |
|
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
|
672 /* 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
|
673 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
|
674 |
|
3418
c27b1b544026
macos: carbon menubar, try 1
William Pitcock <nenolod@atheme.org>
parents:
3411
diff
changeset
|
675 #ifdef GDK_WINDOWING_QUARTZ |
|
c27b1b544026
macos: carbon menubar, try 1
William Pitcock <nenolod@atheme.org>
parents:
3411
diff
changeset
|
676 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
|
677 |
|
c27b1b544026
macos: carbon menubar, try 1
William Pitcock <nenolod@atheme.org>
parents:
3411
diff
changeset
|
678 if ( gerr != NULL ) |
|
c27b1b544026
macos: carbon menubar, try 1
William Pitcock <nenolod@atheme.org>
parents:
3411
diff
changeset
|
679 { |
|
c27b1b544026
macos: carbon menubar, try 1
William Pitcock <nenolod@atheme.org>
parents:
3411
diff
changeset
|
680 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
|
681 g_error_free( gerr ); |
|
c27b1b544026
macos: carbon menubar, try 1
William Pitcock <nenolod@atheme.org>
parents:
3411
diff
changeset
|
682 return; |
|
c27b1b544026
macos: carbon menubar, try 1
William Pitcock <nenolod@atheme.org>
parents:
3411
diff
changeset
|
683 } |
|
c27b1b544026
macos: carbon menubar, try 1
William Pitcock <nenolod@atheme.org>
parents:
3411
diff
changeset
|
684 |
|
c27b1b544026
macos: carbon menubar, try 1
William Pitcock <nenolod@atheme.org>
parents:
3411
diff
changeset
|
685 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
|
686 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
|
687 #endif |
|
c27b1b544026
macos: carbon menubar, try 1
William Pitcock <nenolod@atheme.org>
parents:
3411
diff
changeset
|
688 |
| 2313 | 689 gtk_ui_manager_add_ui_from_file( ui_manager , DATA_DIR "/ui/playlist.ui" , &gerr ); |
| 690 | |
| 691 if ( gerr != NULL ) | |
| 692 { | |
| 693 g_critical( "Error creating UI<ui/playlist.ui>: %s" , gerr->message ); | |
| 694 g_error_free( gerr ); | |
| 695 return; | |
| 696 } | |
| 697 | |
| 698 playlistwin_popup_menu = ui_manager_get_popup_menu(ui_manager, "/playlist-menus/playlist-rightclick-menu"); | |
| 699 | |
| 700 playlistwin_pladd_menu = ui_manager_get_popup_menu(ui_manager, "/playlist-menus/add-menu"); | |
| 701 playlistwin_pldel_menu = ui_manager_get_popup_menu(ui_manager, "/playlist-menus/del-menu"); | |
| 702 playlistwin_plsel_menu = ui_manager_get_popup_menu(ui_manager, "/playlist-menus/select-menu"); | |
| 703 playlistwin_plsort_menu = ui_manager_get_popup_menu(ui_manager, "/playlist-menus/misc-menu"); | |
| 704 playlistwin_pllist_menu = ui_manager_get_popup_menu(ui_manager, "/playlist-menus/playlist-menu"); | |
| 705 | |
|
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
|
706 /* 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
|
707 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
|
708 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
|
709 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
|
710 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
|
711 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
|
712 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
|
713 |
| 2313 | 714 gtk_ui_manager_add_ui_from_file( ui_manager , DATA_DIR "/ui/equalizer.ui" , &gerr ); |
| 715 | |
| 716 if ( gerr != NULL ) | |
| 717 { | |
| 718 g_critical( "Error creating UI<ui/equalizer.ui>: %s" , gerr->message ); | |
| 719 g_error_free( gerr ); | |
| 720 return; | |
| 721 } | |
| 722 | |
| 723 equalizerwin_presets_menu = ui_manager_get_popup_menu(ui_manager, "/equalizer-menus/preset-menu"); | |
| 724 | |
|
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
|
725 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
|
726 |
| 2313 | 727 return; |
| 728 } | |
| 729 | |
| 730 | |
| 731 GtkAccelGroup * | |
| 732 ui_manager_get_accel_group ( void ) | |
| 733 { | |
| 734 return gtk_ui_manager_get_accel_group( ui_manager ); | |
| 735 } | |
| 736 | |
| 737 | |
| 738 GtkWidget * | |
| 739 ui_manager_get_popup_menu ( GtkUIManager * self , const gchar * path ) | |
| 740 { | |
| 741 GtkWidget *menu_item = gtk_ui_manager_get_widget( self , path ); | |
| 742 | |
| 743 if (GTK_IS_MENU_ITEM(menu_item)) | |
| 744 return gtk_menu_item_get_submenu(GTK_MENU_ITEM(menu_item)); | |
| 745 else | |
| 746 return NULL; | |
| 747 } | |
| 748 | |
| 749 | |
| 750 static void | |
| 751 menu_popup_pos_func (GtkMenu * menu , gint * x , gint * y , gboolean * push_in , gint * point ) | |
| 752 { | |
| 753 GtkRequisition requisition; | |
| 754 gint screen_width; | |
| 755 gint screen_height; | |
| 756 | |
| 757 gtk_widget_size_request(GTK_WIDGET(menu), &requisition); | |
| 758 | |
| 759 screen_width = gdk_screen_width(); | |
| 760 screen_height = gdk_screen_height(); | |
| 761 | |
| 762 *x = CLAMP(point[0] - 2, 0, MAX(0, screen_width - requisition.width)); | |
| 763 *y = CLAMP(point[1] - 2, 0, MAX(0, screen_height - requisition.height)); | |
| 764 | |
| 765 *push_in = FALSE; | |
| 766 } | |
| 767 | |
| 768 | |
| 769 void | |
| 770 ui_manager_popup_menu_show ( GtkMenu * menu , gint x , gint y , guint button , guint time ) | |
| 771 { | |
| 772 gint pos[2]; | |
| 773 pos[0] = x; | |
| 774 pos[1] = y; | |
| 775 | |
| 776 gtk_menu_popup( menu , NULL , NULL , | |
| 777 (GtkMenuPositionFunc) menu_popup_pos_func , pos , button , time ); | |
| 778 } | |
|
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
|
779 |
|
404ffedef3e1
added support for plugin-customizable menus; plugins can add their own entries (and even submenus) in main and playlist popup menus
Giacomo Lozito <james@develia.org>
parents:
3251
diff
changeset
|
780 |
|
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 |
|
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 /* 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
|
784 |
|
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
|
785 #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
|
786 |
|
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
|
787 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
|
788 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
|
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 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
|
791 { |
|
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 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
|
793 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
|
794 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
|
795 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
|
796 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
|
797 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
|
798 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
|
799 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
|
800 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
|
801 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
|
802 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
|
803 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
|
804 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
|
805 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
|
806 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
|
807 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
|
808 } |
|
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 } |
|
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 |
|
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
|
811 |
|
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 gint |
|
3751
0fb35f6cc4b7
PluginMenu API is exported now. No changes required to plugins.
William Pitcock <nenolod@atheme.org>
parents:
3599
diff
changeset
|
813 menu_plugin_item_add( gint menu_id , GtkWidget * 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
|
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 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
|
816 { |
|
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
|
817 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
|
818 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
|
819 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
|
820 { |
|
3369
676bfd7b6586
simplified the custom plugin menuentries system, expecially for ui files
Giacomo Lozito <james@develia.org>
parents:
3351
diff
changeset
|
821 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
|
822 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
|
823 { |
|
676bfd7b6586
simplified the custom plugin menuentries system, expecially for ui files
Giacomo Lozito <james@develia.org>
parents:
3351
diff
changeset
|
824 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
|
825 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
|
826 } |
|
676bfd7b6586
simplified the custom plugin menuentries system, expecially for ui files
Giacomo Lozito <james@develia.org>
parents:
3351
diff
changeset
|
827 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
|
828 { |
|
3369
676bfd7b6586
simplified the custom plugin menuentries system, expecially for ui files
Giacomo Lozito <james@develia.org>
parents:
3351
diff
changeset
|
829 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
|
830 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
|
831 } |
|
3369
676bfd7b6586
simplified the custom plugin menuentries system, expecially for ui files
Giacomo Lozito <james@develia.org>
parents:
3351
diff
changeset
|
832 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
|
833 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
|
834 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
|
835 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
|
836 } |
|
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
|
837 } |
| 3372 | 838 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
|
839 } |
|
404ffedef3e1
added support for plugin-customizable menus; plugins can add their own entries (and even submenus) in main and playlist popup menus
Giacomo Lozito <james@develia.org>
parents:
3251
diff
changeset
|
840 |
|
404ffedef3e1
added support for plugin-customizable menus; plugins can add their own entries (and even submenus) in main and playlist popup menus
Giacomo Lozito <james@develia.org>
parents:
3251
diff
changeset
|
841 |
|
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 gint |
|
3751
0fb35f6cc4b7
PluginMenu API is exported now. No changes required to plugins.
William Pitcock <nenolod@atheme.org>
parents:
3599
diff
changeset
|
843 menu_plugin_item_remove( gint menu_id , GtkWidget * 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
|
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 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
|
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 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
|
848 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
|
849 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
|
850 { |
|
3369
676bfd7b6586
simplified the custom plugin menuentries system, expecially for ui files
Giacomo Lozito <james@develia.org>
parents:
3351
diff
changeset
|
851 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
|
852 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
|
853 { |
|
3369
676bfd7b6586
simplified the custom plugin menuentries system, expecially for ui files
Giacomo Lozito <james@develia.org>
parents:
3351
diff
changeset
|
854 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
|
855 if ( plugins_menu ) |
|
676bfd7b6586
simplified the custom plugin menuentries system, expecially for ui files
Giacomo Lozito <james@develia.org>
parents:
3351
diff
changeset
|
856 { |
|
676bfd7b6586
simplified the custom plugin menuentries system, expecially for ui files
Giacomo Lozito <james@develia.org>
parents:
3351
diff
changeset
|
857 /* 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
|
858 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
|
859 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
|
860 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
|
861 { |
|
676bfd7b6586
simplified the custom plugin menuentries system, expecially for ui files
Giacomo Lozito <james@develia.org>
parents:
3351
diff
changeset
|
862 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
|
863 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
|
864 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
|
865 } |
|
676bfd7b6586
simplified the custom plugin menuentries system, expecially for ui files
Giacomo Lozito <james@develia.org>
parents:
3351
diff
changeset
|
866 return 0; /* success */ |
|
676bfd7b6586
simplified the custom plugin menuentries system, expecially for ui files
Giacomo Lozito <james@develia.org>
parents:
3351
diff
changeset
|
867 } |
|
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
|
868 } |
|
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
|
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 } |
| 3372 | 871 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
|
872 } |
