43 |
43 |
const gchar * icon;
|
44 |
44 |
guint key;
|
45 |
45 |
GdkModifierType mod;
|
|
46 |
const gchar * identifier;
|
46 |
47 |
|
47 |
48 |
/* for normal items */
|
48 |
49 |
void (* func) (void);
|
... | ... | |
156 |
157 |
static void autoscroll_set (gboolean on) {aud_set_bool ("gtkui", "autoscroll", on); }
|
157 |
158 |
|
158 |
159 |
static const struct MenuItem file_items[] = {
|
159 |
|
{N_("_Open Files ..."), GTK_STOCK_OPEN, 'o', CTRL, .func = open_files},
|
160 |
|
{N_("Open _URL ..."), GTK_STOCK_NETWORK, 'l', CTRL, .func = open_url},
|
161 |
|
{N_("_Add Files ..."), GTK_STOCK_ADD, 'o', SHIFT | CTRL, .func = add_files},
|
162 |
|
{N_("Add U_RL ..."), GTK_STOCK_NETWORK, 'l', SHIFT | CTRL, .func = add_url},
|
|
160 |
{N_("_Open Files ..."), GTK_STOCK_OPEN, 'o', CTRL, "open_files", .func = open_files},
|
|
161 |
{N_("Open _URL ..."), GTK_STOCK_NETWORK, 'l', CTRL, "open_url", .func = open_url},
|
|
162 |
{N_("_Add Files ..."), GTK_STOCK_ADD, 'o', SHIFT | CTRL, "add_files", .func = add_files},
|
|
163 |
{N_("Add U_RL ..."), GTK_STOCK_NETWORK, 'l', SHIFT | CTRL, "add_url", .func = add_url},
|
163 |
164 |
{.sep = TRUE},
|
164 |
|
{N_("_Search Library"), GTK_STOCK_FIND, 'y', CTRL, .func = activate_search_tool},
|
|
165 |
{N_("_Search Library"), GTK_STOCK_FIND, 'y', CTRL, "search_library", .func = activate_search_tool},
|
165 |
166 |
{.sep = TRUE},
|
166 |
|
{N_("A_bout ..."), GTK_STOCK_ABOUT, .func = audgui_show_about_window},
|
167 |
|
{N_("_Preferences ..."), GTK_STOCK_PREFERENCES, .func = aud_show_prefs_window},
|
168 |
|
{N_("_Quit"), GTK_STOCK_QUIT, 'q', CTRL, .func = aud_drct_quit}};
|
|
167 |
{N_("A_bout ..."), GTK_STOCK_ABOUT, .identifier = "about", .func = audgui_show_about_window},
|
|
168 |
{N_("_Preferences ..."), GTK_STOCK_PREFERENCES, .identifier = "preferences", .func = aud_show_prefs_window},
|
|
169 |
{N_("_Quit"), GTK_STOCK_QUIT, 'q', CTRL, "quit", .func = aud_drct_quit}};
|
169 |
170 |
|
170 |
171 |
static const struct MenuItem playback_items[] = {
|
171 |
|
{N_("_Play"), GTK_STOCK_MEDIA_PLAY, GDK_KEY_Return, CTRL, .func = aud_drct_play},
|
172 |
|
{N_("Paus_e"), GTK_STOCK_MEDIA_PAUSE, ',', CTRL, .func = aud_drct_pause},
|
173 |
|
{N_("_Stop"), GTK_STOCK_MEDIA_STOP, '.', CTRL, .func = aud_drct_stop},
|
174 |
|
{N_("Pre_vious"), GTK_STOCK_MEDIA_PREVIOUS, GDK_KEY_Up, ALT, .func = aud_drct_pl_prev},
|
175 |
|
{N_("_Next"), GTK_STOCK_MEDIA_NEXT, GDK_KEY_Down, ALT, .func = aud_drct_pl_next},
|
|
172 |
{N_("_Play"), GTK_STOCK_MEDIA_PLAY, GDK_KEY_Return, CTRL, "play", .func = aud_drct_play},
|
|
173 |
{N_("Paus_e"), GTK_STOCK_MEDIA_PAUSE, ',', CTRL, "pause", .func = aud_drct_pause},
|
|
174 |
{N_("_Stop"), GTK_STOCK_MEDIA_STOP, '.', CTRL, "stop", .func = aud_drct_stop},
|
|
175 |
{N_("Pre_vious"), GTK_STOCK_MEDIA_PREVIOUS, GDK_KEY_Up, ALT, "previous", .func = aud_drct_pl_prev},
|
|
176 |
{N_("_Next"), GTK_STOCK_MEDIA_NEXT, GDK_KEY_Down, ALT, "next", .func = aud_drct_pl_next},
|
176 |
177 |
{.sep = TRUE},
|
177 |
|
{N_("_Repeat"), NULL, 'r', CTRL, .get = repeat_get, repeat_set, "set repeat"},
|
178 |
|
{N_("S_huffle"), NULL, 's', CTRL, .get = shuffle_get, shuffle_set, "set shuffle"},
|
179 |
|
{N_("N_o Playlist Advance"), NULL, 'n', CTRL, .get = no_advance_get, no_advance_set, "set no_playlist_advance"},
|
180 |
|
{N_("Stop _After This Song"), NULL, 'm', CTRL, .get = stop_after_get, stop_after_set, "set stop_after_current_song"},
|
|
178 |
{N_("_Repeat"), NULL, 'r', CTRL, "repeat", .get = repeat_get, repeat_set, "set repeat"},
|
|
179 |
{N_("S_huffle"), NULL, 's', CTRL, "shuffle", .get = shuffle_get, shuffle_set, "set shuffle"},
|
|
180 |
{N_("N_o Playlist Advance"), NULL, 'n', CTRL, "no_playlist_advance", .get = no_advance_get, no_advance_set, "set no_playlist_advance"},
|
|
181 |
{N_("Stop _After This Song"), NULL, 'm', CTRL, "stop_after_this_song", .get = stop_after_get, stop_after_set, "set stop_after_current_song"},
|
181 |
182 |
{.sep = TRUE},
|
182 |
|
{N_("Song _Info ..."), GTK_STOCK_INFO, 'i', CTRL, .func = audgui_infowin_show_current},
|
183 |
|
{N_("Jump to _Time ..."), GTK_STOCK_JUMP_TO, 'k', CTRL, .func = audgui_jump_to_time},
|
184 |
|
{N_("_Jump to Song ..."), GTK_STOCK_JUMP_TO, 'j', CTRL, .func = audgui_jump_to_track}};
|
|
183 |
{N_("Song _Info ..."), GTK_STOCK_INFO, 'i', CTRL, "song_info", .func = audgui_infowin_show_current},
|
|
184 |
{N_("Jump to _Time ..."), GTK_STOCK_JUMP_TO, .identifier = "jump_to_time", .func = audgui_jump_to_time},
|
|
185 |
{N_("_Jump to Song ..."), GTK_STOCK_JUMP_TO, 'j', CTRL, "jump_to_song", .func = audgui_jump_to_track}};
|
185 |
186 |
|
186 |
187 |
static const struct MenuItem sort_items[] = {
|
187 |
188 |
{N_("By Track _Number"), .func = pl_sort_track},
|
... | ... | |
196 |
197 |
{N_("_Random Order"), .func = pl_random}};
|
197 |
198 |
|
198 |
199 |
static const struct MenuItem playlist_items[] = {
|
199 |
|
{N_("_Play This Playlist"), GTK_STOCK_MEDIA_PLAY, GDK_KEY_Return, SHIFT | CTRL, .func = pl_play},
|
200 |
|
{N_("_Refresh"), GTK_STOCK_REFRESH, GDK_KEY_F5, .func = pl_refresh},
|
201 |
|
{N_("Remove _Unavailable Files"), GTK_STOCK_REMOVE, .func = pl_remove_failed},
|
|
200 |
{N_("_Play This Playlist"), GTK_STOCK_MEDIA_PLAY, GDK_KEY_Return, SHIFT | CTRL, .identifier = "play_this_playlist", .func = pl_play},
|
|
201 |
{N_("_Refresh"), GTK_STOCK_REFRESH, GDK_KEY_F5, .identifier = "playlist_refresh", .func = pl_refresh},
|
|
202 |
{N_("Remove _Unavailable Files"), GTK_STOCK_REMOVE, .identifier = "playlist_remove", .func = pl_remove_failed},
|
202 |
203 |
{.sep = TRUE},
|
203 |
204 |
{N_("_Sort"), GTK_STOCK_SORT_ASCENDING, .items = sort_items, G_N_ELEMENTS (sort_items)},
|
204 |
205 |
{.sep = TRUE},
|
205 |
|
{N_("_New"), GTK_STOCK_NEW, 't', CTRL, .func = pl_new},
|
|
206 |
{N_("_New"), GTK_STOCK_NEW, 't', CTRL, "playlist_new", .func = pl_new},
|
206 |
207 |
{N_("Ren_ame ..."), GTK_STOCK_EDIT, GDK_KEY_F2, .func = pl_rename},
|
207 |
|
{N_("_Close"), GTK_STOCK_CLOSE, 'w', CTRL, .func = pl_close},
|
|
208 |
{N_("_Close"), GTK_STOCK_CLOSE, 'w', CTRL, "playlist_close", .func = pl_close},
|
208 |
209 |
{.sep = TRUE},
|
209 |
|
{N_("_Import ..."), GTK_STOCK_OPEN, .func = audgui_import_playlist},
|
210 |
|
{N_("_Export ..."), GTK_STOCK_SAVE, .func = audgui_export_playlist},
|
|
210 |
{N_("_Import ..."), GTK_STOCK_OPEN, .identifier = "playlist_import", .func = audgui_import_playlist},
|
|
211 |
{N_("_Export ..."), GTK_STOCK_SAVE, .identifier = "playlist_export", .func = audgui_export_playlist},
|
211 |
212 |
{.sep = TRUE},
|
212 |
|
{N_("Playlist _Manager ..."), AUD_STOCK_PLAYLIST, 'p', CTRL, .func = audgui_playlist_manager},
|
213 |
|
{N_("_Queue Manager ..."), AUD_STOCK_QUEUETOGGLE, 'u', CTRL, .func = audgui_queue_manager_show}};
|
|
213 |
{N_("Playlist _Manager ..."), AUD_STOCK_PLAYLIST, 'p', CTRL, "playlist_manager", .func = audgui_playlist_manager},
|
|
214 |
{N_("_Queue Manager ..."), AUD_STOCK_QUEUETOGGLE, 'u', CTRL, "queue_manager", .func = audgui_queue_manager_show}};
|
214 |
215 |
|
215 |
216 |
static const struct MenuItem output_items[] = {
|
216 |
|
{N_("Volume _Up"), GTK_STOCK_GO_UP, '+', CTRL, .func = volume_up},
|
217 |
|
{N_("Volume _Down"), GTK_STOCK_GO_DOWN, '-', CTRL, .func = volume_down},
|
|
217 |
{N_("Volume _Up"), GTK_STOCK_GO_UP, '+', CTRL, "volume_up", .func = volume_up},
|
|
218 |
{N_("Volume _Down"), GTK_STOCK_GO_DOWN, '-', CTRL, "volume_down", .func = volume_down},
|
218 |
219 |
{.sep = TRUE},
|
219 |
|
{N_("_Equalizer"), GTK_STOCK_PREFERENCES, 'e', CTRL, .func = audgui_show_equalizer_window},
|
|
220 |
{N_("_Equalizer"), GTK_STOCK_PREFERENCES, 'e', CTRL, "equalizer", .func = audgui_show_equalizer_window},
|
220 |
221 |
{.sep = TRUE},
|
221 |
222 |
{N_("E_ffects"), .get_sub = audgui_create_effects_menu}};
|
222 |
223 |
|
... | ... | |
224 |
225 |
{N_("_Interface"), .get_sub = audgui_create_iface_menu},
|
225 |
226 |
{N_("_Visualizations"), .get_sub = audgui_create_vis_menu},
|
226 |
227 |
{.sep = TRUE},
|
227 |
|
{N_("Show _Menu Bar"), NULL, 'm', SHIFT | CTRL, .get = menu_bar_get, show_menu},
|
228 |
|
{N_("Show I_nfo Bar"), NULL, 'i', SHIFT | CTRL, .get = infoarea_get, show_infoarea},
|
229 |
|
{N_("Show Info Bar Vis_ualization"), .get = infoarea_vis_get, show_infoarea_vis},
|
230 |
|
{N_("Show _Status Bar"), NULL, 's', SHIFT | CTRL, .get = status_bar_get, show_statusbar},
|
|
228 |
{N_("Show _Menu Bar"), NULL, 'm', SHIFT | CTRL, "show_menu_bar", .get = menu_bar_get, show_menu},
|
|
229 |
{N_("Show I_nfo Bar"), NULL, 'i', SHIFT | CTRL, "show_info_bar", .get = infoarea_get, show_infoarea},
|
|
230 |
{N_("Show Info Bar Vis_ualization"), .identifier = "show_info_bar_visualization", .get = infoarea_vis_get, show_infoarea_vis},
|
|
231 |
{N_("Show _Status Bar"), NULL, 's', SHIFT | CTRL, "show_status_bar", .get = status_bar_get, show_statusbar},
|
231 |
232 |
{.sep = TRUE},
|
232 |
233 |
{N_("Show Close _Buttons"), NULL, .get = close_button_get, close_button_set, "close_button_visible"},
|
233 |
|
{N_("Show Column _Headers"), .get = column_headers_get, playlist_show_headers},
|
234 |
|
{N_("Choose _Columns ..."), .func = pw_col_choose},
|
235 |
|
{N_("Scrol_l on Song Change"), .get = autoscroll_get, autoscroll_set}};
|
|
234 |
{N_("Show Column _Headers"), .identifier = "show_column_headers", .get = column_headers_get, playlist_show_headers},
|
|
235 |
{N_("Choose _Columns ..."), .identifier = "choose_columns", .func = pw_col_choose},
|
|
236 |
{N_("Scrol_l on Song Change"), .identifier = "scroll_on_song_change", .get = autoscroll_get, autoscroll_set}};
|
236 |
237 |
|
237 |
238 |
static const struct MenuItem main_items[] = {
|
238 |
239 |
{N_("_File"), .items = file_items, G_N_ELEMENTS (file_items)},
|
... | ... | |
243 |
244 |
{N_("_View"), .items = view_items, G_N_ELEMENTS (view_items)}};
|
244 |
245 |
|
245 |
246 |
static const struct MenuItem rclick_items[] = {
|
246 |
|
{N_("Song _Info ..."), GTK_STOCK_INFO, 'i', ALT, .func = playlist_song_info},
|
247 |
|
{N_("_Queue/Unqueue"), AUD_STOCK_QUEUETOGGLE, 'q', ALT, .func = playlist_queue_toggle},
|
248 |
|
{N_("_Refresh"), GTK_STOCK_REFRESH, GDK_KEY_F6, .func = pl_refresh_sel},
|
|
247 |
{N_("Song _Info ..."), GTK_STOCK_INFO, 'i', ALT, "list_song_info", .func = playlist_song_info},
|
|
248 |
{N_("_Queue/Unqueue"), AUD_STOCK_QUEUETOGGLE, 'q', ALT, "list_queue", .func = playlist_queue_toggle},
|
|
249 |
{N_("_Refresh"), GTK_STOCK_REFRESH, GDK_KEY_F6, .identifier = "list_refresh", .func = pl_refresh_sel},
|
249 |
250 |
{.sep = TRUE},
|
250 |
|
{N_("Cu_t"), GTK_STOCK_CUT, .func = playlist_cut},
|
251 |
|
{N_("_Copy"), GTK_STOCK_COPY, .func = playlist_copy},
|
252 |
|
{N_("_Paste"), GTK_STOCK_PASTE, .func = playlist_paste},
|
253 |
|
{N_("Select _All"), GTK_STOCK_SELECT_ALL, .func = pl_select_all},
|
|
251 |
{N_("Cu_t"), GTK_STOCK_CUT, .identifier = "list_cut", .func = playlist_cut},
|
|
252 |
{N_("_Copy"), GTK_STOCK_COPY, .identifier = "list_copy", .func = playlist_copy},
|
|
253 |
{N_("_Paste"), GTK_STOCK_PASTE, .identifier = "list_paste", .func = playlist_paste},
|
|
254 |
{N_("Select _All"), GTK_STOCK_SELECT_ALL, .identifier = "list_select_all", .func = pl_select_all},
|
254 |
255 |
{.sep = TRUE},
|
255 |
256 |
{N_("_Services"), .get_sub = get_services_pl}};
|
256 |
257 |
|
257 |
258 |
static const struct MenuItem tab_items[] = {
|
258 |
|
{N_("_Play"), GTK_STOCK_MEDIA_PLAY, .func = pl_tab_play},
|
259 |
|
{N_("_Rename ..."), GTK_STOCK_EDIT, .func = pl_tab_rename},
|
260 |
|
{N_("_Close"), GTK_STOCK_CLOSE, .func = pl_tab_close}};
|
|
259 |
{N_("_Play"), GTK_STOCK_MEDIA_PLAY, .identifier = "tab_play", .func = pl_tab_play},
|
|
260 |
{N_("_Rename ..."), GTK_STOCK_EDIT, .identifier = "tab_rename", .func = pl_tab_rename},
|
|
261 |
{N_("_Close"), GTK_STOCK_CLOSE, .identifier = "tab_close", .func = pl_tab_close}};
|
261 |
262 |
|
262 |
263 |
static void toggled_cb (GtkCheckMenuItem * check, const struct MenuItem * item)
|
263 |
264 |
{
|
... | ... | |
278 |
279 |
hook_dissociate_full (item->hook, (HookFunction) hook_cb, check);
|
279 |
280 |
}
|
280 |
281 |
|
|
282 |
static void hotkey_changed (GtkAccelMap *object, gchar *accel_path, guint accel_key,
|
|
283 |
GdkModifierType accel_mods, gpointer user_data)
|
|
284 |
{
|
|
285 |
if (g_str_has_prefix (accel_path, "<audacious>/"))
|
|
286 |
{
|
|
287 |
gchar *entry = g_strconcat ("key_", accel_path+strlen("<audacious>/"), NULL);
|
|
288 |
gchar *name=gtk_accelerator_name (accel_key, accel_mods);
|
|
289 |
aud_set_string ("gtkui", entry, name);
|
|
290 |
g_free (name);
|
|
291 |
g_free (entry);
|
|
292 |
}
|
|
293 |
}
|
|
294 |
|
281 |
295 |
static void populate_menu (GtkWidget * shell, const struct MenuItem * items,
|
282 |
296 |
gint n_items, GtkAccelGroup * accel)
|
283 |
297 |
{
|
... | ... | |
326 |
340 |
else
|
327 |
341 |
{
|
328 |
342 |
sub = gtk_menu_new ();
|
|
343 |
gtk_menu_set_accel_group (GTK_MENU (sub), accel);
|
329 |
344 |
populate_menu (sub, item->items, item->n_items, accel);
|
330 |
345 |
}
|
331 |
346 |
|
... | ... | |
337 |
352 |
if (! widget)
|
338 |
353 |
continue;
|
339 |
354 |
|
340 |
|
if (item->key)
|
341 |
|
gtk_widget_add_accelerator (widget, "activate", accel, item->key,
|
342 |
|
item->mod, GTK_ACCEL_VISIBLE);
|
|
355 |
guint fkey = 0;
|
|
356 |
GdkModifierType fmod = 0;
|
|
357 |
if (item->identifier)
|
|
358 |
{
|
|
359 |
gchar *temp = g_strconcat ("key_", item->identifier, NULL);
|
|
360 |
gchar *nkey = aud_get_string ("gtkui", temp);
|
|
361 |
gtk_accelerator_parse (nkey, &fkey, &fmod);
|
|
362 |
g_free (nkey);
|
|
363 |
g_free (temp);
|
|
364 |
}
|
|
365 |
|
|
366 |
if(!fkey)
|
|
367 |
{
|
|
368 |
fkey = item->key;
|
|
369 |
fmod = item->mod;
|
|
370 |
}
|
|
371 |
|
|
372 |
if (fkey)
|
|
373 |
{
|
|
374 |
if (item->identifier)
|
|
375 |
{
|
|
376 |
gchar *accel_path=g_strconcat ("<audacious>/", item->identifier, NULL);
|
|
377 |
gtk_menu_item_set_accel_path (GTK_MENU_ITEM (widget), accel_path);
|
|
378 |
gtk_accel_map_add_entry (accel_path, fkey, fmod);
|
|
379 |
g_free (accel_path);
|
|
380 |
}
|
|
381 |
else
|
|
382 |
gtk_widget_add_accelerator (widget, "activate", accel, fkey,
|
|
383 |
fmod, GTK_ACCEL_VISIBLE);
|
|
384 |
}
|
343 |
385 |
|
344 |
386 |
gtk_widget_show (widget);
|
345 |
387 |
gtk_menu_shell_append ((GtkMenuShell *) shell, widget);
|
... | ... | |
350 |
392 |
{
|
351 |
393 |
GtkWidget * bar = gtk_menu_bar_new ();
|
352 |
394 |
populate_menu (bar, main_items, G_N_ELEMENTS (main_items), accel);
|
|
395 |
g_signal_connect (gtk_accel_map_get (), "changed", G_CALLBACK (hotkey_changed), NULL);
|
353 |
396 |
return bar;
|
354 |
397 |
}
|
355 |
398 |
|
356 |
399 |
GtkWidget * make_menu_main (GtkAccelGroup * accel)
|
357 |
400 |
{
|
358 |
401 |
GtkWidget * shell = gtk_menu_new ();
|
|
402 |
gtk_menu_set_accel_group (GTK_MENU (shell), accel);
|
359 |
403 |
populate_menu (shell, main_items, G_N_ELEMENTS (main_items), accel);
|
360 |
404 |
return shell;
|
361 |
405 |
}
|
... | ... | |
363 |
407 |
GtkWidget * make_menu_rclick (GtkAccelGroup * accel)
|
364 |
408 |
{
|
365 |
409 |
GtkWidget * shell = gtk_menu_new ();
|
|
410 |
gtk_menu_set_accel_group (GTK_MENU (shell), accel);
|
366 |
411 |
populate_menu (shell, rclick_items, G_N_ELEMENTS (rclick_items), accel);
|
367 |
412 |
return shell;
|
368 |
413 |
}
|
... | ... | |
370 |
415 |
GtkWidget * make_menu_tab (GtkAccelGroup * accel)
|
371 |
416 |
{
|
372 |
417 |
GtkWidget * shell = gtk_menu_new ();
|
|
418 |
gtk_menu_set_accel_group (GTK_MENU (shell), accel);
|
373 |
419 |
populate_menu (shell, tab_items, G_N_ELEMENTS (tab_items), accel);
|
374 |
420 |
return shell;
|
375 |
421 |
}
|