Mercurial > audlegacy
annotate audacious/prefswin.c @ 369:5d0a74c31ee6 trunk
[svn] Use file magic instead of extensions.
author | chainsaw |
---|---|
date | Sat, 31 Dec 2005 15:04:34 -0800 |
parents | 2d3d921a44e2 |
children | 5c457dac866a |
rev | line source |
---|---|
0 | 1 /* BMP - Cross-platform multimedia player |
2 * Copyright (C) 2003-2004 BMP development team. | |
3 * | |
4 * This program is free software; you can redistribute it and/or modify | |
5 * it under the terms of the GNU General Public Licensse as published by | |
6 * the Free Software Foundation; either version 2 of the License, or | |
7 * (at your option) any later version. | |
8 * | |
9 * This program is distributed in the hope that it will be useful, | |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 * GNU General Public License for more details. | |
13 * | |
14 * You should have received a copy of the GNU General Public License | |
15 * along with this program; if not, write to the Free Software | |
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
17 */ | |
18 | |
19 #ifdef HAVE_CONFIG_H | |
20 # include "config.h" | |
21 #endif | |
22 | |
23 #include <glib.h> | |
24 #include <glib/gi18n.h> | |
25 #include <gtk/gtk.h> | |
26 #include <glade/glade.h> | |
27 #include <string.h> | |
28 | |
29 #include "glade.h" | |
30 | |
31 #include "plugin.h" | |
32 #include "pluginenum.h" | |
33 #include "input.h" | |
34 #include "effect.h" | |
35 #include "general.h" | |
36 #include "output.h" | |
37 #include "visualization.h" | |
38 | |
39 #include "main.h" | |
40 #include "skin.h" | |
41 #include "urldecode.h" | |
42 #include "util.h" | |
43 #include "dnd.h" | |
44 #include "libaudacious/configdb.h" | |
45 | |
46 #include "mainwin.h" | |
47 #include "playlistwin.h" | |
48 #include "skinwin.h" | |
49 #include "playlist_list.h" | |
50 | |
51 | |
52 enum CategoryViewCols { | |
53 CATEGORY_VIEW_COL_ICON, | |
54 CATEGORY_VIEW_COL_NAME, | |
55 CATEGORY_VIEW_COL_ID, | |
56 CATEGORY_VIEW_N_COLS | |
57 }; | |
58 | |
59 enum PluginViewCols { | |
60 PLUGIN_VIEW_COL_ACTIVE, | |
61 PLUGIN_VIEW_COL_DESC, | |
62 PLUGIN_VIEW_COL_FILENAME, | |
63 PLUGIN_VIEW_COL_ID, | |
64 PLUGIN_VIEW_N_COLS | |
65 }; | |
66 | |
67 | |
68 typedef struct { | |
69 const gchar *icon_path; | |
70 const gchar *name; | |
71 gint id; | |
72 } Category; | |
73 | |
74 typedef struct { | |
75 const gchar *name; | |
76 const gchar *tag; | |
77 } | |
78 TitleFieldTag; | |
79 | |
80 static GtkWidget *prefswin = NULL; | |
81 | |
82 static Category categories[] = { | |
83 {DATA_DIR "/images/appearance.png", N_("Appearance"), 1}, | |
84 {DATA_DIR "/images/eq.png", N_("Equalizer"), 4}, | |
85 {DATA_DIR "/images/mouse.png", N_("Mouse"), 2}, | |
86 {DATA_DIR "/images/playlist.png", N_("Playlist"), 3}, | |
87 {DATA_DIR "/images/plugins.png", N_("Plugins"), 0}, | |
88 }; | |
89 | |
90 static gint n_categories = G_N_ELEMENTS(categories); | |
91 | |
92 static TitleFieldTag title_field_tags[] = { | |
93 { N_("Artist") , "%p" }, | |
94 { N_("Album") , "%a" }, | |
95 { N_("Title") , "%t" }, | |
96 { N_("Tracknumber"), "%n" }, | |
97 { N_("Genre") , "%g" }, | |
98 { N_("Filename") , "%f" }, | |
99 { N_("Filepath") , "%F" }, | |
100 { N_("Date") , "%d" }, | |
101 { N_("Year") , "%y" }, | |
102 { N_("Comment") , "%c" } | |
103 }; | |
104 | |
105 static const guint n_title_field_tags = G_N_ELEMENTS(title_field_tags); | |
106 | |
107 | |
108 static GladeXML * | |
109 prefswin_get_xml(void) | |
110 { | |
111 return GLADE_XML(g_object_get_data(G_OBJECT(prefswin), "glade-xml")); | |
112 } | |
113 | |
114 static void | |
115 change_category(GtkNotebook * notebook, | |
116 GtkTreeSelection * selection) | |
117 { | |
118 GtkTreeModel *model; | |
119 GtkTreeIter iter; | |
120 gint index; | |
121 | |
122 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
123 return; | |
124 | |
125 gtk_tree_model_get(model, &iter, CATEGORY_VIEW_COL_ID, &index, -1); | |
126 gtk_notebook_set_current_page(notebook, index); | |
127 } | |
128 | |
129 void | |
130 prefswin_set_category(gint index) | |
131 { | |
132 GladeXML *xml; | |
133 GtkWidget *notebook; | |
134 | |
135 g_return_if_fail(index >= 0 && index < n_categories); | |
136 | |
137 xml = prefswin_get_xml(); | |
138 notebook = glade_xml_get_widget(xml, "category_view"); | |
139 gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook), index); | |
140 } | |
141 | |
142 | |
143 static void | |
144 input_plugin_open_prefs(GtkTreeView * treeview, | |
145 gpointer data) | |
146 { | |
147 GtkTreeSelection *selection; | |
148 GtkTreeModel *model; | |
149 GtkTreeIter iter; | |
150 gint id; | |
151 | |
152 selection = gtk_tree_view_get_selection(treeview); | |
153 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
154 return; | |
155 | |
156 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
157 input_configure(id); | |
158 } | |
159 | |
160 static void | |
161 input_plugin_open_info(GtkTreeView * treeview, | |
162 gpointer data) | |
163 { | |
164 GtkTreeSelection *selection; | |
165 GtkTreeModel *model; | |
166 GtkTreeIter iter; | |
167 gint id; | |
168 | |
169 selection = gtk_tree_view_get_selection(treeview); | |
170 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
171 return; | |
172 | |
173 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
174 input_about(id); | |
175 } | |
176 | |
177 static void | |
178 output_plugin_open_prefs(GtkComboBox * cbox, | |
179 gpointer data) | |
180 { | |
181 output_configure(gtk_combo_box_get_active(cbox)); | |
182 } | |
183 | |
184 static void | |
185 output_plugin_open_info(GtkComboBox * cbox, | |
186 gpointer data) | |
187 { | |
188 output_about(gtk_combo_box_get_active(cbox)); | |
189 } | |
190 | |
191 static void | |
192 general_plugin_open_prefs(GtkTreeView * treeview, | |
193 gpointer data) | |
194 { | |
195 GtkTreeSelection *selection; | |
196 GtkTreeModel *model; | |
197 GtkTreeIter iter; | |
198 gint id; | |
199 | |
200 selection = gtk_tree_view_get_selection(treeview); | |
201 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
202 return; | |
203 | |
204 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
205 general_configure(id); | |
206 } | |
207 | |
208 static void | |
209 general_plugin_open_info(GtkTreeView * treeview, | |
210 gpointer data) | |
211 { | |
212 GtkTreeSelection *selection; | |
213 GtkTreeModel *model; | |
214 GtkTreeIter iter; | |
215 gint id; | |
216 | |
217 selection = gtk_tree_view_get_selection(treeview); | |
218 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
219 return; | |
220 | |
221 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
222 general_about(id); | |
223 } | |
224 | |
225 static void | |
226 input_plugin_toggle(GtkCellRendererToggle * cell, | |
227 const gchar * path_str, | |
228 gpointer data) | |
229 { | |
230 GtkTreeModel *model = GTK_TREE_MODEL(data); | |
231 GtkTreeIter iter; | |
232 GtkTreePath *path = gtk_tree_path_new_from_string(path_str); | |
233 gboolean fixed; | |
234 gint pluginnr; | |
235 gchar *filename, *basename; | |
236 /*GList *diplist, *tmplist; */ | |
237 | |
238 /* get toggled iter */ | |
239 gtk_tree_model_get_iter(model, &iter, path); | |
240 gtk_tree_model_get(model, &iter, | |
241 PLUGIN_VIEW_COL_ACTIVE, &fixed, | |
242 PLUGIN_VIEW_COL_ID, &pluginnr, | |
243 PLUGIN_VIEW_COL_FILENAME, &filename, | |
244 -1); | |
245 | |
246 basename = g_path_get_basename(filename); | |
247 g_free(filename); | |
248 | |
249 /* do something with the value */ | |
250 fixed ^= 1; | |
251 | |
252 g_hash_table_replace(plugin_matrix, basename, GINT_TO_POINTER(fixed)); | |
253 /* g_hash_table_foreach(pluginmatrix, (GHFunc) disp_matrix, NULL); */ | |
254 | |
255 /* set new value */ | |
256 gtk_list_store_set(GTK_LIST_STORE(model), &iter, | |
257 PLUGIN_VIEW_COL_ACTIVE, fixed, -1); | |
258 | |
259 /* clean up */ | |
260 gtk_tree_path_free(path); | |
261 } | |
262 | |
263 | |
264 static void | |
265 vis_plugin_toggle(GtkCellRendererToggle * cell, | |
266 const gchar * path_str, | |
267 gpointer data) | |
268 { | |
269 GtkTreeModel *model = GTK_TREE_MODEL(data); | |
270 GtkTreeIter iter; | |
271 GtkTreePath *path = gtk_tree_path_new_from_string(path_str); | |
272 gboolean fixed; | |
273 gint pluginnr; | |
274 | |
275 /* get toggled iter */ | |
276 gtk_tree_model_get_iter(model, &iter, path); | |
277 gtk_tree_model_get(model, &iter, | |
278 PLUGIN_VIEW_COL_ACTIVE, &fixed, | |
279 PLUGIN_VIEW_COL_ID, &pluginnr, -1); | |
280 | |
281 /* do something with the value */ | |
282 fixed ^= 1; | |
283 | |
284 enable_vis_plugin(pluginnr, fixed); | |
285 | |
286 /* set new value */ | |
287 gtk_list_store_set(GTK_LIST_STORE(model), &iter, | |
288 PLUGIN_VIEW_COL_ACTIVE, fixed, -1); | |
289 | |
290 /* clean up */ | |
291 gtk_tree_path_free(path); | |
292 } | |
293 | |
294 static void | |
295 effect_plugin_toggle(GtkCellRendererToggle * cell, | |
296 const gchar * path_str, | |
297 gpointer data) | |
298 { | |
299 GtkTreeModel *model = GTK_TREE_MODEL(data); | |
300 GtkTreeIter iter; | |
301 GtkTreePath *path = gtk_tree_path_new_from_string(path_str); | |
302 gboolean fixed; | |
303 gint pluginnr; | |
304 | |
305 /* get toggled iter */ | |
306 gtk_tree_model_get_iter(model, &iter, path); | |
307 gtk_tree_model_get(model, &iter, | |
308 PLUGIN_VIEW_COL_ACTIVE, &fixed, | |
309 PLUGIN_VIEW_COL_ID, &pluginnr, -1); | |
310 | |
311 /* do something with the value */ | |
312 fixed ^= 1; | |
313 | |
314 enable_effect_plugin(pluginnr, fixed); | |
315 | |
316 /* set new value */ | |
317 gtk_list_store_set(GTK_LIST_STORE(model), &iter, | |
318 PLUGIN_VIEW_COL_ACTIVE, fixed, -1); | |
319 | |
320 /* clean up */ | |
321 gtk_tree_path_free(path); | |
322 } | |
323 static void | |
324 general_plugin_toggle(GtkCellRendererToggle * cell, | |
325 const gchar * path_str, | |
326 gpointer data) | |
327 { | |
328 GtkTreeModel *model = GTK_TREE_MODEL(data); | |
329 GtkTreeIter iter; | |
330 GtkTreePath *path = gtk_tree_path_new_from_string(path_str); | |
331 gboolean fixed; | |
332 gint pluginnr; | |
333 | |
334 /* get toggled iter */ | |
335 gtk_tree_model_get_iter(model, &iter, path); | |
336 gtk_tree_model_get(model, &iter, | |
337 PLUGIN_VIEW_COL_ACTIVE, &fixed, | |
338 PLUGIN_VIEW_COL_ID, &pluginnr, -1); | |
339 | |
340 /* do something with the value */ | |
341 fixed ^= 1; | |
342 | |
343 enable_general_plugin(pluginnr, fixed); | |
344 | |
345 /* set new value */ | |
346 gtk_list_store_set(GTK_LIST_STORE(model), &iter, | |
347 PLUGIN_VIEW_COL_ACTIVE, fixed, -1); | |
348 | |
349 /* clean up */ | |
350 gtk_tree_path_free(path); | |
351 } | |
352 | |
353 static void | |
354 on_output_plugin_cbox_changed(GtkComboBox * combobox, | |
355 gpointer data) | |
356 { | |
357 gint selected; | |
358 selected = gtk_combo_box_get_active(combobox); | |
359 | |
360 /* Force playback to stop. There is NO way to change the output | |
361 plugin in the middle of a playback, and NO way to know when the | |
362 user closes the output plugin settings dialog. */ | |
363 mainwin_stop_pushed(); | |
364 set_current_output_plugin(selected); | |
365 } | |
366 | |
367 static void | |
368 on_output_plugin_cbox_realize(GtkComboBox * cbox, | |
369 gpointer data) | |
370 { | |
371 GList *olist = get_output_list(); | |
372 OutputPlugin *op, *cp = get_current_output_plugin(); | |
373 gint i = 0, selected = 0; | |
374 | |
375 if (!olist) { | |
376 gtk_widget_set_sensitive(GTK_WIDGET(cbox), FALSE); | |
377 return; | |
378 } | |
379 | |
380 for (i = 0; olist; i++, olist = g_list_next(olist)) { | |
381 op = OUTPUT_PLUGIN(olist->data); | |
382 | |
383 if (olist->data == cp) | |
384 selected = i; | |
385 | |
386 gtk_combo_box_append_text(cbox, op->description); | |
387 } | |
388 | |
389 gtk_combo_box_set_active(cbox, selected); | |
390 g_signal_connect(cbox, "changed", | |
391 G_CALLBACK(on_output_plugin_cbox_changed), NULL); | |
392 } | |
393 | |
394 | |
395 static void | |
396 on_input_plugin_view_realize(GtkTreeView * treeview, | |
397 gpointer data) | |
398 { | |
399 GtkListStore *store; | |
400 GtkTreeIter iter; | |
401 | |
402 GtkCellRenderer *renderer; | |
403 GtkTreeViewColumn *column; | |
404 | |
405 GList *ilist; | |
406 gchar *description[2]; | |
407 InputPlugin *ip; | |
408 gint id = 0; | |
409 | |
410 gboolean enabled; | |
411 | |
412 store = gtk_list_store_new(PLUGIN_VIEW_N_COLS, | |
413 G_TYPE_BOOLEAN, G_TYPE_STRING, | |
414 G_TYPE_STRING, G_TYPE_INT); | |
415 | |
416 column = gtk_tree_view_column_new(); | |
417 gtk_tree_view_column_set_title(column, _("Enabled")); | |
418 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED); | |
419 gtk_tree_view_column_set_spacing(column, 4); | |
420 gtk_tree_view_column_set_resizable(column, FALSE); | |
421 gtk_tree_view_column_set_fixed_width(column, 50); | |
422 | |
423 renderer = gtk_cell_renderer_toggle_new(); | |
424 g_signal_connect(renderer, "toggled", | |
425 G_CALLBACK(input_plugin_toggle), store); | |
426 gtk_tree_view_column_pack_start(column, renderer, TRUE); | |
427 gtk_tree_view_column_set_attributes(column, renderer, "active", | |
428 PLUGIN_VIEW_COL_ACTIVE, NULL); | |
429 | |
430 gtk_tree_view_append_column(treeview, column); | |
431 | |
432 column = gtk_tree_view_column_new(); | |
433 gtk_tree_view_column_set_title(column, _("Description")); | |
434 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); | |
435 gtk_tree_view_column_set_spacing(column, 4); | |
436 gtk_tree_view_column_set_resizable(column, TRUE); | |
437 | |
438 | |
439 renderer = gtk_cell_renderer_text_new(); | |
440 gtk_tree_view_column_pack_start(column, renderer, FALSE); | |
441 gtk_tree_view_column_set_attributes(column, renderer, | |
442 "text", PLUGIN_VIEW_COL_DESC, NULL); | |
443 gtk_tree_view_append_column(treeview, column); | |
444 | |
445 column = gtk_tree_view_column_new(); | |
446 | |
447 gtk_tree_view_column_set_title(column, _("Filename")); | |
448 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); | |
449 gtk_tree_view_column_set_spacing(column, 4); | |
450 gtk_tree_view_column_set_resizable(column, TRUE); | |
451 | |
452 renderer = gtk_cell_renderer_text_new(); | |
453 gtk_tree_view_column_pack_start(column, renderer, TRUE); | |
454 gtk_tree_view_column_set_attributes(column, renderer, "text", | |
455 PLUGIN_VIEW_COL_FILENAME, NULL); | |
456 | |
457 gtk_tree_view_append_column(treeview, column); | |
458 | |
459 for (ilist = get_input_list(); ilist; ilist = g_list_next(ilist)) { | |
460 ip = INPUT_PLUGIN(ilist->data); | |
461 | |
462 description[0] = g_strdup(ip->description); | |
463 description[1] = g_strdup(ip->filename); | |
464 | |
465 enabled = input_is_enabled(description[1]); | |
466 | |
467 gtk_list_store_append(store, &iter); | |
468 gtk_list_store_set(store, &iter, | |
469 PLUGIN_VIEW_COL_ACTIVE, enabled, | |
470 PLUGIN_VIEW_COL_DESC, description[0], | |
471 PLUGIN_VIEW_COL_FILENAME, description[1], | |
472 PLUGIN_VIEW_COL_ID, id++, -1); | |
473 | |
474 g_free(description[1]); | |
475 g_free(description[0]); | |
476 } | |
477 | |
478 gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(store)); | |
479 } | |
480 | |
481 | |
482 static void | |
483 on_general_plugin_view_realize(GtkTreeView * treeview, | |
484 gpointer data) | |
485 { | |
486 GtkListStore *store; | |
487 GtkTreeIter iter; | |
488 | |
489 GtkCellRenderer *renderer; | |
490 GtkTreeViewColumn *column; | |
491 | |
492 GList *ilist /*, *diplist */ ; | |
493 gchar *description[2]; | |
494 GeneralPlugin *gp; | |
495 gint id = 0; | |
496 | |
497 gboolean enabled; | |
498 | |
499 store = gtk_list_store_new(PLUGIN_VIEW_N_COLS, | |
500 G_TYPE_BOOLEAN, G_TYPE_STRING, | |
501 G_TYPE_STRING, G_TYPE_INT); | |
502 | |
503 column = gtk_tree_view_column_new(); | |
504 gtk_tree_view_column_set_title(column, _("Enabled")); | |
505 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED); | |
506 gtk_tree_view_column_set_spacing(column, 4); | |
507 gtk_tree_view_column_set_resizable(column, FALSE); | |
508 gtk_tree_view_column_set_fixed_width(column, 50); | |
509 | |
510 renderer = gtk_cell_renderer_toggle_new(); | |
511 g_signal_connect(renderer, "toggled", | |
512 G_CALLBACK(general_plugin_toggle), store); | |
513 gtk_tree_view_column_pack_start(column, renderer, TRUE); | |
514 gtk_tree_view_column_set_attributes(column, renderer, "active", | |
515 PLUGIN_VIEW_COL_ACTIVE, NULL); | |
516 | |
517 gtk_tree_view_append_column(treeview, column); | |
518 | |
519 column = gtk_tree_view_column_new(); | |
520 gtk_tree_view_column_set_title(column, _("Description")); | |
521 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); | |
522 gtk_tree_view_column_set_spacing(column, 4); | |
523 gtk_tree_view_column_set_resizable(column, TRUE); | |
524 | |
525 | |
526 renderer = gtk_cell_renderer_text_new(); | |
527 gtk_tree_view_column_pack_start(column, renderer, FALSE); | |
528 gtk_tree_view_column_set_attributes(column, renderer, | |
529 "text", PLUGIN_VIEW_COL_DESC, NULL); | |
530 | |
531 gtk_tree_view_append_column(treeview, column); | |
532 | |
533 | |
534 column = gtk_tree_view_column_new(); | |
535 gtk_tree_view_column_set_title(column, _("Filename")); | |
536 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); | |
537 gtk_tree_view_column_set_spacing(column, 4); | |
538 gtk_tree_view_column_set_resizable(column, TRUE); | |
539 | |
540 renderer = gtk_cell_renderer_text_new(); | |
541 gtk_tree_view_column_pack_start(column, renderer, TRUE); | |
542 gtk_tree_view_column_set_attributes(column, renderer, "text", | |
543 PLUGIN_VIEW_COL_FILENAME, NULL); | |
544 | |
545 gtk_tree_view_append_column(treeview, column); | |
546 | |
547 for (ilist = get_general_list(); ilist; ilist = g_list_next(ilist)) { | |
548 gp = GENERAL_PLUGIN(ilist->data); | |
549 | |
550 description[0] = g_strdup(gp->description); | |
551 description[1] = g_strdup(gp->filename); | |
552 | |
553 enabled = general_enabled(id); | |
554 | |
555 gtk_list_store_append(store, &iter); | |
556 gtk_list_store_set(store, &iter, | |
557 PLUGIN_VIEW_COL_ACTIVE, enabled, | |
558 PLUGIN_VIEW_COL_DESC, description[0], | |
559 PLUGIN_VIEW_COL_FILENAME, description[1], | |
560 PLUGIN_VIEW_COL_ID, id++, -1); | |
561 | |
562 g_free(description[1]); | |
563 g_free(description[0]); | |
564 } | |
565 | |
566 gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(store)); | |
567 } | |
568 | |
569 | |
570 static void | |
571 on_vis_plugin_view_realize(GtkTreeView * treeview, | |
572 gpointer data) | |
573 { | |
574 GtkListStore *store; | |
575 GtkTreeIter iter; | |
576 | |
577 GtkCellRenderer *renderer; | |
578 GtkTreeViewColumn *column; | |
579 | |
580 GList *vlist; | |
581 gchar *description[2]; | |
582 VisPlugin *vp; | |
583 gint id = 0; | |
584 | |
585 gboolean enabled; | |
586 | |
587 | |
588 store = gtk_list_store_new(PLUGIN_VIEW_N_COLS, | |
589 G_TYPE_BOOLEAN, G_TYPE_STRING, | |
590 G_TYPE_STRING, G_TYPE_INT); | |
591 | |
592 column = gtk_tree_view_column_new(); | |
593 gtk_tree_view_column_set_title(column, _("Enabled")); | |
594 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED); | |
595 gtk_tree_view_column_set_spacing(column, 4); | |
596 gtk_tree_view_column_set_resizable(column, FALSE); | |
597 gtk_tree_view_column_set_fixed_width(column, 50); | |
598 | |
599 renderer = gtk_cell_renderer_toggle_new(); | |
600 g_signal_connect(renderer, "toggled", | |
601 G_CALLBACK(vis_plugin_toggle), store); | |
602 gtk_tree_view_column_pack_start(column, renderer, TRUE); | |
603 gtk_tree_view_column_set_attributes(column, renderer, "active", | |
604 PLUGIN_VIEW_COL_ACTIVE, NULL); | |
605 | |
606 gtk_tree_view_append_column(treeview, column); | |
607 | |
608 column = gtk_tree_view_column_new(); | |
609 gtk_tree_view_column_set_title(column, _("Description")); | |
610 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); | |
611 gtk_tree_view_column_set_spacing(column, 4); | |
612 gtk_tree_view_column_set_resizable(column, TRUE); | |
613 | |
614 | |
615 renderer = gtk_cell_renderer_text_new(); | |
616 gtk_tree_view_column_pack_start(column, renderer, FALSE); | |
617 gtk_tree_view_column_set_attributes(column, renderer, | |
618 "text", PLUGIN_VIEW_COL_DESC, NULL); | |
619 | |
620 gtk_tree_view_append_column(treeview, column); | |
621 | |
622 | |
623 column = gtk_tree_view_column_new(); | |
624 gtk_tree_view_column_set_title(column, _("Filename")); | |
625 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); | |
626 gtk_tree_view_column_set_spacing(column, 4); | |
627 gtk_tree_view_column_set_resizable(column, TRUE); | |
628 | |
629 renderer = gtk_cell_renderer_text_new(); | |
630 gtk_tree_view_column_pack_start(column, renderer, TRUE); | |
631 gtk_tree_view_column_set_attributes(column, renderer, "text", | |
632 PLUGIN_VIEW_COL_FILENAME, NULL); | |
633 | |
634 gtk_tree_view_append_column(treeview, column); | |
635 | |
636 for (vlist = get_vis_list(); vlist; vlist = g_list_next(vlist)) { | |
637 vp = VIS_PLUGIN(vlist->data); | |
638 | |
639 description[0] = g_strdup(vp->description); | |
640 description[1] = g_strdup(vp->filename); | |
641 | |
642 enabled = vis_enabled(id); | |
643 | |
644 gtk_list_store_append(store, &iter); | |
645 gtk_list_store_set(store, &iter, | |
646 PLUGIN_VIEW_COL_ACTIVE, enabled, | |
647 PLUGIN_VIEW_COL_DESC, description[0], | |
648 PLUGIN_VIEW_COL_FILENAME, description[1], | |
649 PLUGIN_VIEW_COL_ID, id++, -1); | |
650 | |
651 g_free(description[1]); | |
652 g_free(description[0]); | |
653 } | |
654 | |
655 gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(store)); | |
656 } | |
657 | |
658 static void | |
659 editable_insert_text(GtkEditable * editable, | |
660 const gchar * text, | |
661 gint * pos) | |
662 { | |
663 gtk_editable_insert_text(editable, text, strlen(text), pos); | |
664 } | |
665 | |
666 | |
667 static void | |
668 on_effect_plugin_view_realize(GtkTreeView * treeview, | |
669 gpointer data) | |
670 { | |
671 GtkListStore *store; | |
672 GtkTreeIter iter; | |
673 | |
674 GtkCellRenderer *renderer; | |
675 GtkTreeViewColumn *column; | |
676 | |
677 GList *elist; | |
678 gchar *description[2]; | |
679 gint id = 0; | |
680 | |
681 gboolean enabled; | |
682 | |
683 | |
684 store = gtk_list_store_new(PLUGIN_VIEW_N_COLS, | |
685 G_TYPE_BOOLEAN, G_TYPE_STRING, | |
686 G_TYPE_STRING, G_TYPE_INT); | |
687 | |
688 column = gtk_tree_view_column_new(); | |
689 gtk_tree_view_column_set_title(column, _("Enabled")); | |
690 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED); | |
691 gtk_tree_view_column_set_spacing(column, 4); | |
692 gtk_tree_view_column_set_resizable(column, FALSE); | |
693 gtk_tree_view_column_set_fixed_width(column, 50); | |
694 | |
695 renderer = gtk_cell_renderer_toggle_new(); | |
696 g_signal_connect(renderer, "toggled", | |
697 G_CALLBACK(effect_plugin_toggle), store); | |
698 gtk_tree_view_column_pack_start(column, renderer, TRUE); | |
699 gtk_tree_view_column_set_attributes(column, renderer, "active", | |
700 PLUGIN_VIEW_COL_ACTIVE, NULL); | |
701 | |
702 gtk_tree_view_append_column(treeview, column); | |
703 | |
704 column = gtk_tree_view_column_new(); | |
705 gtk_tree_view_column_set_title(column, _("Description")); | |
706 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); | |
707 gtk_tree_view_column_set_spacing(column, 4); | |
708 gtk_tree_view_column_set_resizable(column, TRUE); | |
709 | |
710 | |
711 renderer = gtk_cell_renderer_text_new(); | |
712 gtk_tree_view_column_pack_start(column, renderer, FALSE); | |
713 gtk_tree_view_column_set_attributes(column, renderer, | |
714 "text", PLUGIN_VIEW_COL_DESC, NULL); | |
715 | |
716 gtk_tree_view_append_column(treeview, column); | |
717 | |
718 | |
719 column = gtk_tree_view_column_new(); | |
720 gtk_tree_view_column_set_title(column, _("Filename")); | |
721 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); | |
722 gtk_tree_view_column_set_spacing(column, 4); | |
723 gtk_tree_view_column_set_resizable(column, TRUE); | |
724 | |
725 renderer = gtk_cell_renderer_text_new(); | |
726 gtk_tree_view_column_pack_start(column, renderer, TRUE); | |
727 gtk_tree_view_column_set_attributes(column, renderer, "text", | |
728 PLUGIN_VIEW_COL_FILENAME, NULL); | |
729 | |
730 gtk_tree_view_append_column(treeview, column); | |
731 | |
732 for (elist = get_effect_list(); elist; elist = g_list_next(elist)) { | |
733 EffectPlugin *ep = EFFECT_PLUGIN(elist->data); | |
734 | |
735 description[0] = g_strdup(ep->description); | |
736 description[1] = g_strdup(ep->filename); | |
737 | |
738 enabled = effect_enabled(id); | |
739 | |
740 gtk_list_store_append(store, &iter); | |
741 gtk_list_store_set(store, &iter, | |
742 PLUGIN_VIEW_COL_ACTIVE, enabled, | |
743 PLUGIN_VIEW_COL_DESC, description[0], | |
744 PLUGIN_VIEW_COL_FILENAME, description[1], | |
745 PLUGIN_VIEW_COL_ID, id++, -1); | |
746 | |
747 g_free(description[1]); | |
748 g_free(description[0]); | |
749 } | |
750 | |
751 gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(store)); | |
752 } | |
753 | |
754 static void | |
755 titlestring_tag_menu_callback(GtkMenuItem * menuitem, | |
756 gpointer data) | |
757 { | |
758 const gchar *separator = " - "; | |
759 GladeXML *xml; | |
760 GtkWidget *entry; | |
761 gint item = GPOINTER_TO_INT(data); | |
762 gint pos; | |
763 | |
764 xml = prefswin_get_xml(); | |
765 entry = glade_xml_get_widget(xml, "titlestring_entry"); | |
766 | |
767 pos = gtk_editable_get_position(GTK_EDITABLE(entry)); | |
768 | |
769 /* insert separator as needed */ | |
770 if (g_utf8_strlen(gtk_entry_get_text(GTK_ENTRY(entry)), -1) > 0) | |
771 editable_insert_text(GTK_EDITABLE(entry), separator, &pos); | |
772 | |
773 editable_insert_text(GTK_EDITABLE(entry), _(title_field_tags[item].tag), | |
774 &pos); | |
775 | |
776 gtk_editable_set_position(GTK_EDITABLE(entry), pos); | |
777 } | |
778 | |
779 static void | |
780 on_titlestring_help_button_clicked(GtkButton * button, | |
781 gpointer data) | |
782 { | |
783 | |
784 GtkMenu *menu; | |
785 MenuPos *pos = g_new0(MenuPos, 1); | |
786 GdkWindow *parent; | |
787 | |
788 gint x_ro, y_ro; | |
789 gint x_widget, y_widget; | |
790 gint x_size, y_size; | |
791 | |
792 g_return_if_fail (button != NULL); | |
793 g_return_if_fail (GTK_IS_MENU (data)); | |
794 | |
795 parent = gtk_widget_get_parent_window(GTK_WIDGET(button)); | |
796 | |
797 gdk_drawable_get_size(parent, &x_size, &y_size); | |
798 gdk_window_get_root_origin(GTK_WIDGET(button)->window, &x_ro, &y_ro); | |
799 gdk_window_get_position(GTK_WIDGET(button)->window, &x_widget, &y_widget); | |
800 | |
801 pos->x = x_size + x_ro; | |
802 pos->y = y_size + y_ro - 100; | |
803 | |
804 menu = GTK_MENU(data); | |
805 gtk_menu_popup (menu, NULL, NULL, util_menu_position, pos, | |
806 0, GDK_CURRENT_TIME); | |
807 } | |
808 | |
809 | |
810 static void | |
811 on_titlestring_entry_realize(GtkWidget * entry, | |
812 gpointer data) | |
813 { | |
814 gtk_entry_set_text(GTK_ENTRY(entry), cfg.gentitle_format); | |
815 } | |
816 | |
817 static void | |
818 on_titlestring_entry_changed(GtkWidget * entry, | |
819 gpointer data) | |
820 { | |
821 g_free(cfg.gentitle_format); | |
822 cfg.gentitle_format = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry))); | |
823 } | |
824 | |
825 static void | |
826 on_titlestring_cbox_realize(GtkWidget * cbox, | |
827 gpointer data) | |
828 { | |
829 gtk_combo_box_set_active(GTK_COMBO_BOX(cbox), cfg.titlestring_preset); | |
830 gtk_widget_set_sensitive(GTK_WIDGET(data), | |
831 (cfg.titlestring_preset == n_titlestring_presets)); | |
832 } | |
833 | |
834 static void | |
835 on_titlestring_cbox_changed(GtkWidget * cbox, | |
836 gpointer data) | |
837 { | |
838 gint position = gtk_combo_box_get_active(GTK_COMBO_BOX(cbox)); | |
839 | |
840 cfg.titlestring_preset = position; | |
841 gtk_widget_set_sensitive(GTK_WIDGET(data), (position == 4)); | |
842 } | |
843 | |
844 static void | |
845 on_mainwin_font_button_font_set(GtkFontButton * button, | |
846 gpointer data) | |
847 { | |
848 g_free(cfg.mainwin_font); | |
849 cfg.mainwin_font = g_strdup(gtk_font_button_get_font_name(button)); | |
850 | |
124
428d3865de3c
[svn] More bitmap-font related stuff, working on a scrolling implementation too. (You can now enable or disable bitmap font support in Preferences.)
nenolod
parents:
0
diff
changeset
|
851 textbox_set_xfont(mainwin_info, cfg.mainwin_use_xfont, cfg.mainwin_font); |
428d3865de3c
[svn] More bitmap-font related stuff, working on a scrolling implementation too. (You can now enable or disable bitmap font support in Preferences.)
nenolod
parents:
0
diff
changeset
|
852 mainwin_set_info_text(); |
428d3865de3c
[svn] More bitmap-font related stuff, working on a scrolling implementation too. (You can now enable or disable bitmap font support in Preferences.)
nenolod
parents:
0
diff
changeset
|
853 draw_main_window(TRUE); |
428d3865de3c
[svn] More bitmap-font related stuff, working on a scrolling implementation too. (You can now enable or disable bitmap font support in Preferences.)
nenolod
parents:
0
diff
changeset
|
854 } |
428d3865de3c
[svn] More bitmap-font related stuff, working on a scrolling implementation too. (You can now enable or disable bitmap font support in Preferences.)
nenolod
parents:
0
diff
changeset
|
855 |
428d3865de3c
[svn] More bitmap-font related stuff, working on a scrolling implementation too. (You can now enable or disable bitmap font support in Preferences.)
nenolod
parents:
0
diff
changeset
|
856 static void |
428d3865de3c
[svn] More bitmap-font related stuff, working on a scrolling implementation too. (You can now enable or disable bitmap font support in Preferences.)
nenolod
parents:
0
diff
changeset
|
857 on_use_bitmap_fonts_realize(GtkToggleButton * button, |
428d3865de3c
[svn] More bitmap-font related stuff, working on a scrolling implementation too. (You can now enable or disable bitmap font support in Preferences.)
nenolod
parents:
0
diff
changeset
|
858 gpointer data) |
428d3865de3c
[svn] More bitmap-font related stuff, working on a scrolling implementation too. (You can now enable or disable bitmap font support in Preferences.)
nenolod
parents:
0
diff
changeset
|
859 { |
126
2d3d921a44e2
[svn] Fix realize function for the bitmap fonts option.
nenolod
parents:
124
diff
changeset
|
860 gtk_toggle_button_set_active(button, |
2d3d921a44e2
[svn] Fix realize function for the bitmap fonts option.
nenolod
parents:
124
diff
changeset
|
861 cfg.mainwin_use_xfont != FALSE ? FALSE : TRUE); |
124
428d3865de3c
[svn] More bitmap-font related stuff, working on a scrolling implementation too. (You can now enable or disable bitmap font support in Preferences.)
nenolod
parents:
0
diff
changeset
|
862 } |
428d3865de3c
[svn] More bitmap-font related stuff, working on a scrolling implementation too. (You can now enable or disable bitmap font support in Preferences.)
nenolod
parents:
0
diff
changeset
|
863 |
428d3865de3c
[svn] More bitmap-font related stuff, working on a scrolling implementation too. (You can now enable or disable bitmap font support in Preferences.)
nenolod
parents:
0
diff
changeset
|
864 static void |
428d3865de3c
[svn] More bitmap-font related stuff, working on a scrolling implementation too. (You can now enable or disable bitmap font support in Preferences.)
nenolod
parents:
0
diff
changeset
|
865 on_use_bitmap_fonts_toggled(GtkToggleButton * button, |
428d3865de3c
[svn] More bitmap-font related stuff, working on a scrolling implementation too. (You can now enable or disable bitmap font support in Preferences.)
nenolod
parents:
0
diff
changeset
|
866 gpointer data) |
428d3865de3c
[svn] More bitmap-font related stuff, working on a scrolling implementation too. (You can now enable or disable bitmap font support in Preferences.)
nenolod
parents:
0
diff
changeset
|
867 { |
428d3865de3c
[svn] More bitmap-font related stuff, working on a scrolling implementation too. (You can now enable or disable bitmap font support in Preferences.)
nenolod
parents:
0
diff
changeset
|
868 gboolean useit = gtk_toggle_button_get_active(button); |
428d3865de3c
[svn] More bitmap-font related stuff, working on a scrolling implementation too. (You can now enable or disable bitmap font support in Preferences.)
nenolod
parents:
0
diff
changeset
|
869 cfg.mainwin_use_xfont = useit != FALSE ? FALSE : TRUE; |
428d3865de3c
[svn] More bitmap-font related stuff, working on a scrolling implementation too. (You can now enable or disable bitmap font support in Preferences.)
nenolod
parents:
0
diff
changeset
|
870 textbox_set_xfont(mainwin_info, cfg.mainwin_use_xfont, cfg.mainwin_font); |
0 | 871 mainwin_set_info_text(); |
872 draw_main_window(TRUE); | |
873 } | |
874 | |
875 static void | |
876 on_mainwin_font_button_realize(GtkFontButton * button, | |
877 gpointer data) | |
878 { | |
879 gtk_font_button_set_font_name(button, cfg.mainwin_font); | |
880 } | |
881 | |
882 static void | |
883 on_playlist_font_button_font_set(GtkFontButton * button, | |
884 gpointer data) | |
885 { | |
886 g_free(cfg.playlist_font); | |
887 cfg.playlist_font = g_strdup(gtk_font_button_get_font_name(button)); | |
888 | |
889 playlist_list_set_font(cfg.playlist_font); | |
890 playlistwin_update_list(); | |
891 draw_playlist_window(TRUE); | |
892 } | |
893 | |
894 static void | |
895 on_playlist_font_button_realize(GtkFontButton * button, | |
896 gpointer data) | |
897 { | |
898 gtk_font_button_set_font_name(button, cfg.playlist_font); | |
899 } | |
900 | |
901 static void | |
902 on_playlist_show_pl_numbers_realize(GtkToggleButton * button, | |
903 gpointer data) | |
904 { | |
905 gtk_toggle_button_set_active(button, cfg.show_numbers_in_pl); | |
906 } | |
907 | |
908 static void | |
909 on_playlist_show_pl_numbers_toggled(GtkToggleButton * button, | |
910 gpointer data) | |
911 { | |
912 cfg.show_numbers_in_pl = gtk_toggle_button_get_active(button); | |
913 playlistwin_update_list(); | |
914 draw_playlist_window(TRUE); | |
915 } | |
916 | |
917 static void | |
918 input_plugin_enable_prefs(GtkTreeView * treeview, | |
919 GtkButton * button) | |
920 { | |
921 GtkTreeSelection *selection; | |
922 GtkTreeModel *model; | |
923 GtkTreeIter iter; | |
924 | |
925 GList *plist; | |
926 gint id; | |
927 | |
928 selection = gtk_tree_view_get_selection(treeview); | |
929 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
930 return; | |
931 | |
932 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
933 | |
934 plist = get_input_list(); | |
935 plist = g_list_nth(plist, id); | |
936 | |
937 gtk_widget_set_sensitive(GTK_WIDGET(button), | |
938 INPUT_PLUGIN(plist->data)->configure != NULL); | |
939 } | |
940 | |
941 static void | |
942 input_plugin_enable_info(GtkTreeView * treeview, | |
943 GtkButton * button) | |
944 { | |
945 GtkTreeSelection *selection; | |
946 GtkTreeModel *model; | |
947 GtkTreeIter iter; | |
948 GList *plist; | |
949 gint id; | |
950 | |
951 selection = gtk_tree_view_get_selection(treeview); | |
952 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
953 return; | |
954 | |
955 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
956 | |
957 plist = get_input_list(); | |
958 plist = g_list_nth(plist, id); | |
959 | |
960 gtk_widget_set_sensitive(GTK_WIDGET(button), | |
961 INPUT_PLUGIN(plist->data)->about != NULL); | |
962 } | |
963 | |
964 | |
965 static void | |
966 output_plugin_enable_info(GtkComboBox * cbox, GtkButton * button) | |
967 { | |
968 GList *plist; | |
969 | |
970 gint id = gtk_combo_box_get_active(cbox); | |
971 | |
972 plist = get_output_list(); | |
973 plist = g_list_nth(plist, id); | |
974 | |
975 gtk_widget_set_sensitive(GTK_WIDGET(button), | |
976 OUTPUT_PLUGIN(plist->data)->about != NULL); | |
977 } | |
978 | |
979 static void | |
980 output_plugin_enable_prefs(GtkComboBox * cbox, GtkButton * button) | |
981 { | |
982 GList *plist; | |
983 gint id = gtk_combo_box_get_active(cbox); | |
984 | |
985 plist = get_output_list(); | |
986 plist = g_list_nth(plist, id); | |
987 | |
988 gtk_widget_set_sensitive(GTK_WIDGET(button), | |
989 OUTPUT_PLUGIN(plist->data)->configure != NULL); | |
990 } | |
991 | |
992 | |
993 static void | |
994 general_plugin_enable_info(GtkTreeView * treeview, | |
995 GtkButton * button) | |
996 { | |
997 GtkTreeSelection *selection; | |
998 GtkTreeModel *model; | |
999 GtkTreeIter iter; | |
1000 GList *plist; | |
1001 gint id; | |
1002 | |
1003 selection = gtk_tree_view_get_selection(treeview); | |
1004 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
1005 return; | |
1006 | |
1007 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
1008 | |
1009 plist = get_general_list(); | |
1010 plist = g_list_nth(plist, id); | |
1011 | |
1012 gtk_widget_set_sensitive(GTK_WIDGET(button), | |
1013 GENERAL_PLUGIN(plist->data)->about != NULL); | |
1014 } | |
1015 | |
1016 static void | |
1017 general_plugin_enable_prefs(GtkTreeView * treeview, | |
1018 GtkButton * button) | |
1019 { | |
1020 GtkTreeSelection *selection; | |
1021 GtkTreeModel *model; | |
1022 GtkTreeIter iter; | |
1023 GList *plist; | |
1024 gint id; | |
1025 | |
1026 selection = gtk_tree_view_get_selection(treeview); | |
1027 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
1028 return; | |
1029 | |
1030 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
1031 | |
1032 plist = get_general_list(); | |
1033 plist = g_list_nth(plist, id); | |
1034 | |
1035 gtk_widget_set_sensitive(GTK_WIDGET(button), | |
1036 GENERAL_PLUGIN(plist->data)->configure != NULL); | |
1037 } | |
1038 | |
1039 | |
1040 | |
1041 static void | |
1042 vis_plugin_enable_prefs(GtkTreeView * treeview, | |
1043 GtkButton * button) | |
1044 { | |
1045 GtkTreeSelection *selection; | |
1046 GtkTreeModel *model; | |
1047 GtkTreeIter iter; | |
1048 GList *plist; | |
1049 gint id; | |
1050 | |
1051 selection = gtk_tree_view_get_selection(treeview); | |
1052 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
1053 return; | |
1054 | |
1055 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
1056 | |
1057 plist = get_vis_list(); | |
1058 plist = g_list_nth(plist, id); | |
1059 | |
1060 gtk_widget_set_sensitive(GTK_WIDGET(button), | |
1061 VIS_PLUGIN(plist->data)->configure != NULL); | |
1062 } | |
1063 | |
1064 static void | |
1065 vis_plugin_enable_info(GtkTreeView * treeview, | |
1066 GtkButton * button) | |
1067 { | |
1068 GtkTreeSelection *selection; | |
1069 GtkTreeModel *model; | |
1070 GtkTreeIter iter; | |
1071 GList *plist; | |
1072 gint id; | |
1073 | |
1074 selection = gtk_tree_view_get_selection(treeview); | |
1075 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
1076 return; | |
1077 | |
1078 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
1079 | |
1080 plist = get_vis_list(); | |
1081 plist = g_list_nth(plist, id); | |
1082 | |
1083 gtk_widget_set_sensitive(GTK_WIDGET(button), | |
1084 VIS_PLUGIN(plist->data)->about != NULL); | |
1085 } | |
1086 | |
1087 static void | |
1088 vis_plugin_open_prefs(GtkTreeView * treeview, | |
1089 gpointer data) | |
1090 { | |
1091 GtkTreeSelection *selection; | |
1092 GtkTreeModel *model; | |
1093 GtkTreeIter iter; | |
1094 gint id; | |
1095 | |
1096 selection = gtk_tree_view_get_selection(treeview); | |
1097 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
1098 return; | |
1099 | |
1100 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
1101 vis_configure(id); | |
1102 } | |
1103 | |
1104 | |
1105 static void | |
1106 vis_plugin_open_info(GtkTreeView * treeview, | |
1107 gpointer data) | |
1108 { | |
1109 GtkTreeSelection *selection; | |
1110 GtkTreeModel *model; | |
1111 GtkTreeIter iter; | |
1112 gint id; | |
1113 | |
1114 selection = gtk_tree_view_get_selection(treeview); | |
1115 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
1116 return; | |
1117 | |
1118 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
1119 vis_about(id); | |
1120 } | |
1121 | |
1122 | |
1123 | |
1124 | |
1125 | |
1126 | |
1127 static void | |
1128 effect_plugin_enable_prefs(GtkTreeView * treeview, | |
1129 GtkButton * button) | |
1130 { | |
1131 GtkTreeSelection *selection; | |
1132 GtkTreeModel *model; | |
1133 GtkTreeIter iter; | |
1134 GList *plist; | |
1135 gint id; | |
1136 | |
1137 selection = gtk_tree_view_get_selection(treeview); | |
1138 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
1139 return; | |
1140 | |
1141 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
1142 | |
1143 plist = get_effect_list(); | |
1144 plist = g_list_nth(plist, id); | |
1145 | |
1146 gtk_widget_set_sensitive(GTK_WIDGET(button), | |
1147 EFFECT_PLUGIN(plist->data)->configure != NULL); | |
1148 } | |
1149 | |
1150 static void | |
1151 effect_plugin_enable_info(GtkTreeView * treeview, | |
1152 GtkButton * button) | |
1153 { | |
1154 GtkTreeSelection *selection; | |
1155 GtkTreeModel *model; | |
1156 GtkTreeIter iter; | |
1157 GList *plist; | |
1158 gint id; | |
1159 | |
1160 selection = gtk_tree_view_get_selection(treeview); | |
1161 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
1162 return; | |
1163 | |
1164 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
1165 | |
1166 plist = get_effect_list(); | |
1167 plist = g_list_nth(plist, id); | |
1168 | |
1169 gtk_widget_set_sensitive(GTK_WIDGET(button), | |
1170 EFFECT_PLUGIN(plist->data)->about != NULL); | |
1171 } | |
1172 | |
1173 static void | |
1174 effect_plugin_open_prefs(GtkTreeView * treeview, | |
1175 gpointer data) | |
1176 { | |
1177 GtkTreeSelection *selection; | |
1178 GtkTreeModel *model; | |
1179 GtkTreeIter iter; | |
1180 gint id; | |
1181 | |
1182 selection = gtk_tree_view_get_selection(treeview); | |
1183 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
1184 return; | |
1185 | |
1186 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
1187 effect_configure(id); | |
1188 } | |
1189 | |
1190 | |
1191 static void | |
1192 effect_plugin_open_info(GtkTreeView * treeview, | |
1193 gpointer data) | |
1194 { | |
1195 GtkTreeSelection *selection; | |
1196 GtkTreeModel *model; | |
1197 GtkTreeIter iter; | |
1198 gint id; | |
1199 | |
1200 selection = gtk_tree_view_get_selection(treeview); | |
1201 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
1202 return; | |
1203 | |
1204 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
1205 effect_about(id); | |
1206 } | |
1207 | |
1208 | |
1209 | |
1210 | |
1211 | |
1212 static void | |
1213 on_mouse_wheel_volume_realize(GtkSpinButton * button, | |
1214 gpointer data) | |
1215 { | |
1216 gtk_spin_button_set_value(button, cfg.mouse_change); | |
1217 } | |
1218 | |
1219 static void | |
1220 on_mouse_wheel_volume_changed(GtkSpinButton * button, | |
1221 gpointer data) | |
1222 { | |
1223 cfg.mouse_change = gtk_spin_button_get_value_as_int(button); | |
1224 } | |
1225 | |
1226 static void | |
1227 on_pause_between_songs_time_realize(GtkSpinButton * button, | |
1228 gpointer data) | |
1229 { | |
1230 gtk_spin_button_set_value(button, cfg.pause_between_songs_time); | |
1231 } | |
1232 | |
1233 static void | |
1234 on_pause_between_songs_time_changed(GtkSpinButton * button, | |
1235 gpointer data) | |
1236 { | |
1237 cfg.pause_between_songs_time = gtk_spin_button_get_value_as_int(button); | |
1238 } | |
1239 | |
1240 static void | |
1241 on_mouse_wheel_scroll_pl_realize(GtkSpinButton * button, | |
1242 gpointer data) | |
1243 { | |
1244 gtk_spin_button_set_value(button, cfg.scroll_pl_by); | |
1245 } | |
1246 | |
1247 static void | |
1248 on_mouse_wheel_scroll_pl_changed(GtkSpinButton * button, | |
1249 gpointer data) | |
1250 { | |
1251 cfg.scroll_pl_by = gtk_spin_button_get_value_as_int(button); | |
1252 } | |
1253 | |
1254 static void | |
1255 on_playlist_convert_underscore_realize(GtkToggleButton * button, | |
1256 gpointer data) | |
1257 { | |
1258 gtk_toggle_button_set_active(button, cfg.convert_underscore); | |
1259 } | |
1260 | |
1261 static void | |
1262 on_playlist_convert_underscore_toggled(GtkToggleButton * button, | |
1263 gpointer data) | |
1264 { | |
1265 cfg.convert_underscore = gtk_toggle_button_get_active(button); | |
1266 } | |
1267 | |
1268 static void | |
1269 on_playlist_no_advance_realize(GtkToggleButton * button, gpointer data) | |
1270 { | |
1271 gtk_toggle_button_set_active(button, cfg.no_playlist_advance); | |
1272 } | |
1273 | |
1274 static void | |
1275 on_playlist_no_advance_toggled(GtkToggleButton * button, gpointer data) | |
1276 { | |
1277 cfg.no_playlist_advance = gtk_toggle_button_get_active(button); | |
1278 } | |
1279 | |
1280 static void | |
1281 on_playlist_convert_twenty_realize(GtkToggleButton * button, gpointer data) | |
1282 { | |
1283 gtk_toggle_button_set_active(button, cfg.convert_twenty); | |
1284 } | |
1285 | |
1286 static void | |
1287 on_playlist_convert_twenty_toggled(GtkToggleButton * button, gpointer data) | |
1288 { | |
1289 cfg.convert_twenty = gtk_toggle_button_get_active(button); | |
1290 } | |
1291 | |
1292 #if 0 | |
1293 static void | |
1294 on_playlist_update_clicked(GtkButton * button, | |
1295 gpointer data) | |
1296 { | |
1297 playlistwin_update_list(); | |
1298 draw_playlist_window(TRUE); | |
1299 } | |
1300 #endif | |
1301 | |
1302 static void | |
1303 on_use_pl_metadata_realize(GtkToggleButton * button, | |
1304 gpointer data) | |
1305 { | |
1306 gboolean state = cfg.use_pl_metadata; | |
1307 gtk_toggle_button_set_active(button, state); | |
1308 gtk_widget_set_sensitive(GTK_WIDGET(data), state); | |
1309 } | |
1310 | |
1311 static void | |
1312 on_use_pl_metadata_toggled(GtkToggleButton * button, | |
1313 gpointer data) | |
1314 { | |
1315 gboolean state = gtk_toggle_button_get_active(button); | |
1316 cfg.use_pl_metadata = state; | |
1317 gtk_widget_set_sensitive(GTK_WIDGET(data), state); | |
1318 } | |
1319 | |
1320 static void | |
1321 on_pause_between_songs_realize(GtkToggleButton * button, | |
1322 gpointer data) | |
1323 { | |
1324 gboolean state = cfg.pause_between_songs; | |
1325 gtk_toggle_button_set_active(button, state); | |
1326 gtk_widget_set_sensitive(GTK_WIDGET(data), state); | |
1327 } | |
1328 | |
1329 static void | |
1330 on_pause_between_songs_toggled(GtkToggleButton * button, | |
1331 gpointer data) | |
1332 { | |
1333 gboolean state = gtk_toggle_button_get_active(button); | |
1334 cfg.pause_between_songs = state; | |
1335 gtk_widget_set_sensitive(GTK_WIDGET(data), state); | |
1336 } | |
1337 | |
1338 static void | |
1339 on_pl_metadata_on_load_realize(GtkRadioButton * button, | |
1340 gpointer data) | |
1341 { | |
1342 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), | |
1343 cfg.get_info_on_load); | |
1344 } | |
1345 | |
1346 static void | |
1347 on_pl_metadata_on_display_realize(GtkRadioButton * button, | |
1348 gpointer data) | |
1349 { | |
1350 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), | |
1351 cfg.get_info_on_demand); | |
1352 } | |
1353 | |
1354 static void | |
1355 on_pl_metadata_on_load_toggled(GtkRadioButton * button, | |
1356 gpointer data) | |
1357 { | |
1358 cfg.get_info_on_load = | |
1359 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)); | |
1360 } | |
1361 | |
1362 static void | |
1363 on_pl_metadata_on_display_toggled(GtkRadioButton * button, | |
1364 gpointer data) | |
1365 { | |
1366 cfg.get_info_on_demand = | |
1367 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)); | |
1368 } | |
1369 | |
1370 static void | |
1371 on_custom_cursors_realize(GtkToggleButton * button, | |
1372 gpointer data) | |
1373 { | |
1374 gtk_toggle_button_set_active(button, cfg.custom_cursors); | |
1375 } | |
1376 | |
1377 static void | |
1378 on_custom_cursors_toggled(GtkToggleButton *togglebutton, | |
1379 gpointer data) | |
1380 { | |
1381 cfg.custom_cursors = gtk_toggle_button_get_active(togglebutton); | |
1382 skin_reload_forced(); | |
1383 } | |
1384 | |
1385 static void | |
1386 on_eq_dir_preset_entry_realize(GtkEntry * entry, | |
1387 gpointer data) | |
1388 { | |
1389 gtk_entry_set_text(entry, cfg.eqpreset_default_file); | |
1390 } | |
1391 | |
1392 static void | |
1393 on_eq_dir_preset_entry_changed(GtkEntry * entry, | |
1394 gpointer data) | |
1395 { | |
1396 g_free(cfg.eqpreset_default_file); | |
1397 cfg.eqpreset_default_file = g_strdup(gtk_entry_get_text(entry)); | |
1398 } | |
1399 | |
1400 static void | |
1401 on_eq_file_preset_entry_realize(GtkEntry * entry, | |
1402 gpointer data) | |
1403 { | |
1404 gtk_entry_set_text(entry, cfg.eqpreset_extension); | |
1405 } | |
1406 | |
1407 static void | |
1408 on_eq_file_preset_entry_changed(GtkEntry * entry, gpointer data) | |
1409 { | |
1410 const gchar *text = gtk_entry_get_text(entry); | |
1411 | |
1412 while (*text == '.') | |
1413 text++; | |
1414 | |
1415 g_free(cfg.eqpreset_extension); | |
1416 cfg.eqpreset_extension = g_strdup(text); | |
1417 } | |
1418 | |
1419 | |
1420 /* FIXME: implement these */ | |
1421 | |
1422 static void | |
1423 on_eq_preset_view_realize(GtkTreeView * treeview, | |
1424 gpointer data) | |
1425 {} | |
1426 | |
1427 static void | |
1428 on_eq_preset_add_clicked(GtkButton * button, | |
1429 gpointer data) | |
1430 {} | |
1431 | |
1432 static void | |
1433 on_eq_preset_remove_clicked(GtkButton * button, | |
1434 gpointer data) | |
1435 {} | |
1436 | |
1437 | |
1438 static void | |
1439 prefswin_set_skin_update(gboolean state) | |
1440 { | |
1441 g_object_set_data(G_OBJECT(prefswin), "update-skins", | |
1442 GINT_TO_POINTER(state)); | |
1443 } | |
1444 | |
1445 static gboolean | |
1446 prefswin_get_skin_update(void) | |
1447 { | |
1448 return (gboolean) g_object_get_data(G_OBJECT(prefswin), "update-skins"); | |
1449 } | |
1450 | |
1451 static gboolean | |
1452 on_skin_view_visibility_notify(GtkTreeView * treeview, | |
1453 GdkEvent * event, | |
1454 gpointer data) | |
1455 { | |
1456 if (event->visibility.state == GDK_VISIBILITY_FULLY_OBSCURED) | |
1457 return FALSE; | |
1458 | |
1459 if (!prefswin_get_skin_update()) | |
1460 return FALSE; | |
1461 | |
1462 prefswin_set_skin_update(FALSE); | |
1463 skin_view_update(treeview); | |
1464 | |
1465 return TRUE; | |
1466 } | |
1467 | |
1468 static void | |
1469 on_category_view_realize(GtkTreeView * treeview, | |
1470 GtkNotebook * notebook) | |
1471 { | |
1472 GtkListStore *store; | |
1473 GtkCellRenderer *renderer; | |
1474 GtkTreeViewColumn *column; | |
1475 GtkTreeSelection *selection; | |
1476 GtkTreeIter iter; | |
1477 GdkPixbuf *img; | |
1478 gint i; | |
1479 | |
1480 column = gtk_tree_view_column_new(); | |
1481 gtk_tree_view_column_set_title(column, _("Category")); | |
1482 gtk_tree_view_append_column(treeview, column); | |
1483 gtk_tree_view_column_set_spacing(column, 2); | |
1484 | |
1485 renderer = gtk_cell_renderer_pixbuf_new(); | |
1486 gtk_tree_view_column_pack_start(column, renderer, FALSE); | |
1487 gtk_tree_view_column_set_attributes(column, renderer, "pixbuf", 0, NULL); | |
1488 | |
1489 renderer = gtk_cell_renderer_text_new(); | |
1490 gtk_tree_view_column_pack_start(column, renderer, FALSE); | |
1491 gtk_tree_view_column_set_attributes(column, renderer, "text", 1, NULL); | |
1492 | |
1493 store = gtk_list_store_new(CATEGORY_VIEW_N_COLS, | |
1494 GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_INT); | |
1495 gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(store)); | |
1496 | |
1497 for (i = 0; i < n_categories; i++) { | |
1498 img = gdk_pixbuf_new_from_file(categories[i].icon_path, NULL); | |
1499 gtk_list_store_append(store, &iter); | |
1500 gtk_list_store_set(store, &iter, | |
1501 CATEGORY_VIEW_COL_ICON, img, | |
1502 CATEGORY_VIEW_COL_NAME, | |
1503 gettext(categories[i].name), CATEGORY_VIEW_COL_ID, | |
1504 categories[i].id, -1); | |
1505 g_object_unref(img); | |
1506 } | |
1507 | |
1508 selection = gtk_tree_view_get_selection(treeview); | |
1509 | |
1510 g_signal_connect_swapped(selection, "changed", | |
1511 G_CALLBACK(change_category), notebook); | |
1512 } | |
1513 | |
1514 static void | |
1515 mainwin_drag_data_received1(GtkWidget * widget, | |
1516 GdkDragContext * context, | |
1517 gint x, gint y, | |
1518 GtkSelectionData * selection_data, | |
1519 guint info, guint time, | |
1520 gpointer user_data) | |
1521 { | |
1522 gchar *path, *decoded; | |
1523 | |
1524 if (!selection_data->data) { | |
1525 g_warning("DND data string is NULL"); | |
1526 return; | |
1527 } | |
1528 | |
1529 path = (gchar *) selection_data->data; | |
1530 | |
1531 /* FIXME: use a real URL validator/parser */ | |
1532 | |
1533 if (!str_has_prefix_nocase(path, "fonts:///")) | |
1534 return; | |
1535 | |
1536 path[strlen(path) - 2] = 0; /* Why the hell a CR&LF? */ | |
1537 path += 8; | |
1538 | |
1539 /* plain, since we already stripped the first URI part */ | |
1540 decoded = xmms_urldecode_plain(path); | |
1541 | |
1542 /* Get the old font's size, and add it to the dropped | |
1543 * font's name */ | |
1544 cfg.playlist_font = g_strconcat(decoded+1, | |
1545 strrchr(cfg.playlist_font, ' '), | |
1546 NULL); | |
1547 playlist_list_set_font(cfg.playlist_font); | |
1548 playlistwin_update_list(); | |
1549 gtk_font_button_set_font_name(user_data, cfg.playlist_font); | |
1550 | |
1551 g_free(decoded); | |
1552 } | |
1553 | |
1554 static void | |
1555 on_skin_view_drag_data_received(GtkWidget * widget, | |
1556 GdkDragContext * context, | |
1557 gint x, gint y, | |
1558 GtkSelectionData * selection_data, | |
1559 guint info, guint time, | |
1560 gpointer user_data) | |
1561 { | |
1562 ConfigDb *db; | |
1563 gchar *path; | |
1564 | |
1565 if (!selection_data->data) { | |
1566 g_warning("DND data string is NULL"); | |
1567 return; | |
1568 } | |
1569 | |
1570 path = (gchar *) selection_data->data; | |
1571 | |
1572 /* FIXME: use a real URL validator/parser */ | |
1573 | |
1574 if (str_has_prefix_nocase(path, "file:///")) { | |
1575 path[strlen(path) - 2] = 0; /* Why the hell a CR&LF? */ | |
1576 path += 7; | |
1577 } | |
1578 else if (str_has_prefix_nocase(path, "file:")) { | |
1579 path += 5; | |
1580 } | |
1581 | |
1582 if (file_is_archive(path)) { | |
1583 bmp_active_skin_load(path); | |
1584 skin_install_skin(path); | |
1585 skin_view_update(GTK_TREE_VIEW(widget)); | |
1586 /* Change skin name in the config file */ | |
1587 db = bmp_cfg_db_open(); | |
1588 bmp_cfg_db_set_string(db, NULL, "skin", path); | |
1589 bmp_cfg_db_close(db); | |
1590 } | |
1591 | |
1592 } | |
1593 | |
1594 /* FIXME: complete the map */ | |
1595 FUNC_MAP_BEGIN(prefswin_func_map) | |
1596 FUNC_MAP_ENTRY(on_input_plugin_view_realize) | |
1597 FUNC_MAP_ENTRY(on_output_plugin_cbox_realize) | |
1598 FUNC_MAP_ENTRY(on_general_plugin_view_realize) | |
1599 FUNC_MAP_ENTRY(on_vis_plugin_view_realize) | |
1600 FUNC_MAP_ENTRY(on_effect_plugin_view_realize) | |
1601 FUNC_MAP_ENTRY(on_custom_cursors_realize) | |
1602 FUNC_MAP_ENTRY(on_custom_cursors_toggled) | |
1603 FUNC_MAP_ENTRY(on_mainwin_font_button_realize) | |
1604 FUNC_MAP_ENTRY(on_mainwin_font_button_font_set) | |
124
428d3865de3c
[svn] More bitmap-font related stuff, working on a scrolling implementation too. (You can now enable or disable bitmap font support in Preferences.)
nenolod
parents:
0
diff
changeset
|
1605 FUNC_MAP_ENTRY(on_use_bitmap_fonts_realize) |
428d3865de3c
[svn] More bitmap-font related stuff, working on a scrolling implementation too. (You can now enable or disable bitmap font support in Preferences.)
nenolod
parents:
0
diff
changeset
|
1606 FUNC_MAP_ENTRY(on_use_bitmap_fonts_toggled) |
0 | 1607 FUNC_MAP_ENTRY(on_mouse_wheel_volume_realize) |
1608 FUNC_MAP_ENTRY(on_mouse_wheel_volume_changed) | |
1609 FUNC_MAP_ENTRY(on_mouse_wheel_scroll_pl_realize) | |
1610 FUNC_MAP_ENTRY(on_mouse_wheel_scroll_pl_changed) | |
1611 FUNC_MAP_ENTRY(on_pause_between_songs_time_realize) | |
1612 FUNC_MAP_ENTRY(on_pause_between_songs_time_changed) | |
1613 FUNC_MAP_ENTRY(on_pl_metadata_on_load_realize) | |
1614 FUNC_MAP_ENTRY(on_pl_metadata_on_load_toggled) | |
1615 FUNC_MAP_ENTRY(on_pl_metadata_on_display_realize) | |
1616 FUNC_MAP_ENTRY(on_pl_metadata_on_display_toggled) | |
1617 FUNC_MAP_ENTRY(on_playlist_show_pl_numbers_realize) | |
1618 FUNC_MAP_ENTRY(on_playlist_show_pl_numbers_toggled) | |
1619 FUNC_MAP_ENTRY(on_playlist_convert_twenty_realize) | |
1620 FUNC_MAP_ENTRY(on_playlist_convert_twenty_toggled) | |
1621 FUNC_MAP_ENTRY(on_playlist_convert_underscore_realize) | |
1622 FUNC_MAP_ENTRY(on_playlist_convert_underscore_toggled) | |
1623 FUNC_MAP_ENTRY(on_playlist_font_button_realize) | |
1624 FUNC_MAP_ENTRY(on_playlist_font_button_font_set) | |
1625 FUNC_MAP_ENTRY(on_playlist_no_advance_realize) | |
1626 FUNC_MAP_ENTRY(on_playlist_no_advance_toggled) | |
1627 FUNC_MAP_ENTRY(on_skin_view_visibility_notify) | |
1628 FUNC_MAP_ENTRY(on_titlestring_entry_realize) | |
1629 FUNC_MAP_ENTRY(on_titlestring_entry_changed) | |
1630 FUNC_MAP_ENTRY(on_eq_dir_preset_entry_realize) | |
1631 FUNC_MAP_ENTRY(on_eq_dir_preset_entry_changed) | |
1632 FUNC_MAP_ENTRY(on_eq_file_preset_entry_realize) | |
1633 FUNC_MAP_ENTRY(on_eq_file_preset_entry_changed) | |
1634 FUNC_MAP_ENTRY(on_eq_preset_view_realize) | |
1635 FUNC_MAP_ENTRY(on_eq_preset_add_clicked) | |
1636 FUNC_MAP_ENTRY(on_eq_preset_remove_clicked) | |
1637 FUNC_MAP_END | |
1638 | |
1639 void | |
1640 create_prefs_window(void) | |
1641 { | |
1642 const gchar *glade_file = DATA_DIR "/glade/prefswin.glade"; | |
1643 | |
1644 GladeXML *xml; | |
1645 GtkWidget *widget, *widget2; | |
1646 | |
1647 GtkWidget *titlestring_tag_menu, *menu_item; | |
1648 gint i; | |
1649 | |
1650 /* load the interface */ | |
1651 xml = glade_xml_new_or_die(_("Preferences Window"), glade_file, NULL, | |
1652 NULL); | |
1653 | |
1654 | |
1655 /* connect the signals in the interface */ | |
1656 glade_xml_signal_autoconnect_map(xml, prefswin_func_map); | |
1657 | |
1658 prefswin = glade_xml_get_widget(xml, "prefswin"); | |
1659 g_object_set_data(G_OBJECT(prefswin), "glade-xml", xml); | |
1660 gtk_window_set_transient_for(GTK_WINDOW(prefswin), GTK_WINDOW(mainwin)); | |
1661 | |
1662 /* create category view */ | |
1663 widget = glade_xml_get_widget(xml, "category_view"); | |
1664 widget2 = glade_xml_get_widget(xml, "category_notebook"); | |
1665 g_signal_connect_after(G_OBJECT(widget), "realize", | |
1666 G_CALLBACK(on_category_view_realize), | |
1667 widget2); | |
1668 | |
1669 /* plugin->input page */ | |
1670 | |
1671 widget = glade_xml_get_widget(xml, "input_plugin_view"); | |
1672 widget2 = glade_xml_get_widget(xml, "input_plugin_prefs"); | |
1673 g_signal_connect(G_OBJECT(widget), "cursor-changed", | |
1674 G_CALLBACK(input_plugin_enable_prefs), | |
1675 widget2); | |
1676 | |
1677 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
1678 G_CALLBACK(input_plugin_open_prefs), | |
1679 widget); | |
1680 widget2 = glade_xml_get_widget(xml, "input_plugin_info"); | |
1681 g_signal_connect(G_OBJECT(widget), "cursor-changed", | |
1682 G_CALLBACK(input_plugin_enable_info), | |
1683 widget2); | |
1684 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
1685 G_CALLBACK(input_plugin_open_info), | |
1686 widget); | |
1687 | |
1688 /* plugin->output page */ | |
1689 | |
1690 widget = glade_xml_get_widget(xml, "output_plugin_cbox"); | |
1691 | |
1692 widget2 = glade_xml_get_widget(xml, "output_plugin_prefs"); | |
1693 g_signal_connect(G_OBJECT(widget), "changed", | |
1694 G_CALLBACK(output_plugin_enable_prefs), | |
1695 widget2); | |
1696 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
1697 G_CALLBACK(output_plugin_open_prefs), | |
1698 widget); | |
1699 | |
1700 widget2 = glade_xml_get_widget(xml, "output_plugin_info"); | |
1701 g_signal_connect(G_OBJECT(widget), "changed", | |
1702 G_CALLBACK(output_plugin_enable_info), | |
1703 widget2); | |
1704 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
1705 G_CALLBACK(output_plugin_open_info), | |
1706 widget); | |
1707 | |
1708 /* plugin->general page */ | |
1709 | |
1710 widget = glade_xml_get_widget(xml, "general_plugin_view"); | |
1711 | |
1712 widget2 = glade_xml_get_widget(xml, "general_plugin_prefs"); | |
1713 g_signal_connect(G_OBJECT(widget), "cursor-changed", | |
1714 G_CALLBACK(general_plugin_enable_prefs), | |
1715 widget2); | |
1716 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
1717 G_CALLBACK(general_plugin_open_prefs), | |
1718 widget); | |
1719 | |
1720 widget2 = glade_xml_get_widget(xml, "general_plugin_info"); | |
1721 g_signal_connect(G_OBJECT(widget), "cursor-changed", | |
1722 G_CALLBACK(general_plugin_enable_info), | |
1723 widget2); | |
1724 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
1725 G_CALLBACK(general_plugin_open_info), | |
1726 widget); | |
1727 | |
1728 | |
1729 /* plugin->vis page */ | |
1730 | |
1731 widget = glade_xml_get_widget(xml, "vis_plugin_view"); | |
1732 widget2 = glade_xml_get_widget(xml, "vis_plugin_prefs"); | |
1733 | |
1734 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
1735 G_CALLBACK(vis_plugin_open_prefs), | |
1736 widget); | |
1737 g_signal_connect(G_OBJECT(widget), "cursor-changed", | |
1738 G_CALLBACK(vis_plugin_enable_prefs), widget2); | |
1739 | |
1740 | |
1741 widget2 = glade_xml_get_widget(xml, "vis_plugin_info"); | |
1742 g_signal_connect(G_OBJECT(widget), "cursor-changed", | |
1743 G_CALLBACK(vis_plugin_enable_info), widget2); | |
1744 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
1745 G_CALLBACK(vis_plugin_open_info), | |
1746 widget); | |
1747 | |
1748 | |
1749 /* plugin->effects page */ | |
1750 | |
1751 widget = glade_xml_get_widget(xml, "effect_plugin_view"); | |
1752 widget2 = glade_xml_get_widget(xml, "effect_plugin_prefs"); | |
1753 | |
1754 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
1755 G_CALLBACK(effect_plugin_open_prefs), | |
1756 widget); | |
1757 g_signal_connect(G_OBJECT(widget), "cursor-changed", | |
1758 G_CALLBACK(effect_plugin_enable_prefs), widget2); | |
1759 | |
1760 | |
1761 widget2 = glade_xml_get_widget(xml, "effect_plugin_info"); | |
1762 g_signal_connect(G_OBJECT(widget), "cursor-changed", | |
1763 G_CALLBACK(effect_plugin_enable_info), widget2); | |
1764 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
1765 G_CALLBACK(effect_plugin_open_info), | |
1766 widget); | |
1767 | |
1768 /* playlist page */ | |
1769 | |
1770 widget = glade_xml_get_widget(xml, "pause_between_songs_box"); | |
1771 widget2 = glade_xml_get_widget(xml, "pause_between_songs"); | |
1772 g_signal_connect_after(G_OBJECT(widget2), "realize", | |
1773 G_CALLBACK(on_pause_between_songs_realize), | |
1774 widget); | |
1775 g_signal_connect(G_OBJECT(widget2), "toggled", | |
1776 G_CALLBACK(on_pause_between_songs_toggled), | |
1777 widget); | |
1778 | |
1779 widget = glade_xml_get_widget(xml, "playlist_use_metadata_box"); | |
1780 widget2 = glade_xml_get_widget(xml, "playlist_use_metadata"); | |
1781 g_signal_connect_after(G_OBJECT(widget2), "realize", | |
1782 G_CALLBACK(on_use_pl_metadata_realize), | |
1783 widget); | |
1784 g_signal_connect(G_OBJECT(widget2), "toggled", | |
1785 G_CALLBACK(on_use_pl_metadata_toggled), | |
1786 widget); | |
1787 | |
1788 widget = glade_xml_get_widget(xml, "skin_view"); | |
1789 g_signal_connect(widget, "drag-data-received", | |
1790 G_CALLBACK(on_skin_view_drag_data_received), | |
1791 NULL); | |
1792 bmp_drag_dest_set(widget); | |
1793 | |
1794 g_signal_connect(mainwin, "drag-data-received", | |
1795 G_CALLBACK(mainwin_drag_data_received), | |
1796 widget); | |
1797 | |
1798 widget = glade_xml_get_widget(xml, "playlist_font_button"); | |
1799 g_signal_connect(mainwin, "drag-data-received", | |
1800 G_CALLBACK(mainwin_drag_data_received1), | |
1801 widget); | |
1802 | |
1803 widget = glade_xml_get_widget(xml, "titlestring_cbox"); | |
1804 widget2 = glade_xml_get_widget(xml, "titlestring_entry"); | |
1805 g_signal_connect(widget, "realize", | |
1806 G_CALLBACK(on_titlestring_cbox_realize), | |
1807 widget2); | |
1808 g_signal_connect(widget, "changed", | |
1809 G_CALLBACK(on_titlestring_cbox_changed), | |
1810 widget2); | |
1811 | |
1812 /* FIXME: move this into a function */ | |
1813 /* create tag menu */ | |
1814 titlestring_tag_menu = gtk_menu_new(); | |
1815 for(i = 0; i < n_title_field_tags; i++) { | |
1816 menu_item = gtk_menu_item_new_with_label(_(title_field_tags[i].name)); | |
1817 gtk_menu_shell_append(GTK_MENU_SHELL(titlestring_tag_menu), menu_item); | |
1818 g_signal_connect(menu_item, "activate", | |
1819 G_CALLBACK(titlestring_tag_menu_callback), | |
1820 GINT_TO_POINTER(i)); | |
1821 }; | |
1822 gtk_widget_show_all(titlestring_tag_menu); | |
1823 | |
1824 widget = glade_xml_get_widget(xml, "titlestring_help_button"); | |
1825 widget2 = glade_xml_get_widget(xml, "titlestring_cbox"); | |
1826 | |
1827 g_signal_connect(widget2, "changed", | |
1828 G_CALLBACK(on_titlestring_cbox_changed), | |
1829 widget); | |
1830 g_signal_connect(widget, "clicked", | |
1831 G_CALLBACK(on_titlestring_help_button_clicked), | |
1832 titlestring_tag_menu); | |
1833 } | |
1834 | |
1835 void | |
1836 show_prefs_window(void) | |
1837 { | |
1838 prefswin_set_skin_update(TRUE); | |
1839 gtk_widget_show(prefswin); | |
1840 } |