Mercurial > audlegacy
annotate audacious/prefswin.c @ 1321:b7a29646eb72 trunk
[svn] - sanity checks (don't send NULL pointers off to GTK)
author | nenolod |
---|---|
date | Wed, 21 Jun 2006 02:23:25 -0700 |
parents | 35dc5d2a1675 |
children | 8b249765fdd1 |
rev | line source |
---|---|
1073 | 1 /* Audacious - Cross-platform multimedia player |
2 * Copyright (C) 2005-2006 Audacious development team. | |
3 * | |
4 * BMP - Cross-platform multimedia player | |
0 | 5 * Copyright (C) 2003-2004 BMP development team. |
6 * | |
7 * This program is free software; you can redistribute it and/or modify | |
8 * it under the terms of the GNU General Public Licensse as published by | |
9 * the Free Software Foundation; either version 2 of the License, or | |
10 * (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, | |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 * GNU General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU General Public License | |
18 * along with this program; if not, write to the Free Software | |
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
20 */ | |
21 | |
22 #ifdef HAVE_CONFIG_H | |
23 # include "config.h" | |
24 #endif | |
25 | |
26 #include <glib.h> | |
27 #include <glib/gi18n.h> | |
28 #include <gtk/gtk.h> | |
29 #include <glade/glade.h> | |
30 #include <string.h> | |
887 | 31 #include <stddef.h> |
32 #include <stdio.h> | |
33 #include <sys/types.h> | |
34 #include <dirent.h> | |
35 #include <unistd.h> | |
36 #include <errno.h> | |
37 #include <sys/types.h> | |
38 #include <sys/stat.h> | |
0 | 39 |
40 #include "glade.h" | |
41 | |
42 #include "plugin.h" | |
43 #include "pluginenum.h" | |
44 #include "input.h" | |
45 #include "effect.h" | |
46 #include "general.h" | |
47 #include "output.h" | |
48 #include "visualization.h" | |
49 | |
50 #include "main.h" | |
51 #include "skin.h" | |
52 #include "urldecode.h" | |
53 #include "util.h" | |
54 #include "dnd.h" | |
55 #include "libaudacious/configdb.h" | |
56 | |
57 #include "mainwin.h" | |
383 | 58 #include "ui_playlist.h" |
0 | 59 #include "skinwin.h" |
60 #include "playlist_list.h" | |
816
8073d8300502
[svn] display audacious version and revision in the prefs window
giacomo
parents:
625
diff
changeset
|
61 #include "build_stamp.h" |
1184
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
62 #include "prefswin.h" |
0 | 63 |
64 enum CategoryViewCols { | |
65 CATEGORY_VIEW_COL_ICON, | |
66 CATEGORY_VIEW_COL_NAME, | |
67 CATEGORY_VIEW_COL_ID, | |
68 CATEGORY_VIEW_N_COLS | |
69 }; | |
70 | |
71 enum PluginViewCols { | |
72 PLUGIN_VIEW_COL_ACTIVE, | |
73 PLUGIN_VIEW_COL_DESC, | |
74 PLUGIN_VIEW_COL_FILENAME, | |
75 PLUGIN_VIEW_COL_ID, | |
76 PLUGIN_VIEW_N_COLS | |
77 }; | |
78 | |
79 | |
80 typedef struct { | |
81 const gchar *icon_path; | |
82 const gchar *name; | |
83 gint id; | |
84 } Category; | |
85 | |
86 typedef struct { | |
87 const gchar *name; | |
88 const gchar *tag; | |
89 } | |
90 TitleFieldTag; | |
91 | |
92 static GtkWidget *prefswin = NULL; | |
1175 | 93 static GtkWidget *category_treeview = NULL; |
94 static GtkWidget *category_notebook = NULL; | |
0 | 95 |
96 static Category categories[] = { | |
97 {DATA_DIR "/images/appearance.png", N_("Appearance"), 1}, | |
1143 | 98 {DATA_DIR "/images/audio.png", N_("Audio"), 6}, |
1074 | 99 {DATA_DIR "/images/connectivity.png", N_("Connectivity"), 5}, |
0 | 100 {DATA_DIR "/images/eq.png", N_("Equalizer"), 4}, |
101 {DATA_DIR "/images/mouse.png", N_("Mouse"), 2}, | |
102 {DATA_DIR "/images/playlist.png", N_("Playlist"), 3}, | |
103 {DATA_DIR "/images/plugins.png", N_("Plugins"), 0}, | |
104 }; | |
105 | |
106 static gint n_categories = G_N_ELEMENTS(categories); | |
107 | |
108 static TitleFieldTag title_field_tags[] = { | |
109 { N_("Artist") , "%p" }, | |
110 { N_("Album") , "%a" }, | |
111 { N_("Title") , "%t" }, | |
112 { N_("Tracknumber"), "%n" }, | |
113 { N_("Genre") , "%g" }, | |
114 { N_("Filename") , "%f" }, | |
115 { N_("Filepath") , "%F" }, | |
116 { N_("Date") , "%d" }, | |
117 { N_("Year") , "%y" }, | |
118 { N_("Comment") , "%c" } | |
119 }; | |
120 | |
1184
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
121 typedef struct { |
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
122 GtkWidget *container; |
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
123 char *pg_name; |
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
124 char *img_url; |
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
125 } CategoryQueueEntry; |
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
126 |
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
127 static GList *category_queue = NULL; |
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
128 |
0 | 129 static const guint n_title_field_tags = G_N_ELEMENTS(title_field_tags); |
130 | |
963
e42ce60c308f
[svn] - GLib 2.6 compatibility wrapper, per bug #469
nenolod
parents:
962
diff
changeset
|
131 /* GLib 2.6 compatibility */ |
e42ce60c308f
[svn] - GLib 2.6 compatibility wrapper, per bug #469
nenolod
parents:
962
diff
changeset
|
132 #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
|
133 static const char * |
e42ce60c308f
[svn] - GLib 2.6 compatibility wrapper, per bug #469
nenolod
parents:
962
diff
changeset
|
134 g_get_host_name (void) |
e42ce60c308f
[svn] - GLib 2.6 compatibility wrapper, per bug #469
nenolod
parents:
962
diff
changeset
|
135 { |
e42ce60c308f
[svn] - GLib 2.6 compatibility wrapper, per bug #469
nenolod
parents:
962
diff
changeset
|
136 static char hostname [HOST_NAME_MAX + 1]; |
e42ce60c308f
[svn] - GLib 2.6 compatibility wrapper, per bug #469
nenolod
parents:
962
diff
changeset
|
137 if (gethostname (hostname, HOST_NAME_MAX) == -1) { |
e42ce60c308f
[svn] - GLib 2.6 compatibility wrapper, per bug #469
nenolod
parents:
962
diff
changeset
|
138 return _("localhost"); |
e42ce60c308f
[svn] - GLib 2.6 compatibility wrapper, per bug #469
nenolod
parents:
962
diff
changeset
|
139 } |
e42ce60c308f
[svn] - GLib 2.6 compatibility wrapper, per bug #469
nenolod
parents:
962
diff
changeset
|
140 return hostname; |
e42ce60c308f
[svn] - GLib 2.6 compatibility wrapper, per bug #469
nenolod
parents:
962
diff
changeset
|
141 } |
e42ce60c308f
[svn] - GLib 2.6 compatibility wrapper, per bug #469
nenolod
parents:
962
diff
changeset
|
142 #endif |
0 | 143 |
1184
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
144 static void prefswin_page_queue_destroy(CategoryQueueEntry *ent); |
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
145 |
0 | 146 static GladeXML * |
147 prefswin_get_xml(void) | |
148 { | |
149 return GLADE_XML(g_object_get_data(G_OBJECT(prefswin), "glade-xml")); | |
150 } | |
151 | |
152 static void | |
153 change_category(GtkNotebook * notebook, | |
154 GtkTreeSelection * selection) | |
155 { | |
156 GtkTreeModel *model; | |
157 GtkTreeIter iter; | |
158 gint index; | |
159 | |
160 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
161 return; | |
162 | |
163 gtk_tree_model_get(model, &iter, CATEGORY_VIEW_COL_ID, &index, -1); | |
164 gtk_notebook_set_current_page(notebook, index); | |
165 } | |
166 | |
167 void | |
168 prefswin_set_category(gint index) | |
169 { | |
170 GladeXML *xml; | |
171 GtkWidget *notebook; | |
172 | |
173 g_return_if_fail(index >= 0 && index < n_categories); | |
174 | |
175 xml = prefswin_get_xml(); | |
176 notebook = glade_xml_get_widget(xml, "category_view"); | |
177 gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook), index); | |
178 } | |
179 | |
180 | |
181 static void | |
182 input_plugin_open_prefs(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_configure(id); | |
196 } | |
197 | |
198 static void | |
199 input_plugin_open_info(GtkTreeView * treeview, | |
200 gpointer data) | |
201 { | |
202 GtkTreeSelection *selection; | |
203 GtkTreeModel *model; | |
204 GtkTreeIter iter; | |
205 gint id; | |
206 | |
207 selection = gtk_tree_view_get_selection(treeview); | |
208 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
209 return; | |
210 | |
211 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
212 input_about(id); | |
213 } | |
214 | |
215 static void | |
216 output_plugin_open_prefs(GtkComboBox * cbox, | |
217 gpointer data) | |
218 { | |
219 output_configure(gtk_combo_box_get_active(cbox)); | |
220 } | |
221 | |
222 static void | |
223 output_plugin_open_info(GtkComboBox * cbox, | |
224 gpointer data) | |
225 { | |
226 output_about(gtk_combo_box_get_active(cbox)); | |
227 } | |
228 | |
229 static void | |
230 general_plugin_open_prefs(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_configure(id); | |
244 } | |
245 | |
246 static void | |
247 general_plugin_open_info(GtkTreeView * treeview, | |
248 gpointer data) | |
249 { | |
250 GtkTreeSelection *selection; | |
251 GtkTreeModel *model; | |
252 GtkTreeIter iter; | |
253 gint id; | |
254 | |
255 selection = gtk_tree_view_get_selection(treeview); | |
256 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
257 return; | |
258 | |
259 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
260 general_about(id); | |
261 } | |
262 | |
263 static void | |
264 input_plugin_toggle(GtkCellRendererToggle * cell, | |
265 const gchar * path_str, | |
266 gpointer data) | |
267 { | |
268 GtkTreeModel *model = GTK_TREE_MODEL(data); | |
269 GtkTreeIter iter; | |
270 GtkTreePath *path = gtk_tree_path_new_from_string(path_str); | |
271 gboolean fixed; | |
272 gint pluginnr; | |
273 gchar *filename, *basename; | |
274 /*GList *diplist, *tmplist; */ | |
275 | |
276 /* get toggled iter */ | |
277 gtk_tree_model_get_iter(model, &iter, path); | |
278 gtk_tree_model_get(model, &iter, | |
279 PLUGIN_VIEW_COL_ACTIVE, &fixed, | |
280 PLUGIN_VIEW_COL_ID, &pluginnr, | |
281 PLUGIN_VIEW_COL_FILENAME, &filename, | |
282 -1); | |
283 | |
284 basename = g_path_get_basename(filename); | |
285 g_free(filename); | |
286 | |
287 /* do something with the value */ | |
288 fixed ^= 1; | |
289 | |
290 g_hash_table_replace(plugin_matrix, basename, GINT_TO_POINTER(fixed)); | |
291 /* g_hash_table_foreach(pluginmatrix, (GHFunc) disp_matrix, NULL); */ | |
292 | |
293 /* set new value */ | |
294 gtk_list_store_set(GTK_LIST_STORE(model), &iter, | |
295 PLUGIN_VIEW_COL_ACTIVE, fixed, -1); | |
296 | |
297 /* clean up */ | |
298 gtk_tree_path_free(path); | |
299 } | |
300 | |
301 | |
302 static void | |
303 vis_plugin_toggle(GtkCellRendererToggle * cell, | |
304 const gchar * path_str, | |
305 gpointer data) | |
306 { | |
307 GtkTreeModel *model = GTK_TREE_MODEL(data); | |
308 GtkTreeIter iter; | |
309 GtkTreePath *path = gtk_tree_path_new_from_string(path_str); | |
310 gboolean fixed; | |
311 gint pluginnr; | |
312 | |
313 /* get toggled iter */ | |
314 gtk_tree_model_get_iter(model, &iter, path); | |
315 gtk_tree_model_get(model, &iter, | |
316 PLUGIN_VIEW_COL_ACTIVE, &fixed, | |
317 PLUGIN_VIEW_COL_ID, &pluginnr, -1); | |
318 | |
319 /* do something with the value */ | |
320 fixed ^= 1; | |
321 | |
322 enable_vis_plugin(pluginnr, fixed); | |
323 | |
324 /* set new value */ | |
325 gtk_list_store_set(GTK_LIST_STORE(model), &iter, | |
326 PLUGIN_VIEW_COL_ACTIVE, fixed, -1); | |
327 | |
328 /* clean up */ | |
329 gtk_tree_path_free(path); | |
330 } | |
331 | |
332 static void | |
333 effect_plugin_toggle(GtkCellRendererToggle * cell, | |
334 const gchar * path_str, | |
335 gpointer data) | |
336 { | |
337 GtkTreeModel *model = GTK_TREE_MODEL(data); | |
338 GtkTreeIter iter; | |
339 GtkTreePath *path = gtk_tree_path_new_from_string(path_str); | |
340 gboolean fixed; | |
341 gint pluginnr; | |
342 | |
343 /* get toggled iter */ | |
344 gtk_tree_model_get_iter(model, &iter, path); | |
345 gtk_tree_model_get(model, &iter, | |
346 PLUGIN_VIEW_COL_ACTIVE, &fixed, | |
347 PLUGIN_VIEW_COL_ID, &pluginnr, -1); | |
348 | |
349 /* do something with the value */ | |
350 fixed ^= 1; | |
351 | |
352 enable_effect_plugin(pluginnr, fixed); | |
353 | |
354 /* set new value */ | |
355 gtk_list_store_set(GTK_LIST_STORE(model), &iter, | |
356 PLUGIN_VIEW_COL_ACTIVE, fixed, -1); | |
357 | |
358 /* clean up */ | |
359 gtk_tree_path_free(path); | |
360 } | |
361 static void | |
362 general_plugin_toggle(GtkCellRendererToggle * cell, | |
363 const gchar * path_str, | |
364 gpointer data) | |
365 { | |
366 GtkTreeModel *model = GTK_TREE_MODEL(data); | |
367 GtkTreeIter iter; | |
368 GtkTreePath *path = gtk_tree_path_new_from_string(path_str); | |
369 gboolean fixed; | |
370 gint pluginnr; | |
371 | |
372 /* get toggled iter */ | |
373 gtk_tree_model_get_iter(model, &iter, path); | |
374 gtk_tree_model_get(model, &iter, | |
375 PLUGIN_VIEW_COL_ACTIVE, &fixed, | |
376 PLUGIN_VIEW_COL_ID, &pluginnr, -1); | |
377 | |
378 /* do something with the value */ | |
379 fixed ^= 1; | |
380 | |
381 enable_general_plugin(pluginnr, fixed); | |
382 | |
383 /* set new value */ | |
384 gtk_list_store_set(GTK_LIST_STORE(model), &iter, | |
385 PLUGIN_VIEW_COL_ACTIVE, fixed, -1); | |
386 | |
387 /* clean up */ | |
388 gtk_tree_path_free(path); | |
389 } | |
390 | |
391 static void | |
392 on_output_plugin_cbox_changed(GtkComboBox * combobox, | |
393 gpointer data) | |
394 { | |
395 gint selected; | |
396 selected = gtk_combo_box_get_active(combobox); | |
397 | |
398 /* Force playback to stop. There is NO way to change the output | |
399 plugin in the middle of a playback, and NO way to know when the | |
400 user closes the output plugin settings dialog. */ | |
401 mainwin_stop_pushed(); | |
402 set_current_output_plugin(selected); | |
403 } | |
404 | |
405 static void | |
406 on_output_plugin_cbox_realize(GtkComboBox * cbox, | |
407 gpointer data) | |
408 { | |
409 GList *olist = get_output_list(); | |
410 OutputPlugin *op, *cp = get_current_output_plugin(); | |
411 gint i = 0, selected = 0; | |
412 | |
413 if (!olist) { | |
414 gtk_widget_set_sensitive(GTK_WIDGET(cbox), FALSE); | |
415 return; | |
416 } | |
417 | |
418 for (i = 0; olist; i++, olist = g_list_next(olist)) { | |
419 op = OUTPUT_PLUGIN(olist->data); | |
420 | |
421 if (olist->data == cp) | |
422 selected = i; | |
423 | |
424 gtk_combo_box_append_text(cbox, op->description); | |
425 } | |
426 | |
427 gtk_combo_box_set_active(cbox, selected); | |
428 g_signal_connect(cbox, "changed", | |
429 G_CALLBACK(on_output_plugin_cbox_changed), NULL); | |
430 } | |
431 | |
432 | |
433 static void | |
434 on_input_plugin_view_realize(GtkTreeView * treeview, | |
435 gpointer data) | |
436 { | |
437 GtkListStore *store; | |
438 GtkTreeIter iter; | |
439 | |
440 GtkCellRenderer *renderer; | |
441 GtkTreeViewColumn *column; | |
442 | |
443 GList *ilist; | |
444 gchar *description[2]; | |
445 InputPlugin *ip; | |
446 gint id = 0; | |
447 | |
448 gboolean enabled; | |
449 | |
450 store = gtk_list_store_new(PLUGIN_VIEW_N_COLS, | |
451 G_TYPE_BOOLEAN, G_TYPE_STRING, | |
452 G_TYPE_STRING, G_TYPE_INT); | |
453 | |
454 column = gtk_tree_view_column_new(); | |
455 gtk_tree_view_column_set_title(column, _("Enabled")); | |
456 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED); | |
457 gtk_tree_view_column_set_spacing(column, 4); | |
458 gtk_tree_view_column_set_resizable(column, FALSE); | |
459 gtk_tree_view_column_set_fixed_width(column, 50); | |
460 | |
461 renderer = gtk_cell_renderer_toggle_new(); | |
462 g_signal_connect(renderer, "toggled", | |
463 G_CALLBACK(input_plugin_toggle), store); | |
464 gtk_tree_view_column_pack_start(column, renderer, TRUE); | |
465 gtk_tree_view_column_set_attributes(column, renderer, "active", | |
466 PLUGIN_VIEW_COL_ACTIVE, NULL); | |
467 | |
468 gtk_tree_view_append_column(treeview, column); | |
469 | |
470 column = gtk_tree_view_column_new(); | |
471 gtk_tree_view_column_set_title(column, _("Description")); | |
472 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); | |
473 gtk_tree_view_column_set_spacing(column, 4); | |
474 gtk_tree_view_column_set_resizable(column, TRUE); | |
475 | |
476 | |
477 renderer = gtk_cell_renderer_text_new(); | |
478 gtk_tree_view_column_pack_start(column, renderer, FALSE); | |
479 gtk_tree_view_column_set_attributes(column, renderer, | |
480 "text", PLUGIN_VIEW_COL_DESC, NULL); | |
481 gtk_tree_view_append_column(treeview, column); | |
482 | |
483 column = gtk_tree_view_column_new(); | |
484 | |
485 gtk_tree_view_column_set_title(column, _("Filename")); | |
486 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); | |
487 gtk_tree_view_column_set_spacing(column, 4); | |
488 gtk_tree_view_column_set_resizable(column, TRUE); | |
489 | |
490 renderer = gtk_cell_renderer_text_new(); | |
491 gtk_tree_view_column_pack_start(column, renderer, TRUE); | |
492 gtk_tree_view_column_set_attributes(column, renderer, "text", | |
493 PLUGIN_VIEW_COL_FILENAME, NULL); | |
494 | |
495 gtk_tree_view_append_column(treeview, column); | |
496 | |
497 for (ilist = get_input_list(); ilist; ilist = g_list_next(ilist)) { | |
498 ip = INPUT_PLUGIN(ilist->data); | |
499 | |
500 description[0] = g_strdup(ip->description); | |
501 description[1] = g_strdup(ip->filename); | |
502 | |
503 enabled = input_is_enabled(description[1]); | |
504 | |
505 gtk_list_store_append(store, &iter); | |
506 gtk_list_store_set(store, &iter, | |
507 PLUGIN_VIEW_COL_ACTIVE, enabled, | |
508 PLUGIN_VIEW_COL_DESC, description[0], | |
509 PLUGIN_VIEW_COL_FILENAME, description[1], | |
510 PLUGIN_VIEW_COL_ID, id++, -1); | |
511 | |
512 g_free(description[1]); | |
513 g_free(description[0]); | |
514 } | |
515 | |
516 gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(store)); | |
517 } | |
518 | |
519 | |
520 static void | |
521 on_general_plugin_view_realize(GtkTreeView * treeview, | |
522 gpointer data) | |
523 { | |
524 GtkListStore *store; | |
525 GtkTreeIter iter; | |
526 | |
527 GtkCellRenderer *renderer; | |
528 GtkTreeViewColumn *column; | |
529 | |
530 GList *ilist /*, *diplist */ ; | |
531 gchar *description[2]; | |
532 GeneralPlugin *gp; | |
533 gint id = 0; | |
534 | |
535 gboolean enabled; | |
536 | |
537 store = gtk_list_store_new(PLUGIN_VIEW_N_COLS, | |
538 G_TYPE_BOOLEAN, G_TYPE_STRING, | |
539 G_TYPE_STRING, G_TYPE_INT); | |
540 | |
541 column = gtk_tree_view_column_new(); | |
542 gtk_tree_view_column_set_title(column, _("Enabled")); | |
543 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED); | |
544 gtk_tree_view_column_set_spacing(column, 4); | |
545 gtk_tree_view_column_set_resizable(column, FALSE); | |
546 gtk_tree_view_column_set_fixed_width(column, 50); | |
547 | |
548 renderer = gtk_cell_renderer_toggle_new(); | |
549 g_signal_connect(renderer, "toggled", | |
550 G_CALLBACK(general_plugin_toggle), store); | |
551 gtk_tree_view_column_pack_start(column, renderer, TRUE); | |
552 gtk_tree_view_column_set_attributes(column, renderer, "active", | |
553 PLUGIN_VIEW_COL_ACTIVE, NULL); | |
554 | |
555 gtk_tree_view_append_column(treeview, column); | |
556 | |
557 column = gtk_tree_view_column_new(); | |
558 gtk_tree_view_column_set_title(column, _("Description")); | |
559 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); | |
560 gtk_tree_view_column_set_spacing(column, 4); | |
561 gtk_tree_view_column_set_resizable(column, TRUE); | |
562 | |
563 | |
564 renderer = gtk_cell_renderer_text_new(); | |
565 gtk_tree_view_column_pack_start(column, renderer, FALSE); | |
566 gtk_tree_view_column_set_attributes(column, renderer, | |
567 "text", PLUGIN_VIEW_COL_DESC, NULL); | |
568 | |
569 gtk_tree_view_append_column(treeview, column); | |
570 | |
571 | |
572 column = gtk_tree_view_column_new(); | |
573 gtk_tree_view_column_set_title(column, _("Filename")); | |
574 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); | |
575 gtk_tree_view_column_set_spacing(column, 4); | |
576 gtk_tree_view_column_set_resizable(column, TRUE); | |
577 | |
578 renderer = gtk_cell_renderer_text_new(); | |
579 gtk_tree_view_column_pack_start(column, renderer, TRUE); | |
580 gtk_tree_view_column_set_attributes(column, renderer, "text", | |
581 PLUGIN_VIEW_COL_FILENAME, NULL); | |
582 | |
583 gtk_tree_view_append_column(treeview, column); | |
584 | |
585 for (ilist = get_general_list(); ilist; ilist = g_list_next(ilist)) { | |
586 gp = GENERAL_PLUGIN(ilist->data); | |
587 | |
588 description[0] = g_strdup(gp->description); | |
589 description[1] = g_strdup(gp->filename); | |
590 | |
591 enabled = general_enabled(id); | |
592 | |
593 gtk_list_store_append(store, &iter); | |
594 gtk_list_store_set(store, &iter, | |
595 PLUGIN_VIEW_COL_ACTIVE, enabled, | |
596 PLUGIN_VIEW_COL_DESC, description[0], | |
597 PLUGIN_VIEW_COL_FILENAME, description[1], | |
598 PLUGIN_VIEW_COL_ID, id++, -1); | |
599 | |
600 g_free(description[1]); | |
601 g_free(description[0]); | |
602 } | |
603 | |
604 gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(store)); | |
605 } | |
606 | |
607 | |
608 static void | |
609 on_vis_plugin_view_realize(GtkTreeView * treeview, | |
610 gpointer data) | |
611 { | |
612 GtkListStore *store; | |
613 GtkTreeIter iter; | |
614 | |
615 GtkCellRenderer *renderer; | |
616 GtkTreeViewColumn *column; | |
617 | |
618 GList *vlist; | |
619 gchar *description[2]; | |
620 VisPlugin *vp; | |
621 gint id = 0; | |
622 | |
623 gboolean enabled; | |
624 | |
625 | |
626 store = gtk_list_store_new(PLUGIN_VIEW_N_COLS, | |
627 G_TYPE_BOOLEAN, G_TYPE_STRING, | |
628 G_TYPE_STRING, G_TYPE_INT); | |
629 | |
630 column = gtk_tree_view_column_new(); | |
631 gtk_tree_view_column_set_title(column, _("Enabled")); | |
632 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED); | |
633 gtk_tree_view_column_set_spacing(column, 4); | |
634 gtk_tree_view_column_set_resizable(column, FALSE); | |
635 gtk_tree_view_column_set_fixed_width(column, 50); | |
636 | |
637 renderer = gtk_cell_renderer_toggle_new(); | |
638 g_signal_connect(renderer, "toggled", | |
639 G_CALLBACK(vis_plugin_toggle), store); | |
640 gtk_tree_view_column_pack_start(column, renderer, TRUE); | |
641 gtk_tree_view_column_set_attributes(column, renderer, "active", | |
642 PLUGIN_VIEW_COL_ACTIVE, NULL); | |
643 | |
644 gtk_tree_view_append_column(treeview, column); | |
645 | |
646 column = gtk_tree_view_column_new(); | |
647 gtk_tree_view_column_set_title(column, _("Description")); | |
648 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); | |
649 gtk_tree_view_column_set_spacing(column, 4); | |
650 gtk_tree_view_column_set_resizable(column, TRUE); | |
651 | |
652 | |
653 renderer = gtk_cell_renderer_text_new(); | |
654 gtk_tree_view_column_pack_start(column, renderer, FALSE); | |
655 gtk_tree_view_column_set_attributes(column, renderer, | |
656 "text", PLUGIN_VIEW_COL_DESC, NULL); | |
657 | |
658 gtk_tree_view_append_column(treeview, column); | |
659 | |
660 | |
661 column = gtk_tree_view_column_new(); | |
662 gtk_tree_view_column_set_title(column, _("Filename")); | |
663 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); | |
664 gtk_tree_view_column_set_spacing(column, 4); | |
665 gtk_tree_view_column_set_resizable(column, TRUE); | |
666 | |
667 renderer = gtk_cell_renderer_text_new(); | |
668 gtk_tree_view_column_pack_start(column, renderer, TRUE); | |
669 gtk_tree_view_column_set_attributes(column, renderer, "text", | |
670 PLUGIN_VIEW_COL_FILENAME, NULL); | |
671 | |
672 gtk_tree_view_append_column(treeview, column); | |
673 | |
674 for (vlist = get_vis_list(); vlist; vlist = g_list_next(vlist)) { | |
675 vp = VIS_PLUGIN(vlist->data); | |
676 | |
677 description[0] = g_strdup(vp->description); | |
678 description[1] = g_strdup(vp->filename); | |
679 | |
680 enabled = vis_enabled(id); | |
681 | |
682 gtk_list_store_append(store, &iter); | |
683 gtk_list_store_set(store, &iter, | |
684 PLUGIN_VIEW_COL_ACTIVE, enabled, | |
685 PLUGIN_VIEW_COL_DESC, description[0], | |
686 PLUGIN_VIEW_COL_FILENAME, description[1], | |
687 PLUGIN_VIEW_COL_ID, id++, -1); | |
688 | |
689 g_free(description[1]); | |
690 g_free(description[0]); | |
691 } | |
692 | |
693 gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(store)); | |
694 } | |
695 | |
696 static void | |
697 editable_insert_text(GtkEditable * editable, | |
698 const gchar * text, | |
699 gint * pos) | |
700 { | |
701 gtk_editable_insert_text(editable, text, strlen(text), pos); | |
702 } | |
703 | |
704 | |
705 static void | |
706 on_effect_plugin_view_realize(GtkTreeView * treeview, | |
707 gpointer data) | |
708 { | |
709 GtkListStore *store; | |
710 GtkTreeIter iter; | |
711 | |
712 GtkCellRenderer *renderer; | |
713 GtkTreeViewColumn *column; | |
714 | |
715 GList *elist; | |
716 gchar *description[2]; | |
717 gint id = 0; | |
718 | |
719 gboolean enabled; | |
720 | |
721 | |
722 store = gtk_list_store_new(PLUGIN_VIEW_N_COLS, | |
723 G_TYPE_BOOLEAN, G_TYPE_STRING, | |
724 G_TYPE_STRING, G_TYPE_INT); | |
725 | |
726 column = gtk_tree_view_column_new(); | |
727 gtk_tree_view_column_set_title(column, _("Enabled")); | |
728 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED); | |
729 gtk_tree_view_column_set_spacing(column, 4); | |
730 gtk_tree_view_column_set_resizable(column, FALSE); | |
731 gtk_tree_view_column_set_fixed_width(column, 50); | |
732 | |
733 renderer = gtk_cell_renderer_toggle_new(); | |
734 g_signal_connect(renderer, "toggled", | |
735 G_CALLBACK(effect_plugin_toggle), store); | |
736 gtk_tree_view_column_pack_start(column, renderer, TRUE); | |
737 gtk_tree_view_column_set_attributes(column, renderer, "active", | |
738 PLUGIN_VIEW_COL_ACTIVE, NULL); | |
739 | |
740 gtk_tree_view_append_column(treeview, column); | |
741 | |
742 column = gtk_tree_view_column_new(); | |
743 gtk_tree_view_column_set_title(column, _("Description")); | |
744 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); | |
745 gtk_tree_view_column_set_spacing(column, 4); | |
746 gtk_tree_view_column_set_resizable(column, TRUE); | |
747 | |
748 | |
749 renderer = gtk_cell_renderer_text_new(); | |
750 gtk_tree_view_column_pack_start(column, renderer, FALSE); | |
751 gtk_tree_view_column_set_attributes(column, renderer, | |
752 "text", PLUGIN_VIEW_COL_DESC, NULL); | |
753 | |
754 gtk_tree_view_append_column(treeview, column); | |
755 | |
756 | |
757 column = gtk_tree_view_column_new(); | |
758 gtk_tree_view_column_set_title(column, _("Filename")); | |
759 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); | |
760 gtk_tree_view_column_set_spacing(column, 4); | |
761 gtk_tree_view_column_set_resizable(column, TRUE); | |
762 | |
763 renderer = gtk_cell_renderer_text_new(); | |
764 gtk_tree_view_column_pack_start(column, renderer, TRUE); | |
765 gtk_tree_view_column_set_attributes(column, renderer, "text", | |
766 PLUGIN_VIEW_COL_FILENAME, NULL); | |
767 | |
768 gtk_tree_view_append_column(treeview, column); | |
769 | |
770 for (elist = get_effect_list(); elist; elist = g_list_next(elist)) { | |
771 EffectPlugin *ep = EFFECT_PLUGIN(elist->data); | |
772 | |
773 description[0] = g_strdup(ep->description); | |
774 description[1] = g_strdup(ep->filename); | |
775 | |
776 enabled = effect_enabled(id); | |
777 | |
778 gtk_list_store_append(store, &iter); | |
779 gtk_list_store_set(store, &iter, | |
780 PLUGIN_VIEW_COL_ACTIVE, enabled, | |
781 PLUGIN_VIEW_COL_DESC, description[0], | |
782 PLUGIN_VIEW_COL_FILENAME, description[1], | |
783 PLUGIN_VIEW_COL_ID, id++, -1); | |
784 | |
785 g_free(description[1]); | |
786 g_free(description[0]); | |
787 } | |
788 | |
789 gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(store)); | |
790 } | |
791 | |
792 static void | |
793 titlestring_tag_menu_callback(GtkMenuItem * menuitem, | |
794 gpointer data) | |
795 { | |
796 const gchar *separator = " - "; | |
797 GladeXML *xml; | |
798 GtkWidget *entry; | |
799 gint item = GPOINTER_TO_INT(data); | |
800 gint pos; | |
801 | |
802 xml = prefswin_get_xml(); | |
803 entry = glade_xml_get_widget(xml, "titlestring_entry"); | |
804 | |
805 pos = gtk_editable_get_position(GTK_EDITABLE(entry)); | |
806 | |
807 /* insert separator as needed */ | |
808 if (g_utf8_strlen(gtk_entry_get_text(GTK_ENTRY(entry)), -1) > 0) | |
809 editable_insert_text(GTK_EDITABLE(entry), separator, &pos); | |
810 | |
811 editable_insert_text(GTK_EDITABLE(entry), _(title_field_tags[item].tag), | |
812 &pos); | |
813 | |
814 gtk_editable_set_position(GTK_EDITABLE(entry), pos); | |
815 } | |
816 | |
817 static void | |
818 on_titlestring_help_button_clicked(GtkButton * button, | |
819 gpointer data) | |
820 { | |
821 | |
822 GtkMenu *menu; | |
823 MenuPos *pos = g_new0(MenuPos, 1); | |
824 GdkWindow *parent; | |
825 | |
826 gint x_ro, y_ro; | |
827 gint x_widget, y_widget; | |
828 gint x_size, y_size; | |
829 | |
830 g_return_if_fail (button != NULL); | |
831 g_return_if_fail (GTK_IS_MENU (data)); | |
832 | |
833 parent = gtk_widget_get_parent_window(GTK_WIDGET(button)); | |
834 | |
835 gdk_drawable_get_size(parent, &x_size, &y_size); | |
836 gdk_window_get_root_origin(GTK_WIDGET(button)->window, &x_ro, &y_ro); | |
837 gdk_window_get_position(GTK_WIDGET(button)->window, &x_widget, &y_widget); | |
838 | |
839 pos->x = x_size + x_ro; | |
840 pos->y = y_size + y_ro - 100; | |
841 | |
842 menu = GTK_MENU(data); | |
843 gtk_menu_popup (menu, NULL, NULL, util_menu_position, pos, | |
844 0, GDK_CURRENT_TIME); | |
845 } | |
846 | |
847 | |
848 static void | |
849 on_titlestring_entry_realize(GtkWidget * entry, | |
850 gpointer data) | |
851 { | |
852 gtk_entry_set_text(GTK_ENTRY(entry), cfg.gentitle_format); | |
853 } | |
854 | |
855 static void | |
856 on_titlestring_entry_changed(GtkWidget * entry, | |
857 gpointer data) | |
858 { | |
859 g_free(cfg.gentitle_format); | |
860 cfg.gentitle_format = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry))); | |
861 } | |
862 | |
863 static void | |
864 on_titlestring_cbox_realize(GtkWidget * cbox, | |
865 gpointer data) | |
866 { | |
867 gtk_combo_box_set_active(GTK_COMBO_BOX(cbox), cfg.titlestring_preset); | |
868 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
|
869 (cfg.titlestring_preset == (gint)n_titlestring_presets)); |
0 | 870 } |
871 | |
872 static void | |
873 on_titlestring_cbox_changed(GtkWidget * cbox, | |
874 gpointer data) | |
875 { | |
876 gint position = gtk_combo_box_get_active(GTK_COMBO_BOX(cbox)); | |
877 | |
878 cfg.titlestring_preset = position; | |
946
8cfe13fcd0c7
[svn] - Forgot a few things regarding titlestrings!
nhjm449
parents:
893
diff
changeset
|
879 gtk_widget_set_sensitive(GTK_WIDGET(data), (position == 6)); |
0 | 880 } |
881 | |
882 static void | |
883 on_mainwin_font_button_font_set(GtkFontButton * button, | |
884 gpointer data) | |
885 { | |
886 g_free(cfg.mainwin_font); | |
887 cfg.mainwin_font = g_strdup(gtk_font_button_get_font_name(button)); | |
888 | |
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
|
889 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
|
890 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
|
891 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
|
892 } |
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
|
893 |
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
|
894 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
|
895 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
|
896 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
|
897 { |
126
2d3d921a44e2
[svn] Fix realize function for the bitmap fonts option.
nenolod
parents:
124
diff
changeset
|
898 gtk_toggle_button_set_active(button, |
2d3d921a44e2
[svn] Fix realize function for the bitmap fonts option.
nenolod
parents:
124
diff
changeset
|
899 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
|
900 } |
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
|
901 |
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
|
902 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
|
903 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
|
904 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
|
905 { |
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
|
906 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
|
907 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
|
908 textbox_set_xfont(mainwin_info, cfg.mainwin_use_xfont, cfg.mainwin_font); |
0 | 909 mainwin_set_info_text(); |
910 draw_main_window(TRUE); | |
911 } | |
912 | |
913 static void | |
914 on_mainwin_font_button_realize(GtkFontButton * button, | |
915 gpointer data) | |
916 { | |
917 gtk_font_button_set_font_name(button, cfg.mainwin_font); | |
918 } | |
919 | |
920 static void | |
921 on_playlist_font_button_font_set(GtkFontButton * button, | |
922 gpointer data) | |
923 { | |
924 g_free(cfg.playlist_font); | |
925 cfg.playlist_font = g_strdup(gtk_font_button_get_font_name(button)); | |
926 | |
927 playlist_list_set_font(cfg.playlist_font); | |
928 playlistwin_update_list(); | |
929 draw_playlist_window(TRUE); | |
930 } | |
931 | |
932 static void | |
933 on_playlist_font_button_realize(GtkFontButton * button, | |
934 gpointer data) | |
935 { | |
936 gtk_font_button_set_font_name(button, cfg.playlist_font); | |
937 } | |
938 | |
939 static void | |
940 on_playlist_show_pl_numbers_realize(GtkToggleButton * button, | |
941 gpointer data) | |
942 { | |
943 gtk_toggle_button_set_active(button, cfg.show_numbers_in_pl); | |
944 } | |
945 | |
946 static void | |
947 on_playlist_show_pl_numbers_toggled(GtkToggleButton * button, | |
948 gpointer data) | |
949 { | |
950 cfg.show_numbers_in_pl = gtk_toggle_button_get_active(button); | |
951 playlistwin_update_list(); | |
952 draw_playlist_window(TRUE); | |
953 } | |
954 | |
955 static void | |
1081 | 956 on_playlist_transparent_realize(GtkToggleButton * button, |
957 gpointer data) | |
958 { | |
959 gtk_toggle_button_set_active(button, cfg.playlist_transparent); | |
960 } | |
961 | |
962 static void | |
963 on_playlist_transparent_toggled(GtkToggleButton * button, | |
964 gpointer data) | |
965 { | |
966 cfg.playlist_transparent = gtk_toggle_button_get_active(button); | |
967 playlistwin_update_list(); | |
968 draw_playlist_window(TRUE); | |
969 } | |
970 | |
971 static void | |
1056
21628529c615
[svn] add the config option to enable/disable separator line in the playlist
yaz
parents:
963
diff
changeset
|
972 on_playlist_show_pl_separator_realize(GtkToggleButton * button, |
21628529c615
[svn] add the config option to enable/disable separator line in the playlist
yaz
parents:
963
diff
changeset
|
973 gpointer data) |
21628529c615
[svn] add the config option to enable/disable separator line in the playlist
yaz
parents:
963
diff
changeset
|
974 { |
21628529c615
[svn] add the config option to enable/disable separator line in the playlist
yaz
parents:
963
diff
changeset
|
975 gtk_toggle_button_set_active(button, cfg.show_separator_in_pl); |
21628529c615
[svn] add the config option to enable/disable separator line in the playlist
yaz
parents:
963
diff
changeset
|
976 } |
21628529c615
[svn] add the config option to enable/disable separator line in the playlist
yaz
parents:
963
diff
changeset
|
977 |
21628529c615
[svn] add the config option to enable/disable separator line in the playlist
yaz
parents:
963
diff
changeset
|
978 static void |
21628529c615
[svn] add the config option to enable/disable separator line in the playlist
yaz
parents:
963
diff
changeset
|
979 on_playlist_show_pl_separator_toggled(GtkToggleButton * button, |
21628529c615
[svn] add the config option to enable/disable separator line in the playlist
yaz
parents:
963
diff
changeset
|
980 gpointer data) |
21628529c615
[svn] add the config option to enable/disable separator line in the playlist
yaz
parents:
963
diff
changeset
|
981 { |
21628529c615
[svn] add the config option to enable/disable separator line in the playlist
yaz
parents:
963
diff
changeset
|
982 cfg.show_separator_in_pl = gtk_toggle_button_get_active(button); |
21628529c615
[svn] add the config option to enable/disable separator line in the playlist
yaz
parents:
963
diff
changeset
|
983 playlistwin_update_list(); |
21628529c615
[svn] add the config option to enable/disable separator line in the playlist
yaz
parents:
963
diff
changeset
|
984 draw_playlist_window(TRUE); |
21628529c615
[svn] add the config option to enable/disable separator line in the playlist
yaz
parents:
963
diff
changeset
|
985 } |
21628529c615
[svn] add the config option to enable/disable separator line in the playlist
yaz
parents:
963
diff
changeset
|
986 |
1163
ff71f891265b
[svn] - Allow to do format detection on demand; instead of immediately on add
nenolod
parents:
1147
diff
changeset
|
987 /* format detection */ |
ff71f891265b
[svn] - Allow to do format detection on demand; instead of immediately on add
nenolod
parents:
1147
diff
changeset
|
988 static void |
ff71f891265b
[svn] - Allow to do format detection on demand; instead of immediately on add
nenolod
parents:
1147
diff
changeset
|
989 on_audio_format_det_cb_toggled(GtkToggleButton * button, |
ff71f891265b
[svn] - Allow to do format detection on demand; instead of immediately on add
nenolod
parents:
1147
diff
changeset
|
990 gpointer data) |
ff71f891265b
[svn] - Allow to do format detection on demand; instead of immediately on add
nenolod
parents:
1147
diff
changeset
|
991 { |
ff71f891265b
[svn] - Allow to do format detection on demand; instead of immediately on add
nenolod
parents:
1147
diff
changeset
|
992 cfg.playlist_detect = gtk_toggle_button_get_active(button); |
ff71f891265b
[svn] - Allow to do format detection on demand; instead of immediately on add
nenolod
parents:
1147
diff
changeset
|
993 } |
ff71f891265b
[svn] - Allow to do format detection on demand; instead of immediately on add
nenolod
parents:
1147
diff
changeset
|
994 |
ff71f891265b
[svn] - Allow to do format detection on demand; instead of immediately on add
nenolod
parents:
1147
diff
changeset
|
995 static void |
ff71f891265b
[svn] - Allow to do format detection on demand; instead of immediately on add
nenolod
parents:
1147
diff
changeset
|
996 on_audio_format_det_cb_realize(GtkToggleButton * button, |
ff71f891265b
[svn] - Allow to do format detection on demand; instead of immediately on add
nenolod
parents:
1147
diff
changeset
|
997 gpointer data) |
ff71f891265b
[svn] - Allow to do format detection on demand; instead of immediately on add
nenolod
parents:
1147
diff
changeset
|
998 { |
ff71f891265b
[svn] - Allow to do format detection on demand; instead of immediately on add
nenolod
parents:
1147
diff
changeset
|
999 gtk_toggle_button_set_active(button, cfg.playlist_detect); |
ff71f891265b
[svn] - Allow to do format detection on demand; instead of immediately on add
nenolod
parents:
1147
diff
changeset
|
1000 } |
ff71f891265b
[svn] - Allow to do format detection on demand; instead of immediately on add
nenolod
parents:
1147
diff
changeset
|
1001 |
1070 | 1002 /* proxy */ |
1003 static void | |
1004 on_proxy_use_realize(GtkToggleButton * button, | |
1005 gpointer data) | |
1006 { | |
1007 ConfigDb *db; | |
1008 gboolean ret; | |
1009 | |
1010 db = bmp_cfg_db_open(); | |
1073 | 1011 |
1012 if (bmp_cfg_db_get_bool(db, NULL, "use_proxy", &ret) != FALSE) | |
1013 gtk_toggle_button_set_active(button, ret); | |
1014 | |
1070 | 1015 bmp_cfg_db_close(db); |
1016 } | |
1017 | |
1018 static void | |
1019 on_proxy_use_toggled(GtkToggleButton * button, | |
1020 gpointer data) | |
1021 { | |
1022 ConfigDb *db; | |
1023 gboolean ret = gtk_toggle_button_get_active(button); | |
1024 | |
1025 db = bmp_cfg_db_open(); | |
1026 bmp_cfg_db_set_bool(db, NULL, "use_proxy", ret); | |
1027 bmp_cfg_db_close(db); | |
1028 } | |
1029 | |
1030 static void | |
1031 on_proxy_auth_realize(GtkToggleButton * button, | |
1032 gpointer data) | |
1033 { | |
1034 ConfigDb *db; | |
1035 gboolean ret; | |
1036 | |
1037 db = bmp_cfg_db_open(); | |
1073 | 1038 |
1039 if (bmp_cfg_db_get_bool(db, NULL, "proxy_use_auth", &ret) != FALSE) | |
1040 gtk_toggle_button_set_active(button, ret); | |
1041 | |
1070 | 1042 bmp_cfg_db_close(db); |
1043 } | |
1044 | |
1045 static void | |
1046 on_proxy_auth_toggled(GtkToggleButton * button, | |
1047 gpointer data) | |
1048 { | |
1049 ConfigDb *db; | |
1050 gboolean ret = gtk_toggle_button_get_active(button); | |
1051 | |
1052 db = bmp_cfg_db_open(); | |
1053 bmp_cfg_db_set_bool(db, NULL, "proxy_use_auth", ret); | |
1054 bmp_cfg_db_close(db); | |
1055 } | |
1056 | |
1057 static void | |
1058 on_proxy_host_realize(GtkEntry * entry, | |
1059 gpointer data) | |
1060 { | |
1061 ConfigDb *db; | |
1062 gchar *ret; | |
1063 | |
1064 db = bmp_cfg_db_open(); | |
1065 | |
1073 | 1066 if (bmp_cfg_db_get_string(db, NULL, "proxy_host", &ret) != FALSE) |
1070 | 1067 gtk_entry_set_text(entry, ret); |
1073 | 1068 |
1069 bmp_cfg_db_close(db); | |
1070 | 1070 } |
1071 | |
1072 static void | |
1073 on_proxy_host_changed(GtkEntry * entry, | |
1074 gpointer data) | |
1075 { | |
1076 ConfigDb *db; | |
1077 gchar *ret = g_strdup(gtk_entry_get_text(entry)); | |
1078 | |
1079 db = bmp_cfg_db_open(); | |
1080 bmp_cfg_db_set_string(db, NULL, "proxy_host", ret); | |
1081 bmp_cfg_db_close(db); | |
1082 | |
1083 g_free(ret); | |
1084 } | |
1085 | |
1086 static void | |
1087 on_proxy_port_realize(GtkEntry * entry, | |
1088 gpointer data) | |
1089 { | |
1090 ConfigDb *db; | |
1091 gchar *ret; | |
1092 | |
1093 db = bmp_cfg_db_open(); | |
1094 | |
1073 | 1095 if (bmp_cfg_db_get_string(db, NULL, "proxy_port", &ret) != FALSE) |
1070 | 1096 gtk_entry_set_text(entry, ret); |
1073 | 1097 |
1098 bmp_cfg_db_close(db); | |
1070 | 1099 } |
1100 | |
1101 static void | |
1102 on_proxy_port_changed(GtkEntry * entry, | |
1103 gpointer data) | |
1104 { | |
1105 ConfigDb *db; | |
1106 gchar *ret = g_strdup(gtk_entry_get_text(entry)); | |
1107 | |
1108 db = bmp_cfg_db_open(); | |
1109 bmp_cfg_db_set_string(db, NULL, "proxy_port", ret); | |
1110 bmp_cfg_db_close(db); | |
1111 | |
1112 g_free(ret); | |
1113 } | |
1114 | |
1115 static void | |
1116 on_proxy_user_realize(GtkEntry * entry, | |
1117 gpointer data) | |
1118 { | |
1119 ConfigDb *db; | |
1120 gchar *ret; | |
1121 | |
1122 db = bmp_cfg_db_open(); | |
1123 | |
1073 | 1124 if (bmp_cfg_db_get_string(db, NULL, "proxy_user", &ret) != FALSE) |
1070 | 1125 gtk_entry_set_text(entry, ret); |
1073 | 1126 |
1127 bmp_cfg_db_close(db); | |
1070 | 1128 } |
1129 | |
1130 static void | |
1131 on_proxy_user_changed(GtkEntry * entry, | |
1132 gpointer data) | |
1133 { | |
1134 ConfigDb *db; | |
1135 gchar *ret = g_strdup(gtk_entry_get_text(entry)); | |
1136 | |
1137 db = bmp_cfg_db_open(); | |
1138 bmp_cfg_db_set_string(db, NULL, "proxy_user", ret); | |
1139 bmp_cfg_db_close(db); | |
1140 | |
1141 g_free(ret); | |
1142 } | |
1143 | |
1144 static void | |
1145 on_proxy_pass_realize(GtkEntry * entry, | |
1146 gpointer data) | |
1147 { | |
1148 ConfigDb *db; | |
1149 gchar *ret; | |
1150 | |
1151 db = bmp_cfg_db_open(); | |
1152 | |
1073 | 1153 if (bmp_cfg_db_get_string(db, NULL, "proxy_pass", &ret) != FALSE) |
1070 | 1154 gtk_entry_set_text(entry, ret); |
1073 | 1155 |
1156 bmp_cfg_db_close(db); | |
1070 | 1157 } |
1158 | |
1159 static void | |
1160 on_proxy_pass_changed(GtkEntry * entry, | |
1161 gpointer data) | |
1162 { | |
1163 ConfigDb *db; | |
1164 gchar *ret = g_strdup(gtk_entry_get_text(entry)); | |
1165 | |
1166 db = bmp_cfg_db_open(); | |
1167 bmp_cfg_db_set_string(db, NULL, "proxy_pass", ret); | |
1168 bmp_cfg_db_close(db); | |
1169 | |
1170 g_free(ret); | |
1171 } | |
1172 | |
1056
21628529c615
[svn] add the config option to enable/disable separator line in the playlist
yaz
parents:
963
diff
changeset
|
1173 static void |
0 | 1174 input_plugin_enable_prefs(GtkTreeView * treeview, |
1175 GtkButton * button) | |
1176 { | |
1177 GtkTreeSelection *selection; | |
1178 GtkTreeModel *model; | |
1179 GtkTreeIter iter; | |
1180 | |
1181 GList *plist; | |
1182 gint id; | |
1183 | |
1184 selection = gtk_tree_view_get_selection(treeview); | |
1185 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
1186 return; | |
1187 | |
1188 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
1189 | |
1190 plist = get_input_list(); | |
1191 plist = g_list_nth(plist, id); | |
1192 | |
1193 gtk_widget_set_sensitive(GTK_WIDGET(button), | |
1194 INPUT_PLUGIN(plist->data)->configure != NULL); | |
1195 } | |
1196 | |
1197 static void | |
1198 input_plugin_enable_info(GtkTreeView * treeview, | |
1199 GtkButton * button) | |
1200 { | |
1201 GtkTreeSelection *selection; | |
1202 GtkTreeModel *model; | |
1203 GtkTreeIter iter; | |
1204 GList *plist; | |
1205 gint id; | |
1206 | |
1207 selection = gtk_tree_view_get_selection(treeview); | |
1208 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
1209 return; | |
1210 | |
1211 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
1212 | |
1213 plist = get_input_list(); | |
1214 plist = g_list_nth(plist, id); | |
1215 | |
1216 gtk_widget_set_sensitive(GTK_WIDGET(button), | |
1217 INPUT_PLUGIN(plist->data)->about != NULL); | |
1218 } | |
1219 | |
1220 | |
1221 static void | |
1222 output_plugin_enable_info(GtkComboBox * cbox, GtkButton * button) | |
1223 { | |
1224 GList *plist; | |
1225 | |
1226 gint id = gtk_combo_box_get_active(cbox); | |
1227 | |
1228 plist = get_output_list(); | |
1229 plist = g_list_nth(plist, id); | |
1230 | |
1231 gtk_widget_set_sensitive(GTK_WIDGET(button), | |
1232 OUTPUT_PLUGIN(plist->data)->about != NULL); | |
1233 } | |
1234 | |
1235 static void | |
1236 output_plugin_enable_prefs(GtkComboBox * cbox, GtkButton * button) | |
1237 { | |
1238 GList *plist; | |
1239 gint id = gtk_combo_box_get_active(cbox); | |
1240 | |
1241 plist = get_output_list(); | |
1242 plist = g_list_nth(plist, id); | |
1243 | |
1244 gtk_widget_set_sensitive(GTK_WIDGET(button), | |
1245 OUTPUT_PLUGIN(plist->data)->configure != NULL); | |
1246 } | |
1247 | |
1248 | |
1249 static void | |
1250 general_plugin_enable_info(GtkTreeView * treeview, | |
1251 GtkButton * button) | |
1252 { | |
1253 GtkTreeSelection *selection; | |
1254 GtkTreeModel *model; | |
1255 GtkTreeIter iter; | |
1256 GList *plist; | |
1257 gint id; | |
1258 | |
1259 selection = gtk_tree_view_get_selection(treeview); | |
1260 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
1261 return; | |
1262 | |
1263 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
1264 | |
1265 plist = get_general_list(); | |
1266 plist = g_list_nth(plist, id); | |
1267 | |
1268 gtk_widget_set_sensitive(GTK_WIDGET(button), | |
1269 GENERAL_PLUGIN(plist->data)->about != NULL); | |
1270 } | |
1271 | |
1272 static void | |
1273 general_plugin_enable_prefs(GtkTreeView * treeview, | |
1274 GtkButton * button) | |
1275 { | |
1276 GtkTreeSelection *selection; | |
1277 GtkTreeModel *model; | |
1278 GtkTreeIter iter; | |
1279 GList *plist; | |
1280 gint id; | |
1281 | |
1282 selection = gtk_tree_view_get_selection(treeview); | |
1283 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
1284 return; | |
1285 | |
1286 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
1287 | |
1288 plist = get_general_list(); | |
1289 plist = g_list_nth(plist, id); | |
1290 | |
1291 gtk_widget_set_sensitive(GTK_WIDGET(button), | |
1292 GENERAL_PLUGIN(plist->data)->configure != NULL); | |
1293 } | |
1294 | |
1295 | |
1296 | |
1297 static void | |
1298 vis_plugin_enable_prefs(GtkTreeView * treeview, | |
1299 GtkButton * button) | |
1300 { | |
1301 GtkTreeSelection *selection; | |
1302 GtkTreeModel *model; | |
1303 GtkTreeIter iter; | |
1304 GList *plist; | |
1305 gint id; | |
1306 | |
1307 selection = gtk_tree_view_get_selection(treeview); | |
1308 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
1309 return; | |
1310 | |
1311 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
1312 | |
1313 plist = get_vis_list(); | |
1314 plist = g_list_nth(plist, id); | |
1315 | |
1316 gtk_widget_set_sensitive(GTK_WIDGET(button), | |
1317 VIS_PLUGIN(plist->data)->configure != NULL); | |
1318 } | |
1319 | |
1320 static void | |
1321 vis_plugin_enable_info(GtkTreeView * treeview, | |
1322 GtkButton * button) | |
1323 { | |
1324 GtkTreeSelection *selection; | |
1325 GtkTreeModel *model; | |
1326 GtkTreeIter iter; | |
1327 GList *plist; | |
1328 gint id; | |
1329 | |
1330 selection = gtk_tree_view_get_selection(treeview); | |
1331 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
1332 return; | |
1333 | |
1334 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
1335 | |
1336 plist = get_vis_list(); | |
1337 plist = g_list_nth(plist, id); | |
1338 | |
1339 gtk_widget_set_sensitive(GTK_WIDGET(button), | |
1340 VIS_PLUGIN(plist->data)->about != NULL); | |
1341 } | |
1342 | |
1343 static void | |
1344 vis_plugin_open_prefs(GtkTreeView * treeview, | |
1345 gpointer data) | |
1346 { | |
1347 GtkTreeSelection *selection; | |
1348 GtkTreeModel *model; | |
1349 GtkTreeIter iter; | |
1350 gint id; | |
1351 | |
1352 selection = gtk_tree_view_get_selection(treeview); | |
1353 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
1354 return; | |
1355 | |
1356 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
1357 vis_configure(id); | |
1358 } | |
1359 | |
1360 | |
1361 static void | |
1362 vis_plugin_open_info(GtkTreeView * treeview, | |
1363 gpointer data) | |
1364 { | |
1365 GtkTreeSelection *selection; | |
1366 GtkTreeModel *model; | |
1367 GtkTreeIter iter; | |
1368 gint id; | |
1369 | |
1370 selection = gtk_tree_view_get_selection(treeview); | |
1371 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
1372 return; | |
1373 | |
1374 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
1375 vis_about(id); | |
1376 } | |
1377 | |
1378 | |
1379 | |
1380 | |
1381 | |
1382 | |
1383 static void | |
1384 effect_plugin_enable_prefs(GtkTreeView * treeview, | |
1385 GtkButton * button) | |
1386 { | |
1387 GtkTreeSelection *selection; | |
1388 GtkTreeModel *model; | |
1389 GtkTreeIter iter; | |
1390 GList *plist; | |
1391 gint id; | |
1392 | |
1393 selection = gtk_tree_view_get_selection(treeview); | |
1394 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
1395 return; | |
1396 | |
1397 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
1398 | |
1399 plist = get_effect_list(); | |
1400 plist = g_list_nth(plist, id); | |
1401 | |
1402 gtk_widget_set_sensitive(GTK_WIDGET(button), | |
1403 EFFECT_PLUGIN(plist->data)->configure != NULL); | |
1404 } | |
1405 | |
1406 static void | |
1407 effect_plugin_enable_info(GtkTreeView * treeview, | |
1408 GtkButton * button) | |
1409 { | |
1410 GtkTreeSelection *selection; | |
1411 GtkTreeModel *model; | |
1412 GtkTreeIter iter; | |
1413 GList *plist; | |
1414 gint id; | |
1415 | |
1416 selection = gtk_tree_view_get_selection(treeview); | |
1417 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
1418 return; | |
1419 | |
1420 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
1421 | |
1422 plist = get_effect_list(); | |
1423 plist = g_list_nth(plist, id); | |
1424 | |
1425 gtk_widget_set_sensitive(GTK_WIDGET(button), | |
1426 EFFECT_PLUGIN(plist->data)->about != NULL); | |
1427 } | |
1428 | |
1429 static void | |
1430 effect_plugin_open_prefs(GtkTreeView * treeview, | |
1431 gpointer data) | |
1432 { | |
1433 GtkTreeSelection *selection; | |
1434 GtkTreeModel *model; | |
1435 GtkTreeIter iter; | |
1436 gint id; | |
1437 | |
1438 selection = gtk_tree_view_get_selection(treeview); | |
1439 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
1440 return; | |
1441 | |
1442 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
1443 effect_configure(id); | |
1444 } | |
1445 | |
1446 | |
1447 static void | |
1448 effect_plugin_open_info(GtkTreeView * treeview, | |
1449 gpointer data) | |
1450 { | |
1451 GtkTreeSelection *selection; | |
1452 GtkTreeModel *model; | |
1453 GtkTreeIter iter; | |
1454 gint id; | |
1455 | |
1456 selection = gtk_tree_view_get_selection(treeview); | |
1457 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
1458 return; | |
1459 | |
1460 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
1461 effect_about(id); | |
1462 } | |
1463 | |
1147 | 1464 static void |
1465 on_output_plugin_bufsize_realize(GtkSpinButton *button, | |
1466 gpointer data) | |
1467 { | |
1468 gtk_spin_button_set_value(button, cfg.output_buffer_size); | |
1469 } | |
0 | 1470 |
1147 | 1471 static void |
1472 on_output_plugin_bufsize_value_changed(GtkSpinButton *button, | |
1473 gpointer data) | |
1474 { | |
1475 cfg.output_buffer_size = gtk_spin_button_get_value_as_int(button); | |
1476 } | |
0 | 1477 |
1478 static void | |
1479 on_mouse_wheel_volume_realize(GtkSpinButton * button, | |
1480 gpointer data) | |
1481 { | |
1482 gtk_spin_button_set_value(button, cfg.mouse_change); | |
1483 } | |
1484 | |
1485 static void | |
1486 on_mouse_wheel_volume_changed(GtkSpinButton * button, | |
1487 gpointer data) | |
1488 { | |
1489 cfg.mouse_change = gtk_spin_button_get_value_as_int(button); | |
1490 } | |
1491 | |
1492 static void | |
1493 on_pause_between_songs_time_realize(GtkSpinButton * button, | |
1494 gpointer data) | |
1495 { | |
1496 gtk_spin_button_set_value(button, cfg.pause_between_songs_time); | |
1497 } | |
1498 | |
1499 static void | |
1500 on_pause_between_songs_time_changed(GtkSpinButton * button, | |
1501 gpointer data) | |
1502 { | |
1503 cfg.pause_between_songs_time = gtk_spin_button_get_value_as_int(button); | |
1504 } | |
1505 | |
1506 static void | |
1507 on_mouse_wheel_scroll_pl_realize(GtkSpinButton * button, | |
1508 gpointer data) | |
1509 { | |
1510 gtk_spin_button_set_value(button, cfg.scroll_pl_by); | |
1511 } | |
1512 | |
1513 static void | |
1514 on_mouse_wheel_scroll_pl_changed(GtkSpinButton * button, | |
1515 gpointer data) | |
1516 { | |
1517 cfg.scroll_pl_by = gtk_spin_button_get_value_as_int(button); | |
1518 } | |
1519 | |
1520 static void | |
1521 on_playlist_convert_underscore_realize(GtkToggleButton * button, | |
1522 gpointer data) | |
1523 { | |
1524 gtk_toggle_button_set_active(button, cfg.convert_underscore); | |
1525 } | |
1526 | |
1527 static void | |
1528 on_playlist_convert_underscore_toggled(GtkToggleButton * button, | |
1529 gpointer data) | |
1530 { | |
1531 cfg.convert_underscore = gtk_toggle_button_get_active(button); | |
1532 } | |
1533 | |
1534 static void | |
1535 on_playlist_no_advance_realize(GtkToggleButton * button, gpointer data) | |
1536 { | |
1537 gtk_toggle_button_set_active(button, cfg.no_playlist_advance); | |
1538 } | |
1539 | |
1540 static void | |
1541 on_playlist_no_advance_toggled(GtkToggleButton * button, gpointer data) | |
1542 { | |
1543 cfg.no_playlist_advance = gtk_toggle_button_get_active(button); | |
1544 } | |
1545 | |
1546 static void | |
893
6afdd0d7e1e1
[svn] Make refreshing optional, default to disabled if Gnome VFS available.
nemo
parents:
887
diff
changeset
|
1547 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
|
1548 { |
6afdd0d7e1e1
[svn] Make refreshing optional, default to disabled if Gnome VFS available.
nemo
parents:
887
diff
changeset
|
1549 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
|
1550 } |
6afdd0d7e1e1
[svn] Make refreshing optional, default to disabled if Gnome VFS available.
nemo
parents:
887
diff
changeset
|
1551 |
6afdd0d7e1e1
[svn] Make refreshing optional, default to disabled if Gnome VFS available.
nemo
parents:
887
diff
changeset
|
1552 static void |
6afdd0d7e1e1
[svn] Make refreshing optional, default to disabled if Gnome VFS available.
nemo
parents:
887
diff
changeset
|
1553 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
|
1554 { |
6afdd0d7e1e1
[svn] Make refreshing optional, default to disabled if Gnome VFS available.
nemo
parents:
887
diff
changeset
|
1555 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
|
1556 } |
6afdd0d7e1e1
[svn] Make refreshing optional, default to disabled if Gnome VFS available.
nemo
parents:
887
diff
changeset
|
1557 |
6afdd0d7e1e1
[svn] Make refreshing optional, default to disabled if Gnome VFS available.
nemo
parents:
887
diff
changeset
|
1558 static void |
0 | 1559 on_playlist_convert_twenty_realize(GtkToggleButton * button, gpointer data) |
1560 { | |
1561 gtk_toggle_button_set_active(button, cfg.convert_twenty); | |
1562 } | |
1563 | |
1564 static void | |
1565 on_playlist_convert_twenty_toggled(GtkToggleButton * button, gpointer data) | |
1566 { | |
1567 cfg.convert_twenty = gtk_toggle_button_get_active(button); | |
1568 } | |
1569 | |
1570 #if 0 | |
1571 static void | |
1572 on_playlist_update_clicked(GtkButton * button, | |
1573 gpointer data) | |
1574 { | |
1575 playlistwin_update_list(); | |
1576 draw_playlist_window(TRUE); | |
1577 } | |
1578 #endif | |
1579 | |
1580 static void | |
1581 on_use_pl_metadata_realize(GtkToggleButton * button, | |
1582 gpointer data) | |
1583 { | |
1584 gboolean state = cfg.use_pl_metadata; | |
1585 gtk_toggle_button_set_active(button, state); | |
1586 gtk_widget_set_sensitive(GTK_WIDGET(data), state); | |
1587 } | |
1588 | |
1589 static void | |
1590 on_use_pl_metadata_toggled(GtkToggleButton * button, | |
1591 gpointer data) | |
1592 { | |
1593 gboolean state = gtk_toggle_button_get_active(button); | |
1594 cfg.use_pl_metadata = state; | |
1595 gtk_widget_set_sensitive(GTK_WIDGET(data), state); | |
1596 } | |
1597 | |
1598 static void | |
1599 on_pause_between_songs_realize(GtkToggleButton * button, | |
1600 gpointer data) | |
1601 { | |
1602 gboolean state = cfg.pause_between_songs; | |
1603 gtk_toggle_button_set_active(button, state); | |
1604 gtk_widget_set_sensitive(GTK_WIDGET(data), state); | |
1605 } | |
1606 | |
1607 static void | |
1608 on_pause_between_songs_toggled(GtkToggleButton * button, | |
1609 gpointer data) | |
1610 { | |
1611 gboolean state = gtk_toggle_button_get_active(button); | |
1612 cfg.pause_between_songs = state; | |
1613 gtk_widget_set_sensitive(GTK_WIDGET(data), state); | |
1614 } | |
1615 | |
1616 static void | |
1617 on_pl_metadata_on_load_realize(GtkRadioButton * button, | |
1618 gpointer data) | |
1619 { | |
1620 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), | |
1621 cfg.get_info_on_load); | |
1622 } | |
1623 | |
1624 static void | |
1625 on_pl_metadata_on_display_realize(GtkRadioButton * button, | |
1626 gpointer data) | |
1627 { | |
1628 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), | |
1629 cfg.get_info_on_demand); | |
1630 } | |
1631 | |
1632 static void | |
1633 on_pl_metadata_on_load_toggled(GtkRadioButton * button, | |
1634 gpointer data) | |
1635 { | |
1636 cfg.get_info_on_load = | |
1637 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)); | |
1638 } | |
1639 | |
1640 static void | |
1641 on_pl_metadata_on_display_toggled(GtkRadioButton * button, | |
1642 gpointer data) | |
1643 { | |
1644 cfg.get_info_on_demand = | |
1645 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)); | |
1646 } | |
1647 | |
1648 static void | |
1649 on_custom_cursors_realize(GtkToggleButton * button, | |
1650 gpointer data) | |
1651 { | |
1652 gtk_toggle_button_set_active(button, cfg.custom_cursors); | |
1653 } | |
1654 | |
1655 static void | |
1656 on_custom_cursors_toggled(GtkToggleButton *togglebutton, | |
1657 gpointer data) | |
1658 { | |
1659 cfg.custom_cursors = gtk_toggle_button_get_active(togglebutton); | |
1660 skin_reload_forced(); | |
1661 } | |
1662 | |
1663 static void | |
1664 on_eq_dir_preset_entry_realize(GtkEntry * entry, | |
1665 gpointer data) | |
1666 { | |
1667 gtk_entry_set_text(entry, cfg.eqpreset_default_file); | |
1668 } | |
1669 | |
1670 static void | |
1671 on_eq_dir_preset_entry_changed(GtkEntry * entry, | |
1672 gpointer data) | |
1673 { | |
1674 g_free(cfg.eqpreset_default_file); | |
1675 cfg.eqpreset_default_file = g_strdup(gtk_entry_get_text(entry)); | |
1676 } | |
1677 | |
1678 static void | |
1679 on_eq_file_preset_entry_realize(GtkEntry * entry, | |
1680 gpointer data) | |
1681 { | |
1682 gtk_entry_set_text(entry, cfg.eqpreset_extension); | |
1683 } | |
1684 | |
1685 static void | |
1686 on_eq_file_preset_entry_changed(GtkEntry * entry, gpointer data) | |
1687 { | |
1688 const gchar *text = gtk_entry_get_text(entry); | |
1689 | |
1690 while (*text == '.') | |
1691 text++; | |
1692 | |
1693 g_free(cfg.eqpreset_extension); | |
1694 cfg.eqpreset_extension = g_strdup(text); | |
1695 } | |
1696 | |
1697 | |
1698 /* FIXME: implement these */ | |
1699 | |
1700 static void | |
1701 on_eq_preset_view_realize(GtkTreeView * treeview, | |
1702 gpointer data) | |
1703 {} | |
1704 | |
1705 static void | |
1706 on_eq_preset_add_clicked(GtkButton * button, | |
1707 gpointer data) | |
1708 {} | |
1709 | |
1710 static void | |
1711 on_eq_preset_remove_clicked(GtkButton * button, | |
1712 gpointer data) | |
1713 {} | |
1714 | |
887 | 1715 static void |
1716 on_skin_refresh_button_clicked(GtkButton * button, | |
1717 gpointer data) | |
1718 { | |
1719 GladeXML *xml; | |
962
a341792533a6
[svn] - Let's not let the user press the skin refresh button while already refreshing ;)
nhjm449
parents:
954
diff
changeset
|
1720 GtkWidget *widget, *widget2; |
887 | 1721 |
1722 const mode_t mode755 = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; | |
1723 | |
1724 del_directory(bmp_paths[BMP_PATH_SKIN_THUMB_DIR]); | |
1725 make_directory(bmp_paths[BMP_PATH_SKIN_THUMB_DIR], mode755); | |
1726 | |
1727 xml = prefswin_get_xml(); | |
1728 | |
1729 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
|
1730 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
|
1731 skin_view_update(GTK_TREE_VIEW(widget), GTK_WIDGET(widget2)); |
887 | 1732 } |
0 | 1733 |
1734 static void | |
1735 prefswin_set_skin_update(gboolean state) | |
1736 { | |
1737 g_object_set_data(G_OBJECT(prefswin), "update-skins", | |
1738 GINT_TO_POINTER(state)); | |
1739 } | |
1740 | |
1741 static gboolean | |
1742 prefswin_get_skin_update(void) | |
1743 { | |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
383
diff
changeset
|
1744 return g_object_get_data(G_OBJECT(prefswin), "update-skins") != 0; |
0 | 1745 } |
1746 | |
1747 static gboolean | |
1748 on_skin_view_visibility_notify(GtkTreeView * treeview, | |
1749 GdkEvent * event, | |
1750 gpointer data) | |
1751 { | |
962
a341792533a6
[svn] - Let's not let the user press the skin refresh button while already refreshing ;)
nhjm449
parents:
954
diff
changeset
|
1752 GladeXML *xml; |
a341792533a6
[svn] - Let's not let the user press the skin refresh button while already refreshing ;)
nhjm449
parents:
954
diff
changeset
|
1753 GtkWidget *widget; |
a341792533a6
[svn] - Let's not let the user press the skin refresh button while already refreshing ;)
nhjm449
parents:
954
diff
changeset
|
1754 |
0 | 1755 if (event->visibility.state == GDK_VISIBILITY_FULLY_OBSCURED) |
1756 return FALSE; | |
1757 | |
1758 if (!prefswin_get_skin_update()) | |
1759 return FALSE; | |
1760 | |
1761 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
|
1762 |
a341792533a6
[svn] - Let's not let the user press the skin refresh button while already refreshing ;)
nhjm449
parents:
954
diff
changeset
|
1763 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
|
1764 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
|
1765 skin_view_update(treeview, GTK_WIDGET(widget)); |
0 | 1766 |
1767 return TRUE; | |
1768 } | |
1769 | |
1770 static void | |
1771 on_category_view_realize(GtkTreeView * treeview, | |
1772 GtkNotebook * notebook) | |
1773 { | |
1774 GtkListStore *store; | |
1775 GtkCellRenderer *renderer; | |
1776 GtkTreeViewColumn *column; | |
1777 GtkTreeSelection *selection; | |
1778 GtkTreeIter iter; | |
1779 GdkPixbuf *img; | |
1184
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
1780 GList *qlist; |
0 | 1781 gint i; |
1782 | |
1783 column = gtk_tree_view_column_new(); | |
1784 gtk_tree_view_column_set_title(column, _("Category")); | |
1785 gtk_tree_view_append_column(treeview, column); | |
1786 gtk_tree_view_column_set_spacing(column, 2); | |
1787 | |
1788 renderer = gtk_cell_renderer_pixbuf_new(); | |
1789 gtk_tree_view_column_pack_start(column, renderer, FALSE); | |
1790 gtk_tree_view_column_set_attributes(column, renderer, "pixbuf", 0, NULL); | |
1791 | |
1792 renderer = gtk_cell_renderer_text_new(); | |
1793 gtk_tree_view_column_pack_start(column, renderer, FALSE); | |
1794 gtk_tree_view_column_set_attributes(column, renderer, "text", 1, NULL); | |
1795 | |
1796 store = gtk_list_store_new(CATEGORY_VIEW_N_COLS, | |
1797 GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_INT); | |
1798 gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(store)); | |
1799 | |
1800 for (i = 0; i < n_categories; i++) { | |
1801 img = gdk_pixbuf_new_from_file(categories[i].icon_path, NULL); | |
1802 gtk_list_store_append(store, &iter); | |
1803 gtk_list_store_set(store, &iter, | |
1804 CATEGORY_VIEW_COL_ICON, img, | |
1805 CATEGORY_VIEW_COL_NAME, | |
1806 gettext(categories[i].name), CATEGORY_VIEW_COL_ID, | |
1807 categories[i].id, -1); | |
1808 g_object_unref(img); | |
1809 } | |
1810 | |
1811 selection = gtk_tree_view_get_selection(treeview); | |
1812 | |
1813 g_signal_connect_swapped(selection, "changed", | |
1814 G_CALLBACK(change_category), notebook); | |
1175 | 1815 |
1816 /* mark the treeview widget as available to third party plugins */ | |
1817 category_treeview = GTK_WIDGET(treeview); | |
1184
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
1818 |
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
1819 for (qlist = category_queue; qlist != NULL && qlist->data; qlist = g_list_next(qlist)) |
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
1820 { |
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
1821 CategoryQueueEntry *ent = (CategoryQueueEntry *) qlist->data; |
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
1822 |
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
1823 prefswin_page_new(ent->container, ent->pg_name, ent->img_url); |
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
1824 prefswin_page_queue_destroy(ent); |
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
1825 } |
0 | 1826 } |
1827 | |
1828 static void | |
1829 mainwin_drag_data_received1(GtkWidget * widget, | |
1830 GdkDragContext * context, | |
1831 gint x, gint y, | |
1832 GtkSelectionData * selection_data, | |
1833 guint info, guint time, | |
1834 gpointer user_data) | |
1835 { | |
1836 gchar *path, *decoded; | |
1837 | |
1838 if (!selection_data->data) { | |
1839 g_warning("DND data string is NULL"); | |
1840 return; | |
1841 } | |
1842 | |
1843 path = (gchar *) selection_data->data; | |
1844 | |
1845 /* FIXME: use a real URL validator/parser */ | |
1846 | |
1847 if (!str_has_prefix_nocase(path, "fonts:///")) | |
1848 return; | |
1849 | |
1850 path[strlen(path) - 2] = 0; /* Why the hell a CR&LF? */ | |
1851 path += 8; | |
1852 | |
1853 /* plain, since we already stripped the first URI part */ | |
1854 decoded = xmms_urldecode_plain(path); | |
1855 | |
1856 /* Get the old font's size, and add it to the dropped | |
1857 * font's name */ | |
1858 cfg.playlist_font = g_strconcat(decoded+1, | |
1859 strrchr(cfg.playlist_font, ' '), | |
1860 NULL); | |
1861 playlist_list_set_font(cfg.playlist_font); | |
1862 playlistwin_update_list(); | |
1863 gtk_font_button_set_font_name(user_data, cfg.playlist_font); | |
1864 | |
1865 g_free(decoded); | |
1866 } | |
1867 | |
1868 static void | |
1869 on_skin_view_drag_data_received(GtkWidget * widget, | |
1870 GdkDragContext * context, | |
1871 gint x, gint y, | |
1872 GtkSelectionData * selection_data, | |
1873 guint info, guint time, | |
1874 gpointer user_data) | |
1875 { | |
1876 ConfigDb *db; | |
1877 gchar *path; | |
1878 | |
962
a341792533a6
[svn] - Let's not let the user press the skin refresh button while already refreshing ;)
nhjm449
parents:
954
diff
changeset
|
1879 GladeXML *xml; |
a341792533a6
[svn] - Let's not let the user press the skin refresh button while already refreshing ;)
nhjm449
parents:
954
diff
changeset
|
1880 GtkWidget *widget2; |
a341792533a6
[svn] - Let's not let the user press the skin refresh button while already refreshing ;)
nhjm449
parents:
954
diff
changeset
|
1881 |
0 | 1882 if (!selection_data->data) { |
1883 g_warning("DND data string is NULL"); | |
1884 return; | |
1885 } | |
1886 | |
1887 path = (gchar *) selection_data->data; | |
1888 | |
1889 /* FIXME: use a real URL validator/parser */ | |
1890 | |
1891 if (str_has_prefix_nocase(path, "file:///")) { | |
1892 path[strlen(path) - 2] = 0; /* Why the hell a CR&LF? */ | |
1893 path += 7; | |
1894 } | |
1895 else if (str_has_prefix_nocase(path, "file:")) { | |
1896 path += 5; | |
1897 } | |
1898 | |
1899 if (file_is_archive(path)) { | |
1900 bmp_active_skin_load(path); | |
1901 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
|
1902 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
|
1903 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
|
1904 skin_view_update(GTK_TREE_VIEW(widget), GTK_WIDGET(widget2)); |
0 | 1905 /* Change skin name in the config file */ |
1906 db = bmp_cfg_db_open(); | |
1907 bmp_cfg_db_set_string(db, NULL, "skin", path); | |
1908 bmp_cfg_db_close(db); | |
1909 } | |
1910 | |
1911 } | |
1912 | |
1105
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1913 static void |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1914 on_chardet_detector_cbox_changed(GtkComboBox * combobox, gpointer data) |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1915 { |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1916 ConfigDb *db; |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1917 gint position; |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1918 |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1919 position = gtk_combo_box_get_active(GTK_COMBO_BOX(combobox)); |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1920 cfg.chardet_detector = (char *)chardet_detector_presets[position]; |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1921 |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1922 db = bmp_cfg_db_open(); |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1923 bmp_cfg_db_set_string(db, NULL, "chardet_detector", cfg.chardet_detector); |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1924 bmp_cfg_db_close(db); |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1925 gtk_widget_set_sensitive(GTK_WIDGET(data), 1); |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1926 } |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1927 |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1928 static void |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1929 on_chardet_detector_cbox_realize(GtkComboBox *combobox, gpointer data) |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1930 { |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1931 ConfigDb *db; |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1932 gchar *ret=NULL; |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1933 guint i=0,index=0; |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1934 |
1109
95365899992e
[svn] - audacious should pick runtime library up from ${libdir}.
yaz
parents:
1105
diff
changeset
|
1935 for(i=0; i<n_chardet_detector_presets; i++) { |
95365899992e
[svn] - audacious should pick runtime library up from ${libdir}.
yaz
parents:
1105
diff
changeset
|
1936 gtk_combo_box_append_text(combobox, chardet_detector_presets[i]); |
95365899992e
[svn] - audacious should pick runtime library up from ${libdir}.
yaz
parents:
1105
diff
changeset
|
1937 } |
95365899992e
[svn] - audacious should pick runtime library up from ${libdir}.
yaz
parents:
1105
diff
changeset
|
1938 |
1105
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1939 db = bmp_cfg_db_open(); |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1940 if(bmp_cfg_db_get_string(db, NULL, "chardet_detector", &ret) != FALSE) { |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1941 for(i=0; i<n_chardet_detector_presets; i++) { |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1942 if(!strcmp(chardet_detector_presets[i], ret)) { |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1943 cfg.chardet_detector = (char *)chardet_detector_presets[i]; |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1944 index = i; |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1945 } |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1946 } |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1947 } |
1109
95365899992e
[svn] - audacious should pick runtime library up from ${libdir}.
yaz
parents:
1105
diff
changeset
|
1948 bmp_cfg_db_close(db); |
95365899992e
[svn] - audacious should pick runtime library up from ${libdir}.
yaz
parents:
1105
diff
changeset
|
1949 |
1105
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1950 #ifdef USE_CHARDET |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1951 gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), index); |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1952 gtk_widget_set_sensitive(GTK_WIDGET(data), 1); |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1953 g_signal_connect(combobox, "changed", |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1954 G_CALLBACK(on_chardet_detector_cbox_changed), NULL); |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1955 #else |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1956 gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), -1); |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1957 gtk_widget_set_sensitive(GTK_WIDGET(combobox), 0); |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1958 #endif |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1959 if(ret) |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1960 g_free(ret); |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1961 } |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1962 |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1963 static void |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1964 on_chardet_fallback_realize(GtkEntry *entry, gpointer data) |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1965 { |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1966 ConfigDb *db; |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1967 gchar *ret; |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1968 |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1969 db = bmp_cfg_db_open(); |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1970 |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1971 if (bmp_cfg_db_get_string(db, NULL, "chardet_fallback", &ret) != FALSE) { |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1972 if(cfg.chardet_fallback) |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1973 g_free(cfg.chardet_fallback); |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1974 cfg.chardet_fallback = ret; |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1975 gtk_entry_set_text(entry, cfg.chardet_fallback); |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1976 } |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1977 bmp_cfg_db_close(db); |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1978 } |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1979 |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1980 static void |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1981 on_chardet_fallback_changed(GtkEntry *entry, gpointer data) |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1982 { |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1983 ConfigDb *db; |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1984 gchar *ret; |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1985 |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1986 ret = g_strdup(gtk_entry_get_text(entry)); |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1987 |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1988 if(cfg.chardet_fallback) |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1989 g_free(cfg.chardet_fallback); |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1990 cfg.chardet_fallback = ret; |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1991 |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1992 db = bmp_cfg_db_open(); |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1993 bmp_cfg_db_set_string(db, NULL, "chardet_fallback", cfg.chardet_fallback); |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1994 bmp_cfg_db_close(db); |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1995 } |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
1996 |
0 | 1997 /* FIXME: complete the map */ |
1998 FUNC_MAP_BEGIN(prefswin_func_map) | |
1999 FUNC_MAP_ENTRY(on_input_plugin_view_realize) | |
2000 FUNC_MAP_ENTRY(on_output_plugin_cbox_realize) | |
2001 FUNC_MAP_ENTRY(on_general_plugin_view_realize) | |
2002 FUNC_MAP_ENTRY(on_vis_plugin_view_realize) | |
2003 FUNC_MAP_ENTRY(on_effect_plugin_view_realize) | |
2004 FUNC_MAP_ENTRY(on_custom_cursors_realize) | |
2005 FUNC_MAP_ENTRY(on_custom_cursors_toggled) | |
2006 FUNC_MAP_ENTRY(on_mainwin_font_button_realize) | |
2007 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
|
2008 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
|
2009 FUNC_MAP_ENTRY(on_use_bitmap_fonts_toggled) |
0 | 2010 FUNC_MAP_ENTRY(on_mouse_wheel_volume_realize) |
2011 FUNC_MAP_ENTRY(on_mouse_wheel_volume_changed) | |
2012 FUNC_MAP_ENTRY(on_mouse_wheel_scroll_pl_realize) | |
2013 FUNC_MAP_ENTRY(on_mouse_wheel_scroll_pl_changed) | |
2014 FUNC_MAP_ENTRY(on_pause_between_songs_time_realize) | |
2015 FUNC_MAP_ENTRY(on_pause_between_songs_time_changed) | |
2016 FUNC_MAP_ENTRY(on_pl_metadata_on_load_realize) | |
2017 FUNC_MAP_ENTRY(on_pl_metadata_on_load_toggled) | |
2018 FUNC_MAP_ENTRY(on_pl_metadata_on_display_realize) | |
2019 FUNC_MAP_ENTRY(on_pl_metadata_on_display_toggled) | |
2020 FUNC_MAP_ENTRY(on_playlist_show_pl_numbers_realize) | |
2021 FUNC_MAP_ENTRY(on_playlist_show_pl_numbers_toggled) | |
1056
21628529c615
[svn] add the config option to enable/disable separator line in the playlist
yaz
parents:
963
diff
changeset
|
2022 FUNC_MAP_ENTRY(on_playlist_show_pl_separator_realize) |
21628529c615
[svn] add the config option to enable/disable separator line in the playlist
yaz
parents:
963
diff
changeset
|
2023 FUNC_MAP_ENTRY(on_playlist_show_pl_separator_toggled) |
1081 | 2024 FUNC_MAP_ENTRY(on_playlist_transparent_realize) |
2025 FUNC_MAP_ENTRY(on_playlist_transparent_toggled) | |
0 | 2026 FUNC_MAP_ENTRY(on_playlist_convert_twenty_realize) |
2027 FUNC_MAP_ENTRY(on_playlist_convert_twenty_toggled) | |
2028 FUNC_MAP_ENTRY(on_playlist_convert_underscore_realize) | |
2029 FUNC_MAP_ENTRY(on_playlist_convert_underscore_toggled) | |
2030 FUNC_MAP_ENTRY(on_playlist_font_button_realize) | |
2031 FUNC_MAP_ENTRY(on_playlist_font_button_font_set) | |
2032 FUNC_MAP_ENTRY(on_playlist_no_advance_realize) | |
2033 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
|
2034 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
|
2035 FUNC_MAP_ENTRY(on_refresh_file_list_toggled) |
0 | 2036 FUNC_MAP_ENTRY(on_skin_view_visibility_notify) |
2037 FUNC_MAP_ENTRY(on_titlestring_entry_realize) | |
2038 FUNC_MAP_ENTRY(on_titlestring_entry_changed) | |
2039 FUNC_MAP_ENTRY(on_eq_dir_preset_entry_realize) | |
2040 FUNC_MAP_ENTRY(on_eq_dir_preset_entry_changed) | |
2041 FUNC_MAP_ENTRY(on_eq_file_preset_entry_realize) | |
2042 FUNC_MAP_ENTRY(on_eq_file_preset_entry_changed) | |
2043 FUNC_MAP_ENTRY(on_eq_preset_view_realize) | |
2044 FUNC_MAP_ENTRY(on_eq_preset_add_clicked) | |
2045 FUNC_MAP_ENTRY(on_eq_preset_remove_clicked) | |
954 | 2046 FUNC_MAP_ENTRY(on_skin_refresh_button_clicked) |
1070 | 2047 FUNC_MAP_ENTRY(on_proxy_use_toggled) |
2048 FUNC_MAP_ENTRY(on_proxy_use_realize) | |
2049 FUNC_MAP_ENTRY(on_proxy_auth_toggled) | |
2050 FUNC_MAP_ENTRY(on_proxy_auth_realize) | |
2051 FUNC_MAP_ENTRY(on_proxy_host_realize) | |
2052 FUNC_MAP_ENTRY(on_proxy_host_changed) | |
2053 FUNC_MAP_ENTRY(on_proxy_port_realize) | |
2054 FUNC_MAP_ENTRY(on_proxy_port_changed) | |
2055 FUNC_MAP_ENTRY(on_proxy_user_realize) | |
2056 FUNC_MAP_ENTRY(on_proxy_user_changed) | |
2057 FUNC_MAP_ENTRY(on_proxy_pass_realize) | |
2058 FUNC_MAP_ENTRY(on_proxy_pass_changed) | |
1105
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
2059 FUNC_MAP_ENTRY(on_chardet_detector_cbox_realize) |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
2060 FUNC_MAP_ENTRY(on_chardet_detector_cbox_changed) |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
2061 FUNC_MAP_ENTRY(on_chardet_fallback_realize) |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
2062 FUNC_MAP_ENTRY(on_chardet_fallback_changed) |
1147 | 2063 FUNC_MAP_ENTRY(on_output_plugin_bufsize_realize) |
2064 FUNC_MAP_ENTRY(on_output_plugin_bufsize_value_changed) | |
1163
ff71f891265b
[svn] - Allow to do format detection on demand; instead of immediately on add
nenolod
parents:
1147
diff
changeset
|
2065 FUNC_MAP_ENTRY(on_audio_format_det_cb_toggled) |
ff71f891265b
[svn] - Allow to do format detection on demand; instead of immediately on add
nenolod
parents:
1147
diff
changeset
|
2066 FUNC_MAP_ENTRY(on_audio_format_det_cb_realize) |
0 | 2067 FUNC_MAP_END |
2068 | |
2069 void | |
2070 create_prefs_window(void) | |
2071 { | |
2072 const gchar *glade_file = DATA_DIR "/glade/prefswin.glade"; | |
2073 | |
2074 GladeXML *xml; | |
2075 GtkWidget *widget, *widget2; | |
816
8073d8300502
[svn] display audacious version and revision in the prefs window
giacomo
parents:
625
diff
changeset
|
2076 GString *aud_version_string; |
0 | 2077 |
2078 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
|
2079 guint i; |
0 | 2080 |
2081 /* load the interface */ | |
2082 xml = glade_xml_new_or_die(_("Preferences Window"), glade_file, NULL, | |
2083 NULL); | |
2084 | |
2085 | |
2086 /* connect the signals in the interface */ | |
2087 glade_xml_signal_autoconnect_map(xml, prefswin_func_map); | |
2088 | |
2089 prefswin = glade_xml_get_widget(xml, "prefswin"); | |
2090 g_object_set_data(G_OBJECT(prefswin), "glade-xml", xml); | |
2091 gtk_window_set_transient_for(GTK_WINDOW(prefswin), GTK_WINDOW(mainwin)); | |
2092 | |
2093 /* create category view */ | |
2094 widget = glade_xml_get_widget(xml, "category_view"); | |
2095 widget2 = glade_xml_get_widget(xml, "category_notebook"); | |
2096 g_signal_connect_after(G_OBJECT(widget), "realize", | |
2097 G_CALLBACK(on_category_view_realize), | |
2098 widget2); | |
2099 | |
1180 | 2100 category_treeview = GTK_WIDGET(widget); |
1175 | 2101 category_notebook = GTK_WIDGET(widget2); |
2102 | |
0 | 2103 /* plugin->input page */ |
2104 | |
2105 widget = glade_xml_get_widget(xml, "input_plugin_view"); | |
2106 widget2 = glade_xml_get_widget(xml, "input_plugin_prefs"); | |
2107 g_signal_connect(G_OBJECT(widget), "cursor-changed", | |
2108 G_CALLBACK(input_plugin_enable_prefs), | |
2109 widget2); | |
2110 | |
2111 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
2112 G_CALLBACK(input_plugin_open_prefs), | |
2113 widget); | |
2114 widget2 = glade_xml_get_widget(xml, "input_plugin_info"); | |
2115 g_signal_connect(G_OBJECT(widget), "cursor-changed", | |
2116 G_CALLBACK(input_plugin_enable_info), | |
2117 widget2); | |
2118 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
2119 G_CALLBACK(input_plugin_open_info), | |
2120 widget); | |
2121 | |
2122 /* plugin->output page */ | |
2123 | |
2124 widget = glade_xml_get_widget(xml, "output_plugin_cbox"); | |
2125 | |
2126 widget2 = glade_xml_get_widget(xml, "output_plugin_prefs"); | |
2127 g_signal_connect(G_OBJECT(widget), "changed", | |
2128 G_CALLBACK(output_plugin_enable_prefs), | |
2129 widget2); | |
2130 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
2131 G_CALLBACK(output_plugin_open_prefs), | |
2132 widget); | |
2133 | |
2134 widget2 = glade_xml_get_widget(xml, "output_plugin_info"); | |
2135 g_signal_connect(G_OBJECT(widget), "changed", | |
2136 G_CALLBACK(output_plugin_enable_info), | |
2137 widget2); | |
2138 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
2139 G_CALLBACK(output_plugin_open_info), | |
2140 widget); | |
2141 | |
2142 /* plugin->general page */ | |
2143 | |
2144 widget = glade_xml_get_widget(xml, "general_plugin_view"); | |
2145 | |
2146 widget2 = glade_xml_get_widget(xml, "general_plugin_prefs"); | |
2147 g_signal_connect(G_OBJECT(widget), "cursor-changed", | |
2148 G_CALLBACK(general_plugin_enable_prefs), | |
2149 widget2); | |
2150 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
2151 G_CALLBACK(general_plugin_open_prefs), | |
2152 widget); | |
2153 | |
2154 widget2 = glade_xml_get_widget(xml, "general_plugin_info"); | |
2155 g_signal_connect(G_OBJECT(widget), "cursor-changed", | |
2156 G_CALLBACK(general_plugin_enable_info), | |
2157 widget2); | |
2158 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
2159 G_CALLBACK(general_plugin_open_info), | |
2160 widget); | |
2161 | |
2162 | |
2163 /* plugin->vis page */ | |
2164 | |
2165 widget = glade_xml_get_widget(xml, "vis_plugin_view"); | |
2166 widget2 = glade_xml_get_widget(xml, "vis_plugin_prefs"); | |
2167 | |
2168 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
2169 G_CALLBACK(vis_plugin_open_prefs), | |
2170 widget); | |
2171 g_signal_connect(G_OBJECT(widget), "cursor-changed", | |
2172 G_CALLBACK(vis_plugin_enable_prefs), widget2); | |
2173 | |
2174 | |
2175 widget2 = glade_xml_get_widget(xml, "vis_plugin_info"); | |
2176 g_signal_connect(G_OBJECT(widget), "cursor-changed", | |
2177 G_CALLBACK(vis_plugin_enable_info), widget2); | |
2178 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
2179 G_CALLBACK(vis_plugin_open_info), | |
2180 widget); | |
2181 | |
2182 | |
2183 /* plugin->effects page */ | |
2184 | |
2185 widget = glade_xml_get_widget(xml, "effect_plugin_view"); | |
2186 widget2 = glade_xml_get_widget(xml, "effect_plugin_prefs"); | |
2187 | |
2188 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
2189 G_CALLBACK(effect_plugin_open_prefs), | |
2190 widget); | |
2191 g_signal_connect(G_OBJECT(widget), "cursor-changed", | |
2192 G_CALLBACK(effect_plugin_enable_prefs), widget2); | |
2193 | |
2194 | |
2195 widget2 = glade_xml_get_widget(xml, "effect_plugin_info"); | |
2196 g_signal_connect(G_OBJECT(widget), "cursor-changed", | |
2197 G_CALLBACK(effect_plugin_enable_info), widget2); | |
2198 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
2199 G_CALLBACK(effect_plugin_open_info), | |
2200 widget); | |
2201 | |
2202 /* playlist page */ | |
2203 | |
2204 widget = glade_xml_get_widget(xml, "pause_between_songs_box"); | |
2205 widget2 = glade_xml_get_widget(xml, "pause_between_songs"); | |
2206 g_signal_connect_after(G_OBJECT(widget2), "realize", | |
2207 G_CALLBACK(on_pause_between_songs_realize), | |
2208 widget); | |
2209 g_signal_connect(G_OBJECT(widget2), "toggled", | |
2210 G_CALLBACK(on_pause_between_songs_toggled), | |
2211 widget); | |
2212 | |
2213 widget = glade_xml_get_widget(xml, "playlist_use_metadata_box"); | |
2214 widget2 = glade_xml_get_widget(xml, "playlist_use_metadata"); | |
2215 g_signal_connect_after(G_OBJECT(widget2), "realize", | |
2216 G_CALLBACK(on_use_pl_metadata_realize), | |
2217 widget); | |
2218 g_signal_connect(G_OBJECT(widget2), "toggled", | |
2219 G_CALLBACK(on_use_pl_metadata_toggled), | |
2220 widget); | |
2221 | |
2222 widget = glade_xml_get_widget(xml, "skin_view"); | |
2223 g_signal_connect(widget, "drag-data-received", | |
2224 G_CALLBACK(on_skin_view_drag_data_received), | |
2225 NULL); | |
2226 bmp_drag_dest_set(widget); | |
2227 | |
2228 g_signal_connect(mainwin, "drag-data-received", | |
2229 G_CALLBACK(mainwin_drag_data_received), | |
2230 widget); | |
2231 | |
887 | 2232 widget = glade_xml_get_widget(xml, "skin_refresh_button"); |
2233 g_signal_connect(widget, "clicked", | |
2234 G_CALLBACK(on_skin_refresh_button_clicked), | |
2235 NULL); | |
2236 | |
2237 widget = glade_xml_get_widget(xml, "playlist_font_button"); | |
0 | 2238 g_signal_connect(mainwin, "drag-data-received", |
2239 G_CALLBACK(mainwin_drag_data_received1), | |
2240 widget); | |
2241 | |
2242 widget = glade_xml_get_widget(xml, "titlestring_cbox"); | |
2243 widget2 = glade_xml_get_widget(xml, "titlestring_entry"); | |
2244 g_signal_connect(widget, "realize", | |
2245 G_CALLBACK(on_titlestring_cbox_realize), | |
2246 widget2); | |
2247 g_signal_connect(widget, "changed", | |
2248 G_CALLBACK(on_titlestring_cbox_changed), | |
2249 widget2); | |
2250 | |
2251 /* FIXME: move this into a function */ | |
2252 /* create tag menu */ | |
2253 titlestring_tag_menu = gtk_menu_new(); | |
2254 for(i = 0; i < n_title_field_tags; i++) { | |
2255 menu_item = gtk_menu_item_new_with_label(_(title_field_tags[i].name)); | |
2256 gtk_menu_shell_append(GTK_MENU_SHELL(titlestring_tag_menu), menu_item); | |
2257 g_signal_connect(menu_item, "activate", | |
2258 G_CALLBACK(titlestring_tag_menu_callback), | |
2259 GINT_TO_POINTER(i)); | |
2260 }; | |
2261 gtk_widget_show_all(titlestring_tag_menu); | |
2262 | |
2263 widget = glade_xml_get_widget(xml, "titlestring_help_button"); | |
2264 widget2 = glade_xml_get_widget(xml, "titlestring_cbox"); | |
2265 | |
2266 g_signal_connect(widget2, "changed", | |
2267 G_CALLBACK(on_titlestring_cbox_changed), | |
2268 widget); | |
2269 g_signal_connect(widget, "clicked", | |
2270 G_CALLBACK(on_titlestring_help_button_clicked), | |
2271 titlestring_tag_menu); | |
816
8073d8300502
[svn] display audacious version and revision in the prefs window
giacomo
parents:
625
diff
changeset
|
2272 |
8073d8300502
[svn] display audacious version and revision in the prefs window
giacomo
parents:
625
diff
changeset
|
2273 /* audacious version label */ |
8073d8300502
[svn] display audacious version and revision in the prefs window
giacomo
parents:
625
diff
changeset
|
2274 widget = glade_xml_get_widget(xml, "audversionlabel"); |
8073d8300502
[svn] display audacious version and revision in the prefs window
giacomo
parents:
625
diff
changeset
|
2275 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
|
2276 |
824 | 2277 if (strcasecmp(svn_stamp, "exported")) |
822
c5eb4b762977
[svn] - only show the SVN revision if we know what it is
nenolod
parents:
818
diff
changeset
|
2278 { |
1135 | 2279 g_string_printf( aud_version_string , "<span size='small'>%s (r%s) (%s@%s)</span>" , "Audacious " PACKAGE_VERSION , |
822
c5eb4b762977
[svn] - only show the SVN revision if we know what it is
nenolod
parents:
818
diff
changeset
|
2280 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
|
2281 } |
c5eb4b762977
[svn] - only show the SVN revision if we know what it is
nenolod
parents:
818
diff
changeset
|
2282 else |
c5eb4b762977
[svn] - only show the SVN revision if we know what it is
nenolod
parents:
818
diff
changeset
|
2283 { |
1135 | 2284 g_string_printf( aud_version_string , "<span size='small'>%s (%s@%s)</span>" , "Audacious " PACKAGE_VERSION , |
822
c5eb4b762977
[svn] - only show the SVN revision if we know what it is
nenolod
parents:
818
diff
changeset
|
2285 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
|
2286 } |
c5eb4b762977
[svn] - only show the SVN revision if we know what it is
nenolod
parents:
818
diff
changeset
|
2287 |
1135 | 2288 gtk_label_set_markup( GTK_LABEL(widget) , aud_version_string->str ); |
816
8073d8300502
[svn] display audacious version and revision in the prefs window
giacomo
parents:
625
diff
changeset
|
2289 g_string_free( aud_version_string , TRUE ); |
1180 | 2290 |
2291 gtk_widget_realize(prefswin); | |
0 | 2292 } |
2293 | |
2294 void | |
2295 show_prefs_window(void) | |
2296 { | |
2297 prefswin_set_skin_update(TRUE); | |
2298 gtk_widget_show(prefswin); | |
2299 } | |
1105
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1081
diff
changeset
|
2300 |
1184
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
2301 static void |
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
2302 prefswin_page_queue_new(GtkWidget *container, gchar *name, gchar *imgurl) |
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
2303 { |
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
2304 CategoryQueueEntry *ent = g_new0(CategoryQueueEntry, 1); |
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
2305 |
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
2306 ent->container = container; |
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
2307 ent->pg_name = name; |
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
2308 ent->img_url = imgurl; |
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
2309 category_queue = g_list_append(category_queue, ent); |
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
2310 } |
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
2311 |
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
2312 static void |
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
2313 prefswin_page_queue_destroy(CategoryQueueEntry *ent) |
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
2314 { |
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
2315 category_queue = g_list_remove(category_queue, ent); |
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
2316 g_free(ent); |
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
2317 } |
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
2318 |
1175 | 2319 /* |
2320 * Public APIs for adding new pages to the prefs window. | |
2321 * | |
2322 * Basically, the concept here is that third party components can register themselves in the root | |
2323 * preferences window. | |
2324 * | |
2325 * From a usability standpoint this makes the application look more "united", instead of cluttered | |
2326 * and malorganised. Hopefully this option will be used further in the future. | |
2327 * | |
2328 * - nenolod | |
2329 */ | |
1185 | 2330 gint |
1178 | 2331 prefswin_page_new(GtkWidget *container, gchar *name, gchar *imgurl) |
1175 | 2332 { |
2333 GtkTreeModel *model; | |
2334 GtkTreeIter iter; | |
2335 GdkPixbuf *img = NULL; | |
2336 GtkTreeView *treeview = GTK_TREE_VIEW(category_treeview); | |
2337 gint id; | |
2338 | |
2339 if (treeview == NULL || container == NULL || category_notebook == NULL) | |
1184
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
2340 { |
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
2341 prefswin_page_queue_new(container, name, imgurl); |
1185 | 2342 return -1; |
1184
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
2343 } |
1175 | 2344 |
2345 model = gtk_tree_view_get_model(treeview); | |
2346 | |
2347 if (model == NULL) | |
1184
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
2348 { |
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
2349 prefswin_page_queue_new(container, name, imgurl); |
1185 | 2350 return -1; |
1184
b146ec74d778
[svn] - place plugins we cannot register UIs for right now in a queue and register them later
nenolod
parents:
1180
diff
changeset
|
2351 } |
1175 | 2352 |
1186
d7848ff5bbe5
[svn] - prefswin_page_destroy() code, example will be added to the scrobbler plugin momentarily
nenolod
parents:
1185
diff
changeset
|
2353 /* Make sure the widgets are visible. */ |
1180 | 2354 gtk_widget_show(container); |
1175 | 2355 id = gtk_notebook_append_page(GTK_NOTEBOOK(category_notebook), container, NULL); |
2356 | |
2357 if (id == -1) | |
1185 | 2358 return -1; |
1175 | 2359 |
2360 if (imgurl != NULL) | |
2361 img = gdk_pixbuf_new_from_file(imgurl, NULL); | |
2362 | |
2363 gtk_list_store_append(GTK_LIST_STORE(model), &iter); | |
2364 gtk_list_store_set(GTK_LIST_STORE(model), &iter, | |
2365 CATEGORY_VIEW_COL_ICON, img, | |
2366 CATEGORY_VIEW_COL_NAME, | |
2367 name, CATEGORY_VIEW_COL_ID, id, -1); | |
2368 | |
2369 if (img != NULL) | |
2370 g_object_unref(img); | |
2371 | |
1185 | 2372 return id; |
1175 | 2373 } |
1186
d7848ff5bbe5
[svn] - prefswin_page_destroy() code, example will be added to the scrobbler plugin momentarily
nenolod
parents:
1185
diff
changeset
|
2374 |
d7848ff5bbe5
[svn] - prefswin_page_destroy() code, example will be added to the scrobbler plugin momentarily
nenolod
parents:
1185
diff
changeset
|
2375 void |
1188 | 2376 prefswin_page_destroy(GtkWidget *container) |
1186
d7848ff5bbe5
[svn] - prefswin_page_destroy() code, example will be added to the scrobbler plugin momentarily
nenolod
parents:
1185
diff
changeset
|
2377 { |
d7848ff5bbe5
[svn] - prefswin_page_destroy() code, example will be added to the scrobbler plugin momentarily
nenolod
parents:
1185
diff
changeset
|
2378 GtkTreeModel *model; |
d7848ff5bbe5
[svn] - prefswin_page_destroy() code, example will be added to the scrobbler plugin momentarily
nenolod
parents:
1185
diff
changeset
|
2379 GtkTreeIter iter; |
d7848ff5bbe5
[svn] - prefswin_page_destroy() code, example will be added to the scrobbler plugin momentarily
nenolod
parents:
1185
diff
changeset
|
2380 GtkTreeView *treeview = GTK_TREE_VIEW(category_treeview); |
d7848ff5bbe5
[svn] - prefswin_page_destroy() code, example will be added to the scrobbler plugin momentarily
nenolod
parents:
1185
diff
changeset
|
2381 gboolean ret; |
1188 | 2382 gint id; |
2383 | |
2384 if (category_notebook == NULL || treeview == NULL || container == NULL) | |
2385 return; | |
2386 | |
2387 id = gtk_notebook_page_num(GTK_NOTEBOOK(category_notebook), container); | |
2388 | |
2389 if (id == -1) | |
1186
d7848ff5bbe5
[svn] - prefswin_page_destroy() code, example will be added to the scrobbler plugin momentarily
nenolod
parents:
1185
diff
changeset
|
2390 return; |
d7848ff5bbe5
[svn] - prefswin_page_destroy() code, example will be added to the scrobbler plugin momentarily
nenolod
parents:
1185
diff
changeset
|
2391 |
d7848ff5bbe5
[svn] - prefswin_page_destroy() code, example will be added to the scrobbler plugin momentarily
nenolod
parents:
1185
diff
changeset
|
2392 gtk_notebook_remove_page(GTK_NOTEBOOK(category_notebook), id); |
d7848ff5bbe5
[svn] - prefswin_page_destroy() code, example will be added to the scrobbler plugin momentarily
nenolod
parents:
1185
diff
changeset
|
2393 |
d7848ff5bbe5
[svn] - prefswin_page_destroy() code, example will be added to the scrobbler plugin momentarily
nenolod
parents:
1185
diff
changeset
|
2394 model = gtk_tree_view_get_model(treeview); |
d7848ff5bbe5
[svn] - prefswin_page_destroy() code, example will be added to the scrobbler plugin momentarily
nenolod
parents:
1185
diff
changeset
|
2395 |
d7848ff5bbe5
[svn] - prefswin_page_destroy() code, example will be added to the scrobbler plugin momentarily
nenolod
parents:
1185
diff
changeset
|
2396 if (model == NULL) |
d7848ff5bbe5
[svn] - prefswin_page_destroy() code, example will be added to the scrobbler plugin momentarily
nenolod
parents:
1185
diff
changeset
|
2397 return; |
d7848ff5bbe5
[svn] - prefswin_page_destroy() code, example will be added to the scrobbler plugin momentarily
nenolod
parents:
1185
diff
changeset
|
2398 |
d7848ff5bbe5
[svn] - prefswin_page_destroy() code, example will be added to the scrobbler plugin momentarily
nenolod
parents:
1185
diff
changeset
|
2399 ret = gtk_tree_model_get_iter_first(model, &iter); |
d7848ff5bbe5
[svn] - prefswin_page_destroy() code, example will be added to the scrobbler plugin momentarily
nenolod
parents:
1185
diff
changeset
|
2400 |
d7848ff5bbe5
[svn] - prefswin_page_destroy() code, example will be added to the scrobbler plugin momentarily
nenolod
parents:
1185
diff
changeset
|
2401 while (ret == TRUE) |
d7848ff5bbe5
[svn] - prefswin_page_destroy() code, example will be added to the scrobbler plugin momentarily
nenolod
parents:
1185
diff
changeset
|
2402 { |
d7848ff5bbe5
[svn] - prefswin_page_destroy() code, example will be added to the scrobbler plugin momentarily
nenolod
parents:
1185
diff
changeset
|
2403 gint index = -1; |
d7848ff5bbe5
[svn] - prefswin_page_destroy() code, example will be added to the scrobbler plugin momentarily
nenolod
parents:
1185
diff
changeset
|
2404 |
d7848ff5bbe5
[svn] - prefswin_page_destroy() code, example will be added to the scrobbler plugin momentarily
nenolod
parents:
1185
diff
changeset
|
2405 gtk_tree_model_get(model, &iter, CATEGORY_VIEW_COL_ID, &index, -1); |
d7848ff5bbe5
[svn] - prefswin_page_destroy() code, example will be added to the scrobbler plugin momentarily
nenolod
parents:
1185
diff
changeset
|
2406 |
d7848ff5bbe5
[svn] - prefswin_page_destroy() code, example will be added to the scrobbler plugin momentarily
nenolod
parents:
1185
diff
changeset
|
2407 if (index == id) |
d7848ff5bbe5
[svn] - prefswin_page_destroy() code, example will be added to the scrobbler plugin momentarily
nenolod
parents:
1185
diff
changeset
|
2408 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
d7848ff5bbe5
[svn] - prefswin_page_destroy() code, example will be added to the scrobbler plugin momentarily
nenolod
parents:
1185
diff
changeset
|
2409 |
d7848ff5bbe5
[svn] - prefswin_page_destroy() code, example will be added to the scrobbler plugin momentarily
nenolod
parents:
1185
diff
changeset
|
2410 ret = gtk_tree_model_iter_next(model, &iter); |
d7848ff5bbe5
[svn] - prefswin_page_destroy() code, example will be added to the scrobbler plugin momentarily
nenolod
parents:
1185
diff
changeset
|
2411 } |
d7848ff5bbe5
[svn] - prefswin_page_destroy() code, example will be added to the scrobbler plugin momentarily
nenolod
parents:
1185
diff
changeset
|
2412 } |