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