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