Mercurial > audlegacy
changeset 2232:ac2ea05e60a0 trunk
[svn] - migration from gtkitemfactory to actions and uimanager; main menu has been ported, still much work and test to do
author | giacomo |
---|---|
date | Tue, 02 Jan 2007 16:48:38 -0800 |
parents | 86f0443d0de2 |
children | 10aba78dc8eb |
files | ChangeLog audacious/Makefile audacious/equalizer.c audacious/main.c audacious/mainwin.c audacious/mainwin.h audacious/ui/Makefile audacious/ui/mainwin.ui audacious/ui_manager.c audacious/ui_manager.h audacious/ui_playlist.c |
diffstat | 11 files changed, 1262 insertions(+), 643 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Mon Jan 01 09:28:18 2007 -0800 +++ b/ChangeLog Tue Jan 02 16:48:38 2007 -0800 @@ -1,3 +1,54 @@ +2007-01-01 17:28:18 +0000 Kiyoshi Aman <kiyoshi.aman@gmail.com> + revision [3467] + Update some copyrights notices, update po/ + + trunk/AUTHORS | 2 + trunk/README | 2 + trunk/audacious/about.c | 15 + trunk/audacious/controlsocket.c | 2 + trunk/audacious/controlsocket.h | 5 + trunk/audacious/credits.c | 11 + trunk/audacious/dnd.h | 10 + trunk/audacious/dock.c | 5 + trunk/audacious/dock.h | 5 + trunk/audacious/effect.c | 6 + trunk/audacious/effect.h | 5 + trunk/audacious/equalizer.c | 4 + trunk/audacious/equalizer.h | 6 + trunk/audacious/fft.c | 6 + trunk/audacious/fft.h | 8 + trunk/po/audacious.pot | 252 +++- + trunk/po/br.po | 266 +++- + trunk/po/cs.po | 282 +++-- + trunk/po/cy.po | 264 +++- + trunk/po/de.po | 364 +++--- + trunk/po/el.po | 342 +++--- + trunk/po/es.po | 364 +++--- + trunk/po/fi.po | 285 +++-- + trunk/po/fr.po | 264 +++- + trunk/po/hi.po | 287 +++-- + trunk/po/hu.po | 362 +++--- + trunk/po/it.po | 317 +++-- + trunk/po/ja.po | 352 +++--- + trunk/po/ka.po | 279 +++-- + trunk/po/ko.po | 278 +++-- + trunk/po/lt.po | 283 +++-- + trunk/po/mk.po | 281 +++-- + trunk/po/nl.po | 375 ++++-- + trunk/po/pl.po | 370 ++++-- + trunk/po/pt_BR.po | 282 +++-- + trunk/po/ro.po | 269 +++- + trunk/po/ru.po | 384 ++++--- + trunk/po/sk.po | 282 +++-- + trunk/po/sr.po | 269 +++- + trunk/po/sr@Latn.po | 269 +++- + trunk/po/sv.po | 282 +++-- + trunk/po/uk.po | 291 +++-- + trunk/po/zh_CN.po | 350 +++--- + trunk/po/zh_TW.po | 2185 ++++++++++++++-------------------------- + 44 files changed, 6517 insertions(+), 4305 deletions(-) + + 2007-01-01 07:46:17 +0000 Cheng-Wei Chien <e.cwchien@gmail.com> revision [3465] zh_TW.po updated by: Cheng-Wei Chien <e.cwchien@gmail.com>
--- a/audacious/Makefile Mon Jan 01 09:28:18 2007 -0800 +++ b/audacious/Makefile Tue Jan 02 16:48:38 2007 -0800 @@ -34,15 +34,11 @@ main.h \ output.h \ playlist.h \ - playlist_container.h \ - playlist_manager.h \ plugin.h \ prefswin.h \ util.h \ vfs.h \ - vfs_buffer.h \ - icons-csource.h \ - icons-stock.h + vfs_buffer.h SOURCES = \ build_stamp.c \ @@ -71,6 +67,7 @@ prefswin.c \ ui_fileinfo.c \ ui_playlist.c \ + ui_manager.c \ equalizer.c \ glade.c \ hints.c \
--- a/audacious/equalizer.c Mon Jan 01 09:28:18 2007 -0800 +++ b/audacious/equalizer.c Tue Jan 02 16:48:38 2007 -0800 @@ -40,6 +40,7 @@ #include "hints.h" #include "input.h" #include "main.h" +#include "ui_manager.h" #include "playlist.h" #include "ui_playlist.h" #include "util.h" @@ -277,10 +278,9 @@ static void equalizerwin_set_shade(gboolean shaded) { - GtkWidget *widget; - widget = gtk_item_factory_get_widget(mainwin_view_menu, - "/Roll up Equalizer"); - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widget), shaded); + GtkAction *action = gtk_action_group_get_action( + mainwin_toggleaction_group_others , "roll up equalizer" ); + gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(action) , shaded ); } static void @@ -507,7 +507,7 @@ * Pop up the main menu a few pixels down to avoid * anything to be selected initially. */ - util_item_factory_popup(mainwin_general_menu, event->x_root, + ui_manager_popup_menu_show(GTK_MENU(mainwin_general_menu), event->x_root, event->y_root + 2, 3, event->time); grab = FALSE; } @@ -1009,9 +1009,9 @@ void equalizerwin_show(gboolean show) { - GtkWidget *item = gtk_item_factory_get_widget(mainwin_view_menu, - "/Show Equalizer"); - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), show); + GtkAction *action = gtk_action_group_get_action( + mainwin_toggleaction_group_others , "show equalizer" ); + gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(action) , show ); } void
--- a/audacious/main.c Mon Jan 01 09:28:18 2007 -0800 +++ b/audacious/main.c Tue Jan 02 16:48:38 2007 -0800 @@ -60,6 +60,7 @@ #include "input.h" #include "logger.h" #include "mainwin.h" +#include "ui_manager.h" #include "output.h" #include "playback.h" #include "playlist.h" @@ -1162,6 +1163,10 @@ gtk_accel_map_load(bmp_paths[BMP_PATH_ACCEL_FILE]); + /* uimanager */ + ui_manager_init(); + ui_manager_create_menus(); + if (!init_skins(cfg.skin)) { run_load_skin_error_dialog(cfg.skin); exit(EXIT_FAILURE);
--- a/audacious/mainwin.c Mon Jan 01 09:28:18 2007 -0800 +++ b/audacious/mainwin.c Tue Jan 02 16:48:38 2007 -0800 @@ -55,6 +55,9 @@ #include "mainwin.h" #include "icons-stock.h" +#include "ui_manager.h" +#include "actions-mainwin.h" + #include "main.h" #include "controlsocket.h" @@ -82,30 +85,6 @@ #define ITEM_SEPARATOR {"/-", NULL, NULL, 0, "<Separator>"} #define TRISTATE_THRESHOLD 200 -/* - * If you change the menu below change these defines also - */ - -#define MAINWIN_VIS_MENU_VIS_MODE 1 -#define MAINWIN_VIS_MENU_NUM_VIS_MODE 4 -#define MAINWIN_VIS_MENU_ANALYZER_MODE 6 -#define MAINWIN_VIS_MENU_NUM_ANALYZER_MODE 3 -#define MAINWIN_VIS_MENU_ANALYZER_TYPE 10 -#define MAINWIN_VIS_MENU_NUM_ANALYZER_TYPE 2 -#define MAINWIN_VIS_MENU_ANALYZER_PEAKS 13 -#define MAINWIN_VIS_MENU_SCOPE_MODE 15 -#define MAINWIN_VIS_MENU_NUM_SCOPE_MODE 3 -#define MAINWIN_VIS_MENU_VOICEPRINT_MODE 19 -#define MAINWIN_VIS_MENU_NUM_VOICEPRINT_MODE 3 -#define MAINWIN_VIS_MENU_WSHADEVU_MODE 23 -#define MAINWIN_VIS_MENU_NUM_WSHADEVU_MODE 2 -#define MAINWIN_VIS_MENU_REFRESH_RATE 26 -#define MAINWIN_VIS_MENU_NUM_REFRESH_RATE 4 -#define MAINWIN_VIS_MENU_AFALLOFF 31 -#define MAINWIN_VIS_MENU_NUM_AFALLOFF 5 -#define MAINWIN_VIS_MENU_PFALLOFF 37 -#define MAINWIN_VIS_MENU_NUM_PFALLOFF 5 - #define VOLSET_DISP_TIMES 5 enum { @@ -115,45 +94,6 @@ }; enum { - MAINWIN_SONGNAME_FILEINFO, - MAINWIN_SONGNAME_JTF, - MAINWIN_SONGNAME_JTT, - MAINWIN_SONGNAME_SCROLL, - MAINWIN_SONGNAME_STOPAFTERSONG -}; - -enum { - MAINWIN_OPT_SKIN, MAINWIN_OPT_RELOADSKIN, - MAINWIN_OPT_REPEAT, MAINWIN_OPT_SHUFFLE, MAINWIN_OPT_NPA, - MAINWIN_OPT_TELAPSED, MAINWIN_OPT_TREMAINING, - MAINWIN_OPT_ALWAYS, - MAINWIN_OPT_STICKY, - MAINWIN_OPT_WS, - MAINWIN_OPT_PWS, - MAINWIN_OPT_EQWS, MAINWIN_OPT_DOUBLESIZE, MAINWIN_OPT_EASY_MOVE -}; - -enum { - MAINWIN_VIS_ANALYZER, MAINWIN_VIS_SCOPE, MAINWIN_VIS_VOICEPRINT, MAINWIN_VIS_OFF, - MAINWIN_VIS_ANALYZER_NORMAL, MAINWIN_VIS_ANALYZER_FIRE, - MAINWIN_VIS_ANALYZER_VLINES, - MAINWIN_VIS_ANALYZER_LINES, MAINWIN_VIS_ANALYZER_BARS, - MAINWIN_VIS_ANALYZER_PEAKS, - MAINWIN_VIS_SCOPE_DOT, MAINWIN_VIS_SCOPE_LINE, MAINWIN_VIS_SCOPE_SOLID, - MAINWIN_VIS_VOICEPRINT_NORMAL, MAINWIN_VIS_VOICEPRINT_FIRE, MAINWIN_VIS_VOICEPRINT_ICE, - MAINWIN_VIS_VU_NORMAL, MAINWIN_VIS_VU_SMOOTH, - MAINWIN_VIS_REFRESH_FULL, MAINWIN_VIS_REFRESH_HALF, - MAINWIN_VIS_REFRESH_QUARTER, MAINWIN_VIS_REFRESH_EIGHTH, - MAINWIN_VIS_AFALLOFF_SLOWEST, MAINWIN_VIS_AFALLOFF_SLOW, - MAINWIN_VIS_AFALLOFF_MEDIUM, MAINWIN_VIS_AFALLOFF_FAST, - MAINWIN_VIS_AFALLOFF_FASTEST, - MAINWIN_VIS_PFALLOFF_SLOWEST, MAINWIN_VIS_PFALLOFF_SLOW, - MAINWIN_VIS_PFALLOFF_MEDIUM, MAINWIN_VIS_PFALLOFF_FAST, - MAINWIN_VIS_PFALLOFF_FASTEST, - MAINWIN_VIS_PLUGINS -}; - -enum { MAINWIN_VIS_ACTIVE_MAINWIN, MAINWIN_VIS_ACTIVE_PLAYLISTWIN }; @@ -177,10 +117,6 @@ GtkWidget *mainwin_jtf = NULL; static GtkWidget *mainwin_jtt = NULL; -GtkItemFactory *mainwin_songname_menu, *mainwin_vis_menu; -GtkItemFactory *mainwin_general_menu, *mainwin_play_menu, *mainwin_add_menu; -GtkItemFactory *mainwin_view_menu; - gint seek_state = MAINWIN_SEEK_NIL; gint seek_initial_pos = 0; @@ -235,251 +171,6 @@ static int ab_position_a = -1; static int ab_position_b = -1; -static void mainwin_songname_menu_callback(gpointer user_data, - guint action, - GtkWidget * widget); - -static void mainwin_vis_menu_callback(gpointer user_data, - guint action, - GtkWidget * widget); - -static void mainwin_view_menu_callback(gpointer user_data, - guint action, - GtkWidget * widget); - -static void mainwin_play_menu_callback(gpointer user_data, - guint action, - GtkWidget * widget); - -/* Song name area menu */ - -GtkItemFactoryEntry mainwin_songname_menu_entries[] = { - {N_("/View Track Details"), "<alt>i", mainwin_general_menu_callback, - MAINWIN_GENERAL_FILEINFO, "<StockItem>", AUD_STOCK_INFO }, - {N_("/Jump to File"), "J", mainwin_songname_menu_callback, - MAINWIN_SONGNAME_JTF, "<StockItem>", GTK_STOCK_JUMP_TO}, - {"/-", NULL, NULL, 0, "<Separator>", NULL}, - {N_("/Autoscroll Songname"), NULL, mainwin_songname_menu_callback, - MAINWIN_SONGNAME_SCROLL, "<ToggleItem>", NULL}, - {N_("/Stop After Current Song"), "<control>M", mainwin_songname_menu_callback, - MAINWIN_SONGNAME_STOPAFTERSONG, "<ToggleItem>", NULL}, -}; - -static gint mainwin_songname_menu_entries_num = - G_N_ELEMENTS(mainwin_songname_menu_entries); - -/* Mini-visualizer area menu */ - -/* If you add something here, be sure to update the #defines up above!!! */ - -GtkItemFactoryEntry mainwin_vis_menu_entries[] = { - {N_("/Visualization Mode"), NULL, NULL, 0, "<Branch>", NULL}, - {N_("/Visualization Mode/Analyzer"), NULL, mainwin_vis_menu_callback, - MAINWIN_VIS_ANALYZER, "<RadioItem>", NULL}, - {N_("/Visualization Mode/Scope"), NULL, mainwin_vis_menu_callback, - MAINWIN_VIS_SCOPE, "/Visualization Mode/Analyzer", NULL}, - {N_("/Visualization Mode/Voiceprint"), NULL, mainwin_vis_menu_callback, - MAINWIN_VIS_VOICEPRINT, "/Visualization Mode/Analyzer", NULL}, - {N_("/Visualization Mode/Off"), NULL, mainwin_vis_menu_callback, - MAINWIN_VIS_OFF, "/Visualization Mode/Analyzer", NULL}, - {N_("/Analyzer Mode"), NULL, NULL, 0, "<Branch>", NULL}, - {N_("/Analyzer Mode/Normal"), NULL, mainwin_vis_menu_callback, - MAINWIN_VIS_ANALYZER_NORMAL, "<RadioItem>", NULL}, - {N_("/Analyzer Mode/Fire"), NULL, mainwin_vis_menu_callback, - MAINWIN_VIS_ANALYZER_FIRE, "/Analyzer Mode/Normal", NULL}, - {N_("/Analyzer Mode/Vertical Lines"), NULL, mainwin_vis_menu_callback, - MAINWIN_VIS_ANALYZER_VLINES, "/Analyzer Mode/Normal", NULL}, - {"/Analyzer Mode/-", NULL, NULL, 0, "<Separator>", NULL}, - {N_("/Analyzer Mode/Lines"), NULL, mainwin_vis_menu_callback, - MAINWIN_VIS_ANALYZER_LINES, "<RadioItem>", NULL}, - {N_("/Analyzer Mode/Bars"), NULL, mainwin_vis_menu_callback, - MAINWIN_VIS_ANALYZER_BARS, "/Analyzer Mode/Lines", NULL}, - {"/Analyzer Mode/-", NULL, NULL, 0, "<Separator>", NULL}, - {N_("/Analyzer Mode/Peaks"), NULL, mainwin_vis_menu_callback, - MAINWIN_VIS_ANALYZER_PEAKS, "<ToggleItem>", NULL}, - {N_("/Scope Mode"), NULL, NULL, 0, "<Branch>", NULL}, - {N_("/Scope Mode/Dot Scope"), NULL, mainwin_vis_menu_callback, - MAINWIN_VIS_SCOPE_DOT, "<RadioItem>", NULL}, - {N_("/Scope Mode/Line Scope"), NULL, mainwin_vis_menu_callback, - MAINWIN_VIS_SCOPE_LINE, "/Scope Mode/Dot Scope", NULL}, - {N_("/Scope Mode/Solid Scope"), NULL, mainwin_vis_menu_callback, - MAINWIN_VIS_SCOPE_SOLID, "/Scope Mode/Dot Scope", NULL}, - {N_("/Voiceprint mode"), NULL, NULL, 0, "<Branch>", NULL}, - {N_("/Voiceprint mode/Normal"), NULL, mainwin_vis_menu_callback, - MAINWIN_VIS_VOICEPRINT_NORMAL, "<RadioItem>", NULL}, - {N_("/Voiceprint mode/Fire"), NULL, mainwin_vis_menu_callback, - MAINWIN_VIS_VOICEPRINT_FIRE, "/Voiceprint mode/Normal", NULL}, - {N_("/Voiceprint mode/Ice"), NULL, mainwin_vis_menu_callback, - MAINWIN_VIS_VOICEPRINT_ICE, "/Voiceprint mode/Normal", NULL}, - {N_("/WindowShade VU Mode"), NULL, NULL, 0, "<Branch>", NULL}, - {N_("/WindowShade VU Mode/Normal"), NULL, mainwin_vis_menu_callback, - MAINWIN_VIS_VU_NORMAL, "<RadioItem>", NULL}, - {N_("/WindowShade VU Mode/Smooth"), NULL, mainwin_vis_menu_callback, - MAINWIN_VIS_VU_SMOOTH, "/WindowShade VU Mode/Normal", NULL}, - {N_("/Refresh Rate"), NULL, NULL, 0, "<Branch>", NULL}, - {N_("/Refresh Rate/Full (~50 fps)"), NULL, mainwin_vis_menu_callback, - MAINWIN_VIS_REFRESH_FULL, "<RadioItem>", NULL}, - {N_("/Refresh Rate/Half (~25 fps)"), NULL, mainwin_vis_menu_callback, - MAINWIN_VIS_REFRESH_HALF, "/Refresh Rate/Full (~50 fps)", NULL}, - {N_("/Refresh Rate/Quarter (~13 fps)"), NULL, mainwin_vis_menu_callback, - MAINWIN_VIS_REFRESH_QUARTER, "/Refresh Rate/Full (~50 fps)", NULL}, - {N_("/Refresh Rate/Eighth (~6 fps)"), NULL, mainwin_vis_menu_callback, - MAINWIN_VIS_REFRESH_EIGHTH, "/Refresh Rate/Full (~50 fps)", NULL}, - {N_("/Analyzer Falloff"), NULL, NULL, 0, "<Branch>", NULL}, - {N_("/Analyzer Falloff/Slowest"), NULL, mainwin_vis_menu_callback, - MAINWIN_VIS_AFALLOFF_SLOWEST, "<RadioItem>", NULL}, - {N_("/Analyzer Falloff/Slow"), NULL, mainwin_vis_menu_callback, - MAINWIN_VIS_AFALLOFF_SLOW, "/Analyzer Falloff/Slowest", NULL}, - {N_("/Analyzer Falloff/Medium"), NULL, mainwin_vis_menu_callback, - MAINWIN_VIS_AFALLOFF_MEDIUM, "/Analyzer Falloff/Slowest", NULL}, - {N_("/Analyzer Falloff/Fast"), NULL, mainwin_vis_menu_callback, - MAINWIN_VIS_AFALLOFF_FAST, "/Analyzer Falloff/Slowest", NULL}, - {N_("/Analyzer Falloff/Fastest"), NULL, mainwin_vis_menu_callback, - MAINWIN_VIS_AFALLOFF_FASTEST, "/Analyzer Falloff/Slowest", NULL}, - {N_("/Peaks Falloff"), NULL, NULL, 0, "<Branch>", NULL}, - {N_("/Peaks Falloff/Slowest"), NULL, mainwin_vis_menu_callback, - MAINWIN_VIS_PFALLOFF_SLOWEST, "<RadioItem>", NULL}, - {N_("/Peaks Falloff/Slow"), NULL, mainwin_vis_menu_callback, - MAINWIN_VIS_PFALLOFF_SLOW, "/Peaks Falloff/Slowest", NULL}, - {N_("/Peaks Falloff/Medium"), NULL, mainwin_vis_menu_callback, - MAINWIN_VIS_PFALLOFF_MEDIUM, "/Peaks Falloff/Slowest", NULL}, - {N_("/Peaks Falloff/Fast"), NULL, mainwin_vis_menu_callback, - MAINWIN_VIS_PFALLOFF_FAST, "/Peaks Falloff/Slowest", NULL}, - {N_("/Peaks Falloff/Fastest"), NULL, mainwin_vis_menu_callback, - MAINWIN_VIS_PFALLOFF_FASTEST, "/Peaks Falloff/Slowest", NULL} -}; - -static const gint mainwin_vis_menu_entries_num = - G_N_ELEMENTS(mainwin_vis_menu_entries); - -/* Playback menu (now used only for accelerators) */ - -GtkItemFactoryEntry mainwin_playback_menu_entries[] = { - {N_("/Play CD"), "<alt>C", mainwin_general_menu_callback, - MAINWIN_GENERAL_PLAYCD, "<StockItem>", GTK_STOCK_CDROM}, - {"/-", NULL, NULL, 0, "<Separator>", NULL}, - {N_("/Repeat"), "R", mainwin_play_menu_callback, - MAINWIN_OPT_REPEAT, "<ToggleItem>", NULL}, - {N_("/Shuffle"), "S", mainwin_play_menu_callback, - MAINWIN_OPT_SHUFFLE, "<ToggleItem>", NULL}, - {N_("/No Playlist Advance"), "<control>N", mainwin_play_menu_callback, - MAINWIN_OPT_NPA, "<ToggleItem>", NULL}, - {N_("/Stop After Current Song"), "<control>M", mainwin_songname_menu_callback, - MAINWIN_SONGNAME_STOPAFTERSONG, "<ToggleItem>", NULL}, - {"/-", NULL, NULL, 0, "<Separator>", NULL}, - {N_("/Play"), "x", mainwin_general_menu_callback, - MAINWIN_GENERAL_PLAY, "<StockItem>", GTK_STOCK_MEDIA_PLAY}, - {N_("/Pause"), "c", mainwin_general_menu_callback, - MAINWIN_GENERAL_PAUSE, "<StockItem>", GTK_STOCK_MEDIA_PAUSE}, - {N_("/Stop"), "v", mainwin_general_menu_callback, - MAINWIN_GENERAL_STOP, "<StockItem>", GTK_STOCK_MEDIA_STOP}, - {N_("/Previous"), "z", mainwin_general_menu_callback, - MAINWIN_GENERAL_PREV, "<StockItem>", GTK_STOCK_MEDIA_PREVIOUS}, - {N_("/Next"), "b", mainwin_general_menu_callback, - MAINWIN_GENERAL_NEXT, "<StockItem>", GTK_STOCK_MEDIA_NEXT}, - {"/-", NULL, NULL, 0, "<Separator>", NULL}, - {N_("/Jump to Playlist Start"), "<control>Z", mainwin_general_menu_callback, - MAINWIN_GENERAL_START, "<StockItem>", GTK_STOCK_GOTO_TOP}, - {N_("/-"), NULL, NULL, 0, "<Separator>"}, - {N_("/Set A-B"), "A", mainwin_general_menu_callback, - MAINWIN_GENERAL_SETAB, "<Item>"}, - {N_("/Clear A-B"), "<control>S", mainwin_general_menu_callback, - MAINWIN_GENERAL_CLEARAB, "<Item>"}, - {"/-", NULL, NULL, 0, "<Separator>", NULL}, - {N_("/Jump to File"), "J", mainwin_general_menu_callback, - MAINWIN_GENERAL_JTF, "<StockItem>", GTK_STOCK_JUMP_TO}, - {N_("/Jump to Time"), "<control>J", mainwin_general_menu_callback, - MAINWIN_GENERAL_JTT, "<StockItem>", GTK_STOCK_JUMP_TO}, - {"/-", NULL, NULL, 0, "<Separator>", NULL}, - {N_("/New Playlist"), "<shift>N", mainwin_general_menu_callback, - MAINWIN_GENERAL_NEW_PL, "<Item>"}, - {N_("/Select Next Playlist"), "<shift>P", mainwin_general_menu_callback, - MAINWIN_GENERAL_NEXT_PL, "<Item>"}, - {N_("/Select Previous Playlist"), "<control><shift>P", mainwin_general_menu_callback, - MAINWIN_GENERAL_PREV_PL, "<Item>"}, - {"/-", NULL, NULL, 0, "<Separator>", NULL}, - {N_("/View Track Details"), "<alt>I", mainwin_general_menu_callback, - MAINWIN_GENERAL_FILEINFO, "<StockItem>", AUD_STOCK_INFO } -}; - -static const gint mainwin_playback_menu_entries_num = - G_N_ELEMENTS(mainwin_playback_menu_entries); - -/* Main menu */ - -GtkItemFactoryEntry mainwin_general_menu_entries[] = { - {N_("/About Audacious"), NULL, mainwin_general_menu_callback, - MAINWIN_GENERAL_ABOUT, "<StockItem>", GTK_STOCK_DIALOG_INFO}, - {"/-", NULL, NULL, 0, "<Separator>", NULL}, - {N_("/Play File"), "L", mainwin_general_menu_callback, - MAINWIN_GENERAL_PLAYFILE, "<StockItem>", GTK_STOCK_OPEN}, - {N_("/Play Location"), "<control>L", mainwin_general_menu_callback, - MAINWIN_GENERAL_PLAYLOCATION, "<StockItem>", GTK_STOCK_NETWORK}, - {"/-", NULL, NULL, 0, "<Separator>", NULL}, - {N_("/V_isualization"), NULL, NULL, 0, "<Item>", NULL}, - {N_("/_Playback"), NULL, NULL, 0, "<Item>", NULL}, - {N_("/_View"), NULL, NULL, 0, "<Item>", NULL}, - {"/-", NULL, NULL, 0, "<Separator>", NULL}, - {N_("/Preferences"), "<control>P", mainwin_general_menu_callback, - MAINWIN_GENERAL_PREFS, "<StockItem>", GTK_STOCK_PREFERENCES}, - {N_("/_Quit"), NULL, mainwin_general_menu_callback, - MAINWIN_GENERAL_EXIT, "<StockItem>", GTK_STOCK_QUIT} -}; - -static const gint mainwin_general_menu_entries_num = - G_N_ELEMENTS(mainwin_general_menu_entries); - -/* Add submenu */ - -GtkItemFactoryEntry mainwin_add_menu_entries[] = { - {N_("/Files..."), "f", mainwin_general_menu_callback, - MAINWIN_GENERAL_PLAYFILE, "<StockItem>", GTK_STOCK_OPEN}, - {N_("/Internet location..."), "<control>h", mainwin_general_menu_callback, - MAINWIN_GENERAL_PLAYLOCATION, "<StockItem>", GTK_STOCK_NETWORK}, -}; - -static const gint mainwin_add_menu_entries_num = - G_N_ELEMENTS(mainwin_add_menu_entries); - -/* View submenu */ - -GtkItemFactoryEntry mainwin_view_menu_entries[] = { - {N_("/Show Player"), "<alt>M", mainwin_general_menu_callback, - MAINWIN_GENERAL_SHOWMWIN, "<ToggleItem>", NULL}, - {N_("/Show Playlist Editor"), "<alt>E", mainwin_general_menu_callback, - MAINWIN_GENERAL_SHOWPLWIN, "<ToggleItem>", NULL}, - {N_("/Show Equalizer"), "<alt>G", mainwin_general_menu_callback, - MAINWIN_GENERAL_SHOWEQWIN, "<ToggleItem>", NULL}, - {"/-", NULL, NULL, 0, "<Separator>", NULL}, - {N_("/Time Elapsed"), "<control>E", mainwin_view_menu_callback, - MAINWIN_OPT_TELAPSED, "<RadioItem>", NULL}, - {N_("/Time Remaining"), "<control>R", mainwin_view_menu_callback, - MAINWIN_OPT_TREMAINING, "/Time Elapsed", NULL}, - {"/-", NULL, NULL, 0, "<Separator>", NULL}, - {N_("/Always On Top"), "<control>o", mainwin_view_menu_callback, - MAINWIN_OPT_ALWAYS, "<ToggleItem>", NULL}, - {N_("/Put on All Workspaces"), "<control>S", - mainwin_view_menu_callback, MAINWIN_OPT_STICKY, "<ToggleItem>", NULL}, - {N_("/Autoscroll Songname"), NULL, mainwin_view_menu_callback, - MAINWIN_SONGNAME_SCROLL, "<ToggleItem>", NULL}, - {"/-", NULL, NULL, 0, "<Separator>", NULL}, - {N_("/Roll up Player"), "<control>W", mainwin_view_menu_callback, - MAINWIN_OPT_WS, "<ToggleItem>", NULL}, - {N_("/Roll up Playlist Editor"), "<control><shift>W", mainwin_view_menu_callback, - MAINWIN_OPT_PWS, "<ToggleItem>", NULL}, - {N_("/Roll up Equalizer"), "<control><alt>W", mainwin_view_menu_callback, - MAINWIN_OPT_EQWS, "<ToggleItem>", NULL}, - {"/-", NULL, NULL, 0, "<Separator>", NULL}, - {N_("/DoubleSize"), "<control>D", mainwin_view_menu_callback, - MAINWIN_OPT_DOUBLESIZE, "<ToggleItem>"}, - {N_("/Easy Move"), "<control>E", mainwin_view_menu_callback, - MAINWIN_OPT_EASY_MOVE, "<ToggleItem>"} -}; - -static const gint mainwin_view_menu_entries_num = - G_N_ELEMENTS(mainwin_view_menu_entries); - - static PlaybackInfo playback_info = { NULL, 0, 0, 0 }; @@ -496,6 +187,7 @@ void set_doublesize(gboolean doublesize); + /* FIXME: placed here for now */ void playback_get_sample_params(gint * bitrate, @@ -538,10 +230,9 @@ void mainwin_set_always_on_top(gboolean always) { - GtkWidget *widget = gtk_item_factory_get_widget(mainwin_view_menu, - "/Always On Top"); - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widget), - mainwin_menurow->mr_always_selected); + GtkAction *action = gtk_action_group_get_action( + mainwin_toggleaction_group_others , "view always on top" ); + gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(action) , always ); } static void @@ -561,10 +252,13 @@ static void mainwin_set_shade(gboolean shaded) { - GtkWidget *widget; - widget = gtk_item_factory_get_widget(mainwin_view_menu, - "/Roll up Player"); - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widget), shaded); + GtkAction *action = gtk_action_group_get_action( + mainwin_toggleaction_group_others , "view roll up player" ); + gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(action) , shaded ); +/* + GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager, + "/mainwin-menus/main-menu/view/view roll up player" ); + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widget), shaded);*/ } static void @@ -670,10 +364,30 @@ void mainwin_vis_set_type(VisType mode) { - gchar *path = - mainwin_vis_menu_entries[MAINWIN_VIS_MENU_VIS_MODE + mode].path; - GtkWidget *widget = gtk_item_factory_get_widget(mainwin_vis_menu, path); - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widget), TRUE); + GtkAction *action; + + switch ( mode ) + { + case VIS_ANALYZER: + action = gtk_action_group_get_action( + mainwin_radioaction_group_vismode , "vismode analyzer" ); + break; + case VIS_SCOPE: + action = gtk_action_group_get_action( + mainwin_radioaction_group_vismode , "vismode scope" ); + break; + case VIS_VOICEPRINT: + action = gtk_action_group_get_action( + mainwin_radioaction_group_vismode , "vismode voiceprint" ); + break; + case VIS_OFF: + default: + action = gtk_action_group_get_action( + mainwin_radioaction_group_vismode , "vismode off" ); + break; + } + + gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(action) , TRUE ); } static void @@ -698,7 +412,7 @@ { gint x, y; gtk_window_get_position(GTK_WINDOW(mainwin), &x, &y); - util_item_factory_popup(mainwin_general_menu, + ui_manager_popup_menu_show(GTK_MENU(mainwin_general_menu), x + 6 * (1 + cfg.doublesize), y + MAINWIN_SHADED_HEIGHT * (1 + cfg.doublesize), 1, GDK_CURRENT_TIME); @@ -1477,21 +1191,21 @@ if (event->button == 3) { if (widget_contains(WIDGET(mainwin_info), event->x, event->y)) { - util_item_factory_popup(mainwin_songname_menu, - event->x_root, event->y_root, - 3, event->time); + ui_manager_popup_menu_show(GTK_MENU(mainwin_songname_menu), + event->x_root, event->y_root, + 3, event->time); grab = FALSE; } else if (widget_contains(WIDGET(mainwin_vis), event->x, event->y) || widget_contains(WIDGET(mainwin_svis), event->x, event->y)) { - util_item_factory_popup(mainwin_vis_menu, event->x_root, + ui_manager_popup_menu_show(GTK_MENU(mainwin_visualization_menu), event->x_root, event->y_root, 3, event->time); grab = FALSE; } else if ( (event->y > 70) && (event->x < 128) ) { - util_item_factory_popup(mainwin_play_menu, + ui_manager_popup_menu_show(GTK_MENU(mainwin_playback_menu), event->x_root, event->y_root, 3, event->time); grab = FALSE; @@ -1505,7 +1219,7 @@ ***MD I think the above is stupid, people don't expect this * */ - util_item_factory_popup(mainwin_general_menu, + ui_manager_popup_menu_show(GTK_MENU(mainwin_general_menu), event->x_root, event->y_root, 3, event->time); grab = FALSE; @@ -2365,12 +2079,15 @@ } static void -check_set(GtkItemFactory * factory, - const gchar * path, - gboolean active) +check_set( GtkActionGroup * action_group , + const gchar * action_name , + gboolean is_on ) { - GtkWidget *item = gtk_item_factory_get_widget(factory, path); - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), active); + /* check_set noew uses gtkaction */ + GtkAction *action = gtk_action_group_get_action( action_group , action_name ); + if ( action != NULL ) + gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(action) , is_on ); + return; } void @@ -2481,13 +2198,13 @@ void mainwin_shuffle_pushed(gboolean toggled) { - check_set(mainwin_play_menu, "/Shuffle", toggled); + check_set( mainwin_toggleaction_group_others , "playback shuffle" , toggled ); } void mainwin_repeat_pushed(gboolean toggled) { - check_set(mainwin_play_menu, "/Repeat", toggled); + check_set( mainwin_toggleaction_group_others , "playback repeat" , toggled ); } void @@ -2734,7 +2451,7 @@ { cfg.player_visible = TRUE; - check_set(mainwin_view_menu, "/Show Player", TRUE); + check_set( mainwin_toggleaction_group_others , "show player" , TRUE ); if (cfg.player_shaded) vis_clear_data(active_vis); @@ -2793,7 +2510,7 @@ GdkGC *gc; GdkColor pattern; - check_set(mainwin_view_menu, "/Show Player", FALSE); + check_set( mainwin_toggleaction_group_others , "show player", FALSE); if (cfg.player_shaded) svis_clear_data(mainwin_svis); @@ -2818,70 +2535,14 @@ cfg.player_visible = FALSE; } -static void -mainwin_songname_menu_callback(gpointer data, - guint action, - GtkWidget * item) -{ - GtkCheckMenuItem *check; - - switch (action) { - case MAINWIN_SONGNAME_FILEINFO: - playlist_fileinfo_current(playlist_get_active()); - break; - case MAINWIN_SONGNAME_JTF: - mainwin_jump_to_file(); - break; - case MAINWIN_SONGNAME_JTT: - mainwin_jump_to_time(); - break; - case MAINWIN_SONGNAME_SCROLL: - check = GTK_CHECK_MENU_ITEM(item); - mainwin_set_title_scroll(gtk_check_menu_item_get_active(check)); - check_set(mainwin_view_menu, "/Autoscroll Songname", cfg.autoscroll); - playlistwin_set_sinfo_scroll(cfg.autoscroll); /* propagate scroll setting to playlistwin_sinfo */ - break; - case MAINWIN_SONGNAME_STOPAFTERSONG: - check = GTK_CHECK_MENU_ITEM(item); - cfg.stopaftersong = gtk_check_menu_item_get_active(check); - check_set(mainwin_songname_menu, "/Stop After Current Song", cfg.stopaftersong); - check_set(mainwin_play_menu, "/Stop After Current Song", cfg.stopaftersong); - break; - } -} void mainwin_set_stopaftersong(gboolean stop) { cfg.stopaftersong = stop; - check_set(mainwin_songname_menu, "/Stop After Current Song", cfg.stopaftersong); + check_set(mainwin_toggleaction_group_others, "stop after current song", cfg.stopaftersong); } -static void -mainwin_play_menu_callback(gpointer data, - guint action, - GtkWidget * item) -{ - GtkCheckMenuItem *check; - - switch (action) { - case MAINWIN_OPT_SHUFFLE: - check = GTK_CHECK_MENU_ITEM(item); - cfg.shuffle = gtk_check_menu_item_get_active(check); - playlist_set_shuffle(cfg.shuffle); - tbutton_set_toggled(mainwin_shuffle, cfg.shuffle); - break; - case MAINWIN_OPT_REPEAT: - check = GTK_CHECK_MENU_ITEM(item); - cfg.repeat = gtk_check_menu_item_get_active(check); - tbutton_set_toggled(mainwin_repeat, cfg.repeat); - break; - case MAINWIN_OPT_NPA: - check = GTK_CHECK_MENU_ITEM(item); - cfg.no_playlist_advance = gtk_check_menu_item_get_active(check); - break; - } -} static void mainwin_set_doublesize(gboolean doublesize) @@ -2921,126 +2582,7 @@ equalizerwin_set_doublesize(doublesize); } - -static void -mainwin_view_menu_callback(gpointer data, - guint action, - GtkWidget * item) -{ - GtkCheckMenuItem *check; - - switch (action) { - case MAINWIN_OPT_TELAPSED: - set_timer_mode_menu_cb(TIMER_ELAPSED); - break; - case MAINWIN_OPT_TREMAINING: - set_timer_mode_menu_cb(TIMER_REMAINING); - break; - case MAINWIN_OPT_ALWAYS: - mainwin_menurow->mr_always_selected = GTK_CHECK_MENU_ITEM(item)->active; - cfg.always_on_top = mainwin_menurow->mr_always_selected; - widget_draw(WIDGET(mainwin_menurow)); - - if (starting_up == FALSE) - hint_set_always(cfg.always_on_top); - - break; - case MAINWIN_OPT_STICKY: - cfg.sticky = GTK_CHECK_MENU_ITEM(item)->active; - hint_set_sticky(cfg.sticky); - break; - case MAINWIN_OPT_WS: - mainwin_set_shade_menu_cb(GTK_CHECK_MENU_ITEM(item)->active); - break; - case MAINWIN_OPT_PWS: - playlistwin_set_shade(GTK_CHECK_MENU_ITEM(item)->active); - break; - case MAINWIN_OPT_EQWS: - equalizerwin_set_shade_menu_cb(GTK_CHECK_MENU_ITEM(item)->active); - break; - case MAINWIN_OPT_DOUBLESIZE: - mainwin_menurow->mr_doublesize_selected = - GTK_CHECK_MENU_ITEM(gtk_item_factory_get_widget - (mainwin_view_menu, - "/DoubleSize"))->active; - widget_draw(WIDGET(mainwin_menurow)); - set_doublesize(mainwin_menurow->mr_doublesize_selected); - gdk_flush(); - break; - case MAINWIN_OPT_EASY_MOVE: - cfg.easy_move = - GTK_CHECK_MENU_ITEM(gtk_item_factory_get_widget - (mainwin_view_menu, "/Easy Move"))->active; - break; - case MAINWIN_SONGNAME_SCROLL: - check = GTK_CHECK_MENU_ITEM(item); - mainwin_set_title_scroll(gtk_check_menu_item_get_active(check)); - check_set(mainwin_songname_menu, "/Autoscroll Songname", cfg.autoscroll); - playlistwin_set_sinfo_scroll(cfg.autoscroll); /* propagate scroll setting to playlistwin_sinfo */ - break; - } -} - -void -mainwin_vis_menu_callback(gpointer data, - guint action, - GtkWidget * item) -{ - switch (action) { - case MAINWIN_VIS_ANALYZER: - case MAINWIN_VIS_SCOPE: - case MAINWIN_VIS_VOICEPRINT: - case MAINWIN_VIS_OFF: - mainwin_vis_set_type_menu_cb(action - MAINWIN_VIS_ANALYZER); - break; - case MAINWIN_VIS_ANALYZER_NORMAL: - case MAINWIN_VIS_ANALYZER_FIRE: - case MAINWIN_VIS_ANALYZER_VLINES: - mainwin_vis_set_analyzer_mode(action - MAINWIN_VIS_ANALYZER_NORMAL); - break; - case MAINWIN_VIS_ANALYZER_LINES: - case MAINWIN_VIS_ANALYZER_BARS: - mainwin_vis_set_analyzer_type(action - MAINWIN_VIS_ANALYZER_LINES); - break; - case MAINWIN_VIS_ANALYZER_PEAKS: - cfg.analyzer_peaks = GTK_CHECK_MENU_ITEM(item)->active; - break; - case MAINWIN_VIS_SCOPE_DOT: - case MAINWIN_VIS_SCOPE_LINE: - case MAINWIN_VIS_SCOPE_SOLID: - cfg.scope_mode = action - MAINWIN_VIS_SCOPE_DOT; - break; - case MAINWIN_VIS_VOICEPRINT_NORMAL: - case MAINWIN_VIS_VOICEPRINT_FIRE: - case MAINWIN_VIS_VOICEPRINT_ICE: - cfg.voiceprint_mode = action - MAINWIN_VIS_VOICEPRINT_NORMAL; - break; - case MAINWIN_VIS_VU_NORMAL: - case MAINWIN_VIS_VU_SMOOTH: - cfg.vu_mode = action - MAINWIN_VIS_VU_NORMAL; - break; - case MAINWIN_VIS_REFRESH_FULL: - case MAINWIN_VIS_REFRESH_HALF: - case MAINWIN_VIS_REFRESH_QUARTER: - case MAINWIN_VIS_REFRESH_EIGHTH: - mainwin_vis_set_refresh(action - MAINWIN_VIS_REFRESH_FULL); - break; - case MAINWIN_VIS_AFALLOFF_SLOWEST: - case MAINWIN_VIS_AFALLOFF_SLOW: - case MAINWIN_VIS_AFALLOFF_MEDIUM: - case MAINWIN_VIS_AFALLOFF_FAST: - case MAINWIN_VIS_AFALLOFF_FASTEST: - mainwin_vis_set_afalloff(action - MAINWIN_VIS_AFALLOFF_SLOWEST); - break; - case MAINWIN_VIS_PFALLOFF_SLOWEST: - case MAINWIN_VIS_PFALLOFF_SLOW: - case MAINWIN_VIS_PFALLOFF_MEDIUM: - case MAINWIN_VIS_PFALLOFF_FAST: - case MAINWIN_VIS_PFALLOFF_FASTEST: - mainwin_vis_set_pfalloff(action - MAINWIN_VIS_PFALLOFF_SLOWEST); - break; - } -} + void mainwin_general_menu_callback(gpointer data, @@ -3153,8 +2695,8 @@ case MAINWIN_GENERAL_NEW_PL: { Playlist *new_pl = playlist_new(); - playlist_add_playlist(new_pl); + playlist_select_playlist(new_pl); } break; case MAINWIN_GENERAL_PREV_PL: @@ -3207,28 +2749,27 @@ switch (i) { case MENUROW_OPTIONS: gdk_window_get_pointer(NULL, &x, &y, &modmask); - util_item_factory_popup(mainwin_view_menu, x, y, 1, + ui_manager_popup_menu_show(GTK_MENU(mainwin_view_menu), x, y, 1, GDK_CURRENT_TIME); break; case MENUROW_ALWAYS: - widget = - gtk_item_factory_get_widget(mainwin_view_menu, - "/Always On Top"); - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widget), - mainwin_menurow->mr_always_selected); + gtk_toggle_action_set_active( + GTK_TOGGLE_ACTION(gtk_action_group_get_action( + mainwin_toggleaction_group_others , "view always on top" )) , + mainwin_menurow->mr_always_selected ); break; case MENUROW_FILEINFOBOX: playlist_fileinfo_current(playlist_get_active()); break; case MENUROW_DOUBLESIZE: - widget = - gtk_item_factory_get_widget(mainwin_view_menu, "/DoubleSize"); - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widget), - mainwin_menurow->mr_doublesize_selected); + gtk_toggle_action_set_active( + GTK_TOGGLE_ACTION(gtk_action_group_get_action( + mainwin_toggleaction_group_others , "view doublesize" )) , + mainwin_menurow->mr_doublesize_selected ); break; case MENUROW_VISUALIZATION: gdk_window_get_pointer(NULL, &x, &y, &modmask); - util_item_factory_popup(mainwin_vis_menu, x, y, 1, GDK_CURRENT_TIME); + ui_manager_popup_menu_show(GTK_MENU(mainwin_visualization_menu), x, y, 1, GDK_CURRENT_TIME); break; case MENUROW_NONE: break; @@ -3470,9 +3011,9 @@ set_timer_mode(TimerMode mode) { if (mode == TIMER_ELAPSED) - check_set(mainwin_view_menu, "/Time Elapsed", TRUE); + check_set(mainwin_radioaction_group_viewtime, "view time elapsed", TRUE); else - check_set(mainwin_view_menu, "/Time Remaining", TRUE); + check_set(mainwin_radioaction_group_viewtime, "view time remaining", TRUE); } static void @@ -3500,54 +3041,167 @@ /* View menu */ - check_set(mainwin_view_menu, "/Always On Top", cfg.always_on_top); - check_set(mainwin_view_menu, "/Put on All Workspaces", cfg.sticky); - check_set(mainwin_view_menu, "/Roll up Player", cfg.player_shaded); - check_set(mainwin_view_menu, "/Roll up Playlist Editor", cfg.playlist_shaded); - check_set(mainwin_view_menu, "/Roll up Equalizer", cfg.equalizer_shaded); - check_set(mainwin_view_menu, "/Easy Move", cfg.easy_move); - check_set(mainwin_view_menu, "/DoubleSize", cfg.doublesize); + check_set(mainwin_toggleaction_group_others, "view always on top", cfg.always_on_top); + check_set(mainwin_toggleaction_group_others, "view put on all workspaces", cfg.sticky); + check_set(mainwin_toggleaction_group_others, "roll up player", cfg.player_shaded); + check_set(mainwin_toggleaction_group_others, "roll up playlist editor", cfg.playlist_shaded); + check_set(mainwin_toggleaction_group_others, "roll up equalizer", cfg.equalizer_shaded); + check_set(mainwin_toggleaction_group_others, "view easy move", cfg.easy_move); + check_set(mainwin_toggleaction_group_others, "view doublesize", cfg.doublesize); /* Songname menu */ - check_set(mainwin_songname_menu, "/Autoscroll Songname", cfg.autoscroll); - check_set(mainwin_songname_menu, "/Stop After Current Song", cfg.stopaftersong); + check_set(mainwin_toggleaction_group_others, "autoscroll songname", cfg.autoscroll); + check_set(mainwin_toggleaction_group_others, "stop after current song", cfg.stopaftersong); /* Playback menu */ - check_set(mainwin_play_menu, "/Repeat", cfg.repeat); - check_set(mainwin_play_menu, "/Shuffle", cfg.shuffle); - check_set(mainwin_play_menu, "/No Playlist Advance", cfg.no_playlist_advance); + check_set(mainwin_toggleaction_group_others, "playback repeat", cfg.repeat); + check_set(mainwin_toggleaction_group_others, "playback shuffle", cfg.shuffle); + check_set(mainwin_toggleaction_group_others, "playback no playlist advance", cfg.no_playlist_advance); /* Visualization menu */ - check_set(mainwin_vis_menu, - mainwin_vis_menu_entries[MAINWIN_VIS_MENU_VIS_MODE + - cfg.vis_type].path, TRUE); - check_set(mainwin_vis_menu, - mainwin_vis_menu_entries[MAINWIN_VIS_MENU_ANALYZER_MODE + - cfg.analyzer_mode].path, TRUE); - check_set(mainwin_vis_menu, - mainwin_vis_menu_entries[MAINWIN_VIS_MENU_ANALYZER_TYPE + - cfg.analyzer_type].path, TRUE); - check_set(mainwin_vis_menu, - mainwin_vis_menu_entries[MAINWIN_VIS_MENU_ANALYZER_PEAKS]. - path, cfg.analyzer_peaks); - check_set(mainwin_vis_menu, - mainwin_vis_menu_entries[MAINWIN_VIS_MENU_SCOPE_MODE + - cfg.scope_mode].path, TRUE); - check_set(mainwin_vis_menu, - mainwin_vis_menu_entries[MAINWIN_VIS_MENU_WSHADEVU_MODE + - cfg.vu_mode].path, TRUE); - check_set(mainwin_vis_menu, - mainwin_vis_menu_entries[MAINWIN_VIS_MENU_REFRESH_RATE + - cfg.vis_refresh].path, TRUE); - check_set(mainwin_vis_menu, - mainwin_vis_menu_entries[MAINWIN_VIS_MENU_AFALLOFF + - cfg.analyzer_falloff].path, TRUE); - check_set(mainwin_vis_menu, - mainwin_vis_menu_entries[MAINWIN_VIS_MENU_PFALLOFF + - cfg.peaks_falloff].path, TRUE); + switch ( cfg.vis_type ) + { + case VIS_ANALYZER: + check_set(mainwin_radioaction_group_vismode, "vismode analyzer", TRUE); + break; + case VIS_SCOPE: + check_set(mainwin_radioaction_group_vismode, "vismode scope", TRUE); + break; + case VIS_VOICEPRINT: + check_set(mainwin_radioaction_group_vismode, "vismode voiceprint", TRUE); + break; + case VIS_OFF: + default: + check_set(mainwin_radioaction_group_vismode, "vismode off", TRUE); + break; + } + + switch ( cfg.analyzer_mode ) + { + case ANALYZER_FIRE: + check_set(mainwin_radioaction_group_anamode, "anamode fire", TRUE); + break; + case ANALYZER_VLINES: + check_set(mainwin_radioaction_group_anamode, "anamode vertical lines", TRUE); + break; + case ANALYZER_NORMAL: + default: + check_set(mainwin_radioaction_group_anamode, "anamode normal", TRUE); + break; + } + + switch ( cfg.analyzer_type ) + { + case ANALYZER_BARS: + check_set(mainwin_radioaction_group_anatype, "anatype bars", TRUE); + break; + case ANALYZER_LINES: + default: + check_set(mainwin_radioaction_group_anatype, "anatype lines", TRUE); + break; + } + + check_set(mainwin_toggleaction_group_others, "anamode peaks", cfg.analyzer_peaks ); + + switch ( cfg.scope_mode ) + { + case SCOPE_LINE: + check_set(mainwin_radioaction_group_scomode, "scomode line", TRUE); + break; + case SCOPE_SOLID: + check_set(mainwin_radioaction_group_scomode, "scomode solid", TRUE); + break; + case SCOPE_DOT: + default: + check_set(mainwin_radioaction_group_scomode, "scomode dot", TRUE); + break; + } + + switch ( cfg.voiceprint_mode ) + { + case VOICEPRINT_FIRE: + check_set(mainwin_radioaction_group_vprmode, "vprmode fire", TRUE); + break; + case VOICEPRINT_ICE: + check_set(mainwin_radioaction_group_vprmode, "vprmode ice", TRUE); + break; + case VOICEPRINT_NORMAL: + default: + check_set(mainwin_radioaction_group_vprmode, "vprmode normal", TRUE); + break; + } + + switch ( cfg.vu_mode ) + { + case VU_SMOOTH: + check_set(mainwin_radioaction_group_wshmode, "wshmode smooth", TRUE); + break; + case VU_NORMAL: + default: + check_set(mainwin_radioaction_group_wshmode, "wshmode normal", TRUE); + break; + } + + switch ( cfg.vis_refresh ) + { + case REFRESH_HALF: + check_set(mainwin_radioaction_group_refrate, "refrate half", TRUE); + break; + case REFRESH_QUARTER: + check_set(mainwin_radioaction_group_refrate, "refrate quarter", TRUE); + break; + case REFRESH_EIGTH: + check_set(mainwin_radioaction_group_refrate, "refrate eighth", TRUE); + break; + case REFRESH_FULL: + default: + check_set(mainwin_radioaction_group_refrate, "refrate full", TRUE); + break; + } + + switch ( cfg.analyzer_falloff ) + { + case FALLOFF_SLOW: + check_set(mainwin_radioaction_group_anafoff, "anafoff slow", TRUE); + break; + case FALLOFF_MEDIUM: + check_set(mainwin_radioaction_group_anafoff, "anafoff medium", TRUE); + break; + case FALLOFF_FAST: + check_set(mainwin_radioaction_group_anafoff, "anafoff fast", TRUE); + break; + case FALLOFF_FASTEST: + check_set(mainwin_radioaction_group_anafoff, "anafoff fastest", TRUE); + break; + case FALLOFF_SLOWEST: + default: + check_set(mainwin_radioaction_group_anafoff, "anafoff slowest", TRUE); + break; + } + + switch ( cfg.peaks_falloff ) + { + case FALLOFF_SLOW: + check_set(mainwin_radioaction_group_peafoff, "peafoff slow", TRUE); + break; + case FALLOFF_MEDIUM: + check_set(mainwin_radioaction_group_peafoff, "peafoff medium", TRUE); + break; + case FALLOFF_FAST: + check_set(mainwin_radioaction_group_peafoff, "peafoff fast", TRUE); + break; + case FALLOFF_FASTEST: + check_set(mainwin_radioaction_group_peafoff, "peafoff fastest", TRUE); + break; + case FALLOFF_SLOWEST: + default: + check_set(mainwin_radioaction_group_peafoff, "peafoff slowest", TRUE); + break; + } + } static void @@ -3821,47 +3475,13 @@ G_CALLBACK(mainwin_keypress), NULL); } -static void -mainwin_create_menus(void) -{ - mainwin_general_menu = create_menu(mainwin_general_menu_entries, - mainwin_general_menu_entries_num, - mainwin_accel); - - mainwin_play_menu = create_menu(mainwin_playback_menu_entries, - mainwin_playback_menu_entries_num, - mainwin_accel); - - mainwin_view_menu = create_menu(mainwin_view_menu_entries, - mainwin_view_menu_entries_num, - mainwin_accel); - - mainwin_songname_menu = create_menu(mainwin_songname_menu_entries, - mainwin_songname_menu_entries_num, - mainwin_accel); - - mainwin_add_menu = create_menu(mainwin_add_menu_entries, - mainwin_add_menu_entries_num, - mainwin_accel); - - mainwin_vis_menu = create_menu(mainwin_vis_menu_entries, - mainwin_vis_menu_entries_num, - mainwin_accel); - - make_submenu(mainwin_general_menu, "/View", mainwin_view_menu); - make_submenu(mainwin_general_menu, "/Playback", mainwin_play_menu); - make_submenu(mainwin_general_menu, "/Visualization", mainwin_vis_menu); - - gtk_window_add_accel_group(GTK_WINDOW(mainwin), mainwin_accel); -} - void mainwin_create(void) { mainwin_create_window(); mainwin_accel = gtk_accel_group_new(); - mainwin_create_menus(); + gtk_window_add_accel_group( GTK_WINDOW(mainwin) , ui_manager_get_accel_group() ); mainwin_gc = gdk_gc_new(mainwin->window); mainwin_bg = gdk_pixmap_new(mainwin->window, @@ -4060,3 +3680,339 @@ return TRUE; } + + +/* toggleactionentries actions */ + +void +action_anamode_peaks( GtkToggleAction * action ) +{ + cfg.analyzer_peaks = gtk_toggle_action_get_active( action ); +} + +void +action_autoscroll_songname( GtkToggleAction * action ) +{ + mainwin_set_title_scroll(gtk_toggle_action_get_active(action)); + playlistwin_set_sinfo_scroll(cfg.autoscroll); /* propagate scroll setting to playlistwin_sinfo */ +} + +void +action_playback_noplaylistadvance( GtkToggleAction * action ) +{ + cfg.no_playlist_advance = gtk_toggle_action_get_active( action ); +} + +void +action_playback_repeat( GtkToggleAction * action ) +{ + cfg.repeat = gtk_toggle_action_get_active( action ); + tbutton_set_toggled(mainwin_repeat, cfg.repeat); +} + +void +action_playback_shuffle( GtkToggleAction * action ) +{ + cfg.shuffle = gtk_toggle_action_get_active( action ); + playlist_set_shuffle(cfg.shuffle); + tbutton_set_toggled(mainwin_shuffle, cfg.shuffle); +} + +void +action_stop_after_current_song( GtkToggleAction * action ) +{ + cfg.stopaftersong = gtk_toggle_action_get_active( action ); +} + +void +action_view_always_on_top( GtkToggleAction * action ) +{ + mainwin_menurow->mr_always_selected = gtk_toggle_action_get_active( action ); + cfg.always_on_top = mainwin_menurow->mr_always_selected; + widget_draw(WIDGET(mainwin_menurow)); + + if (starting_up == FALSE) + hint_set_always(cfg.always_on_top); +} + +void +action_view_doublesize( GtkToggleAction * action ) +{ + mainwin_menurow->mr_doublesize_selected = gtk_toggle_action_get_active( action ); + widget_draw(WIDGET(mainwin_menurow)); + set_doublesize(mainwin_menurow->mr_doublesize_selected); + gdk_flush(); +} + +void +action_view_easymove( GtkToggleAction * action ) +{ + cfg.easy_move = gtk_toggle_action_get_active( action ); +} + +void +action_view_on_all_workspaces( GtkToggleAction * action ) +{ + cfg.sticky = gtk_toggle_action_get_active( action ); + hint_set_sticky(cfg.sticky); +} + +void +action_roll_up_equalizer( GtkToggleAction * action ) +{ + equalizerwin_set_shade_menu_cb(gtk_toggle_action_get_active(action)); +} + +void +action_roll_up_player( GtkToggleAction * action ) +{ + mainwin_set_shade_menu_cb(gtk_toggle_action_get_active(action)); +} + +void +action_roll_up_playlist_editor( GtkToggleAction * action ) +{ + playlistwin_set_shade(gtk_toggle_action_get_active(action)); +} + +void +action_show_equalizer( GtkToggleAction * action ) +{ + if (gtk_toggle_action_get_active(action)) + equalizerwin_real_show(); + else + equalizerwin_real_hide(); +} + +void +action_show_playlist_editor( GtkToggleAction * action ) +{ + if (gtk_toggle_action_get_active(action)) + playlistwin_show(); + else + playlistwin_hide(); +} + +void +action_show_player( GtkToggleAction * action ) +{ + mainwin_show(gtk_toggle_action_get_active(action)); +} + + +/* radioactionentries actions (one callback for each radio group) */ + +void +action_anafoff( GtkAction *action, GtkRadioAction *current ) +{ + mainwin_vis_set_afalloff(gtk_radio_action_get_current_value(current)); +} + +void +action_anamode( GtkAction *action, GtkRadioAction *current ) +{ + mainwin_vis_set_analyzer_mode(gtk_radio_action_get_current_value(current)); +} + +void +action_anatype( GtkAction *action, GtkRadioAction *current ) +{ + mainwin_vis_set_analyzer_type(gtk_radio_action_get_current_value(current)); +} + +void +action_peafoff( GtkAction *action, GtkRadioAction *current ) +{ + mainwin_vis_set_pfalloff(gtk_radio_action_get_current_value(current)); +} + +void +action_refrate( GtkAction *action, GtkRadioAction *current ) +{ + mainwin_vis_set_refresh(gtk_radio_action_get_current_value(current)); +} + +void +action_scomode( GtkAction *action, GtkRadioAction *current ) +{ + cfg.scope_mode = gtk_radio_action_get_current_value(current); +} + +void +action_vismode( GtkAction *action, GtkRadioAction *current ) +{ + mainwin_vis_set_type_menu_cb(gtk_radio_action_get_current_value(current)); +} + +void +action_vprmode( GtkAction *action, GtkRadioAction *current ) +{ + cfg.voiceprint_mode = gtk_radio_action_get_current_value(current); +} + +void +action_wshmode( GtkAction *action, GtkRadioAction *current ) +{ + cfg.vu_mode = gtk_radio_action_get_current_value(current); +} + +void +action_viewtime( GtkAction *action, GtkRadioAction *current ) +{ + set_timer_mode_menu_cb(gtk_radio_action_get_current_value(current)); +} + + +/* actionentries actions */ + +void +action_about_audacious( void ) +{ + show_about_window(); +} + +void +action_play_file( void ) +{ + util_run_filebrowser(NO_PLAY_BUTTON); +} + +void +action_play_location( void ) +{ + mainwin_show_add_url_window(); +} + +void +action_ab_set( void ) +{ + Playlist *playlist = playlist_get_active(); + if (playlist_get_current_length(playlist) != -1) + { + if (ab_position_a == -1) + { + ab_position_a = playback_get_time(); + ab_position_b = -1; + mainwin_lock_info_text("LOOP-POINT A POSITION SET."); + } + else if (ab_position_b == -1) + { + int time = playback_get_time(); + if (time > ab_position_a) + ab_position_b = time; + mainwin_release_info_text(); + } + else + { + ab_position_a = playback_get_time(); + ab_position_b = -1; + mainwin_lock_info_text("LOOP-POINT A POSITION RESET."); + } + } +} + +void +action_ab_clear( void ) +{ + Playlist *playlist = playlist_get_active(); + if (playlist_get_current_length(playlist) != -1) + { + ab_position_a = ab_position_b = -1; + mainwin_release_info_text(); + } +} + +void +action_track_info( void ) +{ + playlist_fileinfo_current(playlist_get_active()); +} + +void +action_jump_to_file( void ) +{ + mainwin_jump_to_file(); +} + +void +action_jump_to_playlist_start( void ) +{ + Playlist *playlist = playlist_get_active(); + playlist_set_position(playlist, 0); +} + +void +action_jump_to_time( void ) +{ + mainwin_jump_to_time(); +} + +void +action_playback_next( void ) +{ + Playlist *playlist = playlist_get_active(); + playlist_next(playlist); +} + +void +action_playback_previous( void ) +{ + Playlist *playlist = playlist_get_active(); + playlist_prev(playlist); +} + +void +action_playback_play( void ) +{ + mainwin_play_pushed(); +} + +void +action_playback_playcd( void ) +{ + play_medium(); +} + +void +action_playback_pause( void ) +{ + playback_pause(); +} + +void +action_playback_stop( void ) +{ + mainwin_stop_pushed(); +} + +void +action_playlist_new( void ) +{ + Playlist *new_pl = playlist_new(); + playlist_add_playlist(new_pl); + playlist_select_playlist(new_pl); +} + +void +action_playlist_prev( void ) +{ + playlist_select_prev(); +} + +void +action_playlist_next( void ) +{ + playlist_select_next(); +} + +void +action_preferences( void ) +{ + show_prefs_window(); +} + +void +action_quit( void ) +{ + mainwin_quit_cb(); +}
--- a/audacious/mainwin.h Mon Jan 01 09:28:18 2007 -0800 +++ b/audacious/mainwin.h Tue Jan 02 16:48:38 2007 -0800 @@ -102,9 +102,11 @@ extern GtkWidget *mainwin_jtf; +/* extern GtkItemFactory *mainwin_general_menu; extern GtkItemFactory *mainwin_vis_menu; extern GtkItemFactory *mainwin_play_menu, *mainwin_view_menu; +*/ extern TextBox *mainwin_stime_min, *mainwin_stime_sec; extern TextBox *mainwin_info; @@ -196,4 +198,5 @@ gint * frequency, gint * numchannels); + #endif
--- a/audacious/ui/Makefile Mon Jan 01 09:28:18 2007 -0800 +++ b/audacious/ui/Makefile Tue Jan 02 16:48:38 2007 -0800 @@ -4,6 +4,7 @@ gladexmldir = $(pkgdatadir)/ui OBJECTIVE_DATA = \ + mainwin.ui:$(gladexmldir) \ playlist.ui:$(gladexmldir) \ equalizer.ui:$(gladexmldir)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/audacious/ui/mainwin.ui Tue Jan 02 16:48:38 2007 -0800 @@ -0,0 +1,124 @@ +<?xml version="1.0" standalone="yes" encoding="utf-8" ?> + +<ui> + <menubar name="mainwin-menus"> + <menu action="dummy" name="songname-menu"> + <menuitem action="track info" /> + <separator /> + <menuitem action="autoscroll songname" /> + <menuitem action="stop after current song" /> + </menu> + + <menu action="dummy" name="main-menu"> + <menuitem action="about audacious" /> + <separator /> + <menuitem action="play file" /> + <menuitem action="play location" /> + <separator /> + <menu action="visualization"> + <menu action="vismode"> + <menuitem action="vismode analyzer" /> + <menuitem action="vismode scope" /> + <menuitem action="vismode voiceprint" /> + <menuitem action="vismode off" /> + </menu> + <menu action="anamode"> + <menuitem action="anamode normal" /> + <menuitem action="anamode fire" /> + <menuitem action="anamode vertical lines" /> + <separator /> + <menuitem action="anatype lines" /> + <menuitem action="anatype bars" /> + <separator /> + <menuitem action="anamode peaks" /> + </menu> + <menu action="scomode"> + <menuitem action="scomode dot" /> + <menuitem action="scomode line" /> + <menuitem action="scomode solid" /> + </menu> + <menu action="vprmode"> + <menuitem action="vprmode normal" /> + <menuitem action="vprmode fire" /> + <menuitem action="vprmode ice" /> + </menu> + <menu action="wshmode"> + <menuitem action="wshmode normal" /> + <menuitem action="wshmode smooth" /> + </menu> + <menu action="refrate"> + <menuitem action="refrate full" /> + <menuitem action="refrate half" /> + <menuitem action="refrate quarter" /> + <menuitem action="refrate eighth" /> + </menu> + <menu action="anafoff"> + <menuitem action="anafoff slowest" /> + <menuitem action="anafoff slow" /> + <menuitem action="anafoff medium" /> + <menuitem action="anafoff fast" /> + <menuitem action="anafoff fastest" /> + </menu> + <menu action="peafoff"> + <menuitem action="peafoff slowest" /> + <menuitem action="peafoff slow" /> + <menuitem action="peafoff medium" /> + <menuitem action="peafoff fast" /> + <menuitem action="peafoff fastest" /> + </menu> + </menu> + <menu action="playback"> + <menuitem action="playback play cd" /> + <separator /> + <menuitem action="playback repeat" /> + <menuitem action="playback shuffle" /> + <menuitem action="playback no playlist advance" /> + <menuitem action="stop after current song" /> + <separator /> + <menuitem action="playback play" /> + <menuitem action="playback pause" /> + <menuitem action="playback stop" /> + <menuitem action="playback previous" /> + <menuitem action="playback next" /> + <separator /> + <menuitem action="jump to playlist start" /> + <separator /> + <menuitem action="ab set" /> + <menuitem action="ab clear" /> + <separator /> + <menuitem action="jump to file" /> + <menuitem action="jump to time" /> + <separator /> + <menuitem action="track info" /> + </menu> + <menu action="playlist"> + <menuitem action="playlist new" /> + <menuitem action="playlist select next" /> + <menuitem action="playlist select previous" /> + <menuitem action="playlist delete" /> + </menu> + <menu action="view"> + <menuitem action="show player" /> + <menuitem action="show playlist editor" /> + <menuitem action="show equalizer" /> + <separator /> + <menuitem action="view time elapsed" /> + <menuitem action="view time remaining" /> + <separator /> + <menuitem action="view always on top" /> + <menuitem action="view put on all workspaces" /> + <menuitem action="autoscroll songname" /> + <separator /> + <menuitem action="roll up player" /> + <menuitem action="roll up playlist editor" /> + <menuitem action="roll up equalizer" /> + <separator /> + <menuitem action="view doublesize" /> + <menuitem action="view easy move" /> + </menu> + <separator /> + <menuitem action="preferences" /> + <menuitem action="quit" /> + </menu> + </menubar> +</ui>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/audacious/ui_manager.c Tue Jan 02 16:48:38 2007 -0800 @@ -0,0 +1,436 @@ +/* Audacious - Cross-platform multimedia player + * Copyright (C) 2005-2006 Audacious development team. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; under version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "ui_manager.h" +#include "actions-mainwin.h" + +#include "mainwin.h" +#include "icons-stock.h" +#include "widgets/widgetcore.h" + + +static GtkUIManager *ui_manager; + + +/* toggle action entries */ + +static GtkToggleActionEntry mainwin_toggleaction_entries_others[] = { + + { "autoscroll songname", NULL , N_("Autoscroll Songname"), NULL, + N_("Autoscroll Songname"), G_CALLBACK(action_autoscroll_songname) , FALSE }, + + { "stop after current song", NULL , N_("Stop after Current Song"), "<Ctrl>M", + N_("Stop after Current Song"), G_CALLBACK(action_stop_after_current_song) , FALSE }, + + { "anamode peaks", NULL , N_("Peaks"), NULL, + N_("Peaks"), G_CALLBACK(action_anamode_peaks) , FALSE }, + + { "playback repeat", NULL , N_("Repeat"), "R", + N_("Repeat"), G_CALLBACK(action_playback_repeat) , FALSE }, + + { "playback shuffle", NULL , N_("Shuffle"), "S", + N_("Shuffle"), G_CALLBACK(action_playback_shuffle) , FALSE }, + + { "playback no playlist advance", NULL , N_("No Playlist Advance"), "<Ctrl>N", + N_("No Playlist Advance"), G_CALLBACK(action_playback_noplaylistadvance) , FALSE }, + + { "show player", NULL , N_("Show Player"), "<Alt>M", + N_("Show Player"), G_CALLBACK(action_show_player) , FALSE }, + + { "show playlist editor", NULL , N_("Show Playlist Editor"), "<Alt>E", + N_("Show Playlist Editor"), G_CALLBACK(action_show_playlist_editor) , FALSE }, + + { "show equalizer", NULL , N_("Show Equalizer"), "<Alt>G", + N_("Show Equalizer"), G_CALLBACK(action_show_equalizer) , FALSE }, + + { "view always on top", NULL , N_("Always on Top"), "<Ctrl>O", + N_("Always on Top"), G_CALLBACK(action_view_always_on_top) , FALSE }, + + { "view put on all workspaces", NULL , N_("Put on All Workspaces"), "<Ctrl>S", + N_("Put on All Workspaces"), G_CALLBACK(action_view_on_all_workspaces) , FALSE }, + + { "roll up player", NULL , N_("Roll up Player"), "<Ctrl>W", + N_("Roll up Player"), G_CALLBACK(action_roll_up_player) , FALSE }, + + { "roll up playlist editor", NULL , N_("Roll up Playlist Editor"), "<Shift><Ctrl>W", + N_("Roll up Playlist Editor"), G_CALLBACK(action_roll_up_playlist_editor) , FALSE }, + + { "roll up equalizer", NULL , N_("Roll up Equalizer"), "<Ctrl><Alt>W", + N_("Roll up Equalizer"), G_CALLBACK(action_roll_up_equalizer) , FALSE }, + + { "view doublesize", NULL , N_("DoubleSize"), "<Ctrl>D", + N_("DoubleSize"), G_CALLBACK(action_view_doublesize) , FALSE }, + + { "view easy move", NULL , N_("Easy Move"), "<Ctrl>E", + N_("Easy Move"), G_CALLBACK(action_view_easymove) , FALSE } +}; + + + +/* radio action entries */ + +static GtkRadioActionEntry mainwin_radioaction_entries_vismode[] = { + { "vismode analyzer", NULL , N_("Analyzer"), NULL, N_("Analyzer"), VIS_ANALYZER }, + { "vismode scope", NULL , N_("Scope"), NULL, N_("Scope"), VIS_SCOPE }, + { "vismode voiceprint", NULL , N_("Voiceprint"), NULL, N_("Voiceprint"), VIS_VOICEPRINT }, + { "vismode off", NULL , N_("Off"), NULL, N_("Off"), VIS_OFF } +}; + +static GtkRadioActionEntry mainwin_radioaction_entries_anamode[] = { + { "anamode normal", NULL , N_("Normal"), NULL, N_("Normal"), ANALYZER_NORMAL }, + { "anamode fire", NULL , N_("Fire"), NULL, N_("Fire"), ANALYZER_FIRE }, + { "anamode vertical lines", NULL , N_("Vertical Lines"), NULL, N_("Vertical Lines"), ANALYZER_VLINES } +}; + +static GtkRadioActionEntry mainwin_radioaction_entries_anatype[] = { + { "anatype lines", NULL , N_("Lines"), NULL, N_("Lines"), ANALYZER_LINES }, + { "anatype bars", NULL , N_("Bars"), NULL, N_("Bars"), ANALYZER_BARS } +}; + +static GtkRadioActionEntry mainwin_radioaction_entries_scomode[] = { + { "scomode dot", NULL , N_("Dot Scope"), NULL, N_("Dot Scope"), SCOPE_DOT }, + { "scomode line", NULL , N_("Line Scope"), NULL, N_("Line Scope"), SCOPE_LINE }, + { "scomode solid", NULL , N_("Solid Scope"), NULL, N_("Solid Scope"), SCOPE_SOLID } +}; + +static GtkRadioActionEntry mainwin_radioaction_entries_vprmode[] = { + { "vprmode normal", NULL , N_("Normal"), NULL, N_("Normal"), VOICEPRINT_NORMAL }, + { "vprmode fire", NULL , N_("Fire"), NULL, N_("Fire"), VOICEPRINT_FIRE }, + { "vprmode ice", NULL , N_("Ice"), NULL, N_("Ice"), VOICEPRINT_ICE } +}; + +static GtkRadioActionEntry mainwin_radioaction_entries_wshmode[] = { + { "wshmode normal", NULL , N_("Normal"), NULL, N_("Normal"), VU_NORMAL }, + { "wshmode smooth", NULL , N_("Smooth"), NULL, N_("Smooth"), VU_SMOOTH } +}; + +static GtkRadioActionEntry mainwin_radioaction_entries_refrate[] = { + { "refrate full", NULL , N_("Full (~50 fps)"), NULL, N_("Full (~50 fps)"), REFRESH_FULL }, + { "refrate half", NULL , N_("Half (~25 fps)"), NULL, N_("Half (~25 fps)"), REFRESH_HALF }, + { "refrate quarter", NULL , N_("Quarter (~13 fps)"), NULL, N_("Quarter (~13 fps)"), REFRESH_QUARTER }, + { "refrate eighth", NULL , N_("Eighth (~6 fps)"), NULL, N_("Eighth (~6 fps)"), REFRESH_EIGTH } +}; + +static GtkRadioActionEntry mainwin_radioaction_entries_anafoff[] = { + { "anafoff slowest", NULL , N_("Slowest"), NULL, N_("Slowest"), FALLOFF_SLOWEST }, + { "anafoff slow", NULL , N_("Slow"), NULL, N_("Slow"), FALLOFF_SLOW }, + { "anafoff medium", NULL , N_("Medium"), NULL, N_("Medium"), FALLOFF_MEDIUM }, + { "anafoff fast", NULL , N_("Fast"), NULL, N_("Fast"), FALLOFF_FAST }, + { "anafoff fastest", NULL , N_("Fastest"), NULL, N_("Fastest"), FALLOFF_FASTEST } +}; + +static GtkRadioActionEntry mainwin_radioaction_entries_peafoff[] = { + { "peafoff slowest", NULL , N_("Slowest"), NULL, N_("Slowest"), FALLOFF_SLOWEST }, + { "peafoff slow", NULL , N_("Slow"), NULL, N_("Slow"), FALLOFF_SLOW }, + { "peafoff medium", NULL , N_("Medium"), NULL, N_("Medium"), FALLOFF_MEDIUM }, + { "peafoff fast", NULL , N_("Fast"), NULL, N_("Fast"), FALLOFF_FAST }, + { "peafoff fastest", NULL , N_("Fastest"), NULL, N_("Fastest"), FALLOFF_FASTEST } +}; + +static GtkRadioActionEntry mainwin_radioaction_entries_viewtime[] = { + { "view time elapsed", NULL , N_("Time Elapsed"), "<Ctrl>E", N_("Time Elapsed"), TIMER_ELAPSED }, + { "view time remaining", NULL , N_("Time Remaining"), "<Ctrl>R", N_("Time Remaining"), TIMER_REMAINING } +}; + + + +/* normal actions */ + +static GtkActionEntry mainwin_action_entries_playback[] = { + + { "playback", NULL, "Playback" }, + + { "playback play cd", GTK_STOCK_CDROM , N_("Play CD"), "<Alt>C", + N_("Play CD"), G_CALLBACK(action_playback_playcd) }, + + { "playback play", GTK_STOCK_MEDIA_PLAY , N_("Play"), "X", + N_("Play"), G_CALLBACK(action_playback_play) }, + + { "playback pause", GTK_STOCK_MEDIA_PAUSE , N_("Pause"), "C", + N_("Pause"), G_CALLBACK(action_playback_pause) }, + + { "playback stop", GTK_STOCK_MEDIA_STOP , N_("Stop"), "V", + N_("Stop"), G_CALLBACK(action_playback_stop) }, + + { "playback previous", GTK_STOCK_MEDIA_PREVIOUS , N_("Previous"), "Z", + N_("Previous"), G_CALLBACK(action_playback_previous) }, + + { "playback next", GTK_STOCK_MEDIA_NEXT , N_("Next"), "B", + N_("Next"), G_CALLBACK(action_playback_next) } +}; + + +static GtkActionEntry mainwin_action_entries_visualization[] = { + + { "visualization", NULL, "Visualization" }, + + { "vismode", NULL, "Visualization Mode" }, + + { "anamode", NULL, "Analyzer Mode" }, + + { "scomode", NULL, "Scope Mode" }, + + { "vprmode", NULL, "Voiceprint Mode" }, + + { "wshmode", NULL, "WindowShade VU Mode" }, + + { "refrate", NULL, "Refresh Rate" }, + + { "anafoff", NULL, "Analyzer Falloff" }, + + { "peafoff", NULL, "Peaks Falloff" } +}; + +static GtkActionEntry mainwin_action_entries_playlist[] = { + + { "playlist", NULL, "Playlist" }, + + { "playlist new", NULL , N_("New Playlist"), "<Shift>N", + N_("New Playlist"), G_CALLBACK(action_playlist_new) }, + + { "playlist select next", NULL , N_("Select Next Playlist"), "<Shift>P", + N_("Select Next Playlist"), G_CALLBACK(action_playlist_next) }, + + { "playlist select previous", NULL , N_("Select Previous Playlist"), "<Shift><Ctrl>P", + N_("Select Previous Playlist"), G_CALLBACK(action_playlist_prev) } +}; + +static GtkActionEntry mainwin_action_entries_view[] = { + + { "view", NULL, "View" } +}; + +static GtkActionEntry mainwin_action_entries_others[] = { + + { "dummy", NULL, "dummy" }, + + { "track info", AUD_STOCK_INFO , N_("View Track Details"), NULL, + N_("View track details"), G_CALLBACK(action_track_info) }, + + { "about audacious", GTK_STOCK_DIALOG_INFO , N_("About Audacious"), NULL, + N_("About Audacious"), G_CALLBACK(action_about_audacious) }, + + { "play file", GTK_STOCK_OPEN , N_("Play File"), "L", + N_("Load and play a file"), G_CALLBACK(action_play_file) }, + + { "play location", GTK_STOCK_NETWORK , N_("Play Location"), "<Ctrl>L", + N_("Play media from the selected location"), G_CALLBACK(action_play_location) }, + + { "preferences", GTK_STOCK_PREFERENCES , N_("Preferences"), "<Ctrl>P", + N_("Open preferences window"), G_CALLBACK(action_preferences) }, + + { "quit", GTK_STOCK_QUIT , N_("_Quit"), NULL, + N_("Quit Audacious"), G_CALLBACK(action_quit) }, + + { "ab set", NULL , N_("Set A-B"), "A", + N_("Set A-B"), G_CALLBACK(action_ab_set) }, + + { "ab clear", NULL , N_("Clear A-B"), "<Ctrl>S", + N_("Clear A-B"), G_CALLBACK(action_ab_clear) }, + + { "jump to playlist start", GTK_STOCK_GOTO_TOP , N_("Jump to Playlist Start"), "<Ctrl>Z", + N_("Jump to Playlist Start"), G_CALLBACK(action_jump_to_playlist_start) }, + + { "jump to file", GTK_STOCK_JUMP_TO , N_("Jump to File"), "J", + N_("Jump to File"), G_CALLBACK(action_jump_to_file) }, + + { "jump to time", GTK_STOCK_JUMP_TO , N_("Jump to Time"), "<Ctrl>J", + N_("Jump to Time"), G_CALLBACK(action_jump_to_time) } +}; + + + +/* ***************************** */ + +void +ui_manager_init ( void ) +{ + /* toggle actions */ + mainwin_toggleaction_group_others = gtk_action_group_new("mainwin_toggleaction_others"); + gtk_action_group_add_toggle_actions( + mainwin_toggleaction_group_others , mainwin_toggleaction_entries_others , + G_N_ELEMENTS(mainwin_toggleaction_entries_others) , NULL ); + + /* radio actions */ + mainwin_radioaction_group_anamode = gtk_action_group_new("mainwin_radioaction_anamode"); + gtk_action_group_add_radio_actions( + mainwin_radioaction_group_anamode , mainwin_radioaction_entries_anamode , + G_N_ELEMENTS(mainwin_radioaction_entries_anamode) , 0 , G_CALLBACK(action_anamode) , NULL ); + + mainwin_radioaction_group_anatype = gtk_action_group_new("mainwin_radioaction_anatype"); + gtk_action_group_add_radio_actions( + mainwin_radioaction_group_anatype , mainwin_radioaction_entries_anatype , + G_N_ELEMENTS(mainwin_radioaction_entries_anatype) , 0 , G_CALLBACK(action_anatype) , NULL ); + + mainwin_radioaction_group_scomode = gtk_action_group_new("mainwin_radioaction_scomode"); + gtk_action_group_add_radio_actions( + mainwin_radioaction_group_scomode , mainwin_radioaction_entries_scomode , + G_N_ELEMENTS(mainwin_radioaction_entries_scomode) , 0 , G_CALLBACK(action_scomode) , NULL ); + + mainwin_radioaction_group_vprmode = gtk_action_group_new("mainwin_radioaction_vprmode"); + gtk_action_group_add_radio_actions( + mainwin_radioaction_group_vprmode , mainwin_radioaction_entries_vprmode , + G_N_ELEMENTS(mainwin_radioaction_entries_vprmode) , 0 , G_CALLBACK(action_vprmode) , NULL ); + + mainwin_radioaction_group_wshmode = gtk_action_group_new("mainwin_radioaction_wshmode"); + gtk_action_group_add_radio_actions( + mainwin_radioaction_group_wshmode , mainwin_radioaction_entries_wshmode , + G_N_ELEMENTS(mainwin_radioaction_entries_wshmode) , 0 , G_CALLBACK(action_wshmode) , NULL ); + + mainwin_radioaction_group_refrate = gtk_action_group_new("mainwin_radioaction_refrate"); + gtk_action_group_add_radio_actions( + mainwin_radioaction_group_refrate , mainwin_radioaction_entries_refrate , + G_N_ELEMENTS(mainwin_radioaction_entries_refrate) , 0 , G_CALLBACK(action_refrate) , NULL ); + + mainwin_radioaction_group_anafoff = gtk_action_group_new("mainwin_radioaction_anafoff"); + gtk_action_group_add_radio_actions( + mainwin_radioaction_group_anafoff , mainwin_radioaction_entries_anafoff , + G_N_ELEMENTS(mainwin_radioaction_entries_anafoff) , 0 , G_CALLBACK(action_anafoff) , NULL ); + + mainwin_radioaction_group_peafoff = gtk_action_group_new("mainwin_radioaction_peafoff"); + gtk_action_group_add_radio_actions( + mainwin_radioaction_group_peafoff , mainwin_radioaction_entries_peafoff , + G_N_ELEMENTS(mainwin_radioaction_entries_peafoff) , 0 , G_CALLBACK(action_peafoff) , NULL ); + + mainwin_radioaction_group_vismode = gtk_action_group_new("mainwin_radioaction_vismode"); + gtk_action_group_add_radio_actions( + mainwin_radioaction_group_vismode , mainwin_radioaction_entries_vismode , + G_N_ELEMENTS(mainwin_radioaction_entries_vismode) , 0 , G_CALLBACK(action_vismode) , NULL ); + + mainwin_radioaction_group_viewtime = gtk_action_group_new("mainwin_radioaction_viewtime"); + gtk_action_group_add_radio_actions( + mainwin_radioaction_group_viewtime , mainwin_radioaction_entries_viewtime , + G_N_ELEMENTS(mainwin_radioaction_entries_viewtime) , 0 , G_CALLBACK(action_viewtime) , NULL ); + + /* normal actions */ + mainwin_action_group_playback = gtk_action_group_new("mainwin_action_playback"); + gtk_action_group_add_actions( + mainwin_action_group_playback , mainwin_action_entries_playback , + G_N_ELEMENTS(mainwin_action_entries_playback) , NULL ); + + mainwin_action_group_playlist = gtk_action_group_new("mainwin_action_playlist"); + gtk_action_group_add_actions( + mainwin_action_group_playlist , mainwin_action_entries_playlist , + G_N_ELEMENTS(mainwin_action_entries_playlist) , NULL ); + + mainwin_action_group_visualization = gtk_action_group_new("mainwin_action_visualization"); + gtk_action_group_add_actions( + mainwin_action_group_visualization , mainwin_action_entries_visualization , + G_N_ELEMENTS(mainwin_action_entries_visualization) , NULL ); + + mainwin_action_group_view = gtk_action_group_new("mainwin_action_view"); + gtk_action_group_add_actions( + mainwin_action_group_view , mainwin_action_entries_view , + G_N_ELEMENTS(mainwin_action_entries_view) , NULL ); + + mainwin_action_group_others = gtk_action_group_new("mainwin_action_others"); + gtk_action_group_add_actions( + mainwin_action_group_others , mainwin_action_entries_others , + G_N_ELEMENTS(mainwin_action_entries_others) , NULL ); + + /* ui */ + ui_manager = gtk_ui_manager_new(); + gtk_ui_manager_insert_action_group( ui_manager , mainwin_toggleaction_group_others , 0 ); + gtk_ui_manager_insert_action_group( ui_manager , mainwin_radioaction_group_anamode , 0 ); + gtk_ui_manager_insert_action_group( ui_manager , mainwin_radioaction_group_anatype , 0 ); + gtk_ui_manager_insert_action_group( ui_manager , mainwin_radioaction_group_scomode , 0 ); + gtk_ui_manager_insert_action_group( ui_manager , mainwin_radioaction_group_vprmode , 0 ); + gtk_ui_manager_insert_action_group( ui_manager , mainwin_radioaction_group_wshmode , 0 ); + gtk_ui_manager_insert_action_group( ui_manager , mainwin_radioaction_group_refrate , 0 ); + gtk_ui_manager_insert_action_group( ui_manager , mainwin_radioaction_group_anafoff , 0 ); + gtk_ui_manager_insert_action_group( ui_manager , mainwin_radioaction_group_peafoff , 0 ); + gtk_ui_manager_insert_action_group( ui_manager , mainwin_radioaction_group_vismode , 0 ); + gtk_ui_manager_insert_action_group( ui_manager , mainwin_radioaction_group_viewtime , 0 ); + gtk_ui_manager_insert_action_group( ui_manager , mainwin_action_group_playback , 0 ); + gtk_ui_manager_insert_action_group( ui_manager , mainwin_action_group_playlist , 0 ); + gtk_ui_manager_insert_action_group( ui_manager , mainwin_action_group_visualization , 0 ); + gtk_ui_manager_insert_action_group( ui_manager , mainwin_action_group_view , 0 ); + gtk_ui_manager_insert_action_group( ui_manager , mainwin_action_group_others , 0 ); + + return; +} + + +void +ui_manager_create_menus ( void ) +{ + GError *gerr = NULL; + + /* attach xml menu definitions */ + gtk_ui_manager_add_ui_from_file( ui_manager , DATA_DIR "/ui/mainwin.ui" , &gerr ); + + if ( gerr != NULL ) + { + g_critical( "Error creating UI<ui/mainwin.ui>: %s" , gerr->message ); + g_error_free( gerr ); + return; + } + + /* create GtkMenu widgets using path from xml definitions */ + mainwin_songname_menu = ui_manager_get_popup_menu( ui_manager , "/mainwin-menus/songname-menu" ); + mainwin_visualization_menu = ui_manager_get_popup_menu( ui_manager , "/mainwin-menus/main-menu/visualization" ); + mainwin_playback_menu = ui_manager_get_popup_menu( ui_manager , "/mainwin-menus/main-menu/playback" ); + mainwin_playlist_menu = ui_manager_get_popup_menu( ui_manager , "/mainwin-menus/main-menu/playlist" ); + mainwin_view_menu = ui_manager_get_popup_menu( ui_manager , "/mainwin-menus/main-menu/view" ); + mainwin_general_menu = ui_manager_get_popup_menu( ui_manager , "/mainwin-menus/main-menu" ); + + return; +} + + +GtkAccelGroup * +ui_manager_get_accel_group ( void ) +{ + return gtk_ui_manager_get_accel_group( ui_manager ); +} + + +GtkWidget * +ui_manager_get_popup_menu ( GtkUIManager * self , const gchar * path ) +{ + GtkWidget *menu_item = gtk_ui_manager_get_widget( self , path ); + + if (GTK_IS_MENU_ITEM(menu_item)) + return gtk_menu_item_get_submenu(GTK_MENU_ITEM(menu_item)); + else + return NULL; +} + + +static void +menu_popup_pos_func (GtkMenu * menu , gint * x , gint * y , gboolean * push_in , gint * point ) +{ + *x = point[0]; + *y = point[1]; + *push_in = FALSE; +} + + +void +ui_manager_popup_menu_show ( GtkMenu * menu , gint x , gint y , guint button , guint time ) +{ + gint pos[2]; + pos[0] = x; + pos[1] = y; + + gtk_menu_popup( menu , NULL , NULL , + (GtkMenuPositionFunc) menu_popup_pos_func , pos , button , time ); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/audacious/ui_manager.h Tue Jan 02 16:48:38 2007 -0800 @@ -0,0 +1,60 @@ +/* Audacious - Cross-platform multimedia player + * Copyright (C) 2005-2007 Audacious development team. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; under version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef AUD_UIMANAGER_H +#define AUD_UIMANAGER_H + + +#include <glib.h> +#include <glib/gi18n.h> +#include <gtk/gtk.h> + + +GtkWidget *mainwin_songname_menu; +GtkWidget *mainwin_general_menu; +GtkWidget *mainwin_visualization_menu; +GtkWidget *mainwin_playback_menu; +GtkWidget *mainwin_playlist_menu; +GtkWidget *mainwin_view_menu; + +GtkActionGroup *mainwin_toggleaction_group_others; +GtkActionGroup *mainwin_radioaction_group_anamode; /* Analyzer mode */ +GtkActionGroup *mainwin_radioaction_group_anatype; /* Analyzer type */ +GtkActionGroup *mainwin_radioaction_group_scomode; /* Scope mode */ +GtkActionGroup *mainwin_radioaction_group_vprmode; /* Voiceprint mode */ +GtkActionGroup *mainwin_radioaction_group_wshmode; /* WindowShade VU mode */ +GtkActionGroup *mainwin_radioaction_group_refrate; /* Refresh rate */ +GtkActionGroup *mainwin_radioaction_group_anafoff; /* Analyzer Falloff */ +GtkActionGroup *mainwin_radioaction_group_peafoff; /* Peak Falloff */ +GtkActionGroup *mainwin_radioaction_group_vismode; /* Visualization mode */ +GtkActionGroup *mainwin_radioaction_group_viewtime; /* View time (remaining/elapsed) */ +GtkActionGroup *mainwin_action_group_playback; +GtkActionGroup *mainwin_action_group_playlist; +GtkActionGroup *mainwin_action_group_visualization; +GtkActionGroup *mainwin_action_group_view; +GtkActionGroup *mainwin_action_group_others; + + +void uimanager_init ( void ); +void uimanager_create_menus ( void ); +GtkAccelGroup * ui_manager_get_accel_group ( void ); +GtkWidget * ui_manager_get_popup_menu ( GtkUIManager * , const gchar * ); +void ui_manager_popup_menu_show( GtkMenu * , gint , gint , guint , guint ); +#define popup_menu_show(x1,x2,x3,x4,x5) ui_manager_popup_menu_show(x1,x2,x3,x4,x5) + + +#endif /* AUD_UIMANAGER_H */
--- a/audacious/ui_playlist.c Mon Jan 01 09:28:18 2007 -0800 +++ b/audacious/ui_playlist.c Tue Jan 02 16:48:38 2007 -0800 @@ -44,6 +44,7 @@ #include "input.h" #include "main.h" #include "mainwin.h" +#include "ui_manager.h" #include "playback.h" #include "playlist.h" #include "playlist_container.h" @@ -620,11 +621,9 @@ static void playlistwin_set_shade_menu(gboolean shaded) { - GtkWidget *item; - - item = gtk_item_factory_get_widget(mainwin_view_menu, - "/Roll up Playlist Editor"); - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), shaded); + GtkAction *action = gtk_action_group_get_action( + mainwin_toggleaction_group_others , "roll up playlist editor" ); + gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(action) , shaded ); playlistwin_set_shade(shaded); playlistwin_update_list(playlist_get_active()); @@ -980,15 +979,6 @@ } static void -menu_set_item_sensitive(GtkItemFactory * item_factory, - const gchar * path, - gboolean sensitive) -{ - GtkWidget *item = gtk_item_factory_get_widget(item_factory, path); - gtk_widget_set_sensitive(item, sensitive); -} - -static void show_playlist_save_error(GtkWindow * parent, const gchar * filename) { @@ -1420,7 +1410,7 @@ * Pop up the main menu a few pixels down to avoid * anything to be selected initially. */ - util_item_factory_popup(mainwin_general_menu, event->x_root, + ui_manager_popup_menu_show(GTK_MENU(mainwin_general_menu), event->x_root, event->y_root + 2, 3, event->time); grab = FALSE; } @@ -2106,11 +2096,9 @@ void playlistwin_show(void) { - GtkWidget *item; - - item = gtk_item_factory_get_widget(mainwin_view_menu, - "/Show Playlist Editor"); - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE); + GtkAction *action = gtk_action_group_get_action( + mainwin_toggleaction_group_others , "show playlist editor" ); + gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(action) , TRUE ); tbutton_set_toggled(mainwin_pl, TRUE); cfg.playlist_visible = TRUE; @@ -2124,11 +2112,9 @@ void playlistwin_hide(void) { - GtkWidget *item; - - item = gtk_item_factory_get_widget(mainwin_view_menu, - "/Show Playlist Editor"); - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), FALSE); + GtkAction *action = gtk_action_group_get_action( + mainwin_toggleaction_group_others , "show playlist editor" ); + gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(action) , FALSE ); gtk_widget_hide(playlistwin); tbutton_set_toggled(mainwin_pl, FALSE);