comparison src/crossfade/configure.c @ 3151:7b80d4fb493d

crossfade : the plugin is now translatable.
author Stany Henry <StrassBoy@gmail.com>
date Tue, 12 May 2009 11:23:57 +0200
parents a9593b76cf19
children
comparison
equal deleted inserted replaced
3150:062f42c3737e 3151:7b80d4fb493d
1 /* 1 /*
2 * XMMS Crossfade Plugin 2 * XMMS Crossfade Plugin
3 * Copyright (C) 2000-2007 Peter Eisenlohr <peter@eisenlohr.org> 3 * Copyright (C) 2000-2007 Peter Eisenlohr <peter@eisenlohr.org>
4 * 4 *
5 * based on the original OSS Output Plugin 5 * based on the original OSS Output Plugin
6 * Copyright (C) 1998-2000 Peter Alm, Mikael Alm, Olle Hallnas, Thomas Nilsson and 4Front Technologies 6 * Copyright (C) 1998-2000 Peter Alm, Mikael Alm, Olle Hallnas, Thomas Nilsson and 4Front Technologies
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or 10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version. 11 * (at your option) any later version.
12 * 12 *
13 * This program is distributed in the hope that it will be useful, 13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 * 17 *
116 add_menu_item(GtkWidget *menu, gchar *title, activate_func_t func, gint index, gint **imap) 116 add_menu_item(GtkWidget *menu, gchar *title, activate_func_t func, gint index, gint **imap)
117 { 117 {
118 GtkWidget *item; 118 GtkWidget *item;
119 if (!menu || !title || !func) 119 if (!menu || !title || !func)
120 return; 120 return;
121 121
122 item = gtk_menu_item_new_with_label(title); 122 item = gtk_menu_item_new_with_label(title);
123 gtk_signal_connect(GTK_OBJECT(item), "activate", (GtkSignalFunc)func, GINT_TO_POINTER(index)); 123 gtk_signal_connect(GTK_OBJECT(item), "activate", (GtkSignalFunc)func, GINT_TO_POINTER(index));
124 gtk_widget_show(item); 124 gtk_widget_show(item);
125 gtk_menu_append(GTK_MENU(menu), item); 125 gtk_menu_append(GTK_MENU(menu), item);
126 126
131 static void 131 static void
132 gtk2_spin_button_hack(GtkSpinButton *spin) 132 gtk2_spin_button_hack(GtkSpinButton *spin)
133 { 133 {
134 static gboolean entered = FALSE; 134 static gboolean entered = FALSE;
135 const gchar *text; 135 const gchar *text;
136 136
137 if (entered) return; 137 if (entered) return;
138 entered = TRUE; 138 entered = TRUE;
139 139
140 text = gtk_entry_get_text(GTK_ENTRY(spin)); 140 text = gtk_entry_get_text(GTK_ENTRY(spin));
141 if (text && *text) 141 if (text && *text)
142 { 142 {
143 gint value = atoi(text); 143 gint value = atoi(text);
144 if (value != gtk_spin_button_get_value_as_int(spin)) 144 if (value != gtk_spin_button_get_value_as_int(spin))
145 gtk_spin_button_set_value(spin, value); 145 gtk_spin_button_set_value(spin, value);
147 else 147 else
148 { 148 {
149 gtk_spin_button_set_value(spin, 0.0); 149 gtk_spin_button_set_value(spin, 0.0);
150 gtk_entry_set_text(GTK_ENTRY(spin), ""); 150 gtk_entry_set_text(GTK_ENTRY(spin), "");
151 } 151 }
152 152
153 entered = FALSE; 153 entered = FALSE;
154 } 154 }
155 155
156 /*** plugin output ***********************************************************/ 156 /*** plugin output ***********************************************************/
157 157
180 gtk_widget_set_sensitive(item, FALSE); 180 gtk_widget_set_sensitive(item, FALSE);
181 else 181 else
182 { 182 {
183 if (def_index == -1) 183 if (def_index == -1)
184 def_index = index; 184 def_index = index;
185 185
186 if (op->filename && strcmp(g_basename(op->filename), selected) == 0) 186 if (op->filename && strcmp(g_basename(op->filename), selected) == 0)
187 sel_index = index; 187 sel_index = index;
188 } 188 }
189 189
190 /* create menu item */ 190 /* create menu item */
247 on_output_plugin_configure_button_clicked(GtkButton *button, gpointer user_data) 247 on_output_plugin_configure_button_clicked(GtkButton *button, gpointer user_data)
248 { 248 {
249 OutputPlugin *op = g_list_nth_data(xfplayer_get_output_list(), op_index); 249 OutputPlugin *op = g_list_nth_data(xfplayer_get_output_list(), op_index);
250 if ((op == NULL) || (op->configure == NULL)) 250 if ((op == NULL) || (op->configure == NULL))
251 return; 251 return;
252 252
253 op->configure(); 253 op->configure();
254 } 254 }
255 255
256 void 256 void
257 on_output_plugin_about_button_clicked(GtkButton *button, gpointer user_data) 257 on_output_plugin_about_button_clicked(GtkButton *button, gpointer user_data)
258 { 258 {
259 OutputPlugin *op = g_list_nth_data(xfplayer_get_output_list(), op_index); 259 OutputPlugin *op = g_list_nth_data(xfplayer_get_output_list(), op_index);
260 if ((op == NULL) || (op->about == NULL)) 260 if ((op == NULL) || (op->about == NULL))
261 return; 261 return;
262 262
263 op->about(); 263 op->about();
264 } 264 }
265 265
266 void 266 void
267 on_op_throttle_check_toggled(GtkToggleButton *togglebutton, gpointer user_data) 267 on_op_throttle_check_toggled(GtkToggleButton *togglebutton, gpointer user_data)
306 306
307 if ((optionmenu = lookup_widget(config_win, "xf_config_optionmenu"))) 307 if ((optionmenu = lookup_widget(config_win, "xf_config_optionmenu")))
308 { 308 {
309 for (i = 0; i < MAX_FADE_CONFIGS; i++) 309 for (i = 0; i < MAX_FADE_CONFIGS; i++)
310 xf_config_index_map[i] = -1; 310 xf_config_index_map[i] = -1;
311 311
312 imap = xf_config_index_map; 312 imap = xf_config_index_map;
313 menu = gtk_menu_new(); 313 menu = gtk_menu_new();
314 314
315 add_menu_item(menu, "Start of playback", xf_config_cb, FADE_CONFIG_START, &imap); 315 add_menu_item(menu, _("Start of playback"), xf_config_cb, FADE_CONFIG_START, &imap);
316 add_menu_item(menu, "Automatic songchange", xf_config_cb, FADE_CONFIG_XFADE, &imap); 316 add_menu_item(menu, _("Automatic songchange"), xf_config_cb, FADE_CONFIG_XFADE, &imap);
317 #if 0 317 #if 0
318 /* this should be FADE_TYPE_NONE all the time, anyway, 318 /* this should be FADE_TYPE_NONE all the time, anyway,
319 so no need to make it configureable by the user */ 319 so no need to make it configureable by the user */
320 add_menu_item(menu, "Automatic (gapless)", xf_config_cb, FADE_CONFIG_ALBUM, &imap); 320 add_menu_item(menu, "Automatic (gapless)", xf_config_cb, FADE_CONFIG_ALBUM, &imap);
321 #endif 321 #endif
322 add_menu_item(menu, "Manual songchange", xf_config_cb, FADE_CONFIG_MANUAL, &imap); 322 add_menu_item(menu, _("Manual songchange"), xf_config_cb, FADE_CONFIG_MANUAL, &imap);
323 add_menu_item(menu, "Manual stop", xf_config_cb, FADE_CONFIG_STOP, &imap); 323 add_menu_item(menu, _("Manual stop"), xf_config_cb, FADE_CONFIG_STOP, &imap);
324 add_menu_item(menu, "End of playlist", xf_config_cb, FADE_CONFIG_EOP, &imap); 324 add_menu_item(menu, _("End of playlist"), xf_config_cb, FADE_CONFIG_EOP, &imap);
325 add_menu_item(menu, "Seeking", xf_config_cb, FADE_CONFIG_SEEK, &imap); 325 add_menu_item(menu, _("Seeking"), xf_config_cb, FADE_CONFIG_SEEK, &imap);
326 add_menu_item(menu, "Pause", xf_config_cb, FADE_CONFIG_PAUSE, &imap); 326 add_menu_item(menu, _("Pause"), xf_config_cb, FADE_CONFIG_PAUSE, &imap);
327 gtk_option_menu_set_menu(GTK_OPTION_MENU(optionmenu), menu); 327 gtk_option_menu_set_menu(GTK_OPTION_MENU(optionmenu), menu);
328 } 328 }
329 329
330 } 330 }
331 331
338 338
339 if ((optionmenu = lookup_widget(config_win, "xf_type_optionmenu"))) 339 if ((optionmenu = lookup_widget(config_win, "xf_type_optionmenu")))
340 { 340 {
341 for (i = 0; i < MAX_FADE_TYPES; i++) 341 for (i = 0; i < MAX_FADE_TYPES; i++)
342 xf_type_index_map[i] = -1; 342 xf_type_index_map[i] = -1;
343 343
344 imap = xf_type_index_map; 344 imap = xf_type_index_map;
345 menu = gtk_menu_new(); 345 menu = gtk_menu_new();
346 mask = xfg->fc[xfg->xf_index].type_mask; 346 mask = xfg->fc[xfg->xf_index].type_mask;
347 347
348 if (mask & (1 << FADE_TYPE_REOPEN)) add_menu_item(menu, "Reopen output device", xf_type_cb, FADE_TYPE_REOPEN, &imap); 348 if (mask & (1 << FADE_TYPE_REOPEN)) add_menu_item(menu, _("Reopen output device"), xf_type_cb, FADE_TYPE_REOPEN, &imap);
349 if (mask & (1 << FADE_TYPE_FLUSH)) add_menu_item(menu, "Flush output device", xf_type_cb, FADE_TYPE_FLUSH, &imap); 349 if (mask & (1 << FADE_TYPE_FLUSH)) add_menu_item(menu, _("Flush output device"), xf_type_cb, FADE_TYPE_FLUSH, &imap);
350 if (mask & (1 << FADE_TYPE_NONE)) add_menu_item(menu, "None (gapless/off)", xf_type_cb, FADE_TYPE_NONE, &imap); 350 if (mask & (1 << FADE_TYPE_NONE)) add_menu_item(menu, _("None (gapless/off)"), xf_type_cb, FADE_TYPE_NONE, &imap);
351 if (mask & (1 << FADE_TYPE_PAUSE)) add_menu_item(menu, "Pause", xf_type_cb, FADE_TYPE_PAUSE, &imap); 351 if (mask & (1 << FADE_TYPE_PAUSE)) add_menu_item(menu, _("Pause"), xf_type_cb, FADE_TYPE_PAUSE, &imap);
352 if (mask & (1 << FADE_TYPE_SIMPLE_XF)) add_menu_item(menu, "Simple crossfade", xf_type_cb, FADE_TYPE_SIMPLE_XF, &imap); 352 if (mask & (1 << FADE_TYPE_SIMPLE_XF)) add_menu_item(menu, _("Simple crossfade"), xf_type_cb, FADE_TYPE_SIMPLE_XF, &imap);
353 if (mask & (1 << FADE_TYPE_ADVANCED_XF)) add_menu_item(menu, "Advanced crossfade", xf_type_cb, FADE_TYPE_ADVANCED_XF, &imap); 353 if (mask & (1 << FADE_TYPE_ADVANCED_XF)) add_menu_item(menu, _("Advanced crossfade"), xf_type_cb, FADE_TYPE_ADVANCED_XF, &imap);
354 if (mask & (1 << FADE_TYPE_FADEIN)) add_menu_item(menu, "Fadein", xf_type_cb, FADE_TYPE_FADEIN, &imap); 354 if (mask & (1 << FADE_TYPE_FADEIN)) add_menu_item(menu, _("Fadein"), xf_type_cb, FADE_TYPE_FADEIN, &imap);
355 if (mask & (1 << FADE_TYPE_FADEOUT)) add_menu_item(menu, "Fadeout", xf_type_cb, FADE_TYPE_FADEOUT, &imap); 355 if (mask & (1 << FADE_TYPE_FADEOUT)) add_menu_item(menu, _("Fadeout"), xf_type_cb, FADE_TYPE_FADEOUT, &imap);
356 if (mask & (1 << FADE_TYPE_PAUSE_NONE)) add_menu_item(menu, "None", xf_type_cb, FADE_TYPE_PAUSE_NONE, &imap); 356 if (mask & (1 << FADE_TYPE_PAUSE_NONE)) add_menu_item(menu, _("None"), xf_type_cb, FADE_TYPE_PAUSE_NONE, &imap);
357 if (mask & (1 << FADE_TYPE_PAUSE_ADV)) add_menu_item(menu, "Fadeout/Fadein", xf_type_cb, FADE_TYPE_PAUSE_ADV, &imap); 357 if (mask & (1 << FADE_TYPE_PAUSE_ADV)) add_menu_item(menu, _("Fadeout/Fadein"), xf_type_cb, FADE_TYPE_PAUSE_ADV, &imap);
358 gtk_option_menu_set_menu(GTK_OPTION_MENU(optionmenu), menu); 358 gtk_option_menu_set_menu(GTK_OPTION_MENU(optionmenu), menu);
359 } 359 }
360 } 360 }
361 361
362 #define NONE 0x00000000L 362 #define NONE 0x00000000L