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