Project

General

Profile

change_shortcuts.patch

Horst P., January 29, 2012 16:53

View differences:

menus.c 2012-01-29 16:25:07.000000000 +0100
46 46
    const gchar * icon;
47 47
    guint key;
48 48
    GdkModifierType mod;
49
    const gchar * identifier;
49 50

  
50 51
    /* for normal items */
51 52
    void (* func) (void);
......
128 129
static void autoscroll_set (gboolean on) {aud_set_bool ("gtkui", "autoscroll", on); }
129 130

  
130 131
static const struct MenuItem file_items[] = {
131
 {N_("_Open Files ..."), GTK_STOCK_OPEN, 'o', CTRL, .func = open_files},
132
 {N_("Open _URL ..."), GTK_STOCK_NETWORK, 'l', CTRL, .func = open_url},
133
 {N_("_Add Files ..."), GTK_STOCK_ADD, 'o', SHIFT | CTRL, .func = add_files},
134
 {N_("Add U_RL ..."), GTK_STOCK_NETWORK, 'l', SHIFT | CTRL, .func = add_url},
135
 {.sep = TRUE},
136
 {N_("A_bout ..."), GTK_STOCK_ABOUT, .func = audgui_show_about_window},
137
 {N_("_Preferences ..."), GTK_STOCK_PREFERENCES, .func = aud_show_prefs_window},
138
 {N_("_Quit"), GTK_STOCK_QUIT, 'q', CTRL, .func = aud_drct_quit}};
132
 {N_("_Open Files ..."), GTK_STOCK_OPEN, 'o', CTRL, "open_files", .func = open_files},
133
 {N_("Open _URL ..."), GTK_STOCK_NETWORK, 'l', CTRL, "open_url", .func = open_url},
134
 {N_("_Add Files ..."), GTK_STOCK_ADD, 'o', SHIFT | CTRL, "add_files", .func = add_files},
135
 {N_("Add U_RL ..."), GTK_STOCK_NETWORK, 'l', SHIFT | CTRL, "add_url", .func = add_url},
136
 {.sep = TRUE},
137
 {N_("A_bout ..."), GTK_STOCK_ABOUT, .identifier = "about", .func = audgui_show_about_window},
138
 {N_("_Preferences ..."), GTK_STOCK_PREFERENCES, .identifier = "preferences", .func = aud_show_prefs_window},
139
 {N_("_Quit"), GTK_STOCK_QUIT, 'q', CTRL, "quit", .func = aud_drct_quit}};
139 140

  
140 141
static const struct MenuItem playback_items[] = {
141
 {N_("_Play"), GTK_STOCK_MEDIA_PLAY, GDK_Return, CTRL, .func = aud_drct_play},
142
 {N_("Paus_e"), GTK_STOCK_MEDIA_PAUSE, ',', CTRL, .func = aud_drct_pause},
143
 {N_("_Stop"), GTK_STOCK_MEDIA_STOP, '.', CTRL, .func = aud_drct_stop},
144
 {N_("Pre_vious"), GTK_STOCK_MEDIA_PREVIOUS, GDK_Up, ALT, .func = aud_drct_pl_prev},
145
 {N_("_Next"), GTK_STOCK_MEDIA_NEXT, GDK_Down, ALT, .func = aud_drct_pl_next},
146
 {.sep = TRUE},
147
 {N_("_Repeat"), NULL, 'r', CTRL, .get = repeat_get, repeat_set, "set repeat"},
148
 {N_("S_huffle"), NULL, 's', CTRL, .get = shuffle_get, shuffle_set, "set shuffle"},
149
 {N_("N_o Playlist Advance"), NULL, 'n', CTRL, .get = no_advance_get, no_advance_set, "set no_playlist_advance"},
150
 {N_("Stop _After This Song"), NULL, 'm', CTRL, .get = stop_after_get, stop_after_set, "set stop_after_current_song"},
151
 {.sep = TRUE},
152
 {N_("Song _Info ..."), GTK_STOCK_INFO, 'i', CTRL, .func = audgui_infowin_show_current},
153
 {N_("Jump to _Time ..."), GTK_STOCK_JUMP_TO, .func = audgui_jump_to_time},
154
 {N_("_Jump to Song ..."), GTK_STOCK_JUMP_TO, 'j', CTRL, .func = audgui_jump_to_track}};
