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