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