142
 {N_("_Play"), GTK_STOCK_MEDIA_PLAY, GDK_Return, CTRL, "play", .func = aud_drct_play},
143
 {N_("Paus_e"), GTK_STOCK_MEDIA_PAUSE, ',', CTRL, "pause", .func = aud_drct_pause},
144
 {N_("_Stop"), GTK_STOCK_MEDIA_STOP, '.', CTRL, "stop", .func = aud_drct_stop},
145
 {N_("Pre_vious"), GTK_STOCK_MEDIA_PREVIOUS, GDK_Up, ALT, "previous", .func = aud_drct_pl_prev},
146
 {N_("_Next"), GTK_STOCK_MEDIA_NEXT, GDK_Down, ALT, "next", .func = aud_drct_pl_next},
147
 {.sep = TRUE},
148
 {N_("_Repeat"), NULL, 'r', CTRL, "repeat", .get = repeat_get, repeat_set, "set repeat"},
149
 {N_("S_huffle"), NULL, 's', CTRL, "shuffle", .get = shuffle_get, shuffle_set, "set shuffle"},
150
 {N_("N_o Playlist Advance"), NULL, 'n', CTRL, "no_playlist_advance", .get = no_advance_get, no_advance_set, "set no_playlist_advance"},
151
 {N_("Stop _After This Song"), NULL, 'm', CTRL, "stop_after_this_song", .get = stop_after_get, stop_after_set, "set stop_after_current_song"},
152
 {.sep = TRUE},
153
 {N_("Song _Info ..."), GTK_STOCK_INFO, 'i', CTRL, "song_info", .func = audgui_infowin_show_current},
154
 {N_("Jump to _Time ..."), GTK_STOCK_JUMP_TO, .identifier = "jump_to_time", .func = audgui_jump_to_time},
155
 {N_("_Jump to Song ..."), GTK_STOCK_JUMP_TO, 'j', CTRL, "jump_to_song", .func = audgui_jump_to_track}};
155 156

  
156 157
static const struct MenuItem sort_items[] = {
157 158
 {N_("By Track _Number"), .func = pl_sort_track},
......
166 167
 {N_("_Random Order"), .func = pl_random}};
167 168

  
168 169
static const struct MenuItem playlist_items[] = {
169
 {N_("_Refresh"), GTK_STOCK_REFRESH, GDK_F5, .func = pl_refresh},
170
 {N_("Remove _Unavailable Files"), GTK_STOCK_REMOVE, .func = pl_remove_failed},
170
 {N_("_Refresh"), GTK_STOCK_REFRESH, GDK_F5, .identifier = "playlist_refresh", .func = pl_refresh},
171
 {N_("Remove _Unavailable Files"), GTK_STOCK_REMOVE, .identifier = "playlist_remove", .func = pl_remove_failed},
171 172
 {.sep = TRUE},
172 173
 {N_("_Sort"), GTK_STOCK_SORT_ASCENDING, .items = sort_items, G_N_ELEMENTS (sort_items)},
173 174
 {.sep = TRUE},
174
 {N_("_New"), GTK_STOCK_NEW, 't', CTRL, .func = pl_new},
175
 {N_("_Close"), GTK_STOCK_CLOSE, 'w', CTRL, .func = pl_close},
175
 {N_("_New"), GTK_STOCK_NEW, 't', CTRL, "playlist_new", .func = pl_new},
176
 {N_("_Close"), GTK_STOCK_CLOSE, 'w', CTRL, "playlist_close", .func = pl_close},
176 177
 {.sep = TRUE},
177
 {N_("_Import ..."), GTK_STOCK_OPEN, .func = audgui_import_playlist},
178
 {N_("_Export ..."), GTK_STOCK_SAVE, .func = audgui_export_playlist},
178
 {N_("_Import ..."), GTK_STOCK_OPEN, .identifier = "playlist_import", .func = audgui_import_playlist},
179
 {N_("_Export ..."), GTK_STOCK_SAVE, .identifier = "playlist_export", .func = audgui_export_playlist},
179 180
 {.sep = TRUE},
180
 {N_("_Playlist Manager ..."), AUD_STOCK_PLAYLIST, 'p', CTRL, .func = audgui_playlist_manager},
181
 {N_("_Queue Manager ..."), AUD_STOCK_QUEUETOGGLE, 'u', CTRL, .func = audgui_queue_manager_show}};
