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