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