Guest User

audacious_shortcuts

a guest
Jan 29th, 2012
213
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --- menus.c.orig    2012-01-27 18:09:16.677145401 +0100
  2. +++ menus.c 2012-01-29 16:25:07.000000000 +0100
  3. @@ -46,6 +46,7 @@
  4.      const gchar * icon;
  5.      guint key;
  6.      GdkModifierType mod;
  7. +    const gchar * identifier;
  8.  
  9.      /* for normal items */
  10.      void (* func) (void);
  11. @@ -128,30 +129,30 @@
  12.  static void autoscroll_set (gboolean on) {aud_set_bool ("gtkui", "autoscroll", on); }
  13.  
  14.  static const struct MenuItem file_items[] = {
  15. - {N_("_Open Files ..."), GTK_STOCK_OPEN, 'o', CTRL, .func = open_files},
  16. - {N_("Open _URL ..."), GTK_STOCK_NETWORK, 'l', CTRL, .func = open_url},
  17. - {N_("_Add Files ..."), GTK_STOCK_ADD, 'o', SHIFT | CTRL, .func = add_files},
  18. - {N_("Add U_RL ..."), GTK_STOCK_NETWORK, 'l', SHIFT | CTRL, .func = add_url},
  19. - {.sep = TRUE},
  20. - {N_("A_bout ..."), GTK_STOCK_ABOUT, .func = audgui_show_about_window},
  21. - {N_("_Preferences ..."), GTK_STOCK_PREFERENCES, .func = aud_show_prefs_window},
  22. - {N_("_Quit"), GTK_STOCK_QUIT, 'q', CTRL, .func = aud_drct_quit}};
  23. + {N_("_Open Files ..."), GTK_STOCK_OPEN, 'o', CTRL, "open_files", .func = open_files},
  24. + {N_("Open _URL ..."), GTK_STOCK_NETWORK, 'l', CTRL, "open_url", .func = open_url},
  25. + {N_("_Add Files ..."), GTK_STOCK_ADD, 'o', SHIFT | CTRL, "add_files", .func = add_files},
  26. + {N_("Add U_RL ..."), GTK_STOCK_NETWORK, 'l', SHIFT | CTRL, "add_url", .func = add_url},
  27. + {.sep = TRUE},
  28. + {N_("A_bout ..."), GTK_STOCK_ABOUT, .identifier = "about", .func = audgui_show_about_window},
  29. + {N_("_Preferences ..."), GTK_STOCK_PREFERENCES, .identifier = "preferences", .func = aud_show_prefs_window},
  30. + {N_("_Quit"), GTK_STOCK_QUIT, 'q', CTRL, "quit", .func = aud_drct_quit}};
  31.  
  32.  static const struct MenuItem playback_items[] = {
  33. - {N_("_Play"), GTK_STOCK_MEDIA_PLAY, GDK_Return, CTRL, .func = aud_drct_play},
  34. - {N_("Paus_e"), GTK_STOCK_MEDIA_PAUSE, ',', CTRL, .func = aud_drct_pause},
  35. - {N_("_Stop"), GTK_STOCK_MEDIA_STOP, '.', CTRL, .func = aud_drct_stop},
  36. - {N_("Pre_vious"), GTK_STOCK_MEDIA_PREVIOUS, GDK_Up, ALT, .func = aud_drct_pl_prev},
  37. - {N_("_Next"), GTK_STOCK_MEDIA_NEXT, GDK_Down, ALT, .func = aud_drct_pl_next},
  38. - {.sep = TRUE},
  39. - {N_("_Repeat"), NULL, 'r', CTRL, .get = repeat_get, repeat_set, "set repeat"},
  40. - {N_("S_huffle"), NULL, 's', CTRL, .get = shuffle_get, shuffle_set, "set shuffle"},
  41. - {N_("N_o Playlist Advance"), NULL, 'n', CTRL, .get = no_advance_get, no_advance_set, "set no_playlist_advance"},
  42. - {N_("Stop _After This Song"), NULL, 'm', CTRL, .get = stop_after_get, stop_after_set, "set stop_after_current_song"},
  43. - {.sep = TRUE},
  44. - {N_("Song _Info ..."), GTK_STOCK_INFO, 'i', CTRL, .func = audgui_infowin_show_current},
  45. - {N_("Jump to _Time ..."), GTK_STOCK_JUMP_TO, .func = audgui_jump_to_time},
  46. - {N_("_Jump to Song ..."), GTK_STOCK_JUMP_TO, 'j', CTRL, .func = audgui_jump_to_track}};
  47. + {N_("_Play"), GTK_STOCK_MEDIA_PLAY, GDK_Return, CTRL, "play", .func = aud_drct_play},
  48. + {N_("Paus_e"), GTK_STOCK_MEDIA_PAUSE, ',', CTRL, "pause", .func = aud_drct_pause},
  49. + {N_("_Stop"), GTK_STOCK_MEDIA_STOP, '.', CTRL, "stop", .func = aud_drct_stop},
  50. + {N_("Pre_vious"), GTK_STOCK_MEDIA_PREVIOUS, GDK_Up, ALT, "previous", .func = aud_drct_pl_prev},
  51. + {N_("_Next"), GTK_STOCK_MEDIA_NEXT, GDK_Down, ALT, "next", .func = aud_drct_pl_next},
  52. + {.sep = TRUE},
  53. + {N_("_Repeat"), NULL, 'r', CTRL, "repeat", .get = repeat_get, repeat_set, "set repeat"},
  54. + {N_("S_huffle"), NULL, 's', CTRL, "shuffle", .get = shuffle_get, shuffle_set, "set shuffle"},
  55. + {N_("N_o Playlist Advance"), NULL, 'n', CTRL, "no_playlist_advance", .get = no_advance_get, no_advance_set, "set no_playlist_advance"},
  56. + {N_("Stop _After This Song"), NULL, 'm', CTRL, "stop_after_this_song", .get = stop_after_get, stop_after_set, "set stop_after_current_song"},
  57. + {.sep = TRUE},
  58. + {N_("Song _Info ..."), GTK_STOCK_INFO, 'i', CTRL, "song_info", .func = audgui_infowin_show_current},
  59. + {N_("Jump to _Time ..."), GTK_STOCK_JUMP_TO, .identifier = "jump_to_time", .func = audgui_jump_to_time},
  60. + {N_("_Jump to Song ..."), GTK_STOCK_JUMP_TO, 'j', CTRL, "jump_to_song", .func = audgui_jump_to_track}};
  61.  
  62.  static const struct MenuItem sort_items[] = {
  63.   {N_("By Track _Number"), .func = pl_sort_track},
  64. @@ -166,25 +167,25 @@
  65.   {N_("_Random Order"), .func = pl_random}};
  66.  
  67.  static const struct MenuItem playlist_items[] = {
  68. - {N_("_Refresh"), GTK_STOCK_REFRESH, GDK_F5, .func = pl_refresh},
  69. - {N_("Remove _Unavailable Files"), GTK_STOCK_REMOVE, .func = pl_remove_failed},
  70. + {N_("_Refresh"), GTK_STOCK_REFRESH, GDK_F5, .identifier = "playlist_refresh", .func = pl_refresh},
  71. + {N_("Remove _Unavailable Files"), GTK_STOCK_REMOVE, .identifier = "playlist_remove", .func = pl_remove_failed},
  72.   {.sep = TRUE},
  73.   {N_("_Sort"), GTK_STOCK_SORT_ASCENDING, .items = sort_items, G_N_ELEMENTS (sort_items)},
  74.   {.sep = TRUE},
  75. - {N_("_New"), GTK_STOCK_NEW, 't', CTRL, .func = pl_new},
  76. - {N_("_Close"), GTK_STOCK_CLOSE, 'w', CTRL, .func = pl_close},
  77. + {N_("_New"), GTK_STOCK_NEW, 't', CTRL, "playlist_new", .func = pl_new},
  78. + {N_("_Close"), GTK_STOCK_CLOSE, 'w', CTRL, "playlist_close", .func = pl_close},
  79.   {.sep = TRUE},
  80. - {N_("_Import ..."), GTK_STOCK_OPEN, .func = audgui_import_playlist},
  81. - {N_("_Export ..."), GTK_STOCK_SAVE, .func = audgui_export_playlist},
  82. + {N_("_Import ..."), GTK_STOCK_OPEN, .identifier = "playlist_import", .func = audgui_import_playlist},
  83. + {N_("_Export ..."), GTK_STOCK_SAVE, .identifier = "playlist_export", .func = audgui_export_playlist},
  84.   {.sep = TRUE},
  85. - {N_("_Playlist Manager ..."), AUD_STOCK_PLAYLIST, 'p', CTRL, .func = audgui_playlist_manager},
  86. - {N_("_Queue Manager ..."), AUD_STOCK_QUEUETOGGLE, 'u', CTRL, .func = audgui_queue_manager_show}};
  87. + {N_("_Playlist Manager ..."), AUD_STOCK_PLAYLIST, 'p', CTRL, "playlist_manager", .func = audgui_playlist_manager},
  88. + {N_("_Queue Manager ..."), AUD_STOCK_QUEUETOGGLE, 'u', CTRL, "queue_manager", .func = audgui_queue_manager_show}};
  89.  
  90.  static const struct MenuItem output_items[] = {
  91. - {N_("Volume _Up"), GTK_STOCK_GO_UP, '+', CTRL, .func = volume_up},
  92. - {N_("Volume _Down"), GTK_STOCK_GO_DOWN, '-', CTRL, .func = volume_down},
  93. + {N_("Volume _Up"), GTK_STOCK_GO_UP, '+', CTRL, "volume_up", .func = volume_up},
  94. + {N_("Volume _Down"), GTK_STOCK_GO_DOWN, '-', CTRL, "volume_down", .func = volume_down},
  95.   {.sep = TRUE},
  96. - {N_("_Equalizer"), GTK_STOCK_PREFERENCES, 'e', CTRL, .func = audgui_show_equalizer_window},
  97. + {N_("_Equalizer"), GTK_STOCK_PREFERENCES, 'e', CTRL, "equalizer", .func = audgui_show_equalizer_window},
  98.   {.sep = TRUE},
  99.   {N_("E_ffects"), .get_sub = audgui_create_effects_menu}};
  100.  
  101. @@ -192,13 +193,13 @@
  102.   {N_("_Interface"), .get_sub = audgui_create_iface_menu},
  103.   {N_("_Visualizations"), .get_sub = audgui_create_vis_menu},
  104.   {.sep = TRUE},
  105. - {N_("Show _Menu Bar"), NULL, 'm', SHIFT | CTRL, .get = menu_bar_get, show_menu},
  106. - {N_("Show I_nfo Bar"), NULL, 'i', SHIFT | CTRL, .get = info_bar_get, show_infoarea},
  107. - {N_("Show _Status Bar"), NULL, 's', SHIFT | CTRL, .get = status_bar_get, show_statusbar},
  108. - {.sep = TRUE},
  109. - {N_("Show Column _Headers"), .get = column_headers_get, playlist_show_headers},
  110. - {N_("Choose _Columns ..."), .func = pw_col_choose},
  111. - {N_("Scrol_l on Song Change"), .get = autoscroll_get, autoscroll_set}};
  112. + {N_("Show _Menu Bar"), NULL, 'm', SHIFT | CTRL, "show_menu_bar", .get = menu_bar_get, show_menu},
  113. + {N_("Show I_nfo Bar"), NULL, 'i', SHIFT | CTRL, "show_info_bar", .get = info_bar_get, show_infoarea},
  114. + {N_("Show _Status Bar"), NULL, 's', SHIFT | CTRL, "show_status_bar", .get = status_bar_get, show_statusbar},
  115. + {.sep = TRUE},
  116. + {N_("Show Column _Headers"), .identifier = "show_column_headers", .get = column_headers_get, playlist_show_headers},
  117. + {N_("Choose _Columns ..."), .identifier = "choose_columns", .func = pw_col_choose},
  118. + {N_("Scrol_l on Song Change"),  .identifier = "scroll_on_song_change", .get = autoscroll_get, autoscroll_set}};
  119.  
  120.  static const struct MenuItem main_items[] = {
  121.   {N_("_File"), .items = file_items, G_N_ELEMENTS (file_items)},
  122. @@ -209,20 +210,20 @@
  123.   {N_("_View"), .items = view_items, G_N_ELEMENTS (view_items)}};
  124.  
  125.  static const struct MenuItem rclick_items[] = {
  126. - {N_("Song _Info ..."), GTK_STOCK_INFO, 'i', ALT, .func = playlist_song_info},
  127. - {N_("_Queue/Unqueue"), AUD_STOCK_QUEUETOGGLE, 'q', ALT, .func = playlist_queue_toggle},
  128. - {N_("_Refresh"), GTK_STOCK_REFRESH, GDK_F6, .func = pl_refresh_sel},
  129. - {.sep = TRUE},
  130. - {N_("Cu_t"), GTK_STOCK_CUT, .func = playlist_cut},
  131. - {N_("_Copy"), GTK_STOCK_COPY, .func = playlist_copy},
  132. - {N_("_Paste"), GTK_STOCK_PASTE, .func = playlist_paste},
  133. - {N_("Select _All"), GTK_STOCK_SELECT_ALL, .func = pl_select_all},
  134. + {N_("Song _Info ..."), GTK_STOCK_INFO, 'i', ALT, "list_song_info", .func = playlist_song_info},
  135. + {N_("_Queue/Unqueue"), AUD_STOCK_QUEUETOGGLE, 'q', ALT, "list_queue", .func = playlist_queue_toggle},
  136. + {N_("_Refresh"), GTK_STOCK_REFRESH, GDK_F6, .identifier = "list_refresh", .func = pl_refresh_sel},
  137. + {.sep = TRUE},
  138. + {N_("Cu_t"), GTK_STOCK_CUT, .identifier = "list_cut", .func = playlist_cut},
  139. + {N_("_Copy"), GTK_STOCK_COPY, .identifier = "list_copy", .func = playlist_copy},
  140. + {N_("_Paste"), GTK_STOCK_PASTE, .identifier = "list_paste", .func = playlist_paste},
  141. + {N_("Select _All"), GTK_STOCK_SELECT_ALL, .identifier = "list_select_all", .func = pl_select_all},
  142.   {.sep = TRUE},
  143.   {N_("_Services"), .get_sub = get_services_pl}};
  144.  
  145.  static const struct MenuItem tab_items[] = {
  146. - {N_("_Rename"), GTK_STOCK_EDIT, GDK_F2, .func = pl_rename},
  147. - {N_("_Close"), GTK_STOCK_CLOSE, .func = pl_close}};
  148. + {N_("_Rename"), GTK_STOCK_EDIT, GDK_F2, .identifier = "tab_rename", .func = pl_rename},
  149. + {N_("_Close"), GTK_STOCK_CLOSE, .identifier = "tab_close", .func = pl_close}};
  150.  
  151.  static void toggled_cb (GtkCheckMenuItem * check, const struct MenuItem * item)
  152.  {
  153. @@ -302,9 +303,25 @@
  154.          if (! widget)
  155.              continue;
  156.  
  157. +       guint fkey = item->key;
  158. +       GdkModifierType fmod = item->mod;
  159. +       if (item->identifier)
  160. +       {
  161. +           gchar *nkey;
  162. +           nkey = aud_get_string("gtkui",g_strconcat("key_",item->identifier,NULL));
  163. +           if (nkey[0] != 0)
  164. +               fkey = (guint) (nkey[0]);
  165. +           g_free (nkey);
  166. +          
  167. +           gint nmod;
  168. +           nmod = aud_get_int("gtkui",g_strconcat("mod_",item->identifier,NULL));
  169. +           if (nmod != 0)
  170. +               fmod = (GdkModifierType) nmod;
  171. +       }
  172. +
  173.          if (item->key)
  174. -            gtk_widget_add_accelerator (widget, "activate", accel, item->key,
  175. -             item->mod, GTK_ACCEL_VISIBLE);
  176. +            gtk_widget_add_accelerator (widget, "activate", accel, fkey,
  177. +             fmod, GTK_ACCEL_VISIBLE);
  178.  
  179.          gtk_widget_show (widget);
  180.          gtk_menu_shell_append ((GtkMenuShell *) shell, widget);
RAW Paste Data