Mercurial > audlegacy
changeset 2260:8960824f6706 trunk
[svn] - ported ui_equalizer.c to ui_manager.c framework
author | giacomo |
---|---|
date | Thu, 04 Jan 2007 05:15:08 -0800 |
parents | 3668594b4fc8 |
children | bdb2983612f0 |
files | ChangeLog audacious/ui/equalizer.ui audacious/ui/mainwin.ui audacious/ui/playlist.ui audacious/ui_equalizer.c audacious/ui_manager.c audacious/ui_manager.h audacious/ui_playlist.c audacious/ui_playlist.h |
diffstat | 9 files changed, 154 insertions(+), 214 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Thu Jan 04 04:16:48 2007 -0800 +++ b/ChangeLog Thu Jan 04 05:15:08 2007 -0800 @@ -1,3 +1,13 @@ +2007-01-04 12:16:48 +0000 Giacomo Lozito <james@develia.org> + revision [3523] + - moved action_playlist_* implementation from ui_main.c to ui_playlist.c (more appropriate) + trunk/audacious/actions-mainwin.h | 4 ---- + trunk/audacious/actions-playlist.h | 6 +++++- + trunk/audacious/ui_main.c | 26 -------------------------- + trunk/audacious/ui_playlist.c | 28 ++++++++++++++++++++++++++++ + 4 files changed, 33 insertions(+), 31 deletions(-) + + 2007-01-04 12:11:21 +0000 Giacomo Lozito <james@develia.org> revision [3521] - added delete playlist action (finally :p)
--- a/audacious/ui/equalizer.ui Thu Jan 04 04:16:48 2007 -0800 +++ b/audacious/ui/equalizer.ui Thu Jan 04 05:15:08 2007 -0800 @@ -3,33 +3,33 @@ <ui> <menubar name="equalizer-menus"> <menu action="dummy" name="preset-menu"> - <menu action="preset load menu"> - <menuitem action="load preset" /> - <menuitem action="load auto preset" /> - <menuitem action="load default preset" /> + <menu action="equ preset load menu"> + <menuitem action="equ load preset" /> + <menuitem action="equ load auto preset" /> + <menuitem action="equ load default preset" /> <separator /> - <menuitem action="zero preset" /> + <menuitem action="equ zero preset" /> <separator /> - <menuitem action="load preset file" /> - <menuitem action="load preset eqf" /> + <menuitem action="equ load preset file" /> + <menuitem action="equ load preset eqf" /> </menu> - <menu action="preset import menu"> - <menuitem action="import winamp presets" /> + <menu action="equ preset import menu"> + <menuitem action="equ import winamp presets" /> </menu> - <menu action="preset save menu"> - <menuitem action="save preset" /> - <menuitem action="save auto preset" /> - <menuitem action="save default preset" /> + <menu action="equ preset save menu"> + <menuitem action="equ save preset" /> + <menuitem action="equ save auto preset" /> + <menuitem action="equ save default preset" /> <separator /> - <menuitem action="save preset file" /> - <menuitem action="save preset eqf" /> + <menuitem action="equ save preset file" /> + <menuitem action="equ save preset eqf" /> </menu> - <menu action="preset delete menu"> - <menuitem action="delete preset" /> - <menuitem action="delete auto preset" /> + <menu action="equ preset delete menu"> + <menuitem action="equ delete preset" /> + <menuitem action="equ delete auto preset" /> </menu> </menu> </menubar>
--- a/audacious/ui/mainwin.ui Thu Jan 04 04:16:48 2007 -0800 +++ b/audacious/ui/mainwin.ui Thu Jan 04 05:15:08 2007 -0800 @@ -93,10 +93,10 @@ </menu> <menu action="playlist"> <menuitem action="playlist new" /> + <menuitem action="playlist delete" /> <separator /> <menuitem action="playlist select next" /> <menuitem action="playlist select previous" /> - <menuitem action="playlist delete" /> <separator /> <menuitem action="playlist load" /> <menuitem action="playlist save" />
--- a/audacious/ui/playlist.ui Thu Jan 04 04:16:48 2007 -0800 +++ b/audacious/ui/playlist.ui Thu Jan 04 05:15:08 2007 -0800 @@ -68,10 +68,10 @@ <menu action="dummy" name="playlist-menu"> <menuitem action="playlist new" /> + <menuitem action="playlist delete" /> <separator /> <menuitem action="playlist select next" /> <menuitem action="playlist select previous" /> - <menuitem action="playlist delete" /> <separator /> <menuitem action="playlist load" /> <menuitem action="playlist save" />
--- a/audacious/ui_equalizer.c Thu Jan 04 04:16:48 2007 -0800 +++ b/audacious/ui_equalizer.c Thu Jan 04 05:15:08 2007 -0800 @@ -41,6 +41,7 @@ #include "input.h" #include "main.h" #include "ui_manager.h" +#include "actions-equalizer.h" #include "playlist.h" #include "ui_playlist.h" #include "util.h" @@ -88,103 +89,8 @@ static EqSlider *equalizerwin_preamp, *equalizerwin_bands[10]; static HSlider *equalizerwin_volume, *equalizerwin_balance; -static GtkWidget *presets_menu; - static GList *equalizer_presets = NULL, *equalizer_auto_presets = NULL; -static void action_load_preset(void); -static void action_load_auto_preset(void); -static void action_load_default_preset(void); -static void action_zero_preset(void); -static void action_load_preset_file(void); -static void action_load_preset_eqf(void); -static void action_import_winamp_presets(void); -static void action_save_preset(void); -static void action_save_auto_preset(void); -static void action_save_default_preset(void); -static void action_save_preset_file(void); -static void action_save_preset_eqf(void); -static void action_delete_preset(void); -static void action_delete_auto_preset(void); - -static GtkActionEntry equalizerwin_actions[] = { - { "dummy", NULL, "dummy" }, - - { "preset load menu", NULL, N_("Load") }, - { "preset import menu", NULL, N_("Import") }, - { "preset save menu", NULL, N_("Save") }, - { "preset delete menu", NULL, N_("Delete") }, - - { "load preset", NULL, - N_("Preset"), NULL, - N_("Load preset"), - G_CALLBACK(action_load_preset) }, - - { "load auto preset", NULL, - N_("Auto-load preset"), NULL, - N_("Load auto-load preset"), - G_CALLBACK(action_load_auto_preset) }, - - { "load default preset", NULL, - N_("Default"), NULL, - N_("Load default preset into equalizer"), - G_CALLBACK(action_load_default_preset) }, - - { "zero preset", NULL, - N_("Zero"), NULL, - N_("Set equalizer preset levels to zero"), - G_CALLBACK(action_zero_preset) }, - - { "load preset file", NULL, - N_("From file"), NULL, - N_("Load preset from file"), - G_CALLBACK(action_load_preset_file) }, - - { "load preset eqf", NULL, - N_("From WinAMP EQF file"), NULL, - N_("Load preset from WinAMP EQF file"), - G_CALLBACK(action_load_preset_eqf) }, - - { "import winamp presets", NULL, - N_("WinAMP Presets"), NULL, - N_("Import WinAMP presets"), - G_CALLBACK(action_import_winamp_presets) }, - - { "save preset", NULL, - N_("Preset"), NULL, - N_("Save preset"), - G_CALLBACK(action_save_preset) }, - - { "save auto preset", NULL, - N_("Auto-load preset"), NULL, - N_("Save auto-load preset"), - G_CALLBACK(action_save_auto_preset) }, - - { "save default preset", NULL, - N_("Default"), NULL, - N_("Save default preset"), - G_CALLBACK(action_save_default_preset) }, - - { "save preset file", NULL, - N_("To file"), NULL, - N_("Save preset to file"), - G_CALLBACK(action_save_preset_file) }, - - { "save preset eqf", NULL, - N_("To WinAMP EQF file"), NULL, - N_("Save preset to WinAMP EQF file"), - G_CALLBACK(action_save_preset_eqf) }, - - { "delete preset", NULL, - N_("Preset"), NULL, - N_("Delete preset"), - G_CALLBACK(action_delete_preset) }, - - { "delete auto preset", NULL, - N_("Auto-load preset"), NULL, - N_("Delete auto-load preset"), - G_CALLBACK(action_delete_auto_preset) } -}; EqualizerPreset * equalizer_preset_new(const gchar * name) @@ -322,42 +228,13 @@ } 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; -} - -static void -menu_popup(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); -} - -static void equalizerwin_presets_pushed(void) { GdkModifierType modmask; gint x, y; gdk_window_get_pointer(NULL, &x, &y, &modmask); - menu_popup(GTK_MENU(presets_menu), x, y, 1, GDK_CURRENT_TIME); + ui_manager_popup_menu_show(GTK_MENU(equalizerwin_presets_menu), x, y, 1, GDK_CURRENT_TIME); } static void @@ -949,38 +826,6 @@ return NULL; } -void -equalizerwin_create_popup_menus(void) -{ - GtkUIManager *ui_manager; - GtkActionGroup *action_group; - GError *error = NULL; - - action_group = gtk_action_group_new("equalizer-window"); - gtk_action_group_set_translation_domain(action_group, PACKAGE_NAME); - gtk_action_group_add_actions(action_group, - equalizerwin_actions, - G_N_ELEMENTS(equalizerwin_actions), - NULL); - - ui_manager = gtk_ui_manager_new(); - gtk_ui_manager_add_ui_from_file(ui_manager, - DATA_DIR "/ui/equalizer.ui", - &error); - - if (error) { - g_message("Error creating UI (%s)", error->message); - g_error_free(error); - return; - } - - gtk_ui_manager_insert_action_group(ui_manager, action_group, 0); - - gtk_window_add_accel_group(GTK_WINDOW(equalizerwin), - gtk_ui_manager_get_accel_group(ui_manager)); - - presets_menu = ui_manager_get_popup(ui_manager, "/equalizer-menus/preset-menu"); -} void equalizerwin_create(void) @@ -989,7 +834,8 @@ equalizer_auto_presets = equalizerwin_read_presets("eq.auto_preset"); equalizerwin_create_window(); - equalizerwin_create_popup_menus(); + + gtk_window_add_accel_group( GTK_WINDOW(equalizerwin) , ui_manager_get_accel_group() ); equalizerwin_gc = gdk_gc_new(equalizerwin->window); equalizerwin_bg = gdk_pixmap_new(equalizerwin->window, 275, 116, -1); @@ -1737,8 +1583,8 @@ return eqslider_get_position(equalizerwin_bands[band]); } -static void -action_load_preset(void) +void +action_equ_load_preset(void) { if (equalizerwin_load_window) { gtk_window_present(GTK_WINDOW(equalizerwin_load_window)); @@ -1754,8 +1600,8 @@ G_CALLBACK(equalizerwin_load_select)); } -static void -action_load_auto_preset(void) +void +action_equ_load_auto_preset(void) { if (equalizerwin_load_auto_window) { gtk_window_present(GTK_WINDOW(equalizerwin_load_auto_window)); @@ -1771,14 +1617,14 @@ G_CALLBACK(equalizerwin_load_auto_select)); } -static void -action_load_default_preset(void) +void +action_equ_load_default_preset(void) { equalizerwin_load_preset(equalizer_presets, "Default"); } -static void -action_zero_preset(void) +void +action_equ_zero_preset(void) { gint i; @@ -1789,8 +1635,8 @@ equalizerwin_eq_changed(); } -static void -action_load_preset_file(void) +void +action_equ_load_preset_file(void) { GtkWidget *dialog; @@ -1800,8 +1646,8 @@ load_preset_file); } -static void -action_load_preset_eqf(void) +void +action_equ_load_preset_eqf(void) { GtkWidget *dialog; @@ -1811,8 +1657,8 @@ load_winamp_file); } -static void -action_import_winamp_presets(void) +void +action_equ_import_winamp_presets(void) { GtkWidget *dialog; @@ -1822,8 +1668,8 @@ import_winamp_file); } -static void -action_save_preset(void) +void +action_equ_save_preset(void) { if (equalizerwin_save_window) { gtk_window_present(GTK_WINDOW(equalizerwin_save_window)); @@ -1840,8 +1686,8 @@ G_CALLBACK(equalizerwin_save_select)); } -static void -action_save_auto_preset(void) +void +action_equ_save_auto_preset(void) { gchar *name; Playlist *playlist = playlist_get_active(); @@ -1866,15 +1712,15 @@ } } -static void -action_save_default_preset(void) +void +action_equ_save_default_preset(void) { equalizer_presets = equalizerwin_save_preset(equalizer_presets, "Default", "eq.preset"); } -static void -action_save_preset_file(void) +void +action_equ_save_preset_file(void) { GtkWidget *dialog; gchar *songname; @@ -1896,8 +1742,8 @@ } } -static void -action_save_preset_eqf(void) +void +action_equ_save_preset_eqf(void) { GtkWidget *dialog; @@ -1907,8 +1753,8 @@ save_winamp_file); } -static void -action_delete_preset(void) +void +action_equ_delete_preset(void) { if (equalizerwin_delete_window) { gtk_window_present(GTK_WINDOW(equalizerwin_delete_window)); @@ -1924,8 +1770,8 @@ NULL); } -static void -action_delete_auto_preset(void) +void +action_equ_delete_auto_preset(void) { if (equalizerwin_delete_auto_window) { gtk_window_present(GTK_WINDOW(equalizerwin_delete_auto_window));
--- a/audacious/ui_manager.c Thu Jan 04 04:16:48 2007 -0800 +++ b/audacious/ui_manager.c Thu Jan 04 05:15:08 2007 -0800 @@ -22,6 +22,7 @@ #include "ui_manager.h" #include "actions-mainwin.h" #include "actions-playlist.h" +#include "actions-equalizer.h" #include "ui_main.h" #include "ui_playlist.h" @@ -422,6 +423,57 @@ }; +static GtkActionEntry action_entries_equalizer[] = { + + { "equ preset load menu", NULL, N_("Load") }, + { "equ preset import menu", NULL, N_("Import") }, + { "equ preset save menu", NULL, N_("Save") }, + { "equ preset delete menu", NULL, N_("Delete") }, + + { "equ load preset", NULL, N_("Preset"), NULL, + N_("Load preset"), G_CALLBACK(action_equ_load_preset) }, + + { "equ load auto preset", NULL, N_("Auto-load preset"), NULL, + N_("Load auto-load preset"), G_CALLBACK(action_equ_load_auto_preset) }, + + { "equ load default preset", NULL, N_("Default"), NULL, + N_("Load default preset into equalizer"), G_CALLBACK(action_equ_load_default_preset) }, + + { "equ zero preset", NULL, N_("Zero"), NULL, + N_("Set equalizer preset levels to zero"), G_CALLBACK(action_equ_zero_preset) }, + + { "equ load preset file", NULL, N_("From file"), NULL, + N_("Load preset from file"), G_CALLBACK(action_equ_load_preset_file) }, + + { "equ load preset eqf", NULL, N_("From WinAMP EQF file"), NULL, + N_("Load preset from WinAMP EQF file"), G_CALLBACK(action_equ_load_preset_eqf) }, + + { "equ import winamp presets", NULL, N_("WinAMP Presets"), NULL, + N_("Import WinAMP presets"), G_CALLBACK(action_equ_import_winamp_presets) }, + + { "equ save preset", NULL, N_("Preset"), NULL, + N_("Save preset"), G_CALLBACK(action_equ_save_preset) }, + + { "equ save auto preset", NULL, N_("Auto-load preset"), NULL, + N_("Save auto-load preset"), G_CALLBACK(action_equ_save_auto_preset) }, + + { "equ save default preset", NULL, N_("Default"), NULL, + N_("Save default preset"), G_CALLBACK(action_equ_save_default_preset) }, + + { "equ save preset file", NULL, N_("To file"), NULL, + N_("Save preset to file"), G_CALLBACK(action_equ_save_preset_file) }, + + { "equ save preset eqf", NULL, N_("To WinAMP EQF file"), NULL, + N_("Save preset to WinAMP EQF file"), G_CALLBACK(action_equ_save_preset_eqf) }, + + { "equ delete preset", NULL, N_("Preset"), NULL, + N_("Delete preset"), G_CALLBACK(action_equ_delete_preset) }, + + { "equ delete auto preset", NULL, N_("Auto-load preset"), NULL, + N_("Delete auto-load preset"), G_CALLBACK(action_equ_delete_auto_preset) } +}; + + /* ***************************** */ @@ -521,16 +573,29 @@ G_N_ELEMENTS(action_entries_others) , NULL ); action_group_add = ui_manager_new_action_group("action_add"); - gtk_action_group_add_actions(action_group_add, action_entries_add, G_N_ELEMENTS(action_entries_add), NULL ); + gtk_action_group_add_actions( + action_group_add, action_entries_add, + G_N_ELEMENTS(action_entries_add), NULL ); action_group_select = ui_manager_new_action_group("action_select"); - gtk_action_group_add_actions(action_group_select, action_entries_select, G_N_ELEMENTS(action_entries_select), NULL ); + gtk_action_group_add_actions( + action_group_select, action_entries_select, + G_N_ELEMENTS(action_entries_select), NULL ); action_group_delete = ui_manager_new_action_group("action_delete"); - gtk_action_group_add_actions(action_group_delete, action_entries_delete, G_N_ELEMENTS(action_entries_delete), NULL ); + gtk_action_group_add_actions( + action_group_delete, action_entries_delete, + G_N_ELEMENTS(action_entries_delete), NULL ); action_group_sort = ui_manager_new_action_group("action_sort"); - gtk_action_group_add_actions(action_group_sort, action_entries_sort, G_N_ELEMENTS(action_entries_sort), NULL ); + gtk_action_group_add_actions( + action_group_sort, action_entries_sort, + G_N_ELEMENTS(action_entries_sort), NULL ); + + action_group_equalizer = ui_manager_new_action_group("action_equalizer"); + gtk_action_group_add_actions( + action_group_equalizer, action_entries_equalizer, + G_N_ELEMENTS(action_entries_equalizer), NULL); /* ui */ ui_manager = gtk_ui_manager_new(); @@ -554,6 +619,7 @@ gtk_ui_manager_insert_action_group( ui_manager , action_group_select , 0 ); gtk_ui_manager_insert_action_group( ui_manager , action_group_delete , 0 ); gtk_ui_manager_insert_action_group( ui_manager , action_group_sort , 0 ); + gtk_ui_manager_insert_action_group( ui_manager , action_group_equalizer , 0 ); return; } @@ -599,6 +665,17 @@ plsort_menu = ui_manager_get_popup_menu(ui_manager, "/playlist-menus/misc-menu"); pllist_menu = ui_manager_get_popup_menu(ui_manager, "/playlist-menus/playlist-menu"); + gtk_ui_manager_add_ui_from_file( ui_manager , DATA_DIR "/ui/equalizer.ui" , &gerr ); + + if ( gerr != NULL ) + { + g_critical( "Error creating UI<ui/equalizer.ui>: %s" , gerr->message ); + g_error_free( gerr ); + return; + } + + equalizerwin_presets_menu = ui_manager_get_popup_menu(ui_manager, "/equalizer-menus/preset-menu"); + return; }
--- a/audacious/ui_manager.h Thu Jan 04 04:16:48 2007 -0800 +++ b/audacious/ui_manager.h Thu Jan 04 05:15:08 2007 -0800 @@ -31,6 +31,15 @@ GtkWidget *mainwin_playlist_menu; GtkWidget *mainwin_view_menu; +GtkWidget *pladd_menu; +GtkWidget *pldel_menu; +GtkWidget *plsel_menu; +GtkWidget *plsort_menu; +GtkWidget *pllist_menu; +GtkWidget *playlistwin_popup_menu; + +GtkWidget *equalizerwin_presets_menu; + GtkActionGroup *toggleaction_group_others; GtkActionGroup *radioaction_group_anamode; /* Analyzer mode */ GtkActionGroup *radioaction_group_anatype; /* Analyzer type */ @@ -51,6 +60,7 @@ GtkActionGroup *action_group_select; GtkActionGroup *action_group_delete; GtkActionGroup *action_group_sort; +GtkActionGroup *action_group_equalizer; void uimanager_init ( void );
--- a/audacious/ui_playlist.c Thu Jan 04 04:16:48 2007 -0800 +++ b/audacious/ui_playlist.c Thu Jan 04 05:15:08 2007 -0800 @@ -45,12 +45,12 @@ #include "main.h" #include "ui_main.h" #include "ui_manager.h" +#include "actions-playlist.h" #include "playback.h" #include "playlist.h" #include "playlist_container.h" #include "playlist_manager.h" #include "util.h" -#include "actions-playlist.h" #include "icons-stock.h" #include "images/audacious_playlist.xpm"
--- a/audacious/ui_playlist.h Thu Jan 04 04:16:48 2007 -0800 +++ b/audacious/ui_playlist.h Thu Jan 04 05:15:08 2007 -0800 @@ -77,7 +77,4 @@ extern gboolean playlistwin_focus; -extern GtkWidget *pladd_menu, *pldel_menu, *plsel_menu, *plsort_menu, *pllist_menu; -extern GtkWidget *playlistwin_popup_menu; - #endif