181
 {N_("_Playlist Manager ..."), AUD_STOCK_PLAYLIST, 'p', CTRL, "playlist_manager", .func = audgui_playlist_manager},
182
 {N_("_Queue Manager ..."), AUD_STOCK_QUEUETOGGLE, 'u', CTRL, "queue_manager", .func = audgui_queue_manager_show}};
182 183

  
183 184
static const struct MenuItem output_items[] = {
184
 {N_("Volume _Up"), GTK_STOCK_GO_UP, '+', CTRL, .func = volume_up},
185
 {N_("Volume _Down"), GTK_STOCK_GO_DOWN, '-', CTRL, .func = volume_down},
185
 {N_("Volume _Up"), GTK_STOCK_GO_UP, '+', CTRL, "volume_up", .func = volume_up},
186
 {N_("Volume _Down"), GTK_STOCK_GO_DOWN, '-', CTRL, "volume_down", .func = volume_down},
186 187
 {.sep = TRUE},
187
 {N_("_Equalizer"), GTK_STOCK_PREFERENCES, 'e', CTRL, .func = audgui_show_equalizer_window},
188
 {N_("_Equalizer"), GTK_STOCK_PREFERENCES, 'e', CTRL, "equalizer", .func = audgui_show_equalizer_window},
188 189
 {.sep = TRUE},
189 190
 {N_("E_ffects"), .get_sub = audgui_create_effects_menu}};
190 191

  
......
192 193
 {N_("_Interface"), .get_sub = audgui_create_iface_menu},
193 194
 {N_("_Visualizations"), .get_sub = audgui_create_vis_menu},
194 195
 {.sep = TRUE},
195
 {N_("Show _Menu Bar"), NULL, 'm', SHIFT | CTRL, .get = menu_bar_get, show_menu},
196
 {N_("Show I_nfo Bar"), NULL, 'i', SHIFT | CTRL, .get = info_bar_get, show_infoarea},
197
 {N_("Show _Status Bar"), NULL, 's', SHIFT | CTRL, .get = status_bar_get, show_statusbar},
198
 {.sep = TRUE},
199
 {N_("Show Column _Headers"), .get = column_headers_get, playlist_show_headers},
200
 {N_("Choose _Columns ..."), .func = pw_col_choose},
201
 {N_("Scrol_l on Song Change"), .get = autoscroll_get, autoscroll_set}};
196
 {N_("Show _Menu Bar"), NULL, 'm', SHIFT | CTRL, "show_menu_bar", .get = menu_bar_get, show_menu},
197
 {N_("Show I_nfo Bar"), NULL, 'i', SHIFT | CTRL, "show_info_bar", .get = info_bar_get, show_infoarea},
198
 {N_("Show _Status Bar"), NULL, 's', SHIFT | CTRL, "show_status_bar", .get = status_bar_get, show_statusbar},
199
 {.sep = TRUE},
200
 {N_("Show Column _Headers"), .identifier = "show_column_headers", .get = column_headers_get, playlist_show_headers},
201
 {N_("Choose _Columns ..."), .identifier = "choose_columns", .func = pw_col_choose},
202
 {N_("Scrol_l on Song Change"),  .identifier = "scroll_on_song_change", .get = autoscroll_get, autoscroll_set}};
