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