Mercurial > audlegacy
annotate src/audacious/ui_preferences.c @ 3478:481a4a88d3ec trunk
Use old iterator when new one isn't found
author | Kieran Clancy <clancy.kieran+audacious@gmail.com> |
---|---|
date | Mon, 10 Sep 2007 14:16:20 +0930 |
parents | b0f4ab42dd3b |
children | f8880f2e0501 e235357029ba |
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); |
2313 | 588 } |
589 | |
590 static void | |
591 on_use_bitmap_fonts_realize(GtkToggleButton * button, | |
592 gpointer data) | |
593 { | |
594 gtk_toggle_button_set_active(button, | |
595 cfg.mainwin_use_xfont != FALSE ? FALSE : TRUE); | |
596 } | |
597 | |
598 static void | |
599 on_use_bitmap_fonts_toggled(GtkToggleButton * button, | |
600 gpointer data) | |
601 { | |
602 gboolean useit = gtk_toggle_button_get_active(button); | |
603 cfg.mainwin_use_xfont = useit != FALSE ? FALSE : TRUE; | |
2911 | 604 ui_skinned_textbox_set_xfont(mainwin_info, cfg.mainwin_use_xfont, cfg.mainwin_font); |
2313 | 605 playlistwin_set_sinfo_font(cfg.playlist_font); |
606 | |
607 if (cfg.playlist_shaded) { | |
608 playlistwin_update_list(playlist_get_active()); | |
3221
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3217
diff
changeset
|
609 ui_skinned_window_draw_all(playlistwin); |
2313 | 610 } |
611 } | |
612 | |
613 static void | |
614 on_mainwin_font_button_realize(GtkFontButton * button, | |
615 gpointer data) | |
616 { | |
617 gtk_font_button_set_font_name(button, cfg.mainwin_font); | |
618 } | |
619 | |
620 static void | |
621 on_playlist_font_button_font_set(GtkFontButton * button, | |
622 gpointer data) | |
623 { | |
624 g_free(cfg.playlist_font); | |
625 cfg.playlist_font = g_strdup(gtk_font_button_get_font_name(button)); | |
626 | |
3217 | 627 ui_skinned_playlist_set_font(cfg.playlist_font); |
2313 | 628 playlistwin_set_sinfo_font(cfg.playlist_font); /* propagate font setting to playlistwin_sinfo */ |
629 playlistwin_update_list(playlist_get_active()); | |
3221
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3217
diff
changeset
|
630 gtk_widget_queue_draw(playlistwin_list); |
2313 | 631 } |
632 | |
633 static void | |
634 on_playlist_font_button_realize(GtkFontButton * button, | |
635 gpointer data) | |
636 { | |
637 gtk_font_button_set_font_name(button, cfg.playlist_font); | |
638 } | |
639 | |
640 static void | |
641 on_playlist_show_pl_numbers_realize(GtkToggleButton * button, | |
642 gpointer data) | |
643 { | |
644 gtk_toggle_button_set_active(button, cfg.show_numbers_in_pl); | |
645 } | |
646 | |
647 static void | |
648 on_playlist_show_pl_numbers_toggled(GtkToggleButton * button, | |
649 gpointer data) | |
650 { | |
651 cfg.show_numbers_in_pl = gtk_toggle_button_get_active(button); | |
652 playlistwin_update_list(playlist_get_active()); | |
3221
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3217
diff
changeset
|
653 gtk_widget_queue_draw(playlistwin_list); |
2313 | 654 } |
655 | |
656 static void | |
657 on_playlist_show_pl_separator_realize(GtkToggleButton * button, | |
658 gpointer data) | |
659 { | |
660 gtk_toggle_button_set_active(button, cfg.show_separator_in_pl); | |
661 } | |
662 | |
663 static void | |
664 on_playlist_show_pl_separator_toggled(GtkToggleButton * button, | |
665 gpointer data) | |
666 { | |
667 cfg.show_separator_in_pl = gtk_toggle_button_get_active(button); | |
668 playlistwin_update_list(playlist_get_active()); | |
3221
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3217
diff
changeset
|
669 gtk_widget_queue_draw(playlistwin_list); |
2313 | 670 } |
671 | |
672 /* format detection */ | |
673 static void | |
674 on_audio_format_det_cb_toggled(GtkToggleButton * button, | |
675 gpointer data) | |
676 { | |
677 cfg.playlist_detect = gtk_toggle_button_get_active(button); | |
678 } | |
679 | |
680 static void | |
681 on_audio_format_det_cb_realize(GtkToggleButton * button, | |
682 gpointer data) | |
683 { | |
684 gtk_toggle_button_set_active(button, cfg.playlist_detect); | |
685 } | |
686 | |
687 static void | |
688 on_detect_by_extension_cb_toggled(GtkToggleButton * button, | |
689 gpointer data) | |
690 { | |
691 cfg.use_extension_probing = gtk_toggle_button_get_active(button); | |
692 } | |
693 | |
694 static void | |
695 on_detect_by_extension_cb_realize(GtkToggleButton * button, | |
696 gpointer data) | |
697 { | |
698 gtk_toggle_button_set_active(button, cfg.use_extension_probing); | |
699 } | |
700 | |
701 /* proxy */ | |
702 static void | |
703 on_proxy_use_realize(GtkToggleButton * button, | |
704 gpointer data) | |
705 { | |
706 ConfigDb *db; | |
707 gboolean ret; | |
708 | |
709 db = bmp_cfg_db_open(); | |
710 | |
711 if (bmp_cfg_db_get_bool(db, NULL, "use_proxy", &ret) != FALSE) | |
712 gtk_toggle_button_set_active(button, ret); | |
713 | |
714 bmp_cfg_db_close(db); | |
715 } | |
716 | |
717 static void | |
718 on_proxy_use_toggled(GtkToggleButton * button, | |
719 gpointer data) | |
720 { | |
721 ConfigDb *db; | |
722 gboolean ret = gtk_toggle_button_get_active(button); | |
723 | |
724 db = bmp_cfg_db_open(); | |
725 bmp_cfg_db_set_bool(db, NULL, "use_proxy", ret); | |
726 bmp_cfg_db_close(db); | |
727 } | |
728 | |
729 static void | |
730 on_proxy_auth_realize(GtkToggleButton * button, | |
731 gpointer data) | |
732 { | |
733 ConfigDb *db; | |
734 gboolean ret; | |
735 | |
736 db = bmp_cfg_db_open(); | |
737 | |
738 if (bmp_cfg_db_get_bool(db, NULL, "proxy_use_auth", &ret) != FALSE) | |
739 gtk_toggle_button_set_active(button, ret); | |
740 | |
741 bmp_cfg_db_close(db); | |
742 } | |
743 | |
744 static void | |
745 on_proxy_auth_toggled(GtkToggleButton * button, | |
746 gpointer data) | |
747 { | |
748 ConfigDb *db; | |
749 gboolean ret = gtk_toggle_button_get_active(button); | |
750 | |
751 db = bmp_cfg_db_open(); | |
752 bmp_cfg_db_set_bool(db, NULL, "proxy_use_auth", ret); | |
753 bmp_cfg_db_close(db); | |
754 } | |
755 | |
756 static void | |
757 on_proxy_host_realize(GtkEntry * entry, | |
758 gpointer data) | |
759 { | |
760 ConfigDb *db; | |
761 gchar *ret; | |
762 | |
763 db = bmp_cfg_db_open(); | |
764 | |
765 if (bmp_cfg_db_get_string(db, NULL, "proxy_host", &ret) != FALSE) | |
766 gtk_entry_set_text(entry, ret); | |
767 | |
768 bmp_cfg_db_close(db); | |
769 } | |
770 | |
771 static void | |
772 on_proxy_host_changed(GtkEntry * entry, | |
773 gpointer data) | |
774 { | |
775 ConfigDb *db; | |
776 gchar *ret = g_strdup(gtk_entry_get_text(entry)); | |
777 | |
778 db = bmp_cfg_db_open(); | |
779 bmp_cfg_db_set_string(db, NULL, "proxy_host", ret); | |
780 bmp_cfg_db_close(db); | |
781 | |
782 g_free(ret); | |
783 } | |
784 | |
785 static void | |
786 on_proxy_port_realize(GtkEntry * entry, | |
787 gpointer data) | |
788 { | |
789 ConfigDb *db; | |
790 gchar *ret; | |
791 | |
792 db = bmp_cfg_db_open(); | |
793 | |
794 if (bmp_cfg_db_get_string(db, NULL, "proxy_port", &ret) != FALSE) | |
795 gtk_entry_set_text(entry, ret); | |
796 | |
797 bmp_cfg_db_close(db); | |
798 } | |
799 | |
800 static void | |
801 on_proxy_port_changed(GtkEntry * entry, | |
802 gpointer data) | |
803 { | |
804 ConfigDb *db; | |
805 gchar *ret = g_strdup(gtk_entry_get_text(entry)); | |
806 | |
807 db = bmp_cfg_db_open(); | |
808 bmp_cfg_db_set_string(db, NULL, "proxy_port", ret); | |
809 bmp_cfg_db_close(db); | |
810 | |
811 g_free(ret); | |
812 } | |
813 | |
814 static void | |
815 on_proxy_user_realize(GtkEntry * entry, | |
816 gpointer data) | |
817 { | |
818 ConfigDb *db; | |
819 gchar *ret; | |
820 | |
821 db = bmp_cfg_db_open(); | |
822 | |
823 if (bmp_cfg_db_get_string(db, NULL, "proxy_user", &ret) != FALSE) | |
824 gtk_entry_set_text(entry, ret); | |
825 | |
826 bmp_cfg_db_close(db); | |
827 } | |
828 | |
829 static void | |
830 on_proxy_user_changed(GtkEntry * entry, | |
831 gpointer data) | |
832 { | |
833 ConfigDb *db; | |
834 gchar *ret = g_strdup(gtk_entry_get_text(entry)); | |
835 | |
836 db = bmp_cfg_db_open(); | |
837 bmp_cfg_db_set_string(db, NULL, "proxy_user", ret); | |
838 bmp_cfg_db_close(db); | |
839 | |
840 g_free(ret); | |
841 } | |
842 | |
843 static void | |
844 on_proxy_pass_realize(GtkEntry * entry, | |
845 gpointer data) | |
846 { | |
847 ConfigDb *db; | |
848 gchar *ret; | |
849 | |
850 db = bmp_cfg_db_open(); | |
851 | |
852 if (bmp_cfg_db_get_string(db, NULL, "proxy_pass", &ret) != FALSE) | |
853 gtk_entry_set_text(entry, ret); | |
854 | |
855 bmp_cfg_db_close(db); | |
856 } | |
857 | |
858 static void | |
859 on_proxy_pass_changed(GtkEntry * entry, | |
860 gpointer data) | |
861 { | |
862 ConfigDb *db; | |
863 gchar *ret = g_strdup(gtk_entry_get_text(entry)); | |
864 | |
865 db = bmp_cfg_db_open(); | |
866 bmp_cfg_db_set_string(db, NULL, "proxy_pass", ret); | |
867 bmp_cfg_db_close(db); | |
868 | |
869 g_free(ret); | |
870 } | |
871 | |
872 static void | |
3356 | 873 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
|
874 { |
1cd5fb04e05b
double click on plugin row opens plugin config (if available)
Tomasz Mon <desowin@gmail.com>
parents:
3251
diff
changeset
|
875 GtkTreeSelection *selection; |
1cd5fb04e05b
double click on plugin row opens plugin config (if available)
Tomasz Mon <desowin@gmail.com>
parents:
3251
diff
changeset
|
876 GtkTreeModel *model; |
1cd5fb04e05b
double click on plugin row opens plugin config (if available)
Tomasz Mon <desowin@gmail.com>
parents:
3251
diff
changeset
|
877 GtkTreeIter iter; |
3442
b0f4ab42dd3b
Rework configuration and about calls.
William Pitcock <nenolod@atheme.org>
parents:
3441
diff
changeset
|
878 Plugin *plugin = NULL; |
3353
1cd5fb04e05b
double click on plugin row opens plugin config (if available)
Tomasz Mon <desowin@gmail.com>
parents:
3251
diff
changeset
|
879 |
1cd5fb04e05b
double click on plugin row opens plugin config (if available)
Tomasz Mon <desowin@gmail.com>
parents:
3251
diff
changeset
|
880 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
|
881 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
|
882 return; |
3442
b0f4ab42dd3b
Rework configuration and about calls.
William Pitcock <nenolod@atheme.org>
parents:
3441
diff
changeset
|
883 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
|
884 |
3442
b0f4ab42dd3b
Rework configuration and about calls.
William Pitcock <nenolod@atheme.org>
parents:
3441
diff
changeset
|
885 g_return_if_fail(plugin != NULL); |
b0f4ab42dd3b
Rework configuration and about calls.
William Pitcock <nenolod@atheme.org>
parents:
3441
diff
changeset
|
886 |
b0f4ab42dd3b
Rework configuration and about calls.
William Pitcock <nenolod@atheme.org>
parents:
3441
diff
changeset
|
887 plugin->configure(); |
3353
1cd5fb04e05b
double click on plugin row opens plugin config (if available)
Tomasz Mon <desowin@gmail.com>
parents:
3251
diff
changeset
|
888 } |
1cd5fb04e05b
double click on plugin row opens plugin config (if available)
Tomasz Mon <desowin@gmail.com>
parents:
3251
diff
changeset
|
889 |
1cd5fb04e05b
double click on plugin row opens plugin config (if available)
Tomasz Mon <desowin@gmail.com>
parents:
3251
diff
changeset
|
890 static void |
3357 | 891 plugin_treeview_open_info(GtkTreeView *treeview) |
892 { | |
893 GtkTreeSelection *selection; | |
894 GtkTreeModel *model; | |
895 GtkTreeIter iter; | |
3442
b0f4ab42dd3b
Rework configuration and about calls.
William Pitcock <nenolod@atheme.org>
parents:
3441
diff
changeset
|
896 Plugin *plugin = NULL; |
3357 | 897 |
898 selection = gtk_tree_view_get_selection(treeview); | |
899 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
900 return; | |
3442
b0f4ab42dd3b
Rework configuration and about calls.
William Pitcock <nenolod@atheme.org>
parents:
3441
diff
changeset
|
901 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_PLUGIN_PTR, &plugin, -1); |
3357 | 902 |
3442
b0f4ab42dd3b
Rework configuration and about calls.
William Pitcock <nenolod@atheme.org>
parents:
3441
diff
changeset
|
903 g_return_if_fail(plugin != NULL); |
b0f4ab42dd3b
Rework configuration and about calls.
William Pitcock <nenolod@atheme.org>
parents:
3441
diff
changeset
|
904 |
b0f4ab42dd3b
Rework configuration and about calls.
William Pitcock <nenolod@atheme.org>
parents:
3441
diff
changeset
|
905 plugin->about(); |
3357 | 906 } |
907 | |
908 static void | |
3355
31ecb89e871c
introduce plugin_treeview_enable_prefs and plugin_treeview_enable_info
Tomasz Mon <desowin@gmail.com>
parents:
3353
diff
changeset
|
909 plugin_treeview_enable_prefs(GtkTreeView * treeview, GtkButton * button) |
2313 | 910 { |
911 GtkTreeSelection *selection; | |
912 GtkTreeModel *model; | |
913 GtkTreeIter iter; | |
3442
b0f4ab42dd3b
Rework configuration and about calls.
William Pitcock <nenolod@atheme.org>
parents:
3441
diff
changeset
|
914 Plugin *plugin = NULL; |
2313 | 915 |
916 selection = gtk_tree_view_get_selection(treeview); | |
917 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
918 return; | |
919 | |
3442
b0f4ab42dd3b
Rework configuration and about calls.
William Pitcock <nenolod@atheme.org>
parents:
3441
diff
changeset
|
920 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_PLUGIN_PTR, &plugin, -1); |
2313 | 921 |
3442
b0f4ab42dd3b
Rework configuration and about calls.
William Pitcock <nenolod@atheme.org>
parents:
3441
diff
changeset
|
922 g_return_if_fail(plugin != NULL); |
2313 | 923 |
3442
b0f4ab42dd3b
Rework configuration and about calls.
William Pitcock <nenolod@atheme.org>
parents:
3441
diff
changeset
|
924 gtk_widget_set_sensitive(GTK_WIDGET(button), plugin->configure != NULL); |
2313 | 925 } |
926 | |
927 static void | |
3355
31ecb89e871c
introduce plugin_treeview_enable_prefs and plugin_treeview_enable_info
Tomasz Mon <desowin@gmail.com>
parents:
3353
diff
changeset
|
928 plugin_treeview_enable_info(GtkTreeView * treeview, GtkButton * button) |
2313 | 929 { |
930 GtkTreeSelection *selection; | |
931 GtkTreeModel *model; | |
932 GtkTreeIter iter; | |
3442
b0f4ab42dd3b
Rework configuration and about calls.
William Pitcock <nenolod@atheme.org>
parents:
3441
diff
changeset
|
933 Plugin *plugin = NULL; |
2313 | 934 |
935 selection = gtk_tree_view_get_selection(treeview); | |
936 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
937 return; | |
938 | |
3442
b0f4ab42dd3b
Rework configuration and about calls.
William Pitcock <nenolod@atheme.org>
parents:
3441
diff
changeset
|
939 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_PLUGIN_PTR, &plugin, -1); |
2313 | 940 |
3442
b0f4ab42dd3b
Rework configuration and about calls.
William Pitcock <nenolod@atheme.org>
parents:
3441
diff
changeset
|
941 g_return_if_fail(plugin != NULL); |
2313 | 942 |
3442
b0f4ab42dd3b
Rework configuration and about calls.
William Pitcock <nenolod@atheme.org>
parents:
3441
diff
changeset
|
943 gtk_widget_set_sensitive(GTK_WIDGET(button), plugin->about != NULL); |
2313 | 944 } |
945 | |
946 | |
947 static void | |
948 output_plugin_enable_info(GtkComboBox * cbox, GtkButton * button) | |
949 { | |
950 GList *plist; | |
951 | |
952 gint id = gtk_combo_box_get_active(cbox); | |
953 | |
954 plist = get_output_list(); | |
955 plist = g_list_nth(plist, id); | |
956 | |
957 gtk_widget_set_sensitive(GTK_WIDGET(button), | |
958 OUTPUT_PLUGIN(plist->data)->about != NULL); | |
959 } | |
960 | |
961 static void | |
962 output_plugin_enable_prefs(GtkComboBox * cbox, GtkButton * button) | |
963 { | |
964 GList *plist; | |
965 gint id = gtk_combo_box_get_active(cbox); | |
966 | |
967 plist = get_output_list(); | |
968 plist = g_list_nth(plist, id); | |
969 | |
970 gtk_widget_set_sensitive(GTK_WIDGET(button), | |
971 OUTPUT_PLUGIN(plist->data)->configure != NULL); | |
972 } | |
973 | |
974 static void | |
975 on_output_plugin_bufsize_realize(GtkSpinButton *button, | |
976 gpointer data) | |
977 { | |
978 gtk_spin_button_set_value(button, cfg.output_buffer_size); | |
979 } | |
980 | |
981 static void | |
982 on_output_plugin_bufsize_value_changed(GtkSpinButton *button, | |
983 gpointer data) | |
984 { | |
985 cfg.output_buffer_size = gtk_spin_button_get_value_as_int(button); | |
986 } | |
987 | |
988 static void | |
989 on_mouse_wheel_volume_realize(GtkSpinButton * button, | |
990 gpointer data) | |
991 { | |
992 gtk_spin_button_set_value(button, cfg.mouse_change); | |
993 } | |
994 | |
995 static void | |
996 on_mouse_wheel_volume_changed(GtkSpinButton * button, | |
997 gpointer data) | |
998 { | |
999 cfg.mouse_change = gtk_spin_button_get_value_as_int(button); | |
1000 } | |
1001 | |
1002 static void | |
1003 on_pause_between_songs_time_realize(GtkSpinButton * button, | |
1004 gpointer data) | |
1005 { | |
1006 gtk_spin_button_set_value(button, cfg.pause_between_songs_time); | |
1007 } | |
1008 | |
1009 static void | |
1010 on_pause_between_songs_time_changed(GtkSpinButton * button, | |
1011 gpointer data) | |
1012 { | |
1013 cfg.pause_between_songs_time = gtk_spin_button_get_value_as_int(button); | |
1014 } | |
1015 | |
1016 static void | |
2538
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1017 on_enable_src_realize(GtkToggleButton * button, |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1018 gpointer data) |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1019 { |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1020 #ifdef USE_SRC |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1021 ConfigDb *db; |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1022 gboolean ret; |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1023 |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1024 db = bmp_cfg_db_open(); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1025 |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1026 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
|
1027 gtk_toggle_button_set_active(button, ret); |
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 bmp_cfg_db_close(db); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1030 #else |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1031 gtk_toggle_button_set_active(button, FALSE); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1032 gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1033 #endif |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1034 } |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1035 |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1036 static void |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1037 on_enable_src_toggled(GtkToggleButton * button, |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1038 gpointer data) |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1039 { |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1040 ConfigDb *db; |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1041 gboolean ret = gtk_toggle_button_get_active(button); |
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 db = bmp_cfg_db_open(); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1044 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
|
1045 bmp_cfg_db_close(db); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1046 } |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1047 |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1048 static void |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1049 on_src_rate_realize(GtkSpinButton * button, |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1050 gpointer data) |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1051 { |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1052 #ifdef USE_SRC |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1053 ConfigDb *db; |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1054 gint value; |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1055 |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1056 db = bmp_cfg_db_open(); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1057 |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1058 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
|
1059 gtk_spin_button_set_value(button, (gdouble)value); |
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 bmp_cfg_db_close(db); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1062 #else |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1063 gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1064 #endif |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1065 } |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1066 |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1067 static void |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1068 on_src_rate_value_changed(GtkSpinButton * button, |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1069 gpointer data) |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1070 { |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1071 ConfigDb *db; |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1072 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
|
1073 |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1074 db = bmp_cfg_db_open(); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1075 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
|
1076 bmp_cfg_db_close(db); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1077 } |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1078 |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1079 static void |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1080 on_src_converter_type_realize(GtkComboBox * box, |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1081 gpointer data) |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1082 { |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1083 #ifdef USE_SRC |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1084 ConfigDb *db; |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1085 gint value; |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1086 |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1087 db = bmp_cfg_db_open(); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1088 |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1089 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
|
1090 gtk_combo_box_set_active(box, value); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1091 else |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1092 gtk_combo_box_set_active(box, 0); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1093 |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1094 bmp_cfg_db_close(db); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1095 #else |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1096 gtk_widget_set_sensitive(GTK_WIDGET(box), FALSE); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1097 #endif |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1098 } |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1099 |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1100 static void |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1101 on_src_converter_type_changed(GtkComboBox * box, |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1102 gpointer data) |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1103 { |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1104 ConfigDb *db; |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1105 gint value = gtk_combo_box_get_active(box); |
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 db = bmp_cfg_db_open(); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1108 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
|
1109 bmp_cfg_db_close(db); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1110 } |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1111 |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1112 static void |
2313 | 1113 on_mouse_wheel_scroll_pl_realize(GtkSpinButton * button, |
1114 gpointer data) | |
1115 { | |
1116 gtk_spin_button_set_value(button, cfg.scroll_pl_by); | |
1117 } | |
1118 | |
1119 static void | |
1120 on_mouse_wheel_scroll_pl_changed(GtkSpinButton * button, | |
1121 gpointer data) | |
1122 { | |
1123 cfg.scroll_pl_by = gtk_spin_button_get_value_as_int(button); | |
1124 } | |
1125 | |
1126 static void | |
1127 on_playlist_convert_underscore_realize(GtkToggleButton * button, | |
1128 gpointer data) | |
1129 { | |
1130 gtk_toggle_button_set_active(button, cfg.convert_underscore); | |
1131 } | |
1132 | |
1133 static void | |
1134 on_playlist_convert_underscore_toggled(GtkToggleButton * button, | |
1135 gpointer data) | |
1136 { | |
1137 cfg.convert_underscore = gtk_toggle_button_get_active(button); | |
1138 } | |
1139 | |
1140 static void | |
1141 on_playlist_no_advance_realize(GtkToggleButton * button, gpointer data) | |
1142 { | |
1143 gtk_toggle_button_set_active(button, cfg.no_playlist_advance); | |
1144 } | |
1145 | |
1146 static void | |
1147 on_playlist_no_advance_toggled(GtkToggleButton * button, gpointer data) | |
1148 { | |
1149 cfg.no_playlist_advance = gtk_toggle_button_get_active(button); | |
1150 } | |
1151 | |
1152 static void | |
1153 on_continue_playback_on_startup_realize(GtkToggleButton * button, gpointer data) | |
1154 { | |
1155 gtk_toggle_button_set_active(button, cfg.resume_playback_on_startup); | |
1156 } | |
1157 | |
1158 static void | |
1159 on_continue_playback_on_startup_toggled(GtkToggleButton * button, gpointer data) | |
1160 { | |
1161 cfg.resume_playback_on_startup = gtk_toggle_button_get_active(button); | |
1162 } | |
1163 | |
1164 static void | |
1165 on_refresh_file_list_realize(GtkToggleButton * button, gpointer data) | |
1166 { | |
1167 gtk_toggle_button_set_active(button, cfg.refresh_file_list); | |
1168 } | |
1169 | |
1170 static void | |
1171 on_refresh_file_list_toggled(GtkToggleButton * button, gpointer data) | |
1172 { | |
1173 cfg.refresh_file_list = gtk_toggle_button_get_active(button); | |
1174 } | |
1175 | |
1176 static void | |
1177 on_playlist_convert_twenty_realize(GtkToggleButton * button, gpointer data) | |
1178 { | |
1179 gtk_toggle_button_set_active(button, cfg.convert_twenty); | |
1180 } | |
1181 | |
1182 static void | |
1183 on_playlist_convert_twenty_toggled(GtkToggleButton * button, gpointer data) | |
1184 { | |
1185 cfg.convert_twenty = gtk_toggle_button_get_active(button); | |
1186 } | |
1187 | |
1188 static void | |
1189 on_playlist_convert_slash_realize(GtkToggleButton * button, gpointer data) | |
1190 { | |
1191 gtk_toggle_button_set_active(button, cfg.convert_slash); | |
1192 } | |
1193 | |
1194 static void | |
1195 on_playlist_convert_slash_toggled(GtkToggleButton * button, gpointer data) | |
1196 { | |
1197 cfg.convert_slash = gtk_toggle_button_get_active(button); | |
1198 } | |
1199 | |
1200 static void | |
1201 on_use_pl_metadata_realize(GtkToggleButton * button, | |
1202 gpointer data) | |
1203 { | |
1204 gboolean state = cfg.use_pl_metadata; | |
1205 gtk_toggle_button_set_active(button, state); | |
1206 gtk_widget_set_sensitive(GTK_WIDGET(data), state); | |
1207 } | |
1208 | |
1209 static void | |
1210 on_use_pl_metadata_toggled(GtkToggleButton * button, | |
1211 gpointer data) | |
1212 { | |
1213 gboolean state = gtk_toggle_button_get_active(button); | |
1214 cfg.use_pl_metadata = state; | |
1215 gtk_widget_set_sensitive(GTK_WIDGET(data), state); | |
1216 } | |
1217 | |
1218 static void | |
1219 on_pause_between_songs_realize(GtkToggleButton * button, | |
1220 gpointer data) | |
1221 { | |
1222 gboolean state = cfg.pause_between_songs; | |
1223 gtk_toggle_button_set_active(button, state); | |
1224 gtk_widget_set_sensitive(GTK_WIDGET(data), state); | |
1225 } | |
1226 | |
1227 static void | |
1228 on_pause_between_songs_toggled(GtkToggleButton * button, | |
1229 gpointer data) | |
1230 { | |
1231 gboolean state = gtk_toggle_button_get_active(button); | |
1232 cfg.pause_between_songs = state; | |
1233 gtk_widget_set_sensitive(GTK_WIDGET(data), state); | |
1234 } | |
1235 | |
1236 static void | |
1237 on_pl_metadata_on_load_realize(GtkRadioButton * button, | |
1238 gpointer data) | |
1239 { | |
1240 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), | |
1241 cfg.get_info_on_load); | |
1242 } | |
1243 | |
1244 static void | |
1245 on_pl_metadata_on_display_realize(GtkRadioButton * button, | |
1246 gpointer data) | |
1247 { | |
1248 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), | |
1249 cfg.get_info_on_demand); | |
1250 } | |
1251 | |
1252 static void | |
1253 on_pl_metadata_on_load_toggled(GtkRadioButton * button, | |
1254 gpointer data) | |
1255 { | |
1256 cfg.get_info_on_load = | |
1257 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)); | |
1258 } | |
1259 | |
1260 static void | |
1261 on_pl_metadata_on_display_toggled(GtkRadioButton * button, | |
1262 gpointer data) | |
1263 { | |
1264 cfg.get_info_on_demand = | |
1265 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)); | |
1266 } | |
1267 | |
1268 static void | |
1269 on_custom_cursors_realize(GtkToggleButton * button, | |
1270 gpointer data) | |
1271 { | |
1272 gtk_toggle_button_set_active(button, cfg.custom_cursors); | |
1273 } | |
1274 | |
1275 static void | |
1276 on_custom_cursors_toggled(GtkToggleButton *togglebutton, | |
1277 gpointer data) | |
1278 { | |
1279 cfg.custom_cursors = gtk_toggle_button_get_active(togglebutton); | |
1280 skin_reload_forced(); | |
1281 } | |
1282 | |
1283 static void | |
1284 on_eq_dir_preset_entry_realize(GtkEntry * entry, | |
1285 gpointer data) | |
1286 { | |
1287 gtk_entry_set_text(entry, cfg.eqpreset_default_file); | |
1288 } | |
1289 | |
1290 static void | |
1291 on_eq_dir_preset_entry_changed(GtkEntry * entry, | |
1292 gpointer data) | |
1293 { | |
1294 g_free(cfg.eqpreset_default_file); | |
1295 cfg.eqpreset_default_file = g_strdup(gtk_entry_get_text(entry)); | |
1296 } | |
1297 | |
1298 static void | |
1299 on_eq_file_preset_entry_realize(GtkEntry * entry, | |
1300 gpointer data) | |
1301 { | |
1302 gtk_entry_set_text(entry, cfg.eqpreset_extension); | |
1303 } | |
1304 | |
1305 static void | |
1306 on_eq_file_preset_entry_changed(GtkEntry * entry, gpointer data) | |
1307 { | |
1308 const gchar *text = gtk_entry_get_text(entry); | |
1309 | |
1310 while (*text == '.') | |
1311 text++; | |
1312 | |
1313 g_free(cfg.eqpreset_extension); | |
1314 cfg.eqpreset_extension = g_strdup(text); | |
1315 } | |
1316 | |
1317 | |
1318 /* FIXME: implement these */ | |
1319 | |
1320 static void | |
1321 on_eq_preset_view_realize(GtkTreeView * treeview, | |
1322 gpointer data) | |
1323 {} | |
1324 | |
1325 static void | |
1326 on_eq_preset_add_clicked(GtkButton * button, | |
1327 gpointer data) | |
1328 {} | |
1329 | |
1330 static void | |
1331 on_eq_preset_remove_clicked(GtkButton * button, | |
1332 gpointer data) | |
1333 {} | |
1334 | |
1335 static void | |
1336 on_skin_refresh_button_clicked(GtkButton * button, | |
1337 gpointer data) | |
1338 { | |
1339 GladeXML *xml; | |
1340 GtkWidget *widget, *widget2; | |
1341 | |
1342 const mode_t mode755 = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; | |
1343 | |
1344 del_directory(bmp_paths[BMP_PATH_SKIN_THUMB_DIR]); | |
1345 make_directory(bmp_paths[BMP_PATH_SKIN_THUMB_DIR], mode755); | |
1346 | |
1347 xml = prefswin_get_xml(); | |
1348 | |
1349 widget = glade_xml_get_widget(xml, "skin_view"); | |
1350 widget2 = glade_xml_get_widget(xml, "skin_refresh_button"); | |
1351 skin_view_update(GTK_TREE_VIEW(widget), GTK_WIDGET(widget2)); | |
1352 } | |
1353 | |
1354 static gboolean | |
1355 on_skin_view_realize(GtkTreeView * treeview, | |
1356 gpointer data) | |
1357 { | |
1358 GladeXML *xml; | |
1359 GtkWidget *widget; | |
1360 | |
1361 xml = prefswin_get_xml(); | |
1362 widget = glade_xml_get_widget(xml, "skin_refresh_button"); | |
1363 skin_view_realize(treeview); | |
1364 | |
1365 return TRUE; | |
1366 } | |
1367 | |
1368 static void | |
1369 on_category_view_realize(GtkTreeView * treeview, | |
1370 GtkNotebook * notebook) | |
1371 { | |
1372 GtkListStore *store; | |
1373 GtkCellRenderer *renderer; | |
1374 GtkTreeViewColumn *column; | |
1375 GtkTreeSelection *selection; | |
1376 GtkTreeIter iter; | |
1377 GdkPixbuf *img; | |
1378 CategoryQueueEntry *qlist; | |
1379 gint i; | |
1380 | |
1381 column = gtk_tree_view_column_new(); | |
1382 gtk_tree_view_column_set_title(column, _("Category")); | |
1383 gtk_tree_view_append_column(treeview, column); | |
1384 gtk_tree_view_column_set_spacing(column, 2); | |
1385 | |
1386 renderer = gtk_cell_renderer_pixbuf_new(); | |
1387 gtk_tree_view_column_pack_start(column, renderer, FALSE); | |
1388 gtk_tree_view_column_set_attributes(column, renderer, "pixbuf", 0, NULL); | |
1389 | |
1390 renderer = gtk_cell_renderer_text_new(); | |
1391 gtk_tree_view_column_pack_start(column, renderer, FALSE); | |
1392 gtk_tree_view_column_set_attributes(column, renderer, "text", 1, NULL); | |
1393 | |
1394 store = gtk_list_store_new(CATEGORY_VIEW_N_COLS, | |
1395 GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_INT); | |
1396 gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(store)); | |
1397 | |
1398 for (i = 0; i < n_categories; i++) { | |
1399 img = gdk_pixbuf_new_from_file(categories[i].icon_path, NULL); | |
1400 gtk_list_store_append(store, &iter); | |
1401 gtk_list_store_set(store, &iter, | |
1402 CATEGORY_VIEW_COL_ICON, img, | |
1403 CATEGORY_VIEW_COL_NAME, | |
1404 gettext(categories[i].name), CATEGORY_VIEW_COL_ID, | |
1405 categories[i].id, -1); | |
1406 g_object_unref(img); | |
1407 } | |
1408 | |
1409 selection = gtk_tree_view_get_selection(treeview); | |
1410 | |
1411 g_signal_connect_swapped(selection, "changed", | |
1412 G_CALLBACK(change_category), notebook); | |
1413 | |
1414 /* mark the treeview widget as available to third party plugins */ | |
1415 category_treeview = GTK_WIDGET(treeview); | |
1416 | |
1417 /* prefswin_page_queue_destroy already pops the queue forward for us. */ | |
1418 for (qlist = category_queue; qlist != NULL; qlist = category_queue) | |
1419 { | |
1420 CategoryQueueEntry *ent = (CategoryQueueEntry *) qlist; | |
1421 | |
1422 prefswin_page_new(ent->container, ent->pg_name, ent->img_url); | |
1423 prefswin_page_queue_destroy(ent); | |
1424 } | |
1425 } | |
1426 | |
1427 static void | |
1428 on_skin_view_drag_data_received(GtkWidget * widget, | |
1429 GdkDragContext * context, | |
1430 gint x, gint y, | |
1431 GtkSelectionData * selection_data, | |
1432 guint info, guint time, | |
1433 gpointer user_data) | |
1434 { | |
1435 ConfigDb *db; | |
1436 gchar *path; | |
1437 | |
1438 GladeXML *xml; | |
1439 GtkWidget *widget2; | |
1440 | |
1441 if (!selection_data->data) { | |
1442 g_warning("DND data string is NULL"); | |
1443 return; | |
1444 } | |
1445 | |
1446 path = (gchar *) selection_data->data; | |
1447 | |
1448 /* FIXME: use a real URL validator/parser */ | |
1449 | |
1450 if (str_has_prefix_nocase(path, "file:///")) { | |
1451 path[strlen(path) - 2] = 0; /* Why the hell a CR&LF? */ | |
1452 path += 7; | |
1453 } | |
1454 else if (str_has_prefix_nocase(path, "file:")) { | |
1455 path += 5; | |
1456 } | |
1457 | |
1458 if (file_is_archive(path)) { | |
1459 bmp_active_skin_load(path); | |
1460 skin_install_skin(path); | |
1461 xml = prefswin_get_xml(); | |
1462 widget2 = glade_xml_get_widget(xml, "skin_refresh_button"); | |
1463 skin_view_update(GTK_TREE_VIEW(widget), GTK_WIDGET(widget2)); | |
1464 /* Change skin name in the config file */ | |
1465 db = bmp_cfg_db_open(); | |
1466 bmp_cfg_db_set_string(db, NULL, "skin", path); | |
1467 bmp_cfg_db_close(db); | |
1468 } | |
1469 | |
1470 } | |
1471 | |
1472 static void | |
1473 on_chardet_detector_cbox_changed(GtkComboBox * combobox, gpointer data) | |
1474 { | |
1475 ConfigDb *db; | |
1476 gint position = 0; | |
1477 | |
1478 position = gtk_combo_box_get_active(GTK_COMBO_BOX(combobox)); | |
1479 cfg.chardet_detector = (char *)chardet_detector_presets[position]; | |
1480 | |
1481 db = bmp_cfg_db_open(); | |
1482 bmp_cfg_db_set_string(db, NULL, "chardet_detector", cfg.chardet_detector); | |
1483 bmp_cfg_db_close(db); | |
1484 if (data != NULL) | |
1485 gtk_widget_set_sensitive(GTK_WIDGET(data), 1); | |
1486 } | |
1487 | |
1488 static void | |
1489 on_chardet_detector_cbox_realize(GtkComboBox *combobox, gpointer data) | |
1490 { | |
1491 ConfigDb *db; | |
1492 gchar *ret=NULL; | |
1493 guint i=0,index=0; | |
1494 | |
1495 for(i=0; i<n_chardet_detector_presets; i++) { | |
1496 gtk_combo_box_append_text(combobox, chardet_detector_presets[i]); | |
1497 } | |
1498 | |
1499 db = bmp_cfg_db_open(); | |
1500 if(bmp_cfg_db_get_string(db, NULL, "chardet_detector", &ret) != FALSE) { | |
1501 for(i=0; i<n_chardet_detector_presets; i++) { | |
1502 if(!strcmp(chardet_detector_presets[i], ret)) { | |
1503 cfg.chardet_detector = (char *)chardet_detector_presets[i]; | |
1504 index = i; | |
1505 } | |
1506 } | |
1507 } | |
1508 bmp_cfg_db_close(db); | |
1509 | |
1510 #ifdef USE_CHARDET | |
1511 gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), index); | |
1512 | |
1513 if (data != NULL) | |
1514 gtk_widget_set_sensitive(GTK_WIDGET(data), TRUE); | |
1515 | |
1516 g_signal_connect(combobox, "changed", | |
1517 G_CALLBACK(on_chardet_detector_cbox_changed), NULL); | |
1518 #else | |
1519 gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), -1); | |
1520 gtk_widget_set_sensitive(GTK_WIDGET(combobox), 0); | |
1521 #endif | |
1522 if(ret) | |
1523 g_free(ret); | |
1524 } | |
1525 | |
1526 static void | |
1527 on_chardet_fallback_realize(GtkEntry *entry, gpointer data) | |
1528 { | |
1529 ConfigDb *db; | |
1530 gchar *ret = NULL; | |
1531 | |
1532 db = bmp_cfg_db_open(); | |
1533 | |
1534 if (bmp_cfg_db_get_string(db, NULL, "chardet_fallback", &ret) != FALSE) { | |
1535 if(cfg.chardet_fallback) | |
1536 g_free(cfg.chardet_fallback); | |
1537 | |
1538 if(ret && strncasecmp(ret, "None", sizeof("None"))) { | |
1539 cfg.chardet_fallback = ret; | |
1540 } else { | |
1541 cfg.chardet_fallback = g_strdup(""); | |
1542 } | |
1543 gtk_entry_set_text(entry, cfg.chardet_fallback); | |
1544 } | |
1545 | |
1546 bmp_cfg_db_close(db); | |
1547 } | |
1548 | |
1549 static void | |
1550 on_chardet_fallback_changed(GtkEntry *entry, gpointer data) | |
1551 { | |
1552 ConfigDb *db; | |
1553 gchar *ret = NULL; | |
1554 | |
1555 if(cfg.chardet_fallback) | |
1556 g_free(cfg.chardet_fallback); | |
1557 | |
1558 ret = g_strdup(gtk_entry_get_text(entry)); | |
1559 | |
1560 if(ret == NULL) | |
1561 cfg.chardet_fallback = g_strdup(""); | |
1562 else | |
1563 cfg.chardet_fallback = ret; | |
1564 | |
1565 db = bmp_cfg_db_open(); | |
1566 | |
1567 if(cfg.chardet_fallback == NULL || !strcmp(cfg.chardet_fallback, "")) | |
1568 bmp_cfg_db_set_string(db, NULL, "chardet_fallback", "None"); | |
1569 else | |
1570 bmp_cfg_db_set_string(db, NULL, "chardet_fallback", cfg.chardet_fallback); | |
1571 | |
1572 bmp_cfg_db_close(db); | |
1573 } | |
1574 | |
1575 static void | |
1576 on_show_filepopup_for_tuple_realize(GtkToggleButton * button, gpointer data) | |
1577 { | |
1578 GladeXML *xml = prefswin_get_xml(); | |
1579 GtkWidget *settings_button = glade_xml_get_widget(xml, "filepopup_for_tuple_settings_button"); | |
1580 | |
1581 gtk_toggle_button_set_active(button, cfg.show_filepopup_for_tuple); | |
1582 filepopupbutton = (GtkWidget *)button; | |
1583 | |
1584 gtk_widget_set_sensitive(settings_button, cfg.show_filepopup_for_tuple); | |
1585 } | |
1586 | |
1587 static void | |
1588 on_show_filepopup_for_tuple_toggled(GtkToggleButton * button, gpointer data) | |
1589 { | |
1590 GladeXML *xml = prefswin_get_xml(); | |
1591 GtkWidget *settings_button = glade_xml_get_widget(xml, "filepopup_for_tuple_settings_button"); | |
1592 | |
1593 cfg.show_filepopup_for_tuple = gtk_toggle_button_get_active(button); | |
1594 | |
1595 gtk_widget_set_sensitive(settings_button, cfg.show_filepopup_for_tuple); | |
1596 } | |
1597 | |
1598 static void | |
1599 on_recurse_for_cover_toggled(GtkToggleButton *button, gpointer data) | |
1600 { | |
1601 gtk_widget_set_sensitive(GTK_WIDGET(data), | |
1602 gtk_toggle_button_get_active(button)); | |
1603 } | |
1604 | |
1605 static void | |
1606 on_colorize_button_clicked(GtkButton *button, gpointer data) | |
1607 { | |
1608 GladeXML *xml = prefswin_get_xml(); | |
1609 GtkWidget *widget; | |
1610 | |
1611 widget = glade_xml_get_widget(xml, "red_scale"); | |
1612 gtk_range_set_value(GTK_RANGE(widget), cfg.colorize_r); | |
1613 | |
1614 widget = glade_xml_get_widget(xml, "green_scale"); | |
1615 gtk_range_set_value(GTK_RANGE(widget), cfg.colorize_g); | |
1616 | |
1617 widget = glade_xml_get_widget(xml, "blue_scale"); | |
1618 gtk_range_set_value(GTK_RANGE(widget), cfg.colorize_b); | |
1619 | |
1620 gtk_widget_show(colorize_settings); | |
1621 } | |
1622 | |
1623 static void | |
1624 on_red_scale_value_changed(GtkHScale *scale, gpointer data) | |
1625 { | |
2328 | 1626 //GladeXML *xml = prefswin_get_xml(); |
1627 //GtkWidget *widget; | |
2313 | 1628 gint value; |
1629 | |
1630 value = gtk_range_get_value(GTK_RANGE(scale)); | |
1631 | |
1632 if (value != cfg.colorize_r) | |
1633 { | |
1634 cfg.colorize_r = value; | |
1635 | |
1636 /* reload the skin to apply the change */ | |
1637 skin_reload_forced(); | |
3221
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3217
diff
changeset
|
1638 ui_skinned_window_draw_all(mainwin); |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3217
diff
changeset
|
1639 ui_skinned_window_draw_all(equalizerwin); |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3217
diff
changeset
|
1640 ui_skinned_window_draw_all(playlistwin); |
2313 | 1641 } |
1642 } | |
1643 | |
1644 static void | |
1645 on_green_scale_value_changed(GtkHScale *scale, gpointer data) | |
1646 { | |
2328 | 1647 //GladeXML *xml = prefswin_get_xml(); |
1648 //GtkWidget *widget; | |
2313 | 1649 gint value; |
1650 | |
1651 value = gtk_range_get_value(GTK_RANGE(scale)); | |
1652 | |
1653 if (value != cfg.colorize_r) | |
1654 { | |
1655 cfg.colorize_g = value; | |
1656 | |
1657 /* reload the skin to apply the change */ | |
1658 skin_reload_forced(); | |
3221
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3217
diff
changeset
|
1659 ui_skinned_window_draw_all(mainwin); |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3217
diff
changeset
|
1660 ui_skinned_window_draw_all(equalizerwin); |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3217
diff
changeset
|
1661 ui_skinned_window_draw_all(playlistwin); |
2313 | 1662 } |
1663 } | |
1664 | |
1665 static void | |
1666 on_blue_scale_value_changed(GtkHScale *scale, gpointer data) | |
1667 { | |
2328 | 1668 //GladeXML *xml = prefswin_get_xml(); |
1669 //GtkWidget *widget; | |
2313 | 1670 gint value; |
1671 | |
1672 value = gtk_range_get_value(GTK_RANGE(scale)); | |
1673 | |
1674 if (value != cfg.colorize_r) | |
1675 { | |
1676 cfg.colorize_b = value; | |
1677 | |
1678 /* reload the skin to apply the change */ | |
1679 skin_reload_forced(); | |
3221
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3217
diff
changeset
|
1680 ui_skinned_window_draw_all(mainwin); |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3217
diff
changeset
|
1681 ui_skinned_window_draw_all(equalizerwin); |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3217
diff
changeset
|
1682 ui_skinned_window_draw_all(playlistwin); |
2313 | 1683 } |
1684 } | |
1685 | |
1686 static void | |
1687 on_colorize_close_clicked(GtkButton *button, gpointer data) | |
1688 { | |
1689 gtk_widget_hide(colorize_settings); | |
1690 } | |
1691 | |
1692 static void | |
1693 on_filepopup_for_tuple_settings_clicked(GtkButton *button, gpointer data) | |
1694 { | |
1695 GladeXML *xml = prefswin_get_xml(); | |
1696 GtkWidget *widget, *widget2; | |
1697 | |
1698 widget = glade_xml_get_widget(xml, "filepopup_settings_cover_name_include"); | |
1699 gtk_entry_set_text(GTK_ENTRY(widget), cfg.cover_name_include); | |
1700 | |
1701 widget = glade_xml_get_widget(xml, "filepopup_settings_cover_name_exclude"); | |
1702 gtk_entry_set_text(GTK_ENTRY(widget), cfg.cover_name_exclude); | |
1703 | |
1704 widget2 = glade_xml_get_widget(xml, "filepopup_settings_recurse_for_cover"); | |
1705 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget2), cfg.recurse_for_cover); | |
1706 | |
1707 widget = glade_xml_get_widget(xml, "filepopup_settings_recurse_for_cover_depth"); | |
1708 gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), cfg.recurse_for_cover_depth); | |
1709 | |
1710 widget = glade_xml_get_widget(xml, "filepopup_settings_recurse_for_cover_depth_box"); | |
1711 on_recurse_for_cover_toggled(GTK_TOGGLE_BUTTON(widget2), widget); | |
1712 | |
1713 widget = glade_xml_get_widget(xml, "filepopup_settings_use_file_cover"); | |
1714 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), cfg.use_file_cover); | |
1715 | |
2405 | 1716 widget = glade_xml_get_widget(xml, "filepopup_settings_showprogressbar"); |
1717 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), cfg.filepopup_showprogressbar); | |
1718 | |
1719 widget = glade_xml_get_widget(xml, "filepopup_settings_delay"); | |
1720 gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), cfg.filepopup_delay); | |
1721 | |
2313 | 1722 gtk_widget_show(filepopup_settings); |
1723 } | |
1724 | |
1725 static void | |
1726 on_filepopup_settings_ok_clicked(GtkButton *button, gpointer data) | |
1727 { | |
1728 GladeXML *xml = prefswin_get_xml(); | |
1729 GtkWidget *widget; | |
1730 | |
1731 widget = glade_xml_get_widget(xml, "filepopup_settings_cover_name_include"); | |
1732 g_free(cfg.cover_name_include); | |
1733 cfg.cover_name_include = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget))); | |
1734 | |
1735 widget = glade_xml_get_widget(xml, "filepopup_settings_cover_name_exclude"); | |
1736 g_free(cfg.cover_name_exclude); | |
1737 cfg.cover_name_exclude = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget))); | |
1738 | |
1739 widget = glade_xml_get_widget(xml, "filepopup_settings_recurse_for_cover"); | |
1740 cfg.recurse_for_cover = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); | |
1741 | |
1742 widget = glade_xml_get_widget(xml, "filepopup_settings_recurse_for_cover_depth"); | |
1743 cfg.recurse_for_cover_depth = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget)); | |
1744 | |
1745 widget = glade_xml_get_widget(xml, "filepopup_settings_use_file_cover"); | |
1746 cfg.use_file_cover = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); | |
1747 | |
2405 | 1748 widget = glade_xml_get_widget(xml, "filepopup_settings_showprogressbar"); |
1749 cfg.filepopup_showprogressbar = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); | |
1750 | |
1751 widget = glade_xml_get_widget(xml, "filepopup_settings_delay"); | |
1752 cfg.filepopup_delay = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget)); | |
1753 | |
2313 | 1754 gtk_widget_hide(filepopup_settings); |
1755 } | |
1756 | |
1757 static void | |
1758 on_filepopup_settings_cancel_clicked(GtkButton *button, gpointer data) | |
1759 { | |
1760 gtk_widget_hide(filepopup_settings); | |
1761 } | |
1762 | |
1763 static void | |
1764 on_xmms_style_fileselector_realize(GtkToggleButton * button, | |
1765 gpointer data) | |
1766 { | |
1767 gtk_toggle_button_set_active(button, cfg.use_xmms_style_fileselector); | |
1768 } | |
1769 | |
1770 static void | |
1771 on_xmms_style_fileselector_toggled(GtkToggleButton * button, | |
1772 gpointer data) | |
1773 { | |
1774 cfg.use_xmms_style_fileselector = gtk_toggle_button_get_active(button); | |
1775 } | |
1776 | |
1777 static void | |
1778 on_show_wm_decorations_realize(GtkToggleButton * button, | |
1779 gpointer data) | |
1780 { | |
1781 gtk_toggle_button_set_active(button, cfg.show_wm_decorations); | |
1782 } | |
1783 | |
1784 static void | |
1785 on_show_wm_decorations_toggled(GtkToggleButton * button, | |
1786 gpointer data) | |
1787 { | |
1788 extern GtkWidget *equalizerwin; | |
1789 cfg.show_wm_decorations = gtk_toggle_button_get_active(button); | |
1790 gtk_window_set_decorated(GTK_WINDOW(mainwin), cfg.show_wm_decorations); | |
1791 gtk_window_set_decorated(GTK_WINDOW(playlistwin), cfg.show_wm_decorations); | |
1792 gtk_window_set_decorated(GTK_WINDOW(equalizerwin), cfg.show_wm_decorations); | |
2623 | 1793 } |
1794 | |
1795 static void | |
1796 on_reload_plugins_clicked(GtkButton * button, gpointer data) | |
1797 { | |
1798 /* TBD: should every playlist entry have to be reprobed? | |
1799 * Pointers could come back stale if new plugins are added or | |
1800 * symbol sizes change. - nenolod | |
1801 */ | |
1802 | |
2682
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2635
diff
changeset
|
1803 bmp_config_save(); |
2623 | 1804 plugin_system_cleanup(); |
2682
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2635
diff
changeset
|
1805 bmp_config_free(); |
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2635
diff
changeset
|
1806 bmp_config_load(); |
2623 | 1807 plugin_system_init(); |
2313 | 1808 } |
1809 | |
1810 /* FIXME: complete the map */ | |
1811 FUNC_MAP_BEGIN(prefswin_func_map) | |
1812 FUNC_MAP_ENTRY(on_input_plugin_view_realize) | |
1813 FUNC_MAP_ENTRY(on_output_plugin_cbox_realize) | |
1814 FUNC_MAP_ENTRY(on_general_plugin_view_realize) | |
1815 FUNC_MAP_ENTRY(on_vis_plugin_view_realize) | |
1816 FUNC_MAP_ENTRY(on_effect_plugin_view_realize) | |
1817 FUNC_MAP_ENTRY(on_custom_cursors_realize) | |
1818 FUNC_MAP_ENTRY(on_custom_cursors_toggled) | |
1819 FUNC_MAP_ENTRY(on_mainwin_font_button_realize) | |
1820 FUNC_MAP_ENTRY(on_mainwin_font_button_font_set) | |
1821 FUNC_MAP_ENTRY(on_use_bitmap_fonts_realize) | |
1822 FUNC_MAP_ENTRY(on_use_bitmap_fonts_toggled) | |
1823 FUNC_MAP_ENTRY(on_mouse_wheel_volume_realize) | |
1824 FUNC_MAP_ENTRY(on_mouse_wheel_volume_changed) | |
1825 FUNC_MAP_ENTRY(on_mouse_wheel_scroll_pl_realize) | |
1826 FUNC_MAP_ENTRY(on_mouse_wheel_scroll_pl_changed) | |
1827 FUNC_MAP_ENTRY(on_pause_between_songs_time_realize) | |
1828 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
|
1829 FUNC_MAP_ENTRY(on_enable_src_realize) |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1830 FUNC_MAP_ENTRY(on_enable_src_toggled) |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1831 FUNC_MAP_ENTRY(on_src_rate_realize) |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1832 FUNC_MAP_ENTRY(on_src_rate_value_changed) |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1833 FUNC_MAP_ENTRY(on_src_converter_type_realize) |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1834 FUNC_MAP_ENTRY(on_src_converter_type_changed) |
2313 | 1835 FUNC_MAP_ENTRY(on_pl_metadata_on_load_realize) |
1836 FUNC_MAP_ENTRY(on_pl_metadata_on_load_toggled) | |
1837 FUNC_MAP_ENTRY(on_pl_metadata_on_display_realize) | |
1838 FUNC_MAP_ENTRY(on_pl_metadata_on_display_toggled) | |
1839 FUNC_MAP_ENTRY(on_playlist_show_pl_numbers_realize) | |
1840 FUNC_MAP_ENTRY(on_playlist_show_pl_numbers_toggled) | |
1841 FUNC_MAP_ENTRY(on_playlist_show_pl_separator_realize) | |
1842 FUNC_MAP_ENTRY(on_playlist_show_pl_separator_toggled) | |
1843 FUNC_MAP_ENTRY(on_playlist_convert_twenty_realize) | |
1844 FUNC_MAP_ENTRY(on_playlist_convert_twenty_toggled) | |
1845 FUNC_MAP_ENTRY(on_playlist_convert_underscore_realize) | |
1846 FUNC_MAP_ENTRY(on_playlist_convert_underscore_toggled) | |
1847 FUNC_MAP_ENTRY(on_playlist_convert_slash_realize) | |
1848 FUNC_MAP_ENTRY(on_playlist_convert_slash_toggled) | |
1849 FUNC_MAP_ENTRY(on_playlist_font_button_realize) | |
1850 FUNC_MAP_ENTRY(on_playlist_font_button_font_set) | |
1851 FUNC_MAP_ENTRY(on_playlist_no_advance_realize) | |
1852 FUNC_MAP_ENTRY(on_playlist_no_advance_toggled) | |
1853 FUNC_MAP_ENTRY(on_refresh_file_list_realize) | |
1854 FUNC_MAP_ENTRY(on_refresh_file_list_toggled) | |
1855 FUNC_MAP_ENTRY(on_skin_view_realize) | |
1856 FUNC_MAP_ENTRY(on_titlestring_entry_realize) | |
1857 FUNC_MAP_ENTRY(on_titlestring_entry_changed) | |
1858 FUNC_MAP_ENTRY(on_eq_dir_preset_entry_realize) | |
1859 FUNC_MAP_ENTRY(on_eq_dir_preset_entry_changed) | |
1860 FUNC_MAP_ENTRY(on_eq_file_preset_entry_realize) | |
1861 FUNC_MAP_ENTRY(on_eq_file_preset_entry_changed) | |
1862 FUNC_MAP_ENTRY(on_eq_preset_view_realize) | |
1863 FUNC_MAP_ENTRY(on_eq_preset_add_clicked) | |
1864 FUNC_MAP_ENTRY(on_eq_preset_remove_clicked) | |
1865 FUNC_MAP_ENTRY(on_skin_refresh_button_clicked) | |
1866 FUNC_MAP_ENTRY(on_proxy_use_toggled) | |
1867 FUNC_MAP_ENTRY(on_proxy_use_realize) | |
1868 FUNC_MAP_ENTRY(on_proxy_auth_toggled) | |
1869 FUNC_MAP_ENTRY(on_proxy_auth_realize) | |
1870 FUNC_MAP_ENTRY(on_proxy_host_realize) | |
1871 FUNC_MAP_ENTRY(on_proxy_host_changed) | |
1872 FUNC_MAP_ENTRY(on_proxy_port_realize) | |
1873 FUNC_MAP_ENTRY(on_proxy_port_changed) | |
1874 FUNC_MAP_ENTRY(on_proxy_user_realize) | |
1875 FUNC_MAP_ENTRY(on_proxy_user_changed) | |
1876 FUNC_MAP_ENTRY(on_proxy_pass_realize) | |
1877 FUNC_MAP_ENTRY(on_proxy_pass_changed) | |
1878 FUNC_MAP_ENTRY(on_chardet_detector_cbox_realize) | |
1879 FUNC_MAP_ENTRY(on_chardet_detector_cbox_changed) | |
1880 FUNC_MAP_ENTRY(on_chardet_fallback_realize) | |
1881 FUNC_MAP_ENTRY(on_chardet_fallback_changed) | |
1882 FUNC_MAP_ENTRY(on_output_plugin_bufsize_realize) | |
1883 FUNC_MAP_ENTRY(on_output_plugin_bufsize_value_changed) | |
1884 FUNC_MAP_ENTRY(on_audio_format_det_cb_toggled) | |
1885 FUNC_MAP_ENTRY(on_audio_format_det_cb_realize) | |
1886 FUNC_MAP_ENTRY(on_detect_by_extension_cb_toggled) | |
1887 FUNC_MAP_ENTRY(on_detect_by_extension_cb_realize) | |
1888 FUNC_MAP_ENTRY(on_show_filepopup_for_tuple_realize) | |
1889 FUNC_MAP_ENTRY(on_show_filepopup_for_tuple_toggled) | |
1890 FUNC_MAP_ENTRY(on_filepopup_for_tuple_settings_clicked) | |
1891 FUNC_MAP_ENTRY(on_continue_playback_on_startup_realize) | |
1892 FUNC_MAP_ENTRY(on_continue_playback_on_startup_toggled) | |
1893 | |
1894 /* Filepopup settings */ | |
1895 FUNC_MAP_ENTRY(on_filepopup_settings_ok_clicked) | |
1896 FUNC_MAP_ENTRY(on_filepopup_settings_cancel_clicked) | |
1897 | |
1898 /* XMMS fileselector option -nenolod */ | |
1899 FUNC_MAP_ENTRY(on_xmms_style_fileselector_toggled) | |
1900 FUNC_MAP_ENTRY(on_xmms_style_fileselector_realize) | |
1901 | |
1902 /* show window manager decorations */ | |
1903 FUNC_MAP_ENTRY(on_show_wm_decorations_toggled) | |
1904 FUNC_MAP_ENTRY(on_show_wm_decorations_realize) | |
1905 | |
1906 /* colorize */ | |
1907 FUNC_MAP_ENTRY(on_colorize_button_clicked) | |
1908 FUNC_MAP_ENTRY(on_red_scale_value_changed) | |
1909 FUNC_MAP_ENTRY(on_green_scale_value_changed) | |
1910 FUNC_MAP_ENTRY(on_blue_scale_value_changed) | |
1911 FUNC_MAP_ENTRY(on_colorize_close_clicked) | |
2623 | 1912 |
1913 FUNC_MAP_ENTRY(on_reload_plugins_clicked) | |
2313 | 1914 FUNC_MAP_END |
1915 | |
1916 void | |
1917 create_prefs_window(void) | |
1918 { | |
1919 const gchar *glade_file = DATA_DIR "/glade/prefswin.glade"; | |
1920 | |
1921 GladeXML *xml; | |
1922 GtkWidget *widget, *widget2; | |
2467 | 1923 gchar *aud_version_string; |
2313 | 1924 |
1925 GtkWidget *titlestring_tag_menu, *menu_item; | |
1926 guint i; | |
1927 | |
1928 /* load the interface */ | |
1929 xml = glade_xml_new_or_die(_("Preferences Window"), glade_file, NULL, | |
1930 NULL); | |
1931 | |
1932 | |
1933 /* connect the signals in the interface */ | |
1934 glade_xml_signal_autoconnect_map(xml, prefswin_func_map); | |
1935 | |
1936 prefswin = glade_xml_get_widget(xml, "prefswin"); | |
1937 g_object_set_data(G_OBJECT(prefswin), "glade-xml", xml); | |
1938 | |
1939 /* create category view */ | |
1940 widget = glade_xml_get_widget(xml, "category_view"); | |
1941 widget2 = glade_xml_get_widget(xml, "category_notebook"); | |
1942 g_signal_connect_after(G_OBJECT(widget), "realize", | |
1943 G_CALLBACK(on_category_view_realize), | |
1944 widget2); | |
1945 | |
1946 category_treeview = GTK_WIDGET(widget); | |
1947 category_notebook = GTK_WIDGET(widget2); | |
1948 | |
1949 /* plugin->input page */ | |
1950 | |
1951 widget = glade_xml_get_widget(xml, "input_plugin_view"); | |
1952 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
|
1953 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
|
1954 g_signal_connect(G_OBJECT(widget), "row-activated", |
3356 | 1955 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
|
1956 NULL); |
2313 | 1957 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
|
1958 G_CALLBACK(plugin_treeview_enable_prefs), |
2313 | 1959 widget2); |
1960 | |
1961 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
3356 | 1962 G_CALLBACK(plugin_treeview_open_prefs), |
2313 | 1963 widget); |
1964 widget2 = glade_xml_get_widget(xml, "input_plugin_info"); | |
1965 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
|
1966 G_CALLBACK(plugin_treeview_enable_info), |
2313 | 1967 widget2); |
1968 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
3357 | 1969 G_CALLBACK(plugin_treeview_open_info), |
2313 | 1970 widget); |
1971 | |
1972 /* plugin->output page */ | |
1973 | |
1974 widget = glade_xml_get_widget(xml, "output_plugin_cbox"); | |
1975 | |
1976 widget2 = glade_xml_get_widget(xml, "output_plugin_prefs"); | |
1977 g_signal_connect(G_OBJECT(widget), "changed", | |
1978 G_CALLBACK(output_plugin_enable_prefs), | |
1979 widget2); | |
1980 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
1981 G_CALLBACK(output_plugin_open_prefs), | |
1982 widget); | |
1983 | |
1984 widget2 = glade_xml_get_widget(xml, "output_plugin_info"); | |
1985 g_signal_connect(G_OBJECT(widget), "changed", | |
1986 G_CALLBACK(output_plugin_enable_info), | |
1987 widget2); | |
1988 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
1989 G_CALLBACK(output_plugin_open_info), | |
1990 widget); | |
1991 | |
1992 /* plugin->general page */ | |
1993 | |
1994 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
|
1995 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
|
1996 g_signal_connect(G_OBJECT(widget), "row-activated", |
3356 | 1997 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
|
1998 NULL); |
2313 | 1999 |
2000 widget2 = glade_xml_get_widget(xml, "general_plugin_prefs"); | |
2001 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
|
2002 G_CALLBACK(plugin_treeview_enable_prefs), |
2313 | 2003 widget2); |
3353
1cd5fb04e05b
double click on plugin row opens plugin config (if available)
Tomasz Mon <desowin@gmail.com>
parents:
3251
diff
changeset
|
2004 |
2313 | 2005 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", |
3356 | 2006 G_CALLBACK(plugin_treeview_open_prefs), |
2313 | 2007 widget); |
2008 | |
2009 widget2 = glade_xml_get_widget(xml, "general_plugin_info"); | |
2010 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
|
2011 G_CALLBACK(plugin_treeview_enable_info), |
2313 | 2012 widget2); |
2013 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
3357 | 2014 G_CALLBACK(plugin_treeview_open_info), |
2313 | 2015 widget); |
2016 | |
2017 | |
2018 /* plugin->vis page */ | |
2019 | |
2020 widget = glade_xml_get_widget(xml, "vis_plugin_view"); | |
2021 widget2 = glade_xml_get_widget(xml, "vis_plugin_prefs"); | |
2022 | |
3353
1cd5fb04e05b
double click on plugin row opens plugin config (if available)
Tomasz Mon <desowin@gmail.com>
parents:
3251
diff
changeset
|
2023 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
|
2024 g_signal_connect(G_OBJECT(widget), "row-activated", |
3356 | 2025 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
|
2026 NULL); |
2313 | 2027 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", |
3356 | 2028 G_CALLBACK(plugin_treeview_open_prefs), |
2313 | 2029 widget); |
2030 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
|
2031 G_CALLBACK(plugin_treeview_enable_prefs), widget2); |
2313 | 2032 |
2033 | |
2034 widget2 = glade_xml_get_widget(xml, "vis_plugin_info"); | |
2035 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
|
2036 G_CALLBACK(plugin_treeview_enable_info), widget2); |
2313 | 2037 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", |
3357 | 2038 G_CALLBACK(plugin_treeview_open_info), |
2313 | 2039 widget); |
2040 | |
2041 | |
2042 /* plugin->effects page */ | |
2043 | |
2044 widget = glade_xml_get_widget(xml, "effect_plugin_view"); | |
2045 widget2 = glade_xml_get_widget(xml, "effect_plugin_prefs"); | |
2046 | |
3353
1cd5fb04e05b
double click on plugin row opens plugin config (if available)
Tomasz Mon <desowin@gmail.com>
parents:
3251
diff
changeset
|
2047 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
|
2048 g_signal_connect(G_OBJECT(widget), "row-activated", |
3356 | 2049 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
|
2050 NULL); |
2313 | 2051 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", |
3356 | 2052 G_CALLBACK(plugin_treeview_open_prefs), |
2313 | 2053 widget); |
2054 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
|
2055 G_CALLBACK(plugin_treeview_enable_prefs), widget2); |
2313 | 2056 |
2057 | |
2058 widget2 = glade_xml_get_widget(xml, "effect_plugin_info"); | |
2059 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
|
2060 G_CALLBACK(plugin_treeview_enable_info), widget2); |
2313 | 2061 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", |
3357 | 2062 G_CALLBACK(plugin_treeview_open_info), |
2313 | 2063 widget); |
2064 | |
2065 /* playlist page */ | |
2066 | |
2067 widget = glade_xml_get_widget(xml, "pause_between_songs_box"); | |
2068 widget2 = glade_xml_get_widget(xml, "pause_between_songs"); | |
2069 g_signal_connect_after(G_OBJECT(widget2), "realize", | |
2070 G_CALLBACK(on_pause_between_songs_realize), | |
2071 widget); | |
2072 g_signal_connect(G_OBJECT(widget2), "toggled", | |
2073 G_CALLBACK(on_pause_between_songs_toggled), | |
2074 widget); | |
2075 | |
2076 widget = glade_xml_get_widget(xml, "playlist_use_metadata_box"); | |
2077 widget2 = glade_xml_get_widget(xml, "playlist_use_metadata"); | |
2078 g_signal_connect_after(G_OBJECT(widget2), "realize", | |
2079 G_CALLBACK(on_use_pl_metadata_realize), | |
2080 widget); | |
2081 g_signal_connect(G_OBJECT(widget2), "toggled", | |
2082 G_CALLBACK(on_use_pl_metadata_toggled), | |
2083 widget); | |
2084 | |
2085 widget = glade_xml_get_widget(xml, "skin_view"); | |
2086 g_signal_connect(widget, "drag-data-received", | |
2087 G_CALLBACK(on_skin_view_drag_data_received), | |
2088 NULL); | |
2089 bmp_drag_dest_set(widget); | |
2090 | |
2091 g_signal_connect(mainwin, "drag-data-received", | |
2092 G_CALLBACK(mainwin_drag_data_received), | |
2093 widget); | |
2094 | |
2095 widget = glade_xml_get_widget(xml, "skin_refresh_button"); | |
2096 g_signal_connect(widget, "clicked", | |
2097 G_CALLBACK(on_skin_refresh_button_clicked), | |
2098 NULL); | |
2099 | |
2100 widget = glade_xml_get_widget(xml, "playlist_font_button"); | |
2101 g_signal_connect(mainwin, "drag-data-received", | |
2975 | 2102 G_CALLBACK(mainwin_drag_data_received), |
2313 | 2103 widget); |
2104 | |
2105 widget = glade_xml_get_widget(xml, "titlestring_cbox"); | |
2106 widget2 = glade_xml_get_widget(xml, "titlestring_entry"); | |
2107 g_signal_connect(widget, "realize", | |
2108 G_CALLBACK(on_titlestring_cbox_realize), | |
2109 widget2); | |
2110 g_signal_connect(widget, "changed", | |
2111 G_CALLBACK(on_titlestring_cbox_changed), | |
2112 widget2); | |
2113 | |
2114 /* FIXME: move this into a function */ | |
2115 /* create tag menu */ | |
2116 titlestring_tag_menu = gtk_menu_new(); | |
2117 for(i = 0; i < n_title_field_tags; i++) { | |
2118 menu_item = gtk_menu_item_new_with_label(_(title_field_tags[i].name)); | |
2119 gtk_menu_shell_append(GTK_MENU_SHELL(titlestring_tag_menu), menu_item); | |
2120 g_signal_connect(menu_item, "activate", | |
2121 G_CALLBACK(titlestring_tag_menu_callback), | |
2122 GINT_TO_POINTER(i)); | |
2123 }; | |
2124 gtk_widget_show_all(titlestring_tag_menu); | |
2125 | |
2126 widget = glade_xml_get_widget(xml, "titlestring_help_button"); | |
2127 widget2 = glade_xml_get_widget(xml, "titlestring_cbox"); | |
2128 | |
2129 g_signal_connect(widget2, "changed", | |
2130 G_CALLBACK(on_titlestring_cbox_changed), | |
2131 widget); | |
2132 g_signal_connect(widget, "clicked", | |
2133 G_CALLBACK(on_titlestring_help_button_clicked), | |
2134 titlestring_tag_menu); | |
2135 | |
2136 /* audacious version label */ | |
2137 widget = glade_xml_get_widget(xml, "audversionlabel"); | |
2467 | 2138 |
2468
5206f4ef02f7
[svn] - the svn_stamp is no longer an svn revision, but a serial number
nenolod
parents:
2467
diff
changeset
|
2139 aud_version_string = g_strdup_printf("<span size='small'>%s (%s) (%s@%s)</span>", |
2467 | 2140 "Audacious " PACKAGE_VERSION , |
2466 | 2141 svn_stamp , g_get_user_name() , g_get_host_name() ); |
2313 | 2142 |
2467 | 2143 gtk_label_set_markup( GTK_LABEL(widget) , aud_version_string ); |
2144 g_free(aud_version_string); | |
2313 | 2145 |
2146 /* Create window for filepopup settings */ | |
2147 filepopup_settings = glade_xml_get_widget(xml, "filepopup_for_tuple_settings"); | |
2148 gtk_window_set_transient_for(GTK_WINDOW(filepopup_settings), GTK_WINDOW(prefswin)); | |
2149 | |
2150 widget = glade_xml_get_widget(xml, "filepopup_settings_recurse_for_cover_depth_box"); | |
2151 widget2 = glade_xml_get_widget(xml, "filepopup_settings_recurse_for_cover"); | |
2152 g_signal_connect(G_OBJECT(widget2), "toggled", | |
2153 G_CALLBACK(on_recurse_for_cover_toggled), | |
2154 widget); | |
2155 | |
2635 | 2156 /* Create window for color adjustment settings */ |
2313 | 2157 colorize_settings = glade_xml_get_widget(xml, "colorize_popup"); |
2158 gtk_window_set_transient_for(GTK_WINDOW(colorize_settings), GTK_WINDOW(prefswin)); | |
2159 gtk_widget_hide(colorize_settings); | |
2160 } | |
2161 | |
2162 void | |
2163 show_prefs_window(void) | |
2164 { | |
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
|
2165 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
|
2166 |
2635 | 2167 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
|
2168 |
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
|
2169 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
|
2170 { |
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
|
2171 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
|
2172 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
|
2173 |
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
|
2174 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
|
2175 |
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
|
2176 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
|
2177 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
|
2178 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
|
2179 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
|
2180 } |
2313 | 2181 } |
2182 | |
2183 static void | |
2184 prefswin_page_queue_new(GtkWidget *container, gchar *name, gchar *imgurl) | |
2185 { | |
2186 CategoryQueueEntry *ent = g_malloc0(sizeof(CategoryQueueEntry)); | |
2187 | |
2188 ent->container = container; | |
2189 ent->pg_name = name; | |
2190 ent->img_url = imgurl; | |
2191 | |
2192 if (category_queue) | |
2193 ent->next = category_queue; | |
2194 | |
2195 category_queue = ent; | |
2196 } | |
2197 | |
2198 static void | |
2199 prefswin_page_queue_destroy(CategoryQueueEntry *ent) | |
2200 { | |
2201 category_queue = ent->next; | |
2202 g_free(ent); | |
2203 } | |
2204 | |
2205 /* | |
2206 * Public APIs for adding new pages to the prefs window. | |
2207 * | |
2208 * Basically, the concept here is that third party components can register themselves in the root | |
2209 * preferences window. | |
2210 * | |
2211 * From a usability standpoint this makes the application look more "united", instead of cluttered | |
2212 * and malorganised. Hopefully this option will be used further in the future. | |
2213 * | |
2214 * - nenolod | |
2215 */ | |
2216 gint | |
2217 prefswin_page_new(GtkWidget *container, gchar *name, gchar *imgurl) | |
2218 { | |
2219 GtkTreeModel *model; | |
2220 GtkTreeIter iter; | |
2221 GdkPixbuf *img = NULL; | |
2222 GtkTreeView *treeview = GTK_TREE_VIEW(category_treeview); | |
2223 gint id; | |
2224 | |
2225 if (treeview == NULL || category_notebook == NULL) | |
2226 { | |
2227 prefswin_page_queue_new(container, name, imgurl); | |
2228 return -1; | |
2229 } | |
2230 | |
2231 model = gtk_tree_view_get_model(treeview); | |
2232 | |
2233 if (model == NULL) | |
2234 { | |
2235 prefswin_page_queue_new(container, name, imgurl); | |
2236 return -1; | |
2237 } | |
2238 | |
2239 /* Make sure the widgets are visible. */ | |
2240 gtk_widget_show(container); | |
2241 id = gtk_notebook_append_page(GTK_NOTEBOOK(category_notebook), container, NULL); | |
2242 | |
2243 if (id == -1) | |
2244 return -1; | |
2245 | |
2246 if (imgurl != NULL) | |
2247 img = gdk_pixbuf_new_from_file(imgurl, NULL); | |
2248 | |
2249 gtk_list_store_append(GTK_LIST_STORE(model), &iter); | |
2250 gtk_list_store_set(GTK_LIST_STORE(model), &iter, | |
2251 CATEGORY_VIEW_COL_ICON, img, | |
2252 CATEGORY_VIEW_COL_NAME, | |
2253 name, CATEGORY_VIEW_COL_ID, id, -1); | |
2254 | |
2255 if (img != NULL) | |
2256 g_object_unref(img); | |
2257 | |
2258 return id; | |
2259 } | |
2260 | |
2261 void | |
2262 prefswin_page_destroy(GtkWidget *container) | |
2263 { | |
2264 GtkTreeModel *model; | |
2265 GtkTreeIter iter; | |
2266 GtkTreeView *treeview = GTK_TREE_VIEW(category_treeview); | |
2267 gboolean ret; | |
2268 gint id; | |
2269 gint index = -1; | |
2270 | |
2271 if (category_notebook == NULL || treeview == NULL || container == NULL) | |
2272 return; | |
2273 | |
2274 id = gtk_notebook_page_num(GTK_NOTEBOOK(category_notebook), container); | |
2275 | |
2276 if (id == -1) | |
2277 return; | |
2278 | |
2279 gtk_notebook_remove_page(GTK_NOTEBOOK(category_notebook), id); | |
2280 | |
2281 model = gtk_tree_view_get_model(treeview); | |
2282 | |
2283 if (model == NULL) | |
2284 return; | |
2285 | |
2286 ret = gtk_tree_model_get_iter_first(model, &iter); | |
2287 | |
2288 while (ret == TRUE) | |
2289 { | |
2290 gtk_tree_model_get(model, &iter, CATEGORY_VIEW_COL_ID, &index, -1); | |
2291 | |
2292 if (index == id) | |
2293 { | |
2294 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); | |
2295 ret = gtk_tree_model_get_iter_first(model, &iter); | |
2296 } | |
2297 | |
2298 if (index > id) | |
2299 { | |
2300 index--; | |
2301 gtk_list_store_set(GTK_LIST_STORE(model), &iter, CATEGORY_VIEW_COL_ID, index, -1); | |
2302 } | |
2303 | |
2304 ret = gtk_tree_model_iter_next(model, &iter); | |
2305 } | |
2306 } |