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