Mercurial > audlegacy
annotate src/audacious/ui_preferences.c @ 2555:22da0618297e trunk
[svn] - handle MS-DOS line endings.
author | nenolod |
---|---|
date | Tue, 20 Feb 2007 07:35:05 -0800 |
parents | 719e0898ff3c |
children | 0ad10a95ed10 |
rev | line source |
---|---|
2313 | 1 /* Audacious - Cross-platform multimedia player |
2 * Copyright (C) 2005-2006 Audacious development team. | |
3 * | |
4 * BMP - Cross-platform multimedia player | |
5 * Copyright (C) 2003-2004 BMP development team. | |
6 * | |
7 * This program is free software; you can redistribute it and/or modify | |
8 * it under the terms of the GNU General Public License as published by | |
9 * the Free Software Foundation; under version 2 of the License. | |
10 * | |
11 * This program is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License | |
17 * along with this program; if not, write to the Free Software | |
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
19 */ | |
20 | |
21 #ifdef HAVE_CONFIG_H | |
22 # include "config.h" | |
23 #endif | |
24 | |
25 #include <glib.h> | |
26 #include <glib/gi18n.h> | |
27 #include <gtk/gtk.h> | |
28 #include <glade/glade.h> | |
29 #include <string.h> | |
30 #include <stddef.h> | |
31 #include <stdio.h> | |
32 #include <sys/types.h> | |
33 #include <dirent.h> | |
34 #include <unistd.h> | |
35 #include <errno.h> | |
36 #include <sys/types.h> | |
37 #include <sys/stat.h> | |
38 | |
39 #include "glade.h" | |
40 | |
41 #include "plugin.h" | |
42 #include "pluginenum.h" | |
43 #include "input.h" | |
44 #include "effect.h" | |
45 #include "general.h" | |
46 #include "output.h" | |
47 #include "visualization.h" | |
48 | |
49 #include "main.h" | |
50 #include "widgets/widgetcore.h" | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2405
diff
changeset
|
51 #include "urldecode.h" |
2373
ad1d7687814c
[svn] made strings.h for existing strings.c, cleanups
mf0102
parents:
2328
diff
changeset
|
52 #include "strings.h" |
2313 | 53 #include "util.h" |
54 #include "dnd.h" | |
55 #include "libaudacious/configdb.h" | |
56 | |
57 #include "ui_main.h" | |
58 #include "ui_playlist.h" | |
59 #include "ui_skinselector.h" | |
60 #include "ui_preferences.h" | |
2328 | 61 #include "ui_equalizer.h" |
2313 | 62 |
63 #include "build_stamp.h" | |
64 | |
65 enum CategoryViewCols { | |
66 CATEGORY_VIEW_COL_ICON, | |
67 CATEGORY_VIEW_COL_NAME, | |
68 CATEGORY_VIEW_COL_ID, | |
69 CATEGORY_VIEW_N_COLS | |
70 }; | |
71 | |
72 enum PluginViewCols { | |
73 PLUGIN_VIEW_COL_ACTIVE, | |
74 PLUGIN_VIEW_COL_DESC, | |
75 PLUGIN_VIEW_COL_FILENAME, | |
76 PLUGIN_VIEW_COL_ID, | |
77 PLUGIN_VIEW_N_COLS | |
78 }; | |
79 | |
80 | |
81 typedef struct { | |
82 const gchar *icon_path; | |
83 const gchar *name; | |
84 gint id; | |
85 } Category; | |
86 | |
87 typedef struct { | |
88 const gchar *name; | |
89 const gchar *tag; | |
90 } | |
91 TitleFieldTag; | |
92 | |
93 static GtkWidget *prefswin = NULL; | |
94 static GtkWidget *filepopup_settings = NULL; | |
95 static GtkWidget *colorize_settings = NULL; | |
96 static GtkWidget *category_treeview = NULL; | |
97 static GtkWidget *category_notebook = NULL; | |
98 GtkWidget *filepopupbutton = NULL; | |
99 | |
100 static Category categories[] = { | |
101 {DATA_DIR "/images/appearance.png", N_("Appearance"), 1}, | |
102 {DATA_DIR "/images/audio.png", N_("Audio"), 6}, | |
103 {DATA_DIR "/images/connectivity.png", N_("Connectivity"), 5}, | |
104 {DATA_DIR "/images/eq.png", N_("Equalizer"), 4}, | |
105 {DATA_DIR "/images/mouse.png", N_("Mouse"), 2}, | |
106 {DATA_DIR "/images/playlist.png", N_("Playlist"), 3}, | |
107 {DATA_DIR "/images/plugins.png", N_("Plugins"), 0}, | |
108 }; | |
109 | |
110 static gint n_categories = G_N_ELEMENTS(categories); | |
111 | |
112 static TitleFieldTag title_field_tags[] = { | |
113 { N_("Artist") , "%p" }, | |
114 { N_("Album") , "%a" }, | |
115 { N_("Title") , "%t" }, | |
116 { N_("Tracknumber"), "%n" }, | |
117 { N_("Genre") , "%g" }, | |
118 { N_("Filename") , "%f" }, | |
119 { N_("Filepath") , "%F" }, | |
120 { N_("Date") , "%d" }, | |
121 { N_("Year") , "%y" }, | |
122 { N_("Comment") , "%c" } | |
123 }; | |
124 | |
125 typedef struct { | |
126 void *next; | |
127 GtkWidget *container; | |
128 char *pg_name; | |
129 char *img_url; | |
130 } CategoryQueueEntry; | |
131 | |
132 CategoryQueueEntry *category_queue = NULL; | |
133 | |
134 static const guint n_title_field_tags = G_N_ELEMENTS(title_field_tags); | |
135 | |
136 /* GLib 2.6 compatibility */ | |
137 #if (! ((GLIB_MAJOR_VERSION > 2) || ((GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION >= 8)))) | |
138 static const char * | |
139 g_get_host_name (void) | |
140 { | |
141 static char hostname [HOST_NAME_MAX + 1]; | |
142 if (gethostname (hostname, HOST_NAME_MAX) == -1) { | |
143 return _("localhost"); | |
144 } | |
145 return hostname; | |
146 } | |
147 #endif | |
148 | |
149 static void prefswin_page_queue_destroy(CategoryQueueEntry *ent); | |
150 | |
151 static GladeXML * | |
152 prefswin_get_xml(void) | |
153 { | |
154 return GLADE_XML(g_object_get_data(G_OBJECT(prefswin), "glade-xml")); | |
155 } | |
156 | |
157 static void | |
158 change_category(GtkNotebook * notebook, | |
159 GtkTreeSelection * selection) | |
160 { | |
161 GtkTreeModel *model; | |
162 GtkTreeIter iter; | |
163 gint index; | |
164 | |
165 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
166 return; | |
167 | |
168 gtk_tree_model_get(model, &iter, CATEGORY_VIEW_COL_ID, &index, -1); | |
169 gtk_notebook_set_current_page(notebook, index); | |
170 } | |
171 | |
172 void | |
173 prefswin_set_category(gint index) | |
174 { | |
175 GladeXML *xml; | |
176 GtkWidget *notebook; | |
177 | |
178 g_return_if_fail(index >= 0 && index < n_categories); | |
179 | |
180 xml = prefswin_get_xml(); | |
181 notebook = glade_xml_get_widget(xml, "category_view"); | |
182 gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook), index); | |
183 } | |
184 | |
185 | |
186 static void | |
187 input_plugin_open_prefs(GtkTreeView * treeview, | |
188 gpointer data) | |
189 { | |
190 GtkTreeSelection *selection; | |
191 GtkTreeModel *model; | |
192 GtkTreeIter iter; | |
193 gint id; | |
194 | |
195 selection = gtk_tree_view_get_selection(treeview); | |
196 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
197 return; | |
198 | |
199 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
200 input_configure(id); | |
201 } | |
202 | |
203 static void | |
204 input_plugin_open_info(GtkTreeView * treeview, | |
205 gpointer data) | |
206 { | |
207 GtkTreeSelection *selection; | |
208 GtkTreeModel *model; | |
209 GtkTreeIter iter; | |
210 gint id; | |
211 | |
212 selection = gtk_tree_view_get_selection(treeview); | |
213 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
214 return; | |
215 | |
216 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
217 input_about(id); | |
218 } | |
219 | |
220 static void | |
221 output_plugin_open_prefs(GtkComboBox * cbox, | |
222 gpointer data) | |
223 { | |
224 output_configure(gtk_combo_box_get_active(cbox)); | |
225 } | |
226 | |
227 static void | |
228 output_plugin_open_info(GtkComboBox * cbox, | |
229 gpointer data) | |
230 { | |
231 output_about(gtk_combo_box_get_active(cbox)); | |
232 } | |
233 | |
234 static void | |
235 general_plugin_open_prefs(GtkTreeView * treeview, | |
236 gpointer data) | |
237 { | |
238 GtkTreeSelection *selection; | |
239 GtkTreeModel *model; | |
240 GtkTreeIter iter; | |
241 gint id; | |
242 | |
243 selection = gtk_tree_view_get_selection(treeview); | |
244 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
245 return; | |
246 | |
247 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
248 general_configure(id); | |
249 } | |
250 | |
251 static void | |
252 general_plugin_open_info(GtkTreeView * treeview, | |
253 gpointer data) | |
254 { | |
255 GtkTreeSelection *selection; | |
256 GtkTreeModel *model; | |
257 GtkTreeIter iter; | |
258 gint id; | |
259 | |
260 selection = gtk_tree_view_get_selection(treeview); | |
261 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
262 return; | |
263 | |
264 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
265 general_about(id); | |
266 } | |
267 | |
268 static void | |
269 input_plugin_toggle(GtkCellRendererToggle * cell, | |
270 const gchar * path_str, | |
271 gpointer data) | |
272 { | |
273 GtkTreeModel *model = GTK_TREE_MODEL(data); | |
274 GtkTreeIter iter; | |
275 GtkTreePath *path = gtk_tree_path_new_from_string(path_str); | |
276 gboolean fixed; | |
277 gint pluginnr; | |
278 gchar *filename, *basename; | |
279 /*GList *diplist, *tmplist; */ | |
280 | |
281 /* get toggled iter */ | |
282 gtk_tree_model_get_iter(model, &iter, path); | |
283 gtk_tree_model_get(model, &iter, | |
284 PLUGIN_VIEW_COL_ACTIVE, &fixed, | |
285 PLUGIN_VIEW_COL_ID, &pluginnr, | |
286 PLUGIN_VIEW_COL_FILENAME, &filename, | |
287 -1); | |
288 | |
289 basename = g_path_get_basename(filename); | |
290 g_free(filename); | |
291 | |
292 /* do something with the value */ | |
293 fixed ^= 1; | |
294 | |
295 g_hash_table_replace(plugin_matrix, basename, GINT_TO_POINTER(fixed)); | |
296 /* g_hash_table_foreach(pluginmatrix, (GHFunc) disp_matrix, NULL); */ | |
297 | |
298 /* set new value */ | |
299 gtk_list_store_set(GTK_LIST_STORE(model), &iter, | |
300 PLUGIN_VIEW_COL_ACTIVE, fixed, -1); | |
301 | |
302 /* clean up */ | |
303 gtk_tree_path_free(path); | |
304 } | |
305 | |
306 | |
307 static void | |
308 vis_plugin_toggle(GtkCellRendererToggle * cell, | |
309 const gchar * path_str, | |
310 gpointer data) | |
311 { | |
312 GtkTreeModel *model = GTK_TREE_MODEL(data); | |
313 GtkTreeIter iter; | |
314 GtkTreePath *path = gtk_tree_path_new_from_string(path_str); | |
315 gboolean fixed; | |
316 gint pluginnr; | |
317 | |
318 /* get toggled iter */ | |
319 gtk_tree_model_get_iter(model, &iter, path); | |
320 gtk_tree_model_get(model, &iter, | |
321 PLUGIN_VIEW_COL_ACTIVE, &fixed, | |
322 PLUGIN_VIEW_COL_ID, &pluginnr, -1); | |
323 | |
324 /* do something with the value */ | |
325 fixed ^= 1; | |
326 | |
327 enable_vis_plugin(pluginnr, fixed); | |
328 | |
329 /* set new value */ | |
330 gtk_list_store_set(GTK_LIST_STORE(model), &iter, | |
331 PLUGIN_VIEW_COL_ACTIVE, fixed, -1); | |
332 | |
333 /* clean up */ | |
334 gtk_tree_path_free(path); | |
335 } | |
336 | |
337 static void | |
338 effect_plugin_toggle(GtkCellRendererToggle * cell, | |
339 const gchar * path_str, | |
340 gpointer data) | |
341 { | |
342 GtkTreeModel *model = GTK_TREE_MODEL(data); | |
343 GtkTreeIter iter; | |
344 GtkTreePath *path = gtk_tree_path_new_from_string(path_str); | |
345 gboolean fixed; | |
346 gint pluginnr; | |
347 | |
348 /* get toggled iter */ | |
349 gtk_tree_model_get_iter(model, &iter, path); | |
350 gtk_tree_model_get(model, &iter, | |
351 PLUGIN_VIEW_COL_ACTIVE, &fixed, | |
352 PLUGIN_VIEW_COL_ID, &pluginnr, -1); | |
353 | |
354 /* do something with the value */ | |
355 fixed ^= 1; | |
356 | |
357 enable_effect_plugin(pluginnr, fixed); | |
358 | |
359 /* set new value */ | |
360 gtk_list_store_set(GTK_LIST_STORE(model), &iter, | |
361 PLUGIN_VIEW_COL_ACTIVE, fixed, -1); | |
362 | |
363 /* clean up */ | |
364 gtk_tree_path_free(path); | |
365 } | |
366 static void | |
367 general_plugin_toggle(GtkCellRendererToggle * cell, | |
368 const gchar * path_str, | |
369 gpointer data) | |
370 { | |
371 GtkTreeModel *model = GTK_TREE_MODEL(data); | |
372 GtkTreeIter iter; | |
373 GtkTreePath *path = gtk_tree_path_new_from_string(path_str); | |
374 gboolean fixed; | |
375 gint pluginnr; | |
376 | |
377 /* get toggled iter */ | |
378 gtk_tree_model_get_iter(model, &iter, path); | |
379 gtk_tree_model_get(model, &iter, | |
380 PLUGIN_VIEW_COL_ACTIVE, &fixed, | |
381 PLUGIN_VIEW_COL_ID, &pluginnr, -1); | |
382 | |
383 /* do something with the value */ | |
384 fixed ^= 1; | |
385 | |
386 enable_general_plugin(pluginnr, fixed); | |
387 | |
388 /* set new value */ | |
389 gtk_list_store_set(GTK_LIST_STORE(model), &iter, | |
390 PLUGIN_VIEW_COL_ACTIVE, fixed, -1); | |
391 | |
392 /* clean up */ | |
393 gtk_tree_path_free(path); | |
394 } | |
395 | |
396 static void | |
397 on_output_plugin_cbox_changed(GtkComboBox * combobox, | |
398 gpointer data) | |
399 { | |
400 gint selected; | |
401 selected = gtk_combo_box_get_active(combobox); | |
402 | |
403 set_current_output_plugin(selected); | |
404 } | |
405 | |
406 static void | |
407 on_output_plugin_cbox_realize(GtkComboBox * cbox, | |
408 gpointer data) | |
409 { | |
410 GList *olist = get_output_list(); | |
411 OutputPlugin *op, *cp = get_current_output_plugin(); | |
412 gint i = 0, selected = 0; | |
413 | |
414 if (!olist) { | |
415 gtk_widget_set_sensitive(GTK_WIDGET(cbox), FALSE); | |
416 return; | |
417 } | |
418 | |
419 for (i = 0; olist; i++, olist = g_list_next(olist)) { | |
420 op = OUTPUT_PLUGIN(olist->data); | |
421 | |
422 if (olist->data == cp) | |
423 selected = i; | |
424 | |
425 gtk_combo_box_append_text(cbox, op->description); | |
426 } | |
427 | |
428 gtk_combo_box_set_active(cbox, selected); | |
429 g_signal_connect(cbox, "changed", | |
430 G_CALLBACK(on_output_plugin_cbox_changed), NULL); | |
431 } | |
432 | |
433 | |
434 static void | |
435 on_input_plugin_view_realize(GtkTreeView * treeview, | |
436 gpointer data) | |
437 { | |
438 GtkListStore *store; | |
439 GtkTreeIter iter; | |
440 | |
441 GtkCellRenderer *renderer; | |
442 GtkTreeViewColumn *column; | |
443 | |
444 GList *ilist; | |
445 gchar *description[2]; | |
446 InputPlugin *ip; | |
447 gint id = 0; | |
448 | |
449 gboolean enabled; | |
450 | |
451 store = gtk_list_store_new(PLUGIN_VIEW_N_COLS, | |
452 G_TYPE_BOOLEAN, G_TYPE_STRING, | |
453 G_TYPE_STRING, G_TYPE_INT); | |
454 | |
455 column = gtk_tree_view_column_new(); | |
456 gtk_tree_view_column_set_title(column, _("Enabled")); | |
457 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED); | |
458 gtk_tree_view_column_set_spacing(column, 4); | |
459 gtk_tree_view_column_set_resizable(column, FALSE); | |
460 gtk_tree_view_column_set_fixed_width(column, 50); | |
461 | |
462 renderer = gtk_cell_renderer_toggle_new(); | |
463 g_signal_connect(renderer, "toggled", | |
464 G_CALLBACK(input_plugin_toggle), store); | |
465 gtk_tree_view_column_pack_start(column, renderer, TRUE); | |
466 gtk_tree_view_column_set_attributes(column, renderer, "active", | |
467 PLUGIN_VIEW_COL_ACTIVE, NULL); | |
468 | |
469 gtk_tree_view_append_column(treeview, column); | |
470 | |
471 column = gtk_tree_view_column_new(); | |
472 gtk_tree_view_column_set_title(column, _("Description")); | |
473 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); | |
474 gtk_tree_view_column_set_spacing(column, 4); | |
475 gtk_tree_view_column_set_resizable(column, TRUE); | |
476 | |
477 | |
478 renderer = gtk_cell_renderer_text_new(); | |
479 gtk_tree_view_column_pack_start(column, renderer, FALSE); | |
480 gtk_tree_view_column_set_attributes(column, renderer, | |
481 "text", PLUGIN_VIEW_COL_DESC, NULL); | |
482 gtk_tree_view_append_column(treeview, column); | |
483 | |
484 column = gtk_tree_view_column_new(); | |
485 | |
486 gtk_tree_view_column_set_title(column, _("Filename")); | |
487 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); | |
488 gtk_tree_view_column_set_spacing(column, 4); | |
489 gtk_tree_view_column_set_resizable(column, TRUE); | |
490 | |
491 renderer = gtk_cell_renderer_text_new(); | |
492 gtk_tree_view_column_pack_start(column, renderer, TRUE); | |
493 gtk_tree_view_column_set_attributes(column, renderer, "text", | |
494 PLUGIN_VIEW_COL_FILENAME, NULL); | |
495 | |
496 gtk_tree_view_append_column(treeview, column); | |
497 | |
498 for (ilist = get_input_list(); ilist; ilist = g_list_next(ilist)) { | |
499 ip = INPUT_PLUGIN(ilist->data); | |
500 | |
501 description[0] = g_strdup(ip->description); | |
502 description[1] = g_strdup(ip->filename); | |
503 | |
504 enabled = input_is_enabled(description[1]); | |
505 | |
506 gtk_list_store_append(store, &iter); | |
507 gtk_list_store_set(store, &iter, | |
508 PLUGIN_VIEW_COL_ACTIVE, enabled, | |
509 PLUGIN_VIEW_COL_DESC, description[0], | |
510 PLUGIN_VIEW_COL_FILENAME, description[1], | |
511 PLUGIN_VIEW_COL_ID, id++, -1); | |
512 | |
513 g_free(description[1]); | |
514 g_free(description[0]); | |
515 } | |
516 | |
517 gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(store)); | |
518 } | |
519 | |
520 | |
521 static void | |
522 on_general_plugin_view_realize(GtkTreeView * treeview, | |
523 gpointer data) | |
524 { | |
525 GtkListStore *store; | |
526 GtkTreeIter iter; | |
527 | |
528 GtkCellRenderer *renderer; | |
529 GtkTreeViewColumn *column; | |
530 | |
531 GList *ilist /*, *diplist */ ; | |
532 gchar *description[2]; | |
533 GeneralPlugin *gp; | |
534 gint id = 0; | |
535 | |
536 gboolean enabled; | |
537 | |
538 store = gtk_list_store_new(PLUGIN_VIEW_N_COLS, | |
539 G_TYPE_BOOLEAN, G_TYPE_STRING, | |
540 G_TYPE_STRING, G_TYPE_INT); | |
541 | |
542 column = gtk_tree_view_column_new(); | |
543 gtk_tree_view_column_set_title(column, _("Enabled")); | |
544 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED); | |
545 gtk_tree_view_column_set_spacing(column, 4); | |
546 gtk_tree_view_column_set_resizable(column, FALSE); | |
547 gtk_tree_view_column_set_fixed_width(column, 50); | |
548 | |
549 renderer = gtk_cell_renderer_toggle_new(); | |
550 g_signal_connect(renderer, "toggled", | |
551 G_CALLBACK(general_plugin_toggle), store); | |
552 gtk_tree_view_column_pack_start(column, renderer, TRUE); | |
553 gtk_tree_view_column_set_attributes(column, renderer, "active", | |
554 PLUGIN_VIEW_COL_ACTIVE, NULL); | |
555 | |
556 gtk_tree_view_append_column(treeview, column); | |
557 | |
558 column = gtk_tree_view_column_new(); | |
559 gtk_tree_view_column_set_title(column, _("Description")); | |
560 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); | |
561 gtk_tree_view_column_set_spacing(column, 4); | |
562 gtk_tree_view_column_set_resizable(column, TRUE); | |
563 | |
564 | |
565 renderer = gtk_cell_renderer_text_new(); | |
566 gtk_tree_view_column_pack_start(column, renderer, FALSE); | |
567 gtk_tree_view_column_set_attributes(column, renderer, | |
568 "text", PLUGIN_VIEW_COL_DESC, NULL); | |
569 | |
570 gtk_tree_view_append_column(treeview, column); | |
571 | |
572 | |
573 column = gtk_tree_view_column_new(); | |
574 gtk_tree_view_column_set_title(column, _("Filename")); | |
575 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); | |
576 gtk_tree_view_column_set_spacing(column, 4); | |
577 gtk_tree_view_column_set_resizable(column, TRUE); | |
578 | |
579 renderer = gtk_cell_renderer_text_new(); | |
580 gtk_tree_view_column_pack_start(column, renderer, TRUE); | |
581 gtk_tree_view_column_set_attributes(column, renderer, "text", | |
582 PLUGIN_VIEW_COL_FILENAME, NULL); | |
583 | |
584 gtk_tree_view_append_column(treeview, column); | |
585 | |
586 for (ilist = get_general_list(); ilist; ilist = g_list_next(ilist)) { | |
587 gp = GENERAL_PLUGIN(ilist->data); | |
588 | |
589 description[0] = g_strdup(gp->description); | |
590 description[1] = g_strdup(gp->filename); | |
591 | |
592 enabled = general_enabled(id); | |
593 | |
594 gtk_list_store_append(store, &iter); | |
595 gtk_list_store_set(store, &iter, | |
596 PLUGIN_VIEW_COL_ACTIVE, enabled, | |
597 PLUGIN_VIEW_COL_DESC, description[0], | |
598 PLUGIN_VIEW_COL_FILENAME, description[1], | |
599 PLUGIN_VIEW_COL_ID, id++, -1); | |
600 | |
601 g_free(description[1]); | |
602 g_free(description[0]); | |
603 } | |
604 | |
605 gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(store)); | |
606 } | |
607 | |
608 | |
609 static void | |
610 on_vis_plugin_view_realize(GtkTreeView * treeview, | |
611 gpointer data) | |
612 { | |
613 GtkListStore *store; | |
614 GtkTreeIter iter; | |
615 | |
616 GtkCellRenderer *renderer; | |
617 GtkTreeViewColumn *column; | |
618 | |
619 GList *vlist; | |
620 gchar *description[2]; | |
621 VisPlugin *vp; | |
622 gint id = 0; | |
623 | |
624 gboolean enabled; | |
625 | |
626 | |
627 store = gtk_list_store_new(PLUGIN_VIEW_N_COLS, | |
628 G_TYPE_BOOLEAN, G_TYPE_STRING, | |
629 G_TYPE_STRING, G_TYPE_INT); | |
630 | |
631 column = gtk_tree_view_column_new(); | |
632 gtk_tree_view_column_set_title(column, _("Enabled")); | |
633 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED); | |
634 gtk_tree_view_column_set_spacing(column, 4); | |
635 gtk_tree_view_column_set_resizable(column, FALSE); | |
636 gtk_tree_view_column_set_fixed_width(column, 50); | |
637 | |
638 renderer = gtk_cell_renderer_toggle_new(); | |
639 g_signal_connect(renderer, "toggled", | |
640 G_CALLBACK(vis_plugin_toggle), store); | |
641 gtk_tree_view_column_pack_start(column, renderer, TRUE); | |
642 gtk_tree_view_column_set_attributes(column, renderer, "active", | |
643 PLUGIN_VIEW_COL_ACTIVE, NULL); | |
644 | |
645 gtk_tree_view_append_column(treeview, column); | |
646 | |
647 column = gtk_tree_view_column_new(); | |
648 gtk_tree_view_column_set_title(column, _("Description")); | |
649 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); | |
650 gtk_tree_view_column_set_spacing(column, 4); | |
651 gtk_tree_view_column_set_resizable(column, TRUE); | |
652 | |
653 | |
654 renderer = gtk_cell_renderer_text_new(); | |
655 gtk_tree_view_column_pack_start(column, renderer, FALSE); | |
656 gtk_tree_view_column_set_attributes(column, renderer, | |
657 "text", PLUGIN_VIEW_COL_DESC, NULL); | |
658 | |
659 gtk_tree_view_append_column(treeview, column); | |
660 | |
661 | |
662 column = gtk_tree_view_column_new(); | |
663 gtk_tree_view_column_set_title(column, _("Filename")); | |
664 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); | |
665 gtk_tree_view_column_set_spacing(column, 4); | |
666 gtk_tree_view_column_set_resizable(column, TRUE); | |
667 | |
668 renderer = gtk_cell_renderer_text_new(); | |
669 gtk_tree_view_column_pack_start(column, renderer, TRUE); | |
670 gtk_tree_view_column_set_attributes(column, renderer, "text", | |
671 PLUGIN_VIEW_COL_FILENAME, NULL); | |
672 | |
673 gtk_tree_view_append_column(treeview, column); | |
674 | |
675 for (vlist = get_vis_list(); vlist; vlist = g_list_next(vlist)) { | |
676 vp = VIS_PLUGIN(vlist->data); | |
677 | |
678 description[0] = g_strdup(vp->description); | |
679 description[1] = g_strdup(vp->filename); | |
680 | |
681 enabled = vis_enabled(id); | |
682 | |
683 gtk_list_store_append(store, &iter); | |
684 gtk_list_store_set(store, &iter, | |
685 PLUGIN_VIEW_COL_ACTIVE, enabled, | |
686 PLUGIN_VIEW_COL_DESC, description[0], | |
687 PLUGIN_VIEW_COL_FILENAME, description[1], | |
688 PLUGIN_VIEW_COL_ID, id++, -1); | |
689 | |
690 g_free(description[1]); | |
691 g_free(description[0]); | |
692 } | |
693 | |
694 gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(store)); | |
695 } | |
696 | |
697 static void | |
698 editable_insert_text(GtkEditable * editable, | |
699 const gchar * text, | |
700 gint * pos) | |
701 { | |
702 gtk_editable_insert_text(editable, text, strlen(text), pos); | |
703 } | |
704 | |
705 | |
706 static void | |
707 on_effect_plugin_view_realize(GtkTreeView * treeview, | |
708 gpointer data) | |
709 { | |
710 GtkListStore *store; | |
711 GtkTreeIter iter; | |
712 | |
713 GtkCellRenderer *renderer; | |
714 GtkTreeViewColumn *column; | |
715 | |
716 GList *elist; | |
717 gchar *description[2]; | |
718 gint id = 0; | |
719 | |
720 gboolean enabled; | |
721 | |
722 | |
723 store = gtk_list_store_new(PLUGIN_VIEW_N_COLS, | |
724 G_TYPE_BOOLEAN, G_TYPE_STRING, | |
725 G_TYPE_STRING, G_TYPE_INT); | |
726 | |
727 column = gtk_tree_view_column_new(); | |
728 gtk_tree_view_column_set_title(column, _("Enabled")); | |
729 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED); | |
730 gtk_tree_view_column_set_spacing(column, 4); | |
731 gtk_tree_view_column_set_resizable(column, FALSE); | |
732 gtk_tree_view_column_set_fixed_width(column, 50); | |
733 | |
734 renderer = gtk_cell_renderer_toggle_new(); | |
735 g_signal_connect(renderer, "toggled", | |
736 G_CALLBACK(effect_plugin_toggle), store); | |
737 gtk_tree_view_column_pack_start(column, renderer, TRUE); | |
738 gtk_tree_view_column_set_attributes(column, renderer, "active", | |
739 PLUGIN_VIEW_COL_ACTIVE, NULL); | |
740 | |
741 gtk_tree_view_append_column(treeview, column); | |
742 | |
743 column = gtk_tree_view_column_new(); | |
744 gtk_tree_view_column_set_title(column, _("Description")); | |
745 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); | |
746 gtk_tree_view_column_set_spacing(column, 4); | |
747 gtk_tree_view_column_set_resizable(column, TRUE); | |
748 | |
749 | |
750 renderer = gtk_cell_renderer_text_new(); | |
751 gtk_tree_view_column_pack_start(column, renderer, FALSE); | |
752 gtk_tree_view_column_set_attributes(column, renderer, | |
753 "text", PLUGIN_VIEW_COL_DESC, NULL); | |
754 | |
755 gtk_tree_view_append_column(treeview, column); | |
756 | |
757 | |
758 column = gtk_tree_view_column_new(); | |
759 gtk_tree_view_column_set_title(column, _("Filename")); | |
760 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); | |
761 gtk_tree_view_column_set_spacing(column, 4); | |
762 gtk_tree_view_column_set_resizable(column, TRUE); | |
763 | |
764 renderer = gtk_cell_renderer_text_new(); | |
765 gtk_tree_view_column_pack_start(column, renderer, TRUE); | |
766 gtk_tree_view_column_set_attributes(column, renderer, "text", | |
767 PLUGIN_VIEW_COL_FILENAME, NULL); | |
768 | |
769 gtk_tree_view_append_column(treeview, column); | |
770 | |
771 for (elist = get_effect_list(); elist; elist = g_list_next(elist)) { | |
772 EffectPlugin *ep = EFFECT_PLUGIN(elist->data); | |
773 | |
774 description[0] = g_strdup(ep->description); | |
775 description[1] = g_strdup(ep->filename); | |
776 | |
777 enabled = effect_enabled(id); | |
778 | |
779 gtk_list_store_append(store, &iter); | |
780 gtk_list_store_set(store, &iter, | |
781 PLUGIN_VIEW_COL_ACTIVE, enabled, | |
782 PLUGIN_VIEW_COL_DESC, description[0], | |
783 PLUGIN_VIEW_COL_FILENAME, description[1], | |
784 PLUGIN_VIEW_COL_ID, id++, -1); | |
785 | |
786 g_free(description[1]); | |
787 g_free(description[0]); | |
788 } | |
789 | |
790 gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(store)); | |
791 } | |
792 | |
793 static void | |
794 titlestring_tag_menu_callback(GtkMenuItem * menuitem, | |
795 gpointer data) | |
796 { | |
797 const gchar *separator = " - "; | |
798 GladeXML *xml; | |
799 GtkWidget *entry; | |
800 gint item = GPOINTER_TO_INT(data); | |
801 gint pos; | |
802 | |
803 xml = prefswin_get_xml(); | |
804 entry = glade_xml_get_widget(xml, "titlestring_entry"); | |
805 | |
806 pos = gtk_editable_get_position(GTK_EDITABLE(entry)); | |
807 | |
808 /* insert separator as needed */ | |
809 if (g_utf8_strlen(gtk_entry_get_text(GTK_ENTRY(entry)), -1) > 0) | |
810 editable_insert_text(GTK_EDITABLE(entry), separator, &pos); | |
811 | |
812 editable_insert_text(GTK_EDITABLE(entry), _(title_field_tags[item].tag), | |
813 &pos); | |
814 | |
815 gtk_editable_set_position(GTK_EDITABLE(entry), pos); | |
816 } | |
817 | |
818 static void | |
819 on_titlestring_help_button_clicked(GtkButton * button, | |
820 gpointer data) | |
821 { | |
822 | |
823 GtkMenu *menu; | |
824 MenuPos *pos = g_new0(MenuPos, 1); | |
825 GdkWindow *parent; | |
826 | |
827 gint x_ro, y_ro; | |
828 gint x_widget, y_widget; | |
829 gint x_size, y_size; | |
830 | |
831 g_return_if_fail (button != NULL); | |
832 g_return_if_fail (GTK_IS_MENU (data)); | |
833 | |
834 parent = gtk_widget_get_parent_window(GTK_WIDGET(button)); | |
835 | |
836 gdk_drawable_get_size(parent, &x_size, &y_size); | |
837 gdk_window_get_root_origin(GTK_WIDGET(button)->window, &x_ro, &y_ro); | |
838 gdk_window_get_position(GTK_WIDGET(button)->window, &x_widget, &y_widget); | |
839 | |
840 pos->x = x_size + x_ro; | |
841 pos->y = y_size + y_ro - 100; | |
842 | |
843 menu = GTK_MENU(data); | |
844 gtk_menu_popup (menu, NULL, NULL, util_menu_position, pos, | |
845 0, GDK_CURRENT_TIME); | |
846 } | |
847 | |
848 | |
849 static void | |
850 on_titlestring_entry_realize(GtkWidget * entry, | |
851 gpointer data) | |
852 { | |
853 gtk_entry_set_text(GTK_ENTRY(entry), cfg.gentitle_format); | |
854 } | |
855 | |
856 static void | |
857 on_titlestring_entry_changed(GtkWidget * entry, | |
858 gpointer data) | |
859 { | |
860 g_free(cfg.gentitle_format); | |
861 cfg.gentitle_format = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry))); | |
862 } | |
863 | |
864 static void | |
865 on_titlestring_cbox_realize(GtkWidget * cbox, | |
866 gpointer data) | |
867 { | |
868 gtk_combo_box_set_active(GTK_COMBO_BOX(cbox), cfg.titlestring_preset); | |
869 gtk_widget_set_sensitive(GTK_WIDGET(data), | |
870 (cfg.titlestring_preset == (gint)n_titlestring_presets)); | |
871 } | |
872 | |
873 static void | |
874 on_titlestring_cbox_changed(GtkWidget * cbox, | |
875 gpointer data) | |
876 { | |
877 gint position = gtk_combo_box_get_active(GTK_COMBO_BOX(cbox)); | |
878 | |
879 cfg.titlestring_preset = position; | |
880 gtk_widget_set_sensitive(GTK_WIDGET(data), (position == 6)); | |
881 } | |
882 | |
883 static void | |
884 on_mainwin_font_button_font_set(GtkFontButton * button, | |
885 gpointer data) | |
886 { | |
887 g_free(cfg.mainwin_font); | |
888 cfg.mainwin_font = g_strdup(gtk_font_button_get_font_name(button)); | |
889 | |
890 textbox_set_xfont(mainwin_info, cfg.mainwin_use_xfont, cfg.mainwin_font); | |
891 mainwin_set_info_text(); | |
892 draw_main_window(TRUE); | |
893 } | |
894 | |
895 static void | |
896 on_use_bitmap_fonts_realize(GtkToggleButton * button, | |
897 gpointer data) | |
898 { | |
899 gtk_toggle_button_set_active(button, | |
900 cfg.mainwin_use_xfont != FALSE ? FALSE : TRUE); | |
901 } | |
902 | |
903 static void | |
904 on_use_bitmap_fonts_toggled(GtkToggleButton * button, | |
905 gpointer data) | |
906 { | |
907 gboolean useit = gtk_toggle_button_get_active(button); | |
908 cfg.mainwin_use_xfont = useit != FALSE ? FALSE : TRUE; | |
909 textbox_set_xfont(mainwin_info, cfg.mainwin_use_xfont, cfg.mainwin_font); | |
910 playlistwin_set_sinfo_font(cfg.playlist_font); | |
911 | |
912 mainwin_set_info_text(); | |
913 draw_main_window(TRUE); | |
914 if (cfg.playlist_shaded) { | |
915 playlistwin_update_list(playlist_get_active()); | |
916 draw_playlist_window(TRUE); | |
917 } | |
918 } | |
919 | |
920 static void | |
921 on_mainwin_font_button_realize(GtkFontButton * button, | |
922 gpointer data) | |
923 { | |
924 gtk_font_button_set_font_name(button, cfg.mainwin_font); | |
925 } | |
926 | |
927 static void | |
928 on_playlist_font_button_font_set(GtkFontButton * button, | |
929 gpointer data) | |
930 { | |
931 g_free(cfg.playlist_font); | |
932 cfg.playlist_font = g_strdup(gtk_font_button_get_font_name(button)); | |
933 | |
934 playlist_list_set_font(cfg.playlist_font); | |
935 playlistwin_set_sinfo_font(cfg.playlist_font); /* propagate font setting to playlistwin_sinfo */ | |
936 playlistwin_update_list(playlist_get_active()); | |
937 draw_playlist_window(TRUE); | |
938 } | |
939 | |
940 static void | |
941 on_playlist_font_button_realize(GtkFontButton * button, | |
942 gpointer data) | |
943 { | |
944 gtk_font_button_set_font_name(button, cfg.playlist_font); | |
945 } | |
946 | |
947 static void | |
948 on_playlist_show_pl_numbers_realize(GtkToggleButton * button, | |
949 gpointer data) | |
950 { | |
951 gtk_toggle_button_set_active(button, cfg.show_numbers_in_pl); | |
952 } | |
953 | |
954 static void | |
955 on_playlist_show_pl_numbers_toggled(GtkToggleButton * button, | |
956 gpointer data) | |
957 { | |
958 cfg.show_numbers_in_pl = gtk_toggle_button_get_active(button); | |
959 playlistwin_update_list(playlist_get_active()); | |
960 draw_playlist_window(TRUE); | |
961 } | |
962 | |
963 static void | |
964 on_playlist_show_pl_separator_realize(GtkToggleButton * button, | |
965 gpointer data) | |
966 { | |
967 gtk_toggle_button_set_active(button, cfg.show_separator_in_pl); | |
968 } | |
969 | |
970 static void | |
971 on_playlist_show_pl_separator_toggled(GtkToggleButton * button, | |
972 gpointer data) | |
973 { | |
974 cfg.show_separator_in_pl = gtk_toggle_button_get_active(button); | |
975 playlistwin_update_list(playlist_get_active()); | |
976 draw_playlist_window(TRUE); | |
977 } | |
978 | |
979 /* format detection */ | |
980 static void | |
981 on_audio_format_det_cb_toggled(GtkToggleButton * button, | |
982 gpointer data) | |
983 { | |
984 cfg.playlist_detect = gtk_toggle_button_get_active(button); | |
985 } | |
986 | |
987 static void | |
988 on_audio_format_det_cb_realize(GtkToggleButton * button, | |
989 gpointer data) | |
990 { | |
991 gtk_toggle_button_set_active(button, cfg.playlist_detect); | |
992 } | |
993 | |
994 static void | |
995 on_detect_by_extension_cb_toggled(GtkToggleButton * button, | |
996 gpointer data) | |
997 { | |
998 cfg.use_extension_probing = gtk_toggle_button_get_active(button); | |
999 } | |
1000 | |
1001 static void | |
1002 on_detect_by_extension_cb_realize(GtkToggleButton * button, | |
1003 gpointer data) | |
1004 { | |
1005 gtk_toggle_button_set_active(button, cfg.use_extension_probing); | |
1006 } | |
1007 | |
1008 /* proxy */ | |
1009 static void | |
1010 on_proxy_use_realize(GtkToggleButton * button, | |
1011 gpointer data) | |
1012 { | |
1013 ConfigDb *db; | |
1014 gboolean ret; | |
1015 | |
1016 db = bmp_cfg_db_open(); | |
1017 | |
1018 if (bmp_cfg_db_get_bool(db, NULL, "use_proxy", &ret) != FALSE) | |
1019 gtk_toggle_button_set_active(button, ret); | |
1020 | |
1021 bmp_cfg_db_close(db); | |
1022 } | |
1023 | |
1024 static void | |
1025 on_proxy_use_toggled(GtkToggleButton * button, | |
1026 gpointer data) | |
1027 { | |
1028 ConfigDb *db; | |
1029 gboolean ret = gtk_toggle_button_get_active(button); | |
1030 | |
1031 db = bmp_cfg_db_open(); | |
1032 bmp_cfg_db_set_bool(db, NULL, "use_proxy", ret); | |
1033 bmp_cfg_db_close(db); | |
1034 } | |
1035 | |
1036 static void | |
1037 on_proxy_auth_realize(GtkToggleButton * button, | |
1038 gpointer data) | |
1039 { | |
1040 ConfigDb *db; | |
1041 gboolean ret; | |
1042 | |
1043 db = bmp_cfg_db_open(); | |
1044 | |
1045 if (bmp_cfg_db_get_bool(db, NULL, "proxy_use_auth", &ret) != FALSE) | |
1046 gtk_toggle_button_set_active(button, ret); | |
1047 | |
1048 bmp_cfg_db_close(db); | |
1049 } | |
1050 | |
1051 static void | |
1052 on_proxy_auth_toggled(GtkToggleButton * button, | |
1053 gpointer data) | |
1054 { | |
1055 ConfigDb *db; | |
1056 gboolean ret = gtk_toggle_button_get_active(button); | |
1057 | |
1058 db = bmp_cfg_db_open(); | |
1059 bmp_cfg_db_set_bool(db, NULL, "proxy_use_auth", ret); | |
1060 bmp_cfg_db_close(db); | |
1061 } | |
1062 | |
1063 static void | |
1064 on_proxy_host_realize(GtkEntry * entry, | |
1065 gpointer data) | |
1066 { | |
1067 ConfigDb *db; | |
1068 gchar *ret; | |
1069 | |
1070 db = bmp_cfg_db_open(); | |
1071 | |
1072 if (bmp_cfg_db_get_string(db, NULL, "proxy_host", &ret) != FALSE) | |
1073 gtk_entry_set_text(entry, ret); | |
1074 | |
1075 bmp_cfg_db_close(db); | |
1076 } | |
1077 | |
1078 static void | |
1079 on_proxy_host_changed(GtkEntry * entry, | |
1080 gpointer data) | |
1081 { | |
1082 ConfigDb *db; | |
1083 gchar *ret = g_strdup(gtk_entry_get_text(entry)); | |
1084 | |
1085 db = bmp_cfg_db_open(); | |
1086 bmp_cfg_db_set_string(db, NULL, "proxy_host", ret); | |
1087 bmp_cfg_db_close(db); | |
1088 | |
1089 g_free(ret); | |
1090 } | |
1091 | |
1092 static void | |
1093 on_proxy_port_realize(GtkEntry * entry, | |
1094 gpointer data) | |
1095 { | |
1096 ConfigDb *db; | |
1097 gchar *ret; | |
1098 | |
1099 db = bmp_cfg_db_open(); | |
1100 | |
1101 if (bmp_cfg_db_get_string(db, NULL, "proxy_port", &ret) != FALSE) | |
1102 gtk_entry_set_text(entry, ret); | |
1103 | |
1104 bmp_cfg_db_close(db); | |
1105 } | |
1106 | |
1107 static void | |
1108 on_proxy_port_changed(GtkEntry * entry, | |
1109 gpointer data) | |
1110 { | |
1111 ConfigDb *db; | |
1112 gchar *ret = g_strdup(gtk_entry_get_text(entry)); | |
1113 | |
1114 db = bmp_cfg_db_open(); | |
1115 bmp_cfg_db_set_string(db, NULL, "proxy_port", ret); | |
1116 bmp_cfg_db_close(db); | |
1117 | |
1118 g_free(ret); | |
1119 } | |
1120 | |
1121 static void | |
1122 on_proxy_user_realize(GtkEntry * entry, | |
1123 gpointer data) | |
1124 { | |
1125 ConfigDb *db; | |
1126 gchar *ret; | |
1127 | |
1128 db = bmp_cfg_db_open(); | |
1129 | |
1130 if (bmp_cfg_db_get_string(db, NULL, "proxy_user", &ret) != FALSE) | |
1131 gtk_entry_set_text(entry, ret); | |
1132 | |
1133 bmp_cfg_db_close(db); | |
1134 } | |
1135 | |
1136 static void | |
1137 on_proxy_user_changed(GtkEntry * entry, | |
1138 gpointer data) | |
1139 { | |
1140 ConfigDb *db; | |
1141 gchar *ret = g_strdup(gtk_entry_get_text(entry)); | |
1142 | |
1143 db = bmp_cfg_db_open(); | |
1144 bmp_cfg_db_set_string(db, NULL, "proxy_user", ret); | |
1145 bmp_cfg_db_close(db); | |
1146 | |
1147 g_free(ret); | |
1148 } | |
1149 | |
1150 static void | |
1151 on_proxy_pass_realize(GtkEntry * entry, | |
1152 gpointer data) | |
1153 { | |
1154 ConfigDb *db; | |
1155 gchar *ret; | |
1156 | |
1157 db = bmp_cfg_db_open(); | |
1158 | |
1159 if (bmp_cfg_db_get_string(db, NULL, "proxy_pass", &ret) != FALSE) | |
1160 gtk_entry_set_text(entry, ret); | |
1161 | |
1162 bmp_cfg_db_close(db); | |
1163 } | |
1164 | |
1165 static void | |
1166 on_proxy_pass_changed(GtkEntry * entry, | |
1167 gpointer data) | |
1168 { | |
1169 ConfigDb *db; | |
1170 gchar *ret = g_strdup(gtk_entry_get_text(entry)); | |
1171 | |
1172 db = bmp_cfg_db_open(); | |
1173 bmp_cfg_db_set_string(db, NULL, "proxy_pass", ret); | |
1174 bmp_cfg_db_close(db); | |
1175 | |
1176 g_free(ret); | |
1177 } | |
1178 | |
1179 static void | |
1180 input_plugin_enable_prefs(GtkTreeView * treeview, | |
1181 GtkButton * button) | |
1182 { | |
1183 GtkTreeSelection *selection; | |
1184 GtkTreeModel *model; | |
1185 GtkTreeIter iter; | |
1186 | |
1187 GList *plist; | |
1188 gint id; | |
1189 | |
1190 selection = gtk_tree_view_get_selection(treeview); | |
1191 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
1192 return; | |
1193 | |
1194 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
1195 | |
1196 plist = get_input_list(); | |
1197 plist = g_list_nth(plist, id); | |
1198 | |
1199 gtk_widget_set_sensitive(GTK_WIDGET(button), | |
1200 INPUT_PLUGIN(plist->data)->configure != NULL); | |
1201 } | |
1202 | |
1203 static void | |
1204 input_plugin_enable_info(GtkTreeView * treeview, | |
1205 GtkButton * button) | |
1206 { | |
1207 GtkTreeSelection *selection; | |
1208 GtkTreeModel *model; | |
1209 GtkTreeIter iter; | |
1210 GList *plist; | |
1211 gint id; | |
1212 | |
1213 selection = gtk_tree_view_get_selection(treeview); | |
1214 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
1215 return; | |
1216 | |
1217 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
1218 | |
1219 plist = get_input_list(); | |
1220 plist = g_list_nth(plist, id); | |
1221 | |
1222 gtk_widget_set_sensitive(GTK_WIDGET(button), | |
1223 INPUT_PLUGIN(plist->data)->about != NULL); | |
1224 } | |
1225 | |
1226 | |
1227 static void | |
1228 output_plugin_enable_info(GtkComboBox * cbox, GtkButton * button) | |
1229 { | |
1230 GList *plist; | |
1231 | |
1232 gint id = gtk_combo_box_get_active(cbox); | |
1233 | |
1234 plist = get_output_list(); | |
1235 plist = g_list_nth(plist, id); | |
1236 | |
1237 gtk_widget_set_sensitive(GTK_WIDGET(button), | |
1238 OUTPUT_PLUGIN(plist->data)->about != NULL); | |
1239 } | |
1240 | |
1241 static void | |
1242 output_plugin_enable_prefs(GtkComboBox * cbox, GtkButton * button) | |
1243 { | |
1244 GList *plist; | |
1245 gint id = gtk_combo_box_get_active(cbox); | |
1246 | |
1247 plist = get_output_list(); | |
1248 plist = g_list_nth(plist, id); | |
1249 | |
1250 gtk_widget_set_sensitive(GTK_WIDGET(button), | |
1251 OUTPUT_PLUGIN(plist->data)->configure != NULL); | |
1252 } | |
1253 | |
1254 | |
1255 static void | |
1256 general_plugin_enable_info(GtkTreeView * treeview, | |
1257 GtkButton * button) | |
1258 { | |
1259 GtkTreeSelection *selection; | |
1260 GtkTreeModel *model; | |
1261 GtkTreeIter iter; | |
1262 GList *plist; | |
1263 gint id; | |
1264 | |
1265 selection = gtk_tree_view_get_selection(treeview); | |
1266 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
1267 return; | |
1268 | |
1269 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
1270 | |
1271 plist = get_general_list(); | |
1272 plist = g_list_nth(plist, id); | |
1273 | |
1274 gtk_widget_set_sensitive(GTK_WIDGET(button), | |
1275 GENERAL_PLUGIN(plist->data)->about != NULL); | |
1276 } | |
1277 | |
1278 static void | |
1279 general_plugin_enable_prefs(GtkTreeView * treeview, | |
1280 GtkButton * button) | |
1281 { | |
1282 GtkTreeSelection *selection; | |
1283 GtkTreeModel *model; | |
1284 GtkTreeIter iter; | |
1285 GList *plist; | |
1286 gint id; | |
1287 | |
1288 selection = gtk_tree_view_get_selection(treeview); | |
1289 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
1290 return; | |
1291 | |
1292 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
1293 | |
1294 plist = get_general_list(); | |
1295 plist = g_list_nth(plist, id); | |
1296 | |
1297 gtk_widget_set_sensitive(GTK_WIDGET(button), | |
1298 GENERAL_PLUGIN(plist->data)->configure != NULL); | |
1299 } | |
1300 | |
1301 | |
1302 | |
1303 static void | |
1304 vis_plugin_enable_prefs(GtkTreeView * treeview, | |
1305 GtkButton * button) | |
1306 { | |
1307 GtkTreeSelection *selection; | |
1308 GtkTreeModel *model; | |
1309 GtkTreeIter iter; | |
1310 GList *plist; | |
1311 gint id; | |
1312 | |
1313 selection = gtk_tree_view_get_selection(treeview); | |
1314 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
1315 return; | |
1316 | |
1317 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
1318 | |
1319 plist = get_vis_list(); | |
1320 plist = g_list_nth(plist, id); | |
1321 | |
1322 gtk_widget_set_sensitive(GTK_WIDGET(button), | |
1323 VIS_PLUGIN(plist->data)->configure != NULL); | |
1324 } | |
1325 | |
1326 static void | |
1327 vis_plugin_enable_info(GtkTreeView * treeview, | |
1328 GtkButton * button) | |
1329 { | |
1330 GtkTreeSelection *selection; | |
1331 GtkTreeModel *model; | |
1332 GtkTreeIter iter; | |
1333 GList *plist; | |
1334 gint id; | |
1335 | |
1336 selection = gtk_tree_view_get_selection(treeview); | |
1337 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
1338 return; | |
1339 | |
1340 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
1341 | |
1342 plist = get_vis_list(); | |
1343 plist = g_list_nth(plist, id); | |
1344 | |
1345 gtk_widget_set_sensitive(GTK_WIDGET(button), | |
1346 VIS_PLUGIN(plist->data)->about != NULL); | |
1347 } | |
1348 | |
1349 static void | |
1350 vis_plugin_open_prefs(GtkTreeView * treeview, | |
1351 gpointer data) | |
1352 { | |
1353 GtkTreeSelection *selection; | |
1354 GtkTreeModel *model; | |
1355 GtkTreeIter iter; | |
1356 gint id; | |
1357 | |
1358 selection = gtk_tree_view_get_selection(treeview); | |
1359 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
1360 return; | |
1361 | |
1362 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
1363 vis_configure(id); | |
1364 } | |
1365 | |
1366 | |
1367 static void | |
1368 vis_plugin_open_info(GtkTreeView * treeview, | |
1369 gpointer data) | |
1370 { | |
1371 GtkTreeSelection *selection; | |
1372 GtkTreeModel *model; | |
1373 GtkTreeIter iter; | |
1374 gint id; | |
1375 | |
1376 selection = gtk_tree_view_get_selection(treeview); | |
1377 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
1378 return; | |
1379 | |
1380 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
1381 vis_about(id); | |
1382 } | |
1383 | |
1384 | |
1385 | |
1386 | |
1387 | |
1388 | |
1389 static void | |
1390 effect_plugin_enable_prefs(GtkTreeView * treeview, | |
1391 GtkButton * button) | |
1392 { | |
1393 GtkTreeSelection *selection; | |
1394 GtkTreeModel *model; | |
1395 GtkTreeIter iter; | |
1396 GList *plist; | |
1397 gint id; | |
1398 | |
1399 selection = gtk_tree_view_get_selection(treeview); | |
1400 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
1401 return; | |
1402 | |
1403 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
1404 | |
1405 plist = get_effect_list(); | |
1406 plist = g_list_nth(plist, id); | |
1407 | |
1408 gtk_widget_set_sensitive(GTK_WIDGET(button), | |
1409 EFFECT_PLUGIN(plist->data)->configure != NULL); | |
1410 } | |
1411 | |
1412 static void | |
1413 effect_plugin_enable_info(GtkTreeView * treeview, | |
1414 GtkButton * button) | |
1415 { | |
1416 GtkTreeSelection *selection; | |
1417 GtkTreeModel *model; | |
1418 GtkTreeIter iter; | |
1419 GList *plist; | |
1420 gint id; | |
1421 | |
1422 selection = gtk_tree_view_get_selection(treeview); | |
1423 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
1424 return; | |
1425 | |
1426 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
1427 | |
1428 plist = get_effect_list(); | |
1429 plist = g_list_nth(plist, id); | |
1430 | |
1431 gtk_widget_set_sensitive(GTK_WIDGET(button), | |
1432 EFFECT_PLUGIN(plist->data)->about != NULL); | |
1433 } | |
1434 | |
1435 static void | |
1436 effect_plugin_open_prefs(GtkTreeView * treeview, | |
1437 gpointer data) | |
1438 { | |
1439 GtkTreeSelection *selection; | |
1440 GtkTreeModel *model; | |
1441 GtkTreeIter iter; | |
1442 gint id; | |
1443 | |
1444 selection = gtk_tree_view_get_selection(treeview); | |
1445 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
1446 return; | |
1447 | |
1448 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
1449 effect_configure(id); | |
1450 } | |
1451 | |
1452 | |
1453 static void | |
1454 effect_plugin_open_info(GtkTreeView * treeview, | |
1455 gpointer data) | |
1456 { | |
1457 GtkTreeSelection *selection; | |
1458 GtkTreeModel *model; | |
1459 GtkTreeIter iter; | |
1460 gint id; | |
1461 | |
1462 selection = gtk_tree_view_get_selection(treeview); | |
1463 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
1464 return; | |
1465 | |
1466 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
1467 effect_about(id); | |
1468 } | |
1469 | |
1470 static void | |
1471 on_output_plugin_bufsize_realize(GtkSpinButton *button, | |
1472 gpointer data) | |
1473 { | |
1474 gtk_spin_button_set_value(button, cfg.output_buffer_size); | |
1475 } | |
1476 | |
1477 static void | |
1478 on_output_plugin_bufsize_value_changed(GtkSpinButton *button, | |
1479 gpointer data) | |
1480 { | |
1481 cfg.output_buffer_size = gtk_spin_button_get_value_as_int(button); | |
1482 } | |
1483 | |
1484 static void | |
1485 on_mouse_wheel_volume_realize(GtkSpinButton * button, | |
1486 gpointer data) | |
1487 { | |
1488 gtk_spin_button_set_value(button, cfg.mouse_change); | |
1489 } | |
1490 | |
1491 static void | |
1492 on_mouse_wheel_volume_changed(GtkSpinButton * button, | |
1493 gpointer data) | |
1494 { | |
1495 cfg.mouse_change = gtk_spin_button_get_value_as_int(button); | |
1496 } | |
1497 | |
1498 static void | |
1499 on_pause_between_songs_time_realize(GtkSpinButton * button, | |
1500 gpointer data) | |
1501 { | |
1502 gtk_spin_button_set_value(button, cfg.pause_between_songs_time); | |
1503 } | |
1504 | |
1505 static void | |
1506 on_pause_between_songs_time_changed(GtkSpinButton * button, | |
1507 gpointer data) | |
1508 { | |
1509 cfg.pause_between_songs_time = gtk_spin_button_get_value_as_int(button); | |
1510 } | |
1511 | |
1512 static void | |
2538
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1513 on_enable_src_realize(GtkToggleButton * button, |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1514 gpointer data) |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1515 { |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1516 #ifdef USE_SRC |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1517 ConfigDb *db; |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1518 gboolean ret; |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1519 |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1520 db = bmp_cfg_db_open(); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1521 |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1522 if (bmp_cfg_db_get_bool(db, NULL, "enable_src", &ret) != FALSE) |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1523 gtk_toggle_button_set_active(button, ret); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1524 |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1525 bmp_cfg_db_close(db); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1526 #else |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1527 gtk_toggle_button_set_active(button, FALSE); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1528 gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1529 #endif |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1530 } |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1531 |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1532 static void |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1533 on_enable_src_toggled(GtkToggleButton * button, |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1534 gpointer data) |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1535 { |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1536 ConfigDb *db; |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1537 gboolean ret = gtk_toggle_button_get_active(button); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1538 |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1539 db = bmp_cfg_db_open(); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1540 bmp_cfg_db_set_bool(db, NULL, "enable_src", ret); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1541 bmp_cfg_db_close(db); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1542 } |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1543 |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1544 static void |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1545 on_src_rate_realize(GtkSpinButton * button, |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1546 gpointer data) |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1547 { |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1548 #ifdef USE_SRC |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1549 ConfigDb *db; |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1550 gint value; |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1551 |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1552 db = bmp_cfg_db_open(); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1553 |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1554 if (bmp_cfg_db_get_int(db, NULL, "src_rate", &value) != FALSE) |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1555 gtk_spin_button_set_value(button, (gdouble)value); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1556 |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1557 bmp_cfg_db_close(db); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1558 #else |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1559 gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1560 #endif |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1561 } |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1562 |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1563 static void |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1564 on_src_rate_value_changed(GtkSpinButton * button, |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1565 gpointer data) |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1566 { |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1567 ConfigDb *db; |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1568 gint value = gtk_spin_button_get_value_as_int(button); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1569 |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1570 db = bmp_cfg_db_open(); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1571 bmp_cfg_db_set_int(db, NULL, "src_rate", value); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1572 bmp_cfg_db_close(db); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1573 } |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1574 |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1575 static void |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1576 on_src_converter_type_realize(GtkComboBox * box, |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1577 gpointer data) |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1578 { |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1579 #ifdef USE_SRC |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1580 ConfigDb *db; |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1581 gint value; |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1582 |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1583 db = bmp_cfg_db_open(); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1584 |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1585 if (bmp_cfg_db_get_int(db, NULL, "src_type", &value) != FALSE) |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1586 gtk_combo_box_set_active(box, value); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1587 else |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1588 gtk_combo_box_set_active(box, 0); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1589 |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1590 bmp_cfg_db_close(db); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1591 #else |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1592 gtk_widget_set_sensitive(GTK_WIDGET(box), FALSE); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1593 #endif |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1594 } |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1595 |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1596 static void |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1597 on_src_converter_type_changed(GtkComboBox * box, |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1598 gpointer data) |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1599 { |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1600 ConfigDb *db; |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1601 gint value = gtk_combo_box_get_active(box); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1602 |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1603 db = bmp_cfg_db_open(); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1604 bmp_cfg_db_set_int(db, NULL, "src_type", value); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1605 bmp_cfg_db_close(db); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1606 } |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1607 |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1608 static void |
2313 | 1609 on_mouse_wheel_scroll_pl_realize(GtkSpinButton * button, |
1610 gpointer data) | |
1611 { | |
1612 gtk_spin_button_set_value(button, cfg.scroll_pl_by); | |
1613 } | |
1614 | |
1615 static void | |
1616 on_mouse_wheel_scroll_pl_changed(GtkSpinButton * button, | |
1617 gpointer data) | |
1618 { | |
1619 cfg.scroll_pl_by = gtk_spin_button_get_value_as_int(button); | |
1620 } | |
1621 | |
1622 static void | |
1623 on_playlist_convert_underscore_realize(GtkToggleButton * button, | |
1624 gpointer data) | |
1625 { | |
1626 gtk_toggle_button_set_active(button, cfg.convert_underscore); | |
1627 } | |
1628 | |
1629 static void | |
1630 on_playlist_convert_underscore_toggled(GtkToggleButton * button, | |
1631 gpointer data) | |
1632 { | |
1633 cfg.convert_underscore = gtk_toggle_button_get_active(button); | |
1634 } | |
1635 | |
1636 static void | |
1637 on_playlist_no_advance_realize(GtkToggleButton * button, gpointer data) | |
1638 { | |
1639 gtk_toggle_button_set_active(button, cfg.no_playlist_advance); | |
1640 } | |
1641 | |
1642 static void | |
1643 on_playlist_no_advance_toggled(GtkToggleButton * button, gpointer data) | |
1644 { | |
1645 cfg.no_playlist_advance = gtk_toggle_button_get_active(button); | |
1646 } | |
1647 | |
1648 static void | |
1649 on_continue_playback_on_startup_realize(GtkToggleButton * button, gpointer data) | |
1650 { | |
1651 gtk_toggle_button_set_active(button, cfg.resume_playback_on_startup); | |
1652 } | |
1653 | |
1654 static void | |
1655 on_continue_playback_on_startup_toggled(GtkToggleButton * button, gpointer data) | |
1656 { | |
1657 cfg.resume_playback_on_startup = gtk_toggle_button_get_active(button); | |
1658 } | |
1659 | |
1660 static void | |
1661 on_refresh_file_list_realize(GtkToggleButton * button, gpointer data) | |
1662 { | |
1663 gtk_toggle_button_set_active(button, cfg.refresh_file_list); | |
1664 } | |
1665 | |
1666 static void | |
1667 on_refresh_file_list_toggled(GtkToggleButton * button, gpointer data) | |
1668 { | |
1669 cfg.refresh_file_list = gtk_toggle_button_get_active(button); | |
1670 } | |
1671 | |
1672 static void | |
1673 on_playlist_convert_twenty_realize(GtkToggleButton * button, gpointer data) | |
1674 { | |
1675 gtk_toggle_button_set_active(button, cfg.convert_twenty); | |
1676 } | |
1677 | |
1678 static void | |
1679 on_playlist_convert_twenty_toggled(GtkToggleButton * button, gpointer data) | |
1680 { | |
1681 cfg.convert_twenty = gtk_toggle_button_get_active(button); | |
1682 } | |
1683 | |
1684 static void | |
1685 on_playlist_convert_slash_realize(GtkToggleButton * button, gpointer data) | |
1686 { | |
1687 gtk_toggle_button_set_active(button, cfg.convert_slash); | |
1688 } | |
1689 | |
1690 static void | |
1691 on_playlist_convert_slash_toggled(GtkToggleButton * button, gpointer data) | |
1692 { | |
1693 cfg.convert_slash = gtk_toggle_button_get_active(button); | |
1694 } | |
1695 | |
1696 static void | |
1697 on_use_pl_metadata_realize(GtkToggleButton * button, | |
1698 gpointer data) | |
1699 { | |
1700 gboolean state = cfg.use_pl_metadata; | |
1701 gtk_toggle_button_set_active(button, state); | |
1702 gtk_widget_set_sensitive(GTK_WIDGET(data), state); | |
1703 } | |
1704 | |
1705 static void | |
1706 on_use_pl_metadata_toggled(GtkToggleButton * button, | |
1707 gpointer data) | |
1708 { | |
1709 gboolean state = gtk_toggle_button_get_active(button); | |
1710 cfg.use_pl_metadata = state; | |
1711 gtk_widget_set_sensitive(GTK_WIDGET(data), state); | |
1712 } | |
1713 | |
1714 static void | |
1715 on_pause_between_songs_realize(GtkToggleButton * button, | |
1716 gpointer data) | |
1717 { | |
1718 gboolean state = cfg.pause_between_songs; | |
1719 gtk_toggle_button_set_active(button, state); | |
1720 gtk_widget_set_sensitive(GTK_WIDGET(data), state); | |
1721 } | |
1722 | |
1723 static void | |
1724 on_pause_between_songs_toggled(GtkToggleButton * button, | |
1725 gpointer data) | |
1726 { | |
1727 gboolean state = gtk_toggle_button_get_active(button); | |
1728 cfg.pause_between_songs = state; | |
1729 gtk_widget_set_sensitive(GTK_WIDGET(data), state); | |
1730 } | |
1731 | |
1732 static void | |
1733 on_pl_metadata_on_load_realize(GtkRadioButton * button, | |
1734 gpointer data) | |
1735 { | |
1736 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), | |
1737 cfg.get_info_on_load); | |
1738 } | |
1739 | |
1740 static void | |
1741 on_pl_metadata_on_display_realize(GtkRadioButton * button, | |
1742 gpointer data) | |
1743 { | |
1744 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), | |
1745 cfg.get_info_on_demand); | |
1746 } | |
1747 | |
1748 static void | |
1749 on_pl_metadata_on_load_toggled(GtkRadioButton * button, | |
1750 gpointer data) | |
1751 { | |
1752 cfg.get_info_on_load = | |
1753 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)); | |
1754 } | |
1755 | |
1756 static void | |
1757 on_pl_metadata_on_display_toggled(GtkRadioButton * button, | |
1758 gpointer data) | |
1759 { | |
1760 cfg.get_info_on_demand = | |
1761 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)); | |
1762 } | |
1763 | |
1764 static void | |
1765 on_custom_cursors_realize(GtkToggleButton * button, | |
1766 gpointer data) | |
1767 { | |
1768 gtk_toggle_button_set_active(button, cfg.custom_cursors); | |
1769 } | |
1770 | |
1771 static void | |
1772 on_custom_cursors_toggled(GtkToggleButton *togglebutton, | |
1773 gpointer data) | |
1774 { | |
1775 cfg.custom_cursors = gtk_toggle_button_get_active(togglebutton); | |
1776 skin_reload_forced(); | |
1777 } | |
1778 | |
1779 static void | |
1780 on_eq_dir_preset_entry_realize(GtkEntry * entry, | |
1781 gpointer data) | |
1782 { | |
1783 gtk_entry_set_text(entry, cfg.eqpreset_default_file); | |
1784 } | |
1785 | |
1786 static void | |
1787 on_eq_dir_preset_entry_changed(GtkEntry * entry, | |
1788 gpointer data) | |
1789 { | |
1790 g_free(cfg.eqpreset_default_file); | |
1791 cfg.eqpreset_default_file = g_strdup(gtk_entry_get_text(entry)); | |
1792 } | |
1793 | |
1794 static void | |
1795 on_eq_file_preset_entry_realize(GtkEntry * entry, | |
1796 gpointer data) | |
1797 { | |
1798 gtk_entry_set_text(entry, cfg.eqpreset_extension); | |
1799 } | |
1800 | |
1801 static void | |
1802 on_eq_file_preset_entry_changed(GtkEntry * entry, gpointer data) | |
1803 { | |
1804 const gchar *text = gtk_entry_get_text(entry); | |
1805 | |
1806 while (*text == '.') | |
1807 text++; | |
1808 | |
1809 g_free(cfg.eqpreset_extension); | |
1810 cfg.eqpreset_extension = g_strdup(text); | |
1811 } | |
1812 | |
1813 | |
1814 /* FIXME: implement these */ | |
1815 | |
1816 static void | |
1817 on_eq_preset_view_realize(GtkTreeView * treeview, | |
1818 gpointer data) | |
1819 {} | |
1820 | |
1821 static void | |
1822 on_eq_preset_add_clicked(GtkButton * button, | |
1823 gpointer data) | |
1824 {} | |
1825 | |
1826 static void | |
1827 on_eq_preset_remove_clicked(GtkButton * button, | |
1828 gpointer data) | |
1829 {} | |
1830 | |
1831 static void | |
1832 on_skin_refresh_button_clicked(GtkButton * button, | |
1833 gpointer data) | |
1834 { | |
1835 GladeXML *xml; | |
1836 GtkWidget *widget, *widget2; | |
1837 | |
1838 const mode_t mode755 = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; | |
1839 | |
1840 del_directory(bmp_paths[BMP_PATH_SKIN_THUMB_DIR]); | |
1841 make_directory(bmp_paths[BMP_PATH_SKIN_THUMB_DIR], mode755); | |
1842 | |
1843 xml = prefswin_get_xml(); | |
1844 | |
1845 widget = glade_xml_get_widget(xml, "skin_view"); | |
1846 widget2 = glade_xml_get_widget(xml, "skin_refresh_button"); | |
1847 skin_view_update(GTK_TREE_VIEW(widget), GTK_WIDGET(widget2)); | |
1848 } | |
1849 | |
1850 static gboolean | |
1851 on_skin_view_realize(GtkTreeView * treeview, | |
1852 gpointer data) | |
1853 { | |
1854 GladeXML *xml; | |
1855 GtkWidget *widget; | |
1856 | |
1857 xml = prefswin_get_xml(); | |
1858 widget = glade_xml_get_widget(xml, "skin_refresh_button"); | |
1859 skin_view_realize(treeview); | |
1860 skin_view_update(treeview, GTK_WIDGET(widget)); | |
1861 | |
1862 return TRUE; | |
1863 } | |
1864 | |
1865 static void | |
1866 on_category_view_realize(GtkTreeView * treeview, | |
1867 GtkNotebook * notebook) | |
1868 { | |
1869 GtkListStore *store; | |
1870 GtkCellRenderer *renderer; | |
1871 GtkTreeViewColumn *column; | |
1872 GtkTreeSelection *selection; | |
1873 GtkTreeIter iter; | |
1874 GdkPixbuf *img; | |
1875 CategoryQueueEntry *qlist; | |
1876 gint i; | |
1877 | |
1878 column = gtk_tree_view_column_new(); | |
1879 gtk_tree_view_column_set_title(column, _("Category")); | |
1880 gtk_tree_view_append_column(treeview, column); | |
1881 gtk_tree_view_column_set_spacing(column, 2); | |
1882 | |
1883 renderer = gtk_cell_renderer_pixbuf_new(); | |
1884 gtk_tree_view_column_pack_start(column, renderer, FALSE); | |
1885 gtk_tree_view_column_set_attributes(column, renderer, "pixbuf", 0, NULL); | |
1886 | |
1887 renderer = gtk_cell_renderer_text_new(); | |
1888 gtk_tree_view_column_pack_start(column, renderer, FALSE); | |
1889 gtk_tree_view_column_set_attributes(column, renderer, "text", 1, NULL); | |
1890 | |
1891 store = gtk_list_store_new(CATEGORY_VIEW_N_COLS, | |
1892 GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_INT); | |
1893 gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(store)); | |
1894 | |
1895 for (i = 0; i < n_categories; i++) { | |
1896 img = gdk_pixbuf_new_from_file(categories[i].icon_path, NULL); | |
1897 gtk_list_store_append(store, &iter); | |
1898 gtk_list_store_set(store, &iter, | |
1899 CATEGORY_VIEW_COL_ICON, img, | |
1900 CATEGORY_VIEW_COL_NAME, | |
1901 gettext(categories[i].name), CATEGORY_VIEW_COL_ID, | |
1902 categories[i].id, -1); | |
1903 g_object_unref(img); | |
1904 } | |
1905 | |
1906 selection = gtk_tree_view_get_selection(treeview); | |
1907 | |
1908 g_signal_connect_swapped(selection, "changed", | |
1909 G_CALLBACK(change_category), notebook); | |
1910 | |
1911 /* mark the treeview widget as available to third party plugins */ | |
1912 category_treeview = GTK_WIDGET(treeview); | |
1913 | |
1914 /* prefswin_page_queue_destroy already pops the queue forward for us. */ | |
1915 for (qlist = category_queue; qlist != NULL; qlist = category_queue) | |
1916 { | |
1917 CategoryQueueEntry *ent = (CategoryQueueEntry *) qlist; | |
1918 | |
1919 prefswin_page_new(ent->container, ent->pg_name, ent->img_url); | |
1920 prefswin_page_queue_destroy(ent); | |
1921 } | |
1922 } | |
1923 | |
1924 static void | |
1925 mainwin_drag_data_received1(GtkWidget * widget, | |
1926 GdkDragContext * context, | |
1927 gint x, gint y, | |
1928 GtkSelectionData * selection_data, | |
1929 guint info, guint time, | |
1930 gpointer user_data) | |
1931 { | |
1932 gchar *path, *decoded; | |
1933 | |
1934 if (!selection_data->data) { | |
1935 g_warning("DND data string is NULL"); | |
1936 return; | |
1937 } | |
1938 | |
1939 path = (gchar *) selection_data->data; | |
1940 | |
1941 /* FIXME: use a real URL validator/parser */ | |
1942 | |
1943 if (!str_has_prefix_nocase(path, "fonts:///")) | |
1944 return; | |
1945 | |
1946 path[strlen(path) - 2] = 0; /* Why the hell a CR&LF? */ | |
1947 path += 8; | |
1948 | |
1949 /* plain, since we already stripped the first URI part */ | |
1950 decoded = xmms_urldecode_plain(path); | |
1951 | |
1952 /* Get the old font's size, and add it to the dropped | |
1953 * font's name */ | |
1954 cfg.playlist_font = g_strconcat(decoded+1, | |
1955 strrchr(cfg.playlist_font, ' '), | |
1956 NULL); | |
1957 playlist_list_set_font(cfg.playlist_font); | |
1958 playlistwin_update_list(playlist_get_active()); | |
1959 gtk_font_button_set_font_name(user_data, cfg.playlist_font); | |
1960 | |
1961 g_free(decoded); | |
1962 } | |
1963 | |
1964 static void | |
1965 on_skin_view_drag_data_received(GtkWidget * widget, | |
1966 GdkDragContext * context, | |
1967 gint x, gint y, | |
1968 GtkSelectionData * selection_data, | |
1969 guint info, guint time, | |
1970 gpointer user_data) | |
1971 { | |
1972 ConfigDb *db; | |
1973 gchar *path; | |
1974 | |
1975 GladeXML *xml; | |
1976 GtkWidget *widget2; | |
1977 | |
1978 if (!selection_data->data) { | |
1979 g_warning("DND data string is NULL"); | |
1980 return; | |
1981 } | |
1982 | |
1983 path = (gchar *) selection_data->data; | |
1984 | |
1985 /* FIXME: use a real URL validator/parser */ | |
1986 | |
1987 if (str_has_prefix_nocase(path, "file:///")) { | |
1988 path[strlen(path) - 2] = 0; /* Why the hell a CR&LF? */ | |
1989 path += 7; | |
1990 } | |
1991 else if (str_has_prefix_nocase(path, "file:")) { | |
1992 path += 5; | |
1993 } | |
1994 | |
1995 if (file_is_archive(path)) { | |
1996 bmp_active_skin_load(path); | |
1997 skin_install_skin(path); | |
1998 xml = prefswin_get_xml(); | |
1999 widget2 = glade_xml_get_widget(xml, "skin_refresh_button"); | |
2000 skin_view_update(GTK_TREE_VIEW(widget), GTK_WIDGET(widget2)); | |
2001 /* Change skin name in the config file */ | |
2002 db = bmp_cfg_db_open(); | |
2003 bmp_cfg_db_set_string(db, NULL, "skin", path); | |
2004 bmp_cfg_db_close(db); | |
2005 } | |
2006 | |
2007 } | |
2008 | |
2009 static void | |
2010 on_chardet_detector_cbox_changed(GtkComboBox * combobox, gpointer data) | |
2011 { | |
2012 ConfigDb *db; | |
2013 gint position = 0; | |
2014 | |
2015 position = gtk_combo_box_get_active(GTK_COMBO_BOX(combobox)); | |
2016 cfg.chardet_detector = (char *)chardet_detector_presets[position]; | |
2017 | |
2018 db = bmp_cfg_db_open(); | |
2019 bmp_cfg_db_set_string(db, NULL, "chardet_detector", cfg.chardet_detector); | |
2020 bmp_cfg_db_close(db); | |
2021 if (data != NULL) | |
2022 gtk_widget_set_sensitive(GTK_WIDGET(data), 1); | |
2023 } | |
2024 | |
2025 static void | |
2026 on_chardet_detector_cbox_realize(GtkComboBox *combobox, gpointer data) | |
2027 { | |
2028 ConfigDb *db; | |
2029 gchar *ret=NULL; | |
2030 guint i=0,index=0; | |
2031 | |
2032 for(i=0; i<n_chardet_detector_presets; i++) { | |
2033 gtk_combo_box_append_text(combobox, chardet_detector_presets[i]); | |
2034 } | |
2035 | |
2036 db = bmp_cfg_db_open(); | |
2037 if(bmp_cfg_db_get_string(db, NULL, "chardet_detector", &ret) != FALSE) { | |
2038 for(i=0; i<n_chardet_detector_presets; i++) { | |
2039 if(!strcmp(chardet_detector_presets[i], ret)) { | |
2040 cfg.chardet_detector = (char *)chardet_detector_presets[i]; | |
2041 index = i; | |
2042 } | |
2043 } | |
2044 } | |
2045 bmp_cfg_db_close(db); | |
2046 | |
2047 #ifdef USE_CHARDET | |
2048 gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), index); | |
2049 | |
2050 if (data != NULL) | |
2051 gtk_widget_set_sensitive(GTK_WIDGET(data), TRUE); | |
2052 | |
2053 g_signal_connect(combobox, "changed", | |
2054 G_CALLBACK(on_chardet_detector_cbox_changed), NULL); | |
2055 #else | |
2056 gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), -1); | |
2057 gtk_widget_set_sensitive(GTK_WIDGET(combobox), 0); | |
2058 #endif | |
2059 if(ret) | |
2060 g_free(ret); | |
2061 } | |
2062 | |
2063 static void | |
2064 on_chardet_fallback_realize(GtkEntry *entry, gpointer data) | |
2065 { | |
2066 ConfigDb *db; | |
2067 gchar *ret = NULL; | |
2068 | |
2069 db = bmp_cfg_db_open(); | |
2070 | |
2071 if (bmp_cfg_db_get_string(db, NULL, "chardet_fallback", &ret) != FALSE) { | |
2072 if(cfg.chardet_fallback) | |
2073 g_free(cfg.chardet_fallback); | |
2074 | |
2075 if(ret && strncasecmp(ret, "None", sizeof("None"))) { | |
2076 cfg.chardet_fallback = ret; | |
2077 } else { | |
2078 cfg.chardet_fallback = g_strdup(""); | |
2079 } | |
2080 gtk_entry_set_text(entry, cfg.chardet_fallback); | |
2081 } | |
2082 | |
2083 bmp_cfg_db_close(db); | |
2084 } | |
2085 | |
2086 static void | |
2087 on_chardet_fallback_changed(GtkEntry *entry, gpointer data) | |
2088 { | |
2089 ConfigDb *db; | |
2090 gchar *ret = NULL; | |
2091 | |
2092 if(cfg.chardet_fallback) | |
2093 g_free(cfg.chardet_fallback); | |
2094 | |
2095 ret = g_strdup(gtk_entry_get_text(entry)); | |
2096 | |
2097 if(ret == NULL) | |
2098 cfg.chardet_fallback = g_strdup(""); | |
2099 else | |
2100 cfg.chardet_fallback = ret; | |
2101 | |
2102 db = bmp_cfg_db_open(); | |
2103 | |
2104 if(cfg.chardet_fallback == NULL || !strcmp(cfg.chardet_fallback, "")) | |
2105 bmp_cfg_db_set_string(db, NULL, "chardet_fallback", "None"); | |
2106 else | |
2107 bmp_cfg_db_set_string(db, NULL, "chardet_fallback", cfg.chardet_fallback); | |
2108 | |
2109 bmp_cfg_db_close(db); | |
2110 } | |
2111 | |
2112 static void | |
2113 on_show_filepopup_for_tuple_realize(GtkToggleButton * button, gpointer data) | |
2114 { | |
2115 GladeXML *xml = prefswin_get_xml(); | |
2116 GtkWidget *settings_button = glade_xml_get_widget(xml, "filepopup_for_tuple_settings_button"); | |
2117 | |
2118 gtk_toggle_button_set_active(button, cfg.show_filepopup_for_tuple); | |
2119 filepopupbutton = (GtkWidget *)button; | |
2120 | |
2121 gtk_widget_set_sensitive(settings_button, cfg.show_filepopup_for_tuple); | |
2122 } | |
2123 | |
2124 static void | |
2125 on_show_filepopup_for_tuple_toggled(GtkToggleButton * button, gpointer data) | |
2126 { | |
2127 GladeXML *xml = prefswin_get_xml(); | |
2128 GtkWidget *settings_button = glade_xml_get_widget(xml, "filepopup_for_tuple_settings_button"); | |
2129 | |
2130 cfg.show_filepopup_for_tuple = gtk_toggle_button_get_active(button); | |
2131 | |
2132 gtk_widget_set_sensitive(settings_button, cfg.show_filepopup_for_tuple); | |
2133 } | |
2134 | |
2135 static void | |
2136 on_recurse_for_cover_toggled(GtkToggleButton *button, gpointer data) | |
2137 { | |
2138 gtk_widget_set_sensitive(GTK_WIDGET(data), | |
2139 gtk_toggle_button_get_active(button)); | |
2140 } | |
2141 | |
2142 static void | |
2143 on_colorize_button_clicked(GtkButton *button, gpointer data) | |
2144 { | |
2145 GladeXML *xml = prefswin_get_xml(); | |
2146 GtkWidget *widget; | |
2147 | |
2148 widget = glade_xml_get_widget(xml, "red_scale"); | |
2149 gtk_range_set_value(GTK_RANGE(widget), cfg.colorize_r); | |
2150 | |
2151 widget = glade_xml_get_widget(xml, "green_scale"); | |
2152 gtk_range_set_value(GTK_RANGE(widget), cfg.colorize_g); | |
2153 | |
2154 widget = glade_xml_get_widget(xml, "blue_scale"); | |
2155 gtk_range_set_value(GTK_RANGE(widget), cfg.colorize_b); | |
2156 | |
2157 gtk_widget_show(colorize_settings); | |
2158 } | |
2159 | |
2160 static void | |
2161 on_red_scale_value_changed(GtkHScale *scale, gpointer data) | |
2162 { | |
2328 | 2163 //GladeXML *xml = prefswin_get_xml(); |
2164 //GtkWidget *widget; | |
2313 | 2165 gint value; |
2166 | |
2167 value = gtk_range_get_value(GTK_RANGE(scale)); | |
2168 | |
2169 if (value != cfg.colorize_r) | |
2170 { | |
2171 cfg.colorize_r = value; | |
2172 | |
2173 /* reload the skin to apply the change */ | |
2174 skin_reload_forced(); | |
2175 draw_main_window(TRUE); | |
2176 draw_equalizer_window(TRUE); | |
2177 draw_playlist_window(TRUE); | |
2178 } | |
2179 } | |
2180 | |
2181 static void | |
2182 on_green_scale_value_changed(GtkHScale *scale, gpointer data) | |
2183 { | |
2328 | 2184 //GladeXML *xml = prefswin_get_xml(); |
2185 //GtkWidget *widget; | |
2313 | 2186 gint value; |
2187 | |
2188 value = gtk_range_get_value(GTK_RANGE(scale)); | |
2189 | |
2190 if (value != cfg.colorize_r) | |
2191 { | |
2192 cfg.colorize_g = value; | |
2193 | |
2194 /* reload the skin to apply the change */ | |
2195 skin_reload_forced(); | |
2196 draw_main_window(TRUE); | |
2197 draw_equalizer_window(TRUE); | |
2198 draw_playlist_window(TRUE); | |
2199 } | |
2200 } | |
2201 | |
2202 static void | |
2203 on_blue_scale_value_changed(GtkHScale *scale, gpointer data) | |
2204 { | |
2328 | 2205 //GladeXML *xml = prefswin_get_xml(); |
2206 //GtkWidget *widget; | |
2313 | 2207 gint value; |
2208 | |
2209 value = gtk_range_get_value(GTK_RANGE(scale)); | |
2210 | |
2211 if (value != cfg.colorize_r) | |
2212 { | |
2213 cfg.colorize_b = value; | |
2214 | |
2215 /* reload the skin to apply the change */ | |
2216 skin_reload_forced(); | |
2217 draw_main_window(TRUE); | |
2218 draw_equalizer_window(TRUE); | |
2219 draw_playlist_window(TRUE); | |
2220 } | |
2221 } | |
2222 | |
2223 static void | |
2224 on_colorize_close_clicked(GtkButton *button, gpointer data) | |
2225 { | |
2226 gtk_widget_hide(colorize_settings); | |
2227 } | |
2228 | |
2229 static void | |
2230 on_filepopup_for_tuple_settings_clicked(GtkButton *button, gpointer data) | |
2231 { | |
2232 GladeXML *xml = prefswin_get_xml(); | |
2233 GtkWidget *widget, *widget2; | |
2234 | |
2235 widget = glade_xml_get_widget(xml, "filepopup_settings_cover_name_include"); | |
2236 gtk_entry_set_text(GTK_ENTRY(widget), cfg.cover_name_include); | |
2237 | |
2238 widget = glade_xml_get_widget(xml, "filepopup_settings_cover_name_exclude"); | |
2239 gtk_entry_set_text(GTK_ENTRY(widget), cfg.cover_name_exclude); | |
2240 | |
2241 widget2 = glade_xml_get_widget(xml, "filepopup_settings_recurse_for_cover"); | |
2242 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget2), cfg.recurse_for_cover); | |
2243 | |
2244 widget = glade_xml_get_widget(xml, "filepopup_settings_recurse_for_cover_depth"); | |
2245 gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), cfg.recurse_for_cover_depth); | |
2246 | |
2247 widget = glade_xml_get_widget(xml, "filepopup_settings_recurse_for_cover_depth_box"); | |
2248 on_recurse_for_cover_toggled(GTK_TOGGLE_BUTTON(widget2), widget); | |
2249 | |
2250 widget = glade_xml_get_widget(xml, "filepopup_settings_use_file_cover"); | |
2251 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), cfg.use_file_cover); | |
2252 | |
2405 | 2253 widget = glade_xml_get_widget(xml, "filepopup_settings_showprogressbar"); |
2254 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), cfg.filepopup_showprogressbar); | |
2255 | |
2256 widget = glade_xml_get_widget(xml, "filepopup_settings_delay"); | |
2257 gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), cfg.filepopup_delay); | |
2258 | |
2313 | 2259 gtk_widget_show(filepopup_settings); |
2260 } | |
2261 | |
2262 static void | |
2263 on_filepopup_settings_ok_clicked(GtkButton *button, gpointer data) | |
2264 { | |
2265 GladeXML *xml = prefswin_get_xml(); | |
2266 GtkWidget *widget; | |
2267 | |
2268 widget = glade_xml_get_widget(xml, "filepopup_settings_cover_name_include"); | |
2269 g_free(cfg.cover_name_include); | |
2270 cfg.cover_name_include = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget))); | |
2271 | |
2272 widget = glade_xml_get_widget(xml, "filepopup_settings_cover_name_exclude"); | |
2273 g_free(cfg.cover_name_exclude); | |
2274 cfg.cover_name_exclude = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget))); | |
2275 | |
2276 widget = glade_xml_get_widget(xml, "filepopup_settings_recurse_for_cover"); | |
2277 cfg.recurse_for_cover = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); | |
2278 | |
2279 widget = glade_xml_get_widget(xml, "filepopup_settings_recurse_for_cover_depth"); | |
2280 cfg.recurse_for_cover_depth = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget)); | |
2281 | |
2282 widget = glade_xml_get_widget(xml, "filepopup_settings_use_file_cover"); | |
2283 cfg.use_file_cover = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); | |
2284 | |
2405 | 2285 widget = glade_xml_get_widget(xml, "filepopup_settings_showprogressbar"); |
2286 cfg.filepopup_showprogressbar = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); | |
2287 | |
2288 widget = glade_xml_get_widget(xml, "filepopup_settings_delay"); | |
2289 cfg.filepopup_delay = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget)); | |
2290 | |
2313 | 2291 gtk_widget_hide(filepopup_settings); |
2292 } | |
2293 | |
2294 static void | |
2295 on_filepopup_settings_cancel_clicked(GtkButton *button, gpointer data) | |
2296 { | |
2297 gtk_widget_hide(filepopup_settings); | |
2298 } | |
2299 | |
2300 static void | |
2301 on_xmms_style_fileselector_realize(GtkToggleButton * button, | |
2302 gpointer data) | |
2303 { | |
2304 gtk_toggle_button_set_active(button, cfg.use_xmms_style_fileselector); | |
2305 } | |
2306 | |
2307 static void | |
2308 on_xmms_style_fileselector_toggled(GtkToggleButton * button, | |
2309 gpointer data) | |
2310 { | |
2311 cfg.use_xmms_style_fileselector = gtk_toggle_button_get_active(button); | |
2312 } | |
2313 | |
2314 static void | |
2315 on_show_wm_decorations_realize(GtkToggleButton * button, | |
2316 gpointer data) | |
2317 { | |
2318 gtk_toggle_button_set_active(button, cfg.show_wm_decorations); | |
2319 } | |
2320 | |
2321 static void | |
2322 on_show_wm_decorations_toggled(GtkToggleButton * button, | |
2323 gpointer data) | |
2324 { | |
2325 extern GtkWidget *equalizerwin; | |
2326 cfg.show_wm_decorations = gtk_toggle_button_get_active(button); | |
2327 gtk_window_set_decorated(GTK_WINDOW(mainwin), cfg.show_wm_decorations); | |
2328 gtk_window_set_decorated(GTK_WINDOW(playlistwin), cfg.show_wm_decorations); | |
2329 gtk_window_set_decorated(GTK_WINDOW(equalizerwin), cfg.show_wm_decorations); | |
2330 | |
2331 } | |
2332 | |
2333 /* FIXME: complete the map */ | |
2334 FUNC_MAP_BEGIN(prefswin_func_map) | |
2335 FUNC_MAP_ENTRY(on_input_plugin_view_realize) | |
2336 FUNC_MAP_ENTRY(on_output_plugin_cbox_realize) | |
2337 FUNC_MAP_ENTRY(on_general_plugin_view_realize) | |
2338 FUNC_MAP_ENTRY(on_vis_plugin_view_realize) | |
2339 FUNC_MAP_ENTRY(on_effect_plugin_view_realize) | |
2340 FUNC_MAP_ENTRY(on_custom_cursors_realize) | |
2341 FUNC_MAP_ENTRY(on_custom_cursors_toggled) | |
2342 FUNC_MAP_ENTRY(on_mainwin_font_button_realize) | |
2343 FUNC_MAP_ENTRY(on_mainwin_font_button_font_set) | |
2344 FUNC_MAP_ENTRY(on_use_bitmap_fonts_realize) | |
2345 FUNC_MAP_ENTRY(on_use_bitmap_fonts_toggled) | |
2346 FUNC_MAP_ENTRY(on_mouse_wheel_volume_realize) | |
2347 FUNC_MAP_ENTRY(on_mouse_wheel_volume_changed) | |
2348 FUNC_MAP_ENTRY(on_mouse_wheel_scroll_pl_realize) | |
2349 FUNC_MAP_ENTRY(on_mouse_wheel_scroll_pl_changed) | |
2350 FUNC_MAP_ENTRY(on_pause_between_songs_time_realize) | |
2351 FUNC_MAP_ENTRY(on_pause_between_songs_time_changed) | |
2538
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
2352 FUNC_MAP_ENTRY(on_enable_src_realize) |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
2353 FUNC_MAP_ENTRY(on_enable_src_toggled) |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
2354 FUNC_MAP_ENTRY(on_src_rate_realize) |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
2355 FUNC_MAP_ENTRY(on_src_rate_value_changed) |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
2356 FUNC_MAP_ENTRY(on_src_converter_type_realize) |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
2357 FUNC_MAP_ENTRY(on_src_converter_type_changed) |
2313 | 2358 FUNC_MAP_ENTRY(on_pl_metadata_on_load_realize) |
2359 FUNC_MAP_ENTRY(on_pl_metadata_on_load_toggled) | |
2360 FUNC_MAP_ENTRY(on_pl_metadata_on_display_realize) | |
2361 FUNC_MAP_ENTRY(on_pl_metadata_on_display_toggled) | |
2362 FUNC_MAP_ENTRY(on_playlist_show_pl_numbers_realize) | |
2363 FUNC_MAP_ENTRY(on_playlist_show_pl_numbers_toggled) | |
2364 FUNC_MAP_ENTRY(on_playlist_show_pl_separator_realize) | |
2365 FUNC_MAP_ENTRY(on_playlist_show_pl_separator_toggled) | |
2366 FUNC_MAP_ENTRY(on_playlist_convert_twenty_realize) | |
2367 FUNC_MAP_ENTRY(on_playlist_convert_twenty_toggled) | |
2368 FUNC_MAP_ENTRY(on_playlist_convert_underscore_realize) | |
2369 FUNC_MAP_ENTRY(on_playlist_convert_underscore_toggled) | |
2370 FUNC_MAP_ENTRY(on_playlist_convert_slash_realize) | |
2371 FUNC_MAP_ENTRY(on_playlist_convert_slash_toggled) | |
2372 FUNC_MAP_ENTRY(on_playlist_font_button_realize) | |
2373 FUNC_MAP_ENTRY(on_playlist_font_button_font_set) | |
2374 FUNC_MAP_ENTRY(on_playlist_no_advance_realize) | |
2375 FUNC_MAP_ENTRY(on_playlist_no_advance_toggled) | |
2376 FUNC_MAP_ENTRY(on_refresh_file_list_realize) | |
2377 FUNC_MAP_ENTRY(on_refresh_file_list_toggled) | |
2378 FUNC_MAP_ENTRY(on_skin_view_realize) | |
2379 FUNC_MAP_ENTRY(on_titlestring_entry_realize) | |
2380 FUNC_MAP_ENTRY(on_titlestring_entry_changed) | |
2381 FUNC_MAP_ENTRY(on_eq_dir_preset_entry_realize) | |
2382 FUNC_MAP_ENTRY(on_eq_dir_preset_entry_changed) | |
2383 FUNC_MAP_ENTRY(on_eq_file_preset_entry_realize) | |
2384 FUNC_MAP_ENTRY(on_eq_file_preset_entry_changed) | |
2385 FUNC_MAP_ENTRY(on_eq_preset_view_realize) | |
2386 FUNC_MAP_ENTRY(on_eq_preset_add_clicked) | |
2387 FUNC_MAP_ENTRY(on_eq_preset_remove_clicked) | |
2388 FUNC_MAP_ENTRY(on_skin_refresh_button_clicked) | |
2389 FUNC_MAP_ENTRY(on_proxy_use_toggled) | |
2390 FUNC_MAP_ENTRY(on_proxy_use_realize) | |
2391 FUNC_MAP_ENTRY(on_proxy_auth_toggled) | |
2392 FUNC_MAP_ENTRY(on_proxy_auth_realize) | |
2393 FUNC_MAP_ENTRY(on_proxy_host_realize) | |
2394 FUNC_MAP_ENTRY(on_proxy_host_changed) | |
2395 FUNC_MAP_ENTRY(on_proxy_port_realize) | |
2396 FUNC_MAP_ENTRY(on_proxy_port_changed) | |
2397 FUNC_MAP_ENTRY(on_proxy_user_realize) | |
2398 FUNC_MAP_ENTRY(on_proxy_user_changed) | |
2399 FUNC_MAP_ENTRY(on_proxy_pass_realize) | |
2400 FUNC_MAP_ENTRY(on_proxy_pass_changed) | |
2401 FUNC_MAP_ENTRY(on_chardet_detector_cbox_realize) | |
2402 FUNC_MAP_ENTRY(on_chardet_detector_cbox_changed) | |
2403 FUNC_MAP_ENTRY(on_chardet_fallback_realize) | |
2404 FUNC_MAP_ENTRY(on_chardet_fallback_changed) | |
2405 FUNC_MAP_ENTRY(on_output_plugin_bufsize_realize) | |
2406 FUNC_MAP_ENTRY(on_output_plugin_bufsize_value_changed) | |
2407 FUNC_MAP_ENTRY(on_audio_format_det_cb_toggled) | |
2408 FUNC_MAP_ENTRY(on_audio_format_det_cb_realize) | |
2409 FUNC_MAP_ENTRY(on_detect_by_extension_cb_toggled) | |
2410 FUNC_MAP_ENTRY(on_detect_by_extension_cb_realize) | |
2411 FUNC_MAP_ENTRY(on_show_filepopup_for_tuple_realize) | |
2412 FUNC_MAP_ENTRY(on_show_filepopup_for_tuple_toggled) | |
2413 FUNC_MAP_ENTRY(on_filepopup_for_tuple_settings_clicked) | |
2414 FUNC_MAP_ENTRY(on_continue_playback_on_startup_realize) | |
2415 FUNC_MAP_ENTRY(on_continue_playback_on_startup_toggled) | |
2416 | |
2417 /* Filepopup settings */ | |
2418 FUNC_MAP_ENTRY(on_filepopup_settings_ok_clicked) | |
2419 FUNC_MAP_ENTRY(on_filepopup_settings_cancel_clicked) | |
2420 | |
2421 /* XMMS fileselector option -nenolod */ | |
2422 FUNC_MAP_ENTRY(on_xmms_style_fileselector_toggled) | |
2423 FUNC_MAP_ENTRY(on_xmms_style_fileselector_realize) | |
2424 | |
2425 /* show window manager decorations */ | |
2426 FUNC_MAP_ENTRY(on_show_wm_decorations_toggled) | |
2427 FUNC_MAP_ENTRY(on_show_wm_decorations_realize) | |
2428 | |
2429 /* colorize */ | |
2430 FUNC_MAP_ENTRY(on_colorize_button_clicked) | |
2431 FUNC_MAP_ENTRY(on_red_scale_value_changed) | |
2432 FUNC_MAP_ENTRY(on_green_scale_value_changed) | |
2433 FUNC_MAP_ENTRY(on_blue_scale_value_changed) | |
2434 FUNC_MAP_ENTRY(on_colorize_close_clicked) | |
2435 FUNC_MAP_END | |
2436 | |
2437 void | |
2438 create_prefs_window(void) | |
2439 { | |
2440 const gchar *glade_file = DATA_DIR "/glade/prefswin.glade"; | |
2441 | |
2442 GladeXML *xml; | |
2443 GtkWidget *widget, *widget2; | |
2467 | 2444 gchar *aud_version_string; |
2313 | 2445 |
2446 GtkWidget *titlestring_tag_menu, *menu_item; | |
2447 guint i; | |
2448 | |
2449 /* load the interface */ | |
2450 xml = glade_xml_new_or_die(_("Preferences Window"), glade_file, NULL, | |
2451 NULL); | |
2452 | |
2453 | |
2454 /* connect the signals in the interface */ | |
2455 glade_xml_signal_autoconnect_map(xml, prefswin_func_map); | |
2456 | |
2457 prefswin = glade_xml_get_widget(xml, "prefswin"); | |
2458 g_object_set_data(G_OBJECT(prefswin), "glade-xml", xml); | |
2459 /* this will hide only mainwin. it's annoying! yaz */ | |
2460 // gtk_window_set_transient_for(GTK_WINDOW(prefswin), GTK_WINDOW(mainwin)); | |
2461 | |
2462 /* create category view */ | |
2463 widget = glade_xml_get_widget(xml, "category_view"); | |
2464 widget2 = glade_xml_get_widget(xml, "category_notebook"); | |
2465 g_signal_connect_after(G_OBJECT(widget), "realize", | |
2466 G_CALLBACK(on_category_view_realize), | |
2467 widget2); | |
2468 | |
2469 category_treeview = GTK_WIDGET(widget); | |
2470 category_notebook = GTK_WIDGET(widget2); | |
2471 | |
2472 /* plugin->input page */ | |
2473 | |
2474 widget = glade_xml_get_widget(xml, "input_plugin_view"); | |
2475 widget2 = glade_xml_get_widget(xml, "input_plugin_prefs"); | |
2476 g_signal_connect(G_OBJECT(widget), "cursor-changed", | |
2477 G_CALLBACK(input_plugin_enable_prefs), | |
2478 widget2); | |
2479 | |
2480 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
2481 G_CALLBACK(input_plugin_open_prefs), | |
2482 widget); | |
2483 widget2 = glade_xml_get_widget(xml, "input_plugin_info"); | |
2484 g_signal_connect(G_OBJECT(widget), "cursor-changed", | |
2485 G_CALLBACK(input_plugin_enable_info), | |
2486 widget2); | |
2487 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
2488 G_CALLBACK(input_plugin_open_info), | |
2489 widget); | |
2490 | |
2491 /* plugin->output page */ | |
2492 | |
2493 widget = glade_xml_get_widget(xml, "output_plugin_cbox"); | |
2494 | |
2495 widget2 = glade_xml_get_widget(xml, "output_plugin_prefs"); | |
2496 g_signal_connect(G_OBJECT(widget), "changed", | |
2497 G_CALLBACK(output_plugin_enable_prefs), | |
2498 widget2); | |
2499 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
2500 G_CALLBACK(output_plugin_open_prefs), | |
2501 widget); | |
2502 | |
2503 widget2 = glade_xml_get_widget(xml, "output_plugin_info"); | |
2504 g_signal_connect(G_OBJECT(widget), "changed", | |
2505 G_CALLBACK(output_plugin_enable_info), | |
2506 widget2); | |
2507 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
2508 G_CALLBACK(output_plugin_open_info), | |
2509 widget); | |
2510 | |
2511 /* plugin->general page */ | |
2512 | |
2513 widget = glade_xml_get_widget(xml, "general_plugin_view"); | |
2514 | |
2515 widget2 = glade_xml_get_widget(xml, "general_plugin_prefs"); | |
2516 g_signal_connect(G_OBJECT(widget), "cursor-changed", | |
2517 G_CALLBACK(general_plugin_enable_prefs), | |
2518 widget2); | |
2519 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
2520 G_CALLBACK(general_plugin_open_prefs), | |
2521 widget); | |
2522 | |
2523 widget2 = glade_xml_get_widget(xml, "general_plugin_info"); | |
2524 g_signal_connect(G_OBJECT(widget), "cursor-changed", | |
2525 G_CALLBACK(general_plugin_enable_info), | |
2526 widget2); | |
2527 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
2528 G_CALLBACK(general_plugin_open_info), | |
2529 widget); | |
2530 | |
2531 | |
2532 /* plugin->vis page */ | |
2533 | |
2534 widget = glade_xml_get_widget(xml, "vis_plugin_view"); | |
2535 widget2 = glade_xml_get_widget(xml, "vis_plugin_prefs"); | |
2536 | |
2537 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
2538 G_CALLBACK(vis_plugin_open_prefs), | |
2539 widget); | |
2540 g_signal_connect(G_OBJECT(widget), "cursor-changed", | |
2541 G_CALLBACK(vis_plugin_enable_prefs), widget2); | |
2542 | |
2543 | |
2544 widget2 = glade_xml_get_widget(xml, "vis_plugin_info"); | |
2545 g_signal_connect(G_OBJECT(widget), "cursor-changed", | |
2546 G_CALLBACK(vis_plugin_enable_info), widget2); | |
2547 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
2548 G_CALLBACK(vis_plugin_open_info), | |
2549 widget); | |
2550 | |
2551 | |
2552 /* plugin->effects page */ | |
2553 | |
2554 widget = glade_xml_get_widget(xml, "effect_plugin_view"); | |
2555 widget2 = glade_xml_get_widget(xml, "effect_plugin_prefs"); | |
2556 | |
2557 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
2558 G_CALLBACK(effect_plugin_open_prefs), | |
2559 widget); | |
2560 g_signal_connect(G_OBJECT(widget), "cursor-changed", | |
2561 G_CALLBACK(effect_plugin_enable_prefs), widget2); | |
2562 | |
2563 | |
2564 widget2 = glade_xml_get_widget(xml, "effect_plugin_info"); | |
2565 g_signal_connect(G_OBJECT(widget), "cursor-changed", | |
2566 G_CALLBACK(effect_plugin_enable_info), widget2); | |
2567 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
2568 G_CALLBACK(effect_plugin_open_info), | |
2569 widget); | |
2570 | |
2571 /* playlist page */ | |
2572 | |
2573 widget = glade_xml_get_widget(xml, "pause_between_songs_box"); | |
2574 widget2 = glade_xml_get_widget(xml, "pause_between_songs"); | |
2575 g_signal_connect_after(G_OBJECT(widget2), "realize", | |
2576 G_CALLBACK(on_pause_between_songs_realize), | |
2577 widget); | |
2578 g_signal_connect(G_OBJECT(widget2), "toggled", | |
2579 G_CALLBACK(on_pause_between_songs_toggled), | |
2580 widget); | |
2581 | |
2582 widget = glade_xml_get_widget(xml, "playlist_use_metadata_box"); | |
2583 widget2 = glade_xml_get_widget(xml, "playlist_use_metadata"); | |
2584 g_signal_connect_after(G_OBJECT(widget2), "realize", | |
2585 G_CALLBACK(on_use_pl_metadata_realize), | |
2586 widget); | |
2587 g_signal_connect(G_OBJECT(widget2), "toggled", | |
2588 G_CALLBACK(on_use_pl_metadata_toggled), | |
2589 widget); | |
2590 | |
2591 widget = glade_xml_get_widget(xml, "skin_view"); | |
2592 g_signal_connect(widget, "drag-data-received", | |
2593 G_CALLBACK(on_skin_view_drag_data_received), | |
2594 NULL); | |
2595 bmp_drag_dest_set(widget); | |
2596 | |
2597 g_signal_connect(mainwin, "drag-data-received", | |
2598 G_CALLBACK(mainwin_drag_data_received), | |
2599 widget); | |
2600 | |
2601 widget = glade_xml_get_widget(xml, "skin_refresh_button"); | |
2602 g_signal_connect(widget, "clicked", | |
2603 G_CALLBACK(on_skin_refresh_button_clicked), | |
2604 NULL); | |
2605 | |
2606 widget = glade_xml_get_widget(xml, "playlist_font_button"); | |
2607 g_signal_connect(mainwin, "drag-data-received", | |
2608 G_CALLBACK(mainwin_drag_data_received1), | |
2609 widget); | |
2610 | |
2611 widget = glade_xml_get_widget(xml, "titlestring_cbox"); | |
2612 widget2 = glade_xml_get_widget(xml, "titlestring_entry"); | |
2613 g_signal_connect(widget, "realize", | |
2614 G_CALLBACK(on_titlestring_cbox_realize), | |
2615 widget2); | |
2616 g_signal_connect(widget, "changed", | |
2617 G_CALLBACK(on_titlestring_cbox_changed), | |
2618 widget2); | |
2619 | |
2620 /* FIXME: move this into a function */ | |
2621 /* create tag menu */ | |
2622 titlestring_tag_menu = gtk_menu_new(); | |
2623 for(i = 0; i < n_title_field_tags; i++) { | |
2624 menu_item = gtk_menu_item_new_with_label(_(title_field_tags[i].name)); | |
2625 gtk_menu_shell_append(GTK_MENU_SHELL(titlestring_tag_menu), menu_item); | |
2626 g_signal_connect(menu_item, "activate", | |
2627 G_CALLBACK(titlestring_tag_menu_callback), | |
2628 GINT_TO_POINTER(i)); | |
2629 }; | |
2630 gtk_widget_show_all(titlestring_tag_menu); | |
2631 | |
2632 widget = glade_xml_get_widget(xml, "titlestring_help_button"); | |
2633 widget2 = glade_xml_get_widget(xml, "titlestring_cbox"); | |
2634 | |
2635 g_signal_connect(widget2, "changed", | |
2636 G_CALLBACK(on_titlestring_cbox_changed), | |
2637 widget); | |
2638 g_signal_connect(widget, "clicked", | |
2639 G_CALLBACK(on_titlestring_help_button_clicked), | |
2640 titlestring_tag_menu); | |
2641 | |
2642 /* audacious version label */ | |
2643 widget = glade_xml_get_widget(xml, "audversionlabel"); | |
2467 | 2644 |
2468
5206f4ef02f7
[svn] - the svn_stamp is no longer an svn revision, but a serial number
nenolod
parents:
2467
diff
changeset
|
2645 aud_version_string = g_strdup_printf("<span size='small'>%s (%s) (%s@%s)</span>", |
2467 | 2646 "Audacious " PACKAGE_VERSION , |
2466 | 2647 svn_stamp , g_get_user_name() , g_get_host_name() ); |
2313 | 2648 |
2467 | 2649 gtk_label_set_markup( GTK_LABEL(widget) , aud_version_string ); |
2650 g_free(aud_version_string); | |
2313 | 2651 |
2652 /* Create window for filepopup settings */ | |
2653 filepopup_settings = glade_xml_get_widget(xml, "filepopup_for_tuple_settings"); | |
2654 gtk_window_set_transient_for(GTK_WINDOW(filepopup_settings), GTK_WINDOW(prefswin)); | |
2655 | |
2656 widget = glade_xml_get_widget(xml, "filepopup_settings_recurse_for_cover_depth_box"); | |
2657 widget2 = glade_xml_get_widget(xml, "filepopup_settings_recurse_for_cover"); | |
2658 g_signal_connect(G_OBJECT(widget2), "toggled", | |
2659 G_CALLBACK(on_recurse_for_cover_toggled), | |
2660 widget); | |
2661 | |
2662 /* Create window for filepopup settings */ | |
2663 colorize_settings = glade_xml_get_widget(xml, "colorize_popup"); | |
2664 gtk_window_set_transient_for(GTK_WINDOW(colorize_settings), GTK_WINDOW(prefswin)); | |
2665 gtk_widget_hide(colorize_settings); | |
2666 } | |
2667 | |
2668 void | |
2669 show_prefs_window(void) | |
2670 { | |
2671 gtk_widget_show(prefswin); | |
2672 } | |
2673 | |
2674 static void | |
2675 prefswin_page_queue_new(GtkWidget *container, gchar *name, gchar *imgurl) | |
2676 { | |
2677 CategoryQueueEntry *ent = g_malloc0(sizeof(CategoryQueueEntry)); | |
2678 | |
2679 ent->container = container; | |
2680 ent->pg_name = name; | |
2681 ent->img_url = imgurl; | |
2682 | |
2683 if (category_queue) | |
2684 ent->next = category_queue; | |
2685 | |
2686 category_queue = ent; | |
2687 } | |
2688 | |
2689 static void | |
2690 prefswin_page_queue_destroy(CategoryQueueEntry *ent) | |
2691 { | |
2692 category_queue = ent->next; | |
2693 g_free(ent); | |
2694 } | |
2695 | |
2696 /* | |
2697 * Public APIs for adding new pages to the prefs window. | |
2698 * | |
2699 * Basically, the concept here is that third party components can register themselves in the root | |
2700 * preferences window. | |
2701 * | |
2702 * From a usability standpoint this makes the application look more "united", instead of cluttered | |
2703 * and malorganised. Hopefully this option will be used further in the future. | |
2704 * | |
2705 * - nenolod | |
2706 */ | |
2707 gint | |
2708 prefswin_page_new(GtkWidget *container, gchar *name, gchar *imgurl) | |
2709 { | |
2710 GtkTreeModel *model; | |
2711 GtkTreeIter iter; | |
2712 GdkPixbuf *img = NULL; | |
2713 GtkTreeView *treeview = GTK_TREE_VIEW(category_treeview); | |
2714 gint id; | |
2715 | |
2716 if (treeview == NULL || category_notebook == NULL) | |
2717 { | |
2718 prefswin_page_queue_new(container, name, imgurl); | |
2719 return -1; | |
2720 } | |
2721 | |
2722 model = gtk_tree_view_get_model(treeview); | |
2723 | |
2724 if (model == NULL) | |
2725 { | |
2726 prefswin_page_queue_new(container, name, imgurl); | |
2727 return -1; | |
2728 } | |
2729 | |
2730 /* Make sure the widgets are visible. */ | |
2731 gtk_widget_show(container); | |
2732 id = gtk_notebook_append_page(GTK_NOTEBOOK(category_notebook), container, NULL); | |
2733 | |
2734 if (id == -1) | |
2735 return -1; | |
2736 | |
2737 if (imgurl != NULL) | |
2738 img = gdk_pixbuf_new_from_file(imgurl, NULL); | |
2739 | |
2740 gtk_list_store_append(GTK_LIST_STORE(model), &iter); | |
2741 gtk_list_store_set(GTK_LIST_STORE(model), &iter, | |
2742 CATEGORY_VIEW_COL_ICON, img, | |
2743 CATEGORY_VIEW_COL_NAME, | |
2744 name, CATEGORY_VIEW_COL_ID, id, -1); | |
2745 | |
2746 if (img != NULL) | |
2747 g_object_unref(img); | |
2748 | |
2749 return id; | |
2750 } | |
2751 | |
2752 void | |
2753 prefswin_page_destroy(GtkWidget *container) | |
2754 { | |
2755 GtkTreeModel *model; | |
2756 GtkTreeIter iter; | |
2757 GtkTreeView *treeview = GTK_TREE_VIEW(category_treeview); | |
2758 gboolean ret; | |
2759 gint id; | |
2760 gint index = -1; | |
2761 | |
2762 if (category_notebook == NULL || treeview == NULL || container == NULL) | |
2763 return; | |
2764 | |
2765 id = gtk_notebook_page_num(GTK_NOTEBOOK(category_notebook), container); | |
2766 | |
2767 if (id == -1) | |
2768 return; | |
2769 | |
2770 gtk_notebook_remove_page(GTK_NOTEBOOK(category_notebook), id); | |
2771 | |
2772 model = gtk_tree_view_get_model(treeview); | |
2773 | |
2774 if (model == NULL) | |
2775 return; | |
2776 | |
2777 ret = gtk_tree_model_get_iter_first(model, &iter); | |
2778 | |
2779 while (ret == TRUE) | |
2780 { | |
2781 gtk_tree_model_get(model, &iter, CATEGORY_VIEW_COL_ID, &index, -1); | |
2782 | |
2783 if (index == id) | |
2784 { | |
2785 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); | |
2786 ret = gtk_tree_model_get_iter_first(model, &iter); | |
2787 } | |
2788 | |
2789 if (index > id) | |
2790 { | |
2791 index--; | |
2792 gtk_list_store_set(GTK_LIST_STORE(model), &iter, CATEGORY_VIEW_COL_ID, index, -1); | |
2793 } | |
2794 | |
2795 ret = gtk_tree_model_iter_next(model, &iter); | |
2796 } | |
2797 } |