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