202 203

  
203 204
static const struct MenuItem main_items[] = {
204 205
 {N_("_File"), .items = file_items, G_N_ELEMENTS (file_items)},
......
209 210
 {N_("_View"), .items = view_items, G_N_ELEMENTS (view_items)}};
210 211

  
211 212
static const struct MenuItem rclick_items[] = {
212
 {N_("Song _Info ..."), GTK_STOCK_INFO, 'i', ALT, .func = playlist_song_info},
213
 {N_("_Queue/Unqueue"), AUD_STOCK_QUEUETOGGLE, 'q', ALT, .func = playlist_queue_toggle},
214
 {N_("_Refresh"), GTK_STOCK_REFRESH, GDK_F6, .func = pl_refresh_sel},
215
 {.sep = TRUE},
216
 {N_("Cu_t"), GTK_STOCK_CUT, .func = playlist_cut},
217
 {N_("_Copy"), GTK_STOCK_COPY, .func = playlist_copy},
218
 {N_("_Paste"), GTK_STOCK_PASTE, .func = playlist_paste},
219
 {N_("Select _All"), GTK_STOCK_SELECT_ALL, .func = pl_select_all},
213
 {N_("Song _Info ..."), GTK_STOCK_INFO, 'i', ALT, "list_song_info", .func = playlist_song_info},
214
 {N_("_Queue/Unqueue"), AUD_STOCK_QUEUETOGGLE, 'q', ALT, "list_queue", .func = playlist_queue_toggle},
215
 {N_("_Refresh"), GTK_STOCK_REFRESH, GDK_F6, .identifier = "list_refresh", .func = pl_refresh_sel},
216
 {.sep = TRUE},
217
 {N_("Cu_t"), GTK_STOCK_CUT, .identifier = "list_cut", .func = playlist_cut},
218
 {N_("_Copy"), GTK_STOCK_COPY, .identifier = "list_copy", .func = playlist_copy},
219
 {N_("_Paste"), GTK_STOCK_PASTE, .identifier = "list_paste", .func = playlist_paste},
220
 {N_("Select _All"), GTK_STOCK_SELECT_ALL, .identifier = "list_select_all", .func = pl_select_all},
220 221
 {.sep = TRUE},
221 222
 {N_("_Services"), .get_sub = get_services_pl}};
222 223

  
223 224
static const struct MenuItem tab_items[] = {
224
 {N_("_Rename"), GTK_STOCK_EDIT, GDK_F2, .func = pl_rename},
225
 {N_("_Close"), GTK_STOCK_CLOSE, .func = pl_close}};
225
 {N_("_Rename"), GTK_STOCK_EDIT, GDK_F2, .identifier = "tab_rename", .func = pl_rename},
226
 {N_("_Close"), GTK_STOCK_CLOSE, .identifier = "tab_close", .func = pl_close}};
226 227

  
227 228
static void toggled_cb (GtkCheckMenuItem * check, const struct MenuItem * item)
228 229
{
......
302 303
        if (! widget)
303 304
            continue;
304 305

  
306
		guint fkey = item->key;
307
		GdkModifierType fmod = item->mod;
308
		if (item->identifier) 
309
		{
310
			gchar *nkey; 
311
			nkey = aud_get_string("gtkui",g_strconcat("key_",item->identifier,NULL));
312
			if (nkey[0] != 0)
313
				fkey = (guint) (nkey[0]);
314
			g_free (nkey);
315
			
316
			gint nmod;
317
			nmod = aud_get_int("gtkui",g_strconcat("mod_",item->identifier,NULL));
318
			if (nmod != 0)
319
				fmod = (GdkModifierType) nmod;
320
		}
321

  
305 322
        if (item->key)
306
            gtk_widget_add_accelerator (widget, "activate", accel, item->key,
307
             item->mod, GTK_ACCEL_VISIBLE);
323
            gtk_widget_add_accelerator (widget, "activate", accel, fkey,
324
             fmod, GTK_ACCEL_VISIBLE);
308 325

  
309 326
        gtk_widget_show (widget);
310 327
        gtk_menu_shell_append ((GtkMenuShell *) shell, widget);