Mercurial > audlegacy
annotate src/audacious/ui_preferences.c @ 2935:fc8a2ebb2e13 trunk
Fix display of help system.
| author | William Pitcock <nenolod@atheme.org> |
|---|---|
| date | Fri, 29 Jun 2007 08:38:29 -0500 |
| parents | cd21a4556dd2 |
| children | 1ec423a12756 |
| 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 | |
| 9 * the Free Software Foundation; under version 2 of the License. | |
| 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 | |
| 17 * along with this program; if not, write to the Free Software | |
| 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
| 19 */ | |
| 20 | |
| 21 #ifdef HAVE_CONFIG_H | |
| 22 # include "config.h" | |
| 23 #endif | |
| 24 | |
| 25 #include <glib.h> | |
| 26 #include <glib/gi18n.h> | |
| 27 #include <gtk/gtk.h> | |
| 28 #include <glade/glade.h> | |
| 29 #include <string.h> | |
| 30 #include <stddef.h> | |
| 31 #include <stdio.h> | |
| 32 #include <sys/types.h> | |
| 33 #include <dirent.h> | |
| 34 #include <unistd.h> | |
| 35 #include <errno.h> | |
| 36 #include <sys/types.h> | |
| 37 #include <sys/stat.h> | |
| 38 | |
| 39 #include "glade.h" | |
| 40 | |
| 41 #include "plugin.h" | |
| 42 #include "pluginenum.h" | |
| 43 #include "input.h" | |
| 44 #include "effect.h" | |
| 45 #include "general.h" | |
| 46 #include "output.h" | |
| 47 #include "visualization.h" | |
| 48 | |
| 49 #include "main.h" | |
| 50 #include "widgets/widgetcore.h" | |
| 2911 | 51 #include "ui_skinned_textbox.h" |
|
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2405
diff
changeset
|
52 #include "urldecode.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" |
| 2313 | 63 |
| 64 #include "build_stamp.h" | |
| 65 | |
| 66 enum CategoryViewCols { | |
| 67 CATEGORY_VIEW_COL_ICON, | |
| 68 CATEGORY_VIEW_COL_NAME, | |
| 69 CATEGORY_VIEW_COL_ID, | |
| 70 CATEGORY_VIEW_N_COLS | |
| 71 }; | |
| 72 | |
| 73 enum PluginViewCols { | |
| 74 PLUGIN_VIEW_COL_ACTIVE, | |
| 75 PLUGIN_VIEW_COL_DESC, | |
| 76 PLUGIN_VIEW_COL_FILENAME, | |
| 77 PLUGIN_VIEW_COL_ID, | |
| 78 PLUGIN_VIEW_N_COLS | |
| 79 }; | |
| 80 | |
| 81 | |
| 82 typedef struct { | |
| 83 const gchar *icon_path; | |
| 84 const gchar *name; | |
| 85 gint id; | |
| 86 } Category; | |
| 87 | |
| 88 typedef struct { | |
| 89 const gchar *name; | |
| 90 const gchar *tag; | |
| 91 } | |
| 92 TitleFieldTag; | |
| 93 | |
| 94 static GtkWidget *prefswin = NULL; | |
| 95 static GtkWidget *filepopup_settings = NULL; | |
| 96 static GtkWidget *colorize_settings = NULL; | |
| 97 static GtkWidget *category_treeview = NULL; | |
| 98 static GtkWidget *category_notebook = NULL; | |
| 99 GtkWidget *filepopupbutton = NULL; | |
| 100 | |
| 101 static Category categories[] = { | |
| 102 {DATA_DIR "/images/appearance.png", N_("Appearance"), 1}, | |
| 103 {DATA_DIR "/images/audio.png", N_("Audio"), 6}, | |
| 104 {DATA_DIR "/images/connectivity.png", N_("Connectivity"), 5}, | |
| 105 {DATA_DIR "/images/eq.png", N_("Equalizer"), 4}, | |
| 106 {DATA_DIR "/images/mouse.png", N_("Mouse"), 2}, | |
| 107 {DATA_DIR "/images/playlist.png", N_("Playlist"), 3}, | |
| 108 {DATA_DIR "/images/plugins.png", N_("Plugins"), 0}, | |
| 109 }; | |
| 110 | |
| 111 static gint n_categories = G_N_ELEMENTS(categories); | |
| 112 | |
| 113 static TitleFieldTag title_field_tags[] = { | |
| 114 { N_("Artist") , "%p" }, | |
| 115 { N_("Album") , "%a" }, | |
| 116 { N_("Title") , "%t" }, | |
| 117 { N_("Tracknumber"), "%n" }, | |
| 118 { N_("Genre") , "%g" }, | |
| 119 { N_("Filename") , "%f" }, | |
| 120 { N_("Filepath") , "%F" }, | |
| 121 { N_("Date") , "%d" }, | |
| 122 { N_("Year") , "%y" }, | |
| 123 { N_("Comment") , "%c" } | |
| 124 }; | |
| 125 | |
| 126 typedef struct { | |
| 127 void *next; | |
| 128 GtkWidget *container; | |
| 129 char *pg_name; | |
| 130 char *img_url; | |
| 131 } CategoryQueueEntry; | |
| 132 | |
| 133 CategoryQueueEntry *category_queue = NULL; | |
| 134 | |
| 135 static const guint n_title_field_tags = G_N_ELEMENTS(title_field_tags); | |
| 136 | |
| 137 /* GLib 2.6 compatibility */ | |
| 138 #if (! ((GLIB_MAJOR_VERSION > 2) || ((GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION >= 8)))) | |
| 139 static const char * | |
| 140 g_get_host_name (void) | |
| 141 { | |
| 142 static char hostname [HOST_NAME_MAX + 1]; | |
| 143 if (gethostname (hostname, HOST_NAME_MAX) == -1) { | |
| 144 return _("localhost"); | |
| 145 } | |
| 146 return hostname; | |
| 147 } | |
| 148 #endif | |
| 149 | |
| 150 static void prefswin_page_queue_destroy(CategoryQueueEntry *ent); | |
| 151 | |
| 152 static GladeXML * | |
| 153 prefswin_get_xml(void) | |
| 154 { | |
| 155 return GLADE_XML(g_object_get_data(G_OBJECT(prefswin), "glade-xml")); | |
| 156 } | |
| 157 | |
| 158 static void | |
| 159 change_category(GtkNotebook * notebook, | |
| 160 GtkTreeSelection * selection) | |
| 161 { | |
| 162 GtkTreeModel *model; | |
| 163 GtkTreeIter iter; | |
| 164 gint index; | |
| 165 | |
| 166 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
| 167 return; | |
| 168 | |
| 169 gtk_tree_model_get(model, &iter, CATEGORY_VIEW_COL_ID, &index, -1); | |
| 170 gtk_notebook_set_current_page(notebook, index); | |
| 171 } | |
| 172 | |
| 173 void | |
| 174 prefswin_set_category(gint index) | |
| 175 { | |
| 176 GladeXML *xml; | |
| 177 GtkWidget *notebook; | |
| 178 | |
| 179 g_return_if_fail(index >= 0 && index < n_categories); | |
| 180 | |
| 181 xml = prefswin_get_xml(); | |
| 182 notebook = glade_xml_get_widget(xml, "category_view"); | |
| 183 gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook), index); | |
| 184 } | |
| 185 | |
| 186 | |
| 187 static void | |
| 188 input_plugin_open_prefs(GtkTreeView * treeview, | |
| 189 gpointer data) | |
| 190 { | |
| 191 GtkTreeSelection *selection; | |
| 192 GtkTreeModel *model; | |
| 193 GtkTreeIter iter; | |
| 194 gint id; | |
| 195 | |
| 196 selection = gtk_tree_view_get_selection(treeview); | |
| 197 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
| 198 return; | |
| 199 | |
| 200 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
| 201 input_configure(id); | |
| 202 } | |
| 203 | |
| 204 static void | |
| 205 input_plugin_open_info(GtkTreeView * treeview, | |
| 206 gpointer data) | |
| 207 { | |
| 208 GtkTreeSelection *selection; | |
| 209 GtkTreeModel *model; | |
| 210 GtkTreeIter iter; | |
| 211 gint id; | |
| 212 | |
| 213 selection = gtk_tree_view_get_selection(treeview); | |
| 214 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
| 215 return; | |
| 216 | |
| 217 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
| 218 input_about(id); | |
| 219 } | |
| 220 | |
| 221 static void | |
| 222 output_plugin_open_prefs(GtkComboBox * cbox, | |
| 223 gpointer data) | |
| 224 { | |
| 225 output_configure(gtk_combo_box_get_active(cbox)); | |
| 226 } | |
| 227 | |
| 228 static void | |
| 229 output_plugin_open_info(GtkComboBox * cbox, | |
| 230 gpointer data) | |
| 231 { | |
| 232 output_about(gtk_combo_box_get_active(cbox)); | |
| 233 } | |
| 234 | |
| 235 static void | |
| 236 general_plugin_open_prefs(GtkTreeView * treeview, | |
| 237 gpointer data) | |
| 238 { | |
| 239 GtkTreeSelection *selection; | |
| 240 GtkTreeModel *model; | |
| 241 GtkTreeIter iter; | |
| 242 gint id; | |
| 243 | |
| 244 selection = gtk_tree_view_get_selection(treeview); | |
| 245 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
| 246 return; | |
| 247 | |
| 248 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
| 249 general_configure(id); | |
| 250 } | |
| 251 | |
| 252 static void | |
| 253 general_plugin_open_info(GtkTreeView * treeview, | |
| 254 gpointer data) | |
| 255 { | |
| 256 GtkTreeSelection *selection; | |
| 257 GtkTreeModel *model; | |
| 258 GtkTreeIter iter; | |
| 259 gint id; | |
| 260 | |
| 261 selection = gtk_tree_view_get_selection(treeview); | |
| 262 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
| 263 return; | |
| 264 | |
| 265 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
| 266 general_about(id); | |
| 267 } | |
| 268 | |
| 269 static void | |
| 270 input_plugin_toggle(GtkCellRendererToggle * cell, | |
| 271 const gchar * path_str, | |
| 272 gpointer data) | |
| 273 { | |
| 274 GtkTreeModel *model = GTK_TREE_MODEL(data); | |
| 275 GtkTreeIter iter; | |
| 276 GtkTreePath *path = gtk_tree_path_new_from_string(path_str); | |
| 277 gboolean fixed; | |
| 278 gint pluginnr; | |
| 279 gchar *filename, *basename; | |
| 280 /*GList *diplist, *tmplist; */ | |
| 281 | |
| 282 /* get toggled iter */ | |
| 283 gtk_tree_model_get_iter(model, &iter, path); | |
| 284 gtk_tree_model_get(model, &iter, | |
| 285 PLUGIN_VIEW_COL_ACTIVE, &fixed, | |
| 286 PLUGIN_VIEW_COL_ID, &pluginnr, | |
| 287 PLUGIN_VIEW_COL_FILENAME, &filename, | |
| 288 -1); | |
| 289 | |
| 290 basename = g_path_get_basename(filename); | |
| 291 g_free(filename); | |
| 292 | |
| 293 /* do something with the value */ | |
| 294 fixed ^= 1; | |
| 295 | |
| 296 g_hash_table_replace(plugin_matrix, basename, GINT_TO_POINTER(fixed)); | |
| 297 /* g_hash_table_foreach(pluginmatrix, (GHFunc) disp_matrix, NULL); */ | |
| 298 | |
| 299 /* set new value */ | |
| 300 gtk_list_store_set(GTK_LIST_STORE(model), &iter, | |
| 301 PLUGIN_VIEW_COL_ACTIVE, fixed, -1); | |
| 302 | |
| 303 /* clean up */ | |
| 304 gtk_tree_path_free(path); | |
| 305 } | |
| 306 | |
| 307 | |
| 308 static void | |
| 309 vis_plugin_toggle(GtkCellRendererToggle * cell, | |
| 310 const gchar * path_str, | |
| 311 gpointer data) | |
| 312 { | |
| 313 GtkTreeModel *model = GTK_TREE_MODEL(data); | |
| 314 GtkTreeIter iter; | |
| 315 GtkTreePath *path = gtk_tree_path_new_from_string(path_str); | |
| 316 gboolean fixed; | |
| 317 gint pluginnr; | |
| 318 | |
| 319 /* get toggled iter */ | |
| 320 gtk_tree_model_get_iter(model, &iter, path); | |
| 321 gtk_tree_model_get(model, &iter, | |
| 322 PLUGIN_VIEW_COL_ACTIVE, &fixed, | |
| 323 PLUGIN_VIEW_COL_ID, &pluginnr, -1); | |
| 324 | |
| 325 /* do something with the value */ | |
| 326 fixed ^= 1; | |
| 327 | |
| 328 enable_vis_plugin(pluginnr, fixed); | |
| 329 | |
| 330 /* set new value */ | |
| 331 gtk_list_store_set(GTK_LIST_STORE(model), &iter, | |
| 332 PLUGIN_VIEW_COL_ACTIVE, fixed, -1); | |
| 333 | |
| 334 /* clean up */ | |
| 335 gtk_tree_path_free(path); | |
| 336 } | |
| 337 | |
| 338 static void | |
| 339 effect_plugin_toggle(GtkCellRendererToggle * cell, | |
| 340 const gchar * path_str, | |
| 341 gpointer data) | |
| 342 { | |
| 343 GtkTreeModel *model = GTK_TREE_MODEL(data); | |
| 344 GtkTreeIter iter; | |
| 345 GtkTreePath *path = gtk_tree_path_new_from_string(path_str); | |
| 346 gboolean fixed; | |
| 347 gint pluginnr; | |
| 348 | |
| 349 /* get toggled iter */ | |
| 350 gtk_tree_model_get_iter(model, &iter, path); | |
| 351 gtk_tree_model_get(model, &iter, | |
| 352 PLUGIN_VIEW_COL_ACTIVE, &fixed, | |
| 353 PLUGIN_VIEW_COL_ID, &pluginnr, -1); | |
| 354 | |
| 355 /* do something with the value */ | |
| 356 fixed ^= 1; | |
| 357 | |
| 358 enable_effect_plugin(pluginnr, fixed); | |
| 359 | |
| 360 /* set new value */ | |
| 361 gtk_list_store_set(GTK_LIST_STORE(model), &iter, | |
| 362 PLUGIN_VIEW_COL_ACTIVE, fixed, -1); | |
| 363 | |
| 364 /* clean up */ | |
| 365 gtk_tree_path_free(path); | |
| 366 } | |
| 367 static void | |
| 368 general_plugin_toggle(GtkCellRendererToggle * cell, | |
| 369 const gchar * path_str, | |
| 370 gpointer data) | |
| 371 { | |
| 372 GtkTreeModel *model = GTK_TREE_MODEL(data); | |
| 373 GtkTreeIter iter; | |
| 374 GtkTreePath *path = gtk_tree_path_new_from_string(path_str); | |
| 375 gboolean fixed; | |
| 376 gint pluginnr; | |
| 377 | |
| 378 /* get toggled iter */ | |
| 379 gtk_tree_model_get_iter(model, &iter, path); | |
| 380 gtk_tree_model_get(model, &iter, | |
| 381 PLUGIN_VIEW_COL_ACTIVE, &fixed, | |
| 382 PLUGIN_VIEW_COL_ID, &pluginnr, -1); | |
| 383 | |
| 384 /* do something with the value */ | |
| 385 fixed ^= 1; | |
| 386 | |
| 387 enable_general_plugin(pluginnr, fixed); | |
| 388 | |
| 389 /* set new value */ | |
| 390 gtk_list_store_set(GTK_LIST_STORE(model), &iter, | |
| 391 PLUGIN_VIEW_COL_ACTIVE, fixed, -1); | |
| 392 | |
| 393 /* clean up */ | |
| 394 gtk_tree_path_free(path); | |
| 395 } | |
| 396 | |
| 397 static void | |
| 398 on_output_plugin_cbox_changed(GtkComboBox * combobox, | |
| 399 gpointer data) | |
| 400 { | |
| 401 gint selected; | |
| 402 selected = gtk_combo_box_get_active(combobox); | |
| 403 | |
| 404 set_current_output_plugin(selected); | |
| 405 } | |
| 406 | |
| 407 static void | |
| 408 on_output_plugin_cbox_realize(GtkComboBox * cbox, | |
| 409 gpointer data) | |
| 410 { | |
| 411 GList *olist = get_output_list(); | |
| 412 OutputPlugin *op, *cp = get_current_output_plugin(); | |
| 413 gint i = 0, selected = 0; | |
| 414 | |
| 415 if (!olist) { | |
| 416 gtk_widget_set_sensitive(GTK_WIDGET(cbox), FALSE); | |
| 417 return; | |
| 418 } | |
| 419 | |
| 420 for (i = 0; olist; i++, olist = g_list_next(olist)) { | |
| 421 op = OUTPUT_PLUGIN(olist->data); | |
| 422 | |
| 423 if (olist->data == cp) | |
| 424 selected = i; | |
| 425 | |
| 426 gtk_combo_box_append_text(cbox, op->description); | |
| 427 } | |
| 428 | |
| 429 gtk_combo_box_set_active(cbox, selected); | |
| 430 g_signal_connect(cbox, "changed", | |
| 431 G_CALLBACK(on_output_plugin_cbox_changed), NULL); | |
| 432 } | |
| 433 | |
| 434 | |
| 435 static void | |
| 436 on_input_plugin_view_realize(GtkTreeView * treeview, | |
| 437 gpointer data) | |
| 438 { | |
| 439 GtkListStore *store; | |
| 440 GtkTreeIter iter; | |
| 441 | |
| 442 GtkCellRenderer *renderer; | |
| 443 GtkTreeViewColumn *column; | |
| 444 | |
| 445 GList *ilist; | |
| 446 gchar *description[2]; | |
| 447 InputPlugin *ip; | |
| 448 gint id = 0; | |
| 449 | |
| 450 gboolean enabled; | |
| 451 | |
| 452 store = gtk_list_store_new(PLUGIN_VIEW_N_COLS, | |
| 453 G_TYPE_BOOLEAN, G_TYPE_STRING, | |
| 454 G_TYPE_STRING, G_TYPE_INT); | |
| 455 | |
| 456 column = gtk_tree_view_column_new(); | |
| 457 gtk_tree_view_column_set_title(column, _("Enabled")); | |
| 458 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED); | |
| 459 gtk_tree_view_column_set_spacing(column, 4); | |
| 460 gtk_tree_view_column_set_resizable(column, FALSE); | |
| 461 gtk_tree_view_column_set_fixed_width(column, 50); | |
| 462 | |
| 463 renderer = gtk_cell_renderer_toggle_new(); | |
| 464 g_signal_connect(renderer, "toggled", | |
| 465 G_CALLBACK(input_plugin_toggle), store); | |
| 466 gtk_tree_view_column_pack_start(column, renderer, TRUE); | |
| 467 gtk_tree_view_column_set_attributes(column, renderer, "active", | |
| 468 PLUGIN_VIEW_COL_ACTIVE, NULL); | |
| 469 | |
| 470 gtk_tree_view_append_column(treeview, column); | |
| 471 | |
| 472 column = gtk_tree_view_column_new(); | |
| 473 gtk_tree_view_column_set_title(column, _("Description")); | |
| 474 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); | |
| 475 gtk_tree_view_column_set_spacing(column, 4); | |
| 476 gtk_tree_view_column_set_resizable(column, TRUE); | |
| 477 | |
| 478 | |
| 479 renderer = gtk_cell_renderer_text_new(); | |
| 480 gtk_tree_view_column_pack_start(column, renderer, FALSE); | |
| 481 gtk_tree_view_column_set_attributes(column, renderer, | |
| 482 "text", PLUGIN_VIEW_COL_DESC, NULL); | |
| 483 gtk_tree_view_append_column(treeview, column); | |
| 484 | |
| 485 column = gtk_tree_view_column_new(); | |
| 486 | |
| 487 gtk_tree_view_column_set_title(column, _("Filename")); | |
| 488 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); | |
| 489 gtk_tree_view_column_set_spacing(column, 4); | |
| 490 gtk_tree_view_column_set_resizable(column, TRUE); | |
| 491 | |
| 492 renderer = gtk_cell_renderer_text_new(); | |
| 493 gtk_tree_view_column_pack_start(column, renderer, TRUE); | |
| 494 gtk_tree_view_column_set_attributes(column, renderer, "text", | |
| 495 PLUGIN_VIEW_COL_FILENAME, NULL); | |
| 496 | |
| 497 gtk_tree_view_append_column(treeview, column); | |
| 498 | |
| 499 for (ilist = get_input_list(); ilist; ilist = g_list_next(ilist)) { | |
| 500 ip = INPUT_PLUGIN(ilist->data); | |
| 501 | |
| 502 description[0] = g_strdup(ip->description); | |
| 503 description[1] = g_strdup(ip->filename); | |
| 504 | |
| 505 enabled = input_is_enabled(description[1]); | |
| 506 | |
| 507 gtk_list_store_append(store, &iter); | |
| 508 gtk_list_store_set(store, &iter, | |
| 509 PLUGIN_VIEW_COL_ACTIVE, enabled, | |
| 510 PLUGIN_VIEW_COL_DESC, description[0], | |
| 511 PLUGIN_VIEW_COL_FILENAME, description[1], | |
| 512 PLUGIN_VIEW_COL_ID, id++, -1); | |
| 513 | |
| 514 g_free(description[1]); | |
| 515 g_free(description[0]); | |
| 516 } | |
| 517 | |
| 518 gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(store)); | |
| 519 } | |
| 520 | |
| 521 | |
| 522 static void | |
| 523 on_general_plugin_view_realize(GtkTreeView * treeview, | |
| 524 gpointer data) | |
| 525 { | |
| 526 GtkListStore *store; | |
| 527 GtkTreeIter iter; | |
| 528 | |
| 529 GtkCellRenderer *renderer; | |
| 530 GtkTreeViewColumn *column; | |
| 531 | |
| 532 GList *ilist /*, *diplist */ ; | |
| 533 gchar *description[2]; | |
| 534 GeneralPlugin *gp; | |
| 535 gint id = 0; | |
| 536 | |
| 537 gboolean enabled; | |
| 538 | |
| 539 store = gtk_list_store_new(PLUGIN_VIEW_N_COLS, | |
| 540 G_TYPE_BOOLEAN, G_TYPE_STRING, | |
| 541 G_TYPE_STRING, G_TYPE_INT); | |
| 542 | |
| 543 column = gtk_tree_view_column_new(); | |
| 544 gtk_tree_view_column_set_title(column, _("Enabled")); | |
| 545 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED); | |
| 546 gtk_tree_view_column_set_spacing(column, 4); | |
| 547 gtk_tree_view_column_set_resizable(column, FALSE); | |
| 548 gtk_tree_view_column_set_fixed_width(column, 50); | |
| 549 | |
| 550 renderer = gtk_cell_renderer_toggle_new(); | |
| 551 g_signal_connect(renderer, "toggled", | |
| 552 G_CALLBACK(general_plugin_toggle), store); | |
| 553 gtk_tree_view_column_pack_start(column, renderer, TRUE); | |
| 554 gtk_tree_view_column_set_attributes(column, renderer, "active", | |
| 555 PLUGIN_VIEW_COL_ACTIVE, NULL); | |
| 556 | |
| 557 gtk_tree_view_append_column(treeview, column); | |
| 558 | |
| 559 column = gtk_tree_view_column_new(); | |
| 560 gtk_tree_view_column_set_title(column, _("Description")); | |
| 561 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); | |
| 562 gtk_tree_view_column_set_spacing(column, 4); | |
| 563 gtk_tree_view_column_set_resizable(column, TRUE); | |
| 564 | |
| 565 | |
| 566 renderer = gtk_cell_renderer_text_new(); | |
| 567 gtk_tree_view_column_pack_start(column, renderer, FALSE); | |
| 568 gtk_tree_view_column_set_attributes(column, renderer, | |
| 569 "text", PLUGIN_VIEW_COL_DESC, NULL); | |
| 570 | |
| 571 gtk_tree_view_append_column(treeview, column); | |
| 572 | |
| 573 | |
| 574 column = gtk_tree_view_column_new(); | |
| 575 gtk_tree_view_column_set_title(column, _("Filename")); | |
| 576 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); | |
| 577 gtk_tree_view_column_set_spacing(column, 4); | |
| 578 gtk_tree_view_column_set_resizable(column, TRUE); | |
| 579 | |
| 580 renderer = gtk_cell_renderer_text_new(); | |
| 581 gtk_tree_view_column_pack_start(column, renderer, TRUE); | |
| 582 gtk_tree_view_column_set_attributes(column, renderer, "text", | |
| 583 PLUGIN_VIEW_COL_FILENAME, NULL); | |
| 584 | |
| 585 gtk_tree_view_append_column(treeview, column); | |
| 586 | |
| 587 for (ilist = get_general_list(); ilist; ilist = g_list_next(ilist)) { | |
| 588 gp = GENERAL_PLUGIN(ilist->data); | |
| 589 | |
| 590 description[0] = g_strdup(gp->description); | |
| 591 description[1] = g_strdup(gp->filename); | |
| 592 | |
| 593 enabled = general_enabled(id); | |
| 594 | |
| 595 gtk_list_store_append(store, &iter); | |
| 596 gtk_list_store_set(store, &iter, | |
| 597 PLUGIN_VIEW_COL_ACTIVE, enabled, | |
| 598 PLUGIN_VIEW_COL_DESC, description[0], | |
| 599 PLUGIN_VIEW_COL_FILENAME, description[1], | |
| 600 PLUGIN_VIEW_COL_ID, id++, -1); | |
| 601 | |
| 602 g_free(description[1]); | |
| 603 g_free(description[0]); | |
| 604 } | |
| 605 | |
| 606 gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(store)); | |
| 607 } | |
| 608 | |
| 609 | |
| 610 static void | |
| 611 on_vis_plugin_view_realize(GtkTreeView * treeview, | |
| 612 gpointer data) | |
| 613 { | |
| 614 GtkListStore *store; | |
| 615 GtkTreeIter iter; | |
| 616 | |
| 617 GtkCellRenderer *renderer; | |
| 618 GtkTreeViewColumn *column; | |
| 619 | |
| 620 GList *vlist; | |
| 621 gchar *description[2]; | |
| 622 VisPlugin *vp; | |
| 623 gint id = 0; | |
| 624 | |
| 625 gboolean enabled; | |
| 626 | |
| 627 | |
| 628 store = gtk_list_store_new(PLUGIN_VIEW_N_COLS, | |
| 629 G_TYPE_BOOLEAN, G_TYPE_STRING, | |
| 630 G_TYPE_STRING, G_TYPE_INT); | |
| 631 | |
| 632 column = gtk_tree_view_column_new(); | |
| 633 gtk_tree_view_column_set_title(column, _("Enabled")); | |
| 634 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED); | |
| 635 gtk_tree_view_column_set_spacing(column, 4); | |
| 636 gtk_tree_view_column_set_resizable(column, FALSE); | |
| 637 gtk_tree_view_column_set_fixed_width(column, 50); | |
| 638 | |
| 639 renderer = gtk_cell_renderer_toggle_new(); | |
| 640 g_signal_connect(renderer, "toggled", | |
| 641 G_CALLBACK(vis_plugin_toggle), store); | |
| 642 gtk_tree_view_column_pack_start(column, renderer, TRUE); | |
| 643 gtk_tree_view_column_set_attributes(column, renderer, "active", | |
| 644 PLUGIN_VIEW_COL_ACTIVE, NULL); | |
| 645 | |
| 646 gtk_tree_view_append_column(treeview, column); | |
| 647 | |
| 648 column = gtk_tree_view_column_new(); | |
| 649 gtk_tree_view_column_set_title(column, _("Description")); | |
| 650 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); | |
| 651 gtk_tree_view_column_set_spacing(column, 4); | |
| 652 gtk_tree_view_column_set_resizable(column, TRUE); | |
| 653 | |
| 654 | |
| 655 renderer = gtk_cell_renderer_text_new(); | |
| 656 gtk_tree_view_column_pack_start(column, renderer, FALSE); | |
| 657 gtk_tree_view_column_set_attributes(column, renderer, | |
| 658 "text", PLUGIN_VIEW_COL_DESC, NULL); | |
| 659 | |
| 660 gtk_tree_view_append_column(treeview, column); | |
| 661 | |
| 662 | |
| 663 column = gtk_tree_view_column_new(); | |
| 664 gtk_tree_view_column_set_title(column, _("Filename")); | |
| 665 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); | |
| 666 gtk_tree_view_column_set_spacing(column, 4); | |
| 667 gtk_tree_view_column_set_resizable(column, TRUE); | |
| 668 | |
| 669 renderer = gtk_cell_renderer_text_new(); | |
| 670 gtk_tree_view_column_pack_start(column, renderer, TRUE); | |
| 671 gtk_tree_view_column_set_attributes(column, renderer, "text", | |
| 672 PLUGIN_VIEW_COL_FILENAME, NULL); | |
| 673 | |
| 674 gtk_tree_view_append_column(treeview, column); | |
| 675 | |
| 676 for (vlist = get_vis_list(); vlist; vlist = g_list_next(vlist)) { | |
| 677 vp = VIS_PLUGIN(vlist->data); | |
| 678 | |
| 679 description[0] = g_strdup(vp->description); | |
| 680 description[1] = g_strdup(vp->filename); | |
| 681 | |
| 682 enabled = vis_enabled(id); | |
| 683 | |
| 684 gtk_list_store_append(store, &iter); | |
| 685 gtk_list_store_set(store, &iter, | |
| 686 PLUGIN_VIEW_COL_ACTIVE, enabled, | |
| 687 PLUGIN_VIEW_COL_DESC, description[0], | |
| 688 PLUGIN_VIEW_COL_FILENAME, description[1], | |
| 689 PLUGIN_VIEW_COL_ID, id++, -1); | |
| 690 | |
| 691 g_free(description[1]); | |
| 692 g_free(description[0]); | |
| 693 } | |
| 694 | |
| 695 gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(store)); | |
| 696 } | |
| 697 | |
| 698 static void | |
| 699 editable_insert_text(GtkEditable * editable, | |
| 700 const gchar * text, | |
| 701 gint * pos) | |
| 702 { | |
| 703 gtk_editable_insert_text(editable, text, strlen(text), pos); | |
| 704 } | |
| 705 | |
| 706 | |
| 707 static void | |
| 708 on_effect_plugin_view_realize(GtkTreeView * treeview, | |
| 709 gpointer data) | |
| 710 { | |
| 711 GtkListStore *store; | |
| 712 GtkTreeIter iter; | |
| 713 | |
| 714 GtkCellRenderer *renderer; | |
| 715 GtkTreeViewColumn *column; | |
| 716 | |
| 717 GList *elist; | |
| 718 gchar *description[2]; | |
| 719 gint id = 0; | |
| 720 | |
| 721 gboolean enabled; | |
| 722 | |
| 723 | |
| 724 store = gtk_list_store_new(PLUGIN_VIEW_N_COLS, | |
| 725 G_TYPE_BOOLEAN, G_TYPE_STRING, | |
| 726 G_TYPE_STRING, G_TYPE_INT); | |
| 727 | |
| 728 column = gtk_tree_view_column_new(); | |
| 729 gtk_tree_view_column_set_title(column, _("Enabled")); | |
| 730 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED); | |
| 731 gtk_tree_view_column_set_spacing(column, 4); | |
| 732 gtk_tree_view_column_set_resizable(column, FALSE); | |
| 733 gtk_tree_view_column_set_fixed_width(column, 50); | |
| 734 | |
| 735 renderer = gtk_cell_renderer_toggle_new(); | |
| 736 g_signal_connect(renderer, "toggled", | |
| 737 G_CALLBACK(effect_plugin_toggle), store); | |
| 738 gtk_tree_view_column_pack_start(column, renderer, TRUE); | |
| 739 gtk_tree_view_column_set_attributes(column, renderer, "active", | |
| 740 PLUGIN_VIEW_COL_ACTIVE, NULL); | |
| 741 | |
| 742 gtk_tree_view_append_column(treeview, column); | |
| 743 | |
| 744 column = gtk_tree_view_column_new(); | |
| 745 gtk_tree_view_column_set_title(column, _("Description")); | |
| 746 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); | |
| 747 gtk_tree_view_column_set_spacing(column, 4); | |
| 748 gtk_tree_view_column_set_resizable(column, TRUE); | |
| 749 | |
| 750 | |
| 751 renderer = gtk_cell_renderer_text_new(); | |
| 752 gtk_tree_view_column_pack_start(column, renderer, FALSE); | |
| 753 gtk_tree_view_column_set_attributes(column, renderer, | |
| 754 "text", PLUGIN_VIEW_COL_DESC, NULL); | |
| 755 | |
| 756 gtk_tree_view_append_column(treeview, column); | |
| 757 | |
| 758 | |
| 759 column = gtk_tree_view_column_new(); | |
| 760 gtk_tree_view_column_set_title(column, _("Filename")); | |
| 761 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); | |
| 762 gtk_tree_view_column_set_spacing(column, 4); | |
| 763 gtk_tree_view_column_set_resizable(column, TRUE); | |
| 764 | |
| 765 renderer = gtk_cell_renderer_text_new(); | |
| 766 gtk_tree_view_column_pack_start(column, renderer, TRUE); | |
| 767 gtk_tree_view_column_set_attributes(column, renderer, "text", | |
| 768 PLUGIN_VIEW_COL_FILENAME, NULL); | |
| 769 | |
| 770 gtk_tree_view_append_column(treeview, column); | |
| 771 | |
| 772 for (elist = get_effect_list(); elist; elist = g_list_next(elist)) { | |
| 773 EffectPlugin *ep = EFFECT_PLUGIN(elist->data); | |
| 774 | |
| 775 description[0] = g_strdup(ep->description); | |
| 776 description[1] = g_strdup(ep->filename); | |
| 777 | |
| 778 enabled = effect_enabled(id); | |
| 779 | |
| 780 gtk_list_store_append(store, &iter); | |
| 781 gtk_list_store_set(store, &iter, | |
| 782 PLUGIN_VIEW_COL_ACTIVE, enabled, | |
| 783 PLUGIN_VIEW_COL_DESC, description[0], | |
| 784 PLUGIN_VIEW_COL_FILENAME, description[1], | |
| 785 PLUGIN_VIEW_COL_ID, id++, -1); | |
| 786 | |
| 787 g_free(description[1]); | |
| 788 g_free(description[0]); | |
| 789 } | |
| 790 | |
| 791 gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(store)); | |
| 792 } | |
| 793 | |
| 794 static void | |
| 795 titlestring_tag_menu_callback(GtkMenuItem * menuitem, | |
| 796 gpointer data) | |
| 797 { | |
| 798 const gchar *separator = " - "; | |
| 799 GladeXML *xml; | |
| 800 GtkWidget *entry; | |
| 801 gint item = GPOINTER_TO_INT(data); | |
| 802 gint pos; | |
| 803 | |
| 804 xml = prefswin_get_xml(); | |
| 805 entry = glade_xml_get_widget(xml, "titlestring_entry"); | |
| 806 | |
| 807 pos = gtk_editable_get_position(GTK_EDITABLE(entry)); | |
| 808 | |
| 809 /* insert separator as needed */ | |
| 810 if (g_utf8_strlen(gtk_entry_get_text(GTK_ENTRY(entry)), -1) > 0) | |
| 811 editable_insert_text(GTK_EDITABLE(entry), separator, &pos); | |
| 812 | |
| 813 editable_insert_text(GTK_EDITABLE(entry), _(title_field_tags[item].tag), | |
| 814 &pos); | |
| 815 | |
| 816 gtk_editable_set_position(GTK_EDITABLE(entry), pos); | |
| 817 } | |
| 818 | |
| 819 static void | |
| 820 on_titlestring_help_button_clicked(GtkButton * button, | |
| 821 gpointer data) | |
| 822 { | |
| 823 | |
| 824 GtkMenu *menu; | |
| 825 MenuPos *pos = g_new0(MenuPos, 1); | |
| 826 GdkWindow *parent; | |
| 827 | |
| 828 gint x_ro, y_ro; | |
| 829 gint x_widget, y_widget; | |
| 830 gint x_size, y_size; | |
| 831 | |
| 832 g_return_if_fail (button != NULL); | |
| 833 g_return_if_fail (GTK_IS_MENU (data)); | |
| 834 | |
| 835 parent = gtk_widget_get_parent_window(GTK_WIDGET(button)); | |
| 836 | |
| 837 gdk_drawable_get_size(parent, &x_size, &y_size); | |
| 838 gdk_window_get_root_origin(GTK_WIDGET(button)->window, &x_ro, &y_ro); | |
| 839 gdk_window_get_position(GTK_WIDGET(button)->window, &x_widget, &y_widget); | |
| 840 | |
| 841 pos->x = x_size + x_ro; | |
| 842 pos->y = y_size + y_ro - 100; | |
| 843 | |
| 844 menu = GTK_MENU(data); | |
| 845 gtk_menu_popup (menu, NULL, NULL, util_menu_position, pos, | |
| 846 0, GDK_CURRENT_TIME); | |
| 847 } | |
| 848 | |
| 849 | |
| 850 static void | |
| 851 on_titlestring_entry_realize(GtkWidget * entry, | |
| 852 gpointer data) | |
| 853 { | |
| 854 gtk_entry_set_text(GTK_ENTRY(entry), cfg.gentitle_format); | |
| 855 } | |
| 856 | |
| 857 static void | |
| 858 on_titlestring_entry_changed(GtkWidget * entry, | |
| 859 gpointer data) | |
| 860 { | |
| 861 g_free(cfg.gentitle_format); | |
| 862 cfg.gentitle_format = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry))); | |
| 863 } | |
| 864 | |
| 865 static void | |
| 866 on_titlestring_cbox_realize(GtkWidget * cbox, | |
| 867 gpointer data) | |
| 868 { | |
| 869 gtk_combo_box_set_active(GTK_COMBO_BOX(cbox), cfg.titlestring_preset); | |
| 870 gtk_widget_set_sensitive(GTK_WIDGET(data), | |
| 871 (cfg.titlestring_preset == (gint)n_titlestring_presets)); | |
| 872 } | |
| 873 | |
| 874 static void | |
| 875 on_titlestring_cbox_changed(GtkWidget * cbox, | |
| 876 gpointer data) | |
| 877 { | |
| 878 gint position = gtk_combo_box_get_active(GTK_COMBO_BOX(cbox)); | |
| 879 | |
| 880 cfg.titlestring_preset = position; | |
| 881 gtk_widget_set_sensitive(GTK_WIDGET(data), (position == 6)); | |
| 882 } | |
| 883 | |
| 884 static void | |
| 885 on_mainwin_font_button_font_set(GtkFontButton * button, | |
| 886 gpointer data) | |
| 887 { | |
| 888 g_free(cfg.mainwin_font); | |
| 889 cfg.mainwin_font = g_strdup(gtk_font_button_get_font_name(button)); | |
| 890 | |
| 2911 | 891 ui_skinned_textbox_set_xfont(mainwin_info, cfg.mainwin_use_xfont, cfg.mainwin_font); |
| 2313 | 892 mainwin_set_info_text(); |
| 893 draw_main_window(TRUE); | |
| 894 } | |
| 895 | |
| 896 static void | |
| 897 on_use_bitmap_fonts_realize(GtkToggleButton * button, | |
| 898 gpointer data) | |
| 899 { | |
| 900 gtk_toggle_button_set_active(button, | |
| 901 cfg.mainwin_use_xfont != FALSE ? FALSE : TRUE); | |
| 902 } | |
| 903 | |
| 904 static void | |
| 905 on_use_bitmap_fonts_toggled(GtkToggleButton * button, | |
| 906 gpointer data) | |
| 907 { | |
| 908 gboolean useit = gtk_toggle_button_get_active(button); | |
| 909 cfg.mainwin_use_xfont = useit != FALSE ? FALSE : TRUE; | |
| 2911 | 910 ui_skinned_textbox_set_xfont(mainwin_info, cfg.mainwin_use_xfont, cfg.mainwin_font); |
| 2313 | 911 playlistwin_set_sinfo_font(cfg.playlist_font); |
| 912 | |
| 913 mainwin_set_info_text(); | |
| 914 draw_main_window(TRUE); | |
| 915 if (cfg.playlist_shaded) { | |
| 916 playlistwin_update_list(playlist_get_active()); | |
| 917 draw_playlist_window(TRUE); | |
| 918 } | |
| 919 } | |
| 920 | |
| 921 static void | |
| 922 on_mainwin_font_button_realize(GtkFontButton * button, | |
| 923 gpointer data) | |
| 924 { | |
| 925 gtk_font_button_set_font_name(button, cfg.mainwin_font); | |
| 926 } | |
| 927 | |
| 928 static void | |
| 929 on_playlist_font_button_font_set(GtkFontButton * button, | |
| 930 gpointer data) | |
| 931 { | |
| 932 g_free(cfg.playlist_font); | |
| 933 cfg.playlist_font = g_strdup(gtk_font_button_get_font_name(button)); | |
| 934 | |
| 935 playlist_list_set_font(cfg.playlist_font); | |
| 936 playlistwin_set_sinfo_font(cfg.playlist_font); /* propagate font setting to playlistwin_sinfo */ | |
| 937 playlistwin_update_list(playlist_get_active()); | |
| 938 draw_playlist_window(TRUE); | |
| 939 } | |
| 940 | |
| 941 static void | |
| 942 on_playlist_font_button_realize(GtkFontButton * button, | |
| 943 gpointer data) | |
| 944 { | |
| 945 gtk_font_button_set_font_name(button, cfg.playlist_font); | |
| 946 } | |
| 947 | |
| 948 static void | |
| 949 on_playlist_show_pl_numbers_realize(GtkToggleButton * button, | |
| 950 gpointer data) | |
| 951 { | |
| 952 gtk_toggle_button_set_active(button, cfg.show_numbers_in_pl); | |
| 953 } | |
| 954 | |
| 955 static void | |
| 956 on_playlist_show_pl_numbers_toggled(GtkToggleButton * button, | |
| 957 gpointer data) | |
| 958 { | |
| 959 cfg.show_numbers_in_pl = gtk_toggle_button_get_active(button); | |
| 960 playlistwin_update_list(playlist_get_active()); | |
| 961 draw_playlist_window(TRUE); | |
| 962 } | |
| 963 | |
| 964 static void | |
| 965 on_playlist_show_pl_separator_realize(GtkToggleButton * button, | |
| 966 gpointer data) | |
| 967 { | |
| 968 gtk_toggle_button_set_active(button, cfg.show_separator_in_pl); | |
| 969 } | |
| 970 | |
| 971 static void | |
| 972 on_playlist_show_pl_separator_toggled(GtkToggleButton * button, | |
| 973 gpointer data) | |
| 974 { | |
| 975 cfg.show_separator_in_pl = gtk_toggle_button_get_active(button); | |
| 976 playlistwin_update_list(playlist_get_active()); | |
| 977 draw_playlist_window(TRUE); | |
| 978 } | |
| 979 | |
| 980 /* format detection */ | |
| 981 static void | |
| 982 on_audio_format_det_cb_toggled(GtkToggleButton * button, | |
| 983 gpointer data) | |
| 984 { | |
| 985 cfg.playlist_detect = gtk_toggle_button_get_active(button); | |
| 986 } | |
| 987 | |
| 988 static void | |
| 989 on_audio_format_det_cb_realize(GtkToggleButton * button, | |
| 990 gpointer data) | |
| 991 { | |
| 992 gtk_toggle_button_set_active(button, cfg.playlist_detect); | |
| 993 } | |
| 994 | |
| 995 static void | |
| 996 on_detect_by_extension_cb_toggled(GtkToggleButton * button, | |
| 997 gpointer data) | |
| 998 { | |
| 999 cfg.use_extension_probing = gtk_toggle_button_get_active(button); | |
| 1000 } | |
| 1001 | |
| 1002 static void | |
| 1003 on_detect_by_extension_cb_realize(GtkToggleButton * button, | |
| 1004 gpointer data) | |
| 1005 { | |
| 1006 gtk_toggle_button_set_active(button, cfg.use_extension_probing); | |
| 1007 } | |
| 1008 | |
| 1009 /* proxy */ | |
| 1010 static void | |
| 1011 on_proxy_use_realize(GtkToggleButton * button, | |
| 1012 gpointer data) | |
| 1013 { | |
| 1014 ConfigDb *db; | |
| 1015 gboolean ret; | |
| 1016 | |
| 1017 db = bmp_cfg_db_open(); | |
| 1018 | |
| 1019 if (bmp_cfg_db_get_bool(db, NULL, "use_proxy", &ret) != FALSE) | |
| 1020 gtk_toggle_button_set_active(button, ret); | |
| 1021 | |
| 1022 bmp_cfg_db_close(db); | |
| 1023 } | |
| 1024 | |
| 1025 static void | |
| 1026 on_proxy_use_toggled(GtkToggleButton * button, | |
| 1027 gpointer data) | |
| 1028 { | |
| 1029 ConfigDb *db; | |
| 1030 gboolean ret = gtk_toggle_button_get_active(button); | |
| 1031 | |
| 1032 db = bmp_cfg_db_open(); | |
| 1033 bmp_cfg_db_set_bool(db, NULL, "use_proxy", ret); | |
| 1034 bmp_cfg_db_close(db); | |
| 1035 } | |
| 1036 | |
| 1037 static void | |
| 1038 on_proxy_auth_realize(GtkToggleButton * button, | |
| 1039 gpointer data) | |
| 1040 { | |
| 1041 ConfigDb *db; | |
| 1042 gboolean ret; | |
| 1043 | |
| 1044 db = bmp_cfg_db_open(); | |
| 1045 | |
| 1046 if (bmp_cfg_db_get_bool(db, NULL, "proxy_use_auth", &ret) != FALSE) | |
| 1047 gtk_toggle_button_set_active(button, ret); | |
| 1048 | |
| 1049 bmp_cfg_db_close(db); | |
| 1050 } | |
| 1051 | |
| 1052 static void | |
| 1053 on_proxy_auth_toggled(GtkToggleButton * button, | |
| 1054 gpointer data) | |
| 1055 { | |
| 1056 ConfigDb *db; | |
| 1057 gboolean ret = gtk_toggle_button_get_active(button); | |
| 1058 | |
| 1059 db = bmp_cfg_db_open(); | |
| 1060 bmp_cfg_db_set_bool(db, NULL, "proxy_use_auth", ret); | |
| 1061 bmp_cfg_db_close(db); | |
| 1062 } | |
| 1063 | |
| 1064 static void | |
| 1065 on_proxy_host_realize(GtkEntry * entry, | |
| 1066 gpointer data) | |
| 1067 { | |
| 1068 ConfigDb *db; | |
| 1069 gchar *ret; | |
| 1070 | |
| 1071 db = bmp_cfg_db_open(); | |
| 1072 | |
| 1073 if (bmp_cfg_db_get_string(db, NULL, "proxy_host", &ret) != FALSE) | |
| 1074 gtk_entry_set_text(entry, ret); | |
| 1075 | |
| 1076 bmp_cfg_db_close(db); | |
| 1077 } | |
| 1078 | |
| 1079 static void | |
| 1080 on_proxy_host_changed(GtkEntry * entry, | |
| 1081 gpointer data) | |
| 1082 { | |
| 1083 ConfigDb *db; | |
| 1084 gchar *ret = g_strdup(gtk_entry_get_text(entry)); | |
| 1085 | |
| 1086 db = bmp_cfg_db_open(); | |
| 1087 bmp_cfg_db_set_string(db, NULL, "proxy_host", ret); | |
| 1088 bmp_cfg_db_close(db); | |
| 1089 | |
| 1090 g_free(ret); | |
| 1091 } | |
| 1092 | |
| 1093 static void | |
| 1094 on_proxy_port_realize(GtkEntry * entry, | |
| 1095 gpointer data) | |
| 1096 { | |
| 1097 ConfigDb *db; | |
| 1098 gchar *ret; | |
| 1099 | |
| 1100 db = bmp_cfg_db_open(); | |
| 1101 | |
| 1102 if (bmp_cfg_db_get_string(db, NULL, "proxy_port", &ret) != FALSE) | |
| 1103 gtk_entry_set_text(entry, ret); | |
| 1104 | |
| 1105 bmp_cfg_db_close(db); | |
| 1106 } | |
| 1107 | |
| 1108 static void | |
| 1109 on_proxy_port_changed(GtkEntry * entry, | |
| 1110 gpointer data) | |
| 1111 { | |
| 1112 ConfigDb *db; | |
| 1113 gchar *ret = g_strdup(gtk_entry_get_text(entry)); | |
| 1114 | |
| 1115 db = bmp_cfg_db_open(); | |
| 1116 bmp_cfg_db_set_string(db, NULL, "proxy_port", ret); | |
| 1117 bmp_cfg_db_close(db); | |
| 1118 | |
| 1119 g_free(ret); | |
| 1120 } | |
| 1121 | |
| 1122 static void | |
| 1123 on_proxy_user_realize(GtkEntry * entry, | |
| 1124 gpointer data) | |
| 1125 { | |
| 1126 ConfigDb *db; | |
| 1127 gchar *ret; | |
| 1128 | |
| 1129 db = bmp_cfg_db_open(); | |
| 1130 | |
| 1131 if (bmp_cfg_db_get_string(db, NULL, "proxy_user", &ret) != FALSE) | |
| 1132 gtk_entry_set_text(entry, ret); | |
| 1133 | |
| 1134 bmp_cfg_db_close(db); | |
| 1135 } | |
| 1136 | |
| 1137 static void | |
| 1138 on_proxy_user_changed(GtkEntry * entry, | |
| 1139 gpointer data) | |
| 1140 { | |
| 1141 ConfigDb *db; | |
| 1142 gchar *ret = g_strdup(gtk_entry_get_text(entry)); | |
| 1143 | |
| 1144 db = bmp_cfg_db_open(); | |
| 1145 bmp_cfg_db_set_string(db, NULL, "proxy_user", ret); | |
| 1146 bmp_cfg_db_close(db); | |
| 1147 | |
| 1148 g_free(ret); | |
| 1149 } | |
| 1150 | |
| 1151 static void | |
| 1152 on_proxy_pass_realize(GtkEntry * entry, | |
| 1153 gpointer data) | |
| 1154 { | |
| 1155 ConfigDb *db; | |
| 1156 gchar *ret; | |
| 1157 | |
| 1158 db = bmp_cfg_db_open(); | |
| 1159 | |
| 1160 if (bmp_cfg_db_get_string(db, NULL, "proxy_pass", &ret) != FALSE) | |
| 1161 gtk_entry_set_text(entry, ret); | |
| 1162 | |
| 1163 bmp_cfg_db_close(db); | |
| 1164 } | |
| 1165 | |
| 1166 static void | |
| 1167 on_proxy_pass_changed(GtkEntry * entry, | |
| 1168 gpointer data) | |
| 1169 { | |
| 1170 ConfigDb *db; | |
| 1171 gchar *ret = g_strdup(gtk_entry_get_text(entry)); | |
| 1172 | |
| 1173 db = bmp_cfg_db_open(); | |
| 1174 bmp_cfg_db_set_string(db, NULL, "proxy_pass", ret); | |
| 1175 bmp_cfg_db_close(db); | |
| 1176 | |
| 1177 g_free(ret); | |
| 1178 } | |
| 1179 | |
| 1180 static void | |
| 1181 input_plugin_enable_prefs(GtkTreeView * treeview, | |
| 1182 GtkButton * button) | |
| 1183 { | |
| 1184 GtkTreeSelection *selection; | |
| 1185 GtkTreeModel *model; | |
| 1186 GtkTreeIter iter; | |
| 1187 | |
| 1188 GList *plist; | |
| 1189 gint id; | |
| 1190 | |
| 1191 selection = gtk_tree_view_get_selection(treeview); | |
| 1192 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
| 1193 return; | |
| 1194 | |
| 1195 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
| 1196 | |
| 1197 plist = get_input_list(); | |
| 1198 plist = g_list_nth(plist, id); | |
| 1199 | |
| 1200 gtk_widget_set_sensitive(GTK_WIDGET(button), | |
| 1201 INPUT_PLUGIN(plist->data)->configure != NULL); | |
| 1202 } | |
| 1203 | |
| 1204 static void | |
| 1205 input_plugin_enable_info(GtkTreeView * treeview, | |
| 1206 GtkButton * button) | |
| 1207 { | |
| 1208 GtkTreeSelection *selection; | |
| 1209 GtkTreeModel *model; | |
| 1210 GtkTreeIter iter; | |
| 1211 GList *plist; | |
| 1212 gint id; | |
| 1213 | |
| 1214 selection = gtk_tree_view_get_selection(treeview); | |
| 1215 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
| 1216 return; | |
| 1217 | |
| 1218 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
| 1219 | |
| 1220 plist = get_input_list(); | |
| 1221 plist = g_list_nth(plist, id); | |
| 1222 | |
| 1223 gtk_widget_set_sensitive(GTK_WIDGET(button), | |
| 1224 INPUT_PLUGIN(plist->data)->about != NULL); | |
| 1225 } | |
| 1226 | |
| 1227 | |
| 1228 static void | |
| 1229 output_plugin_enable_info(GtkComboBox * cbox, GtkButton * button) | |
| 1230 { | |
| 1231 GList *plist; | |
| 1232 | |
| 1233 gint id = gtk_combo_box_get_active(cbox); | |
| 1234 | |
| 1235 plist = get_output_list(); | |
| 1236 plist = g_list_nth(plist, id); | |
| 1237 | |
| 1238 gtk_widget_set_sensitive(GTK_WIDGET(button), | |
| 1239 OUTPUT_PLUGIN(plist->data)->about != NULL); | |
| 1240 } | |
| 1241 | |
| 1242 static void | |
| 1243 output_plugin_enable_prefs(GtkComboBox * cbox, GtkButton * button) | |
| 1244 { | |
| 1245 GList *plist; | |
| 1246 gint id = gtk_combo_box_get_active(cbox); | |
| 1247 | |
| 1248 plist = get_output_list(); | |
| 1249 plist = g_list_nth(plist, id); | |
| 1250 | |
| 1251 gtk_widget_set_sensitive(GTK_WIDGET(button), | |
| 1252 OUTPUT_PLUGIN(plist->data)->configure != NULL); | |
| 1253 } | |
| 1254 | |
| 1255 | |
| 1256 static void | |
| 1257 general_plugin_enable_info(GtkTreeView * treeview, | |
| 1258 GtkButton * button) | |
| 1259 { | |
| 1260 GtkTreeSelection *selection; | |
| 1261 GtkTreeModel *model; | |
| 1262 GtkTreeIter iter; | |
| 1263 GList *plist; | |
| 1264 gint id; | |
| 1265 | |
| 1266 selection = gtk_tree_view_get_selection(treeview); | |
| 1267 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
| 1268 return; | |
| 1269 | |
| 1270 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
| 1271 | |
| 1272 plist = get_general_list(); | |
| 1273 plist = g_list_nth(plist, id); | |
| 1274 | |
| 1275 gtk_widget_set_sensitive(GTK_WIDGET(button), | |
| 1276 GENERAL_PLUGIN(plist->data)->about != NULL); | |
| 1277 } | |
| 1278 | |
| 1279 static void | |
| 1280 general_plugin_enable_prefs(GtkTreeView * treeview, | |
| 1281 GtkButton * button) | |
| 1282 { | |
| 1283 GtkTreeSelection *selection; | |
| 1284 GtkTreeModel *model; | |
| 1285 GtkTreeIter iter; | |
| 1286 GList *plist; | |
| 1287 gint id; | |
| 1288 | |
| 1289 selection = gtk_tree_view_get_selection(treeview); | |
| 1290 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
| 1291 return; | |
| 1292 | |
| 1293 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
| 1294 | |
| 1295 plist = get_general_list(); | |
| 1296 plist = g_list_nth(plist, id); | |
| 1297 | |
| 1298 gtk_widget_set_sensitive(GTK_WIDGET(button), | |
| 1299 GENERAL_PLUGIN(plist->data)->configure != NULL); | |
| 1300 } | |
| 1301 | |
| 1302 | |
| 1303 | |
| 1304 static void | |
| 1305 vis_plugin_enable_prefs(GtkTreeView * treeview, | |
| 1306 GtkButton * button) | |
| 1307 { | |
| 1308 GtkTreeSelection *selection; | |
| 1309 GtkTreeModel *model; | |
| 1310 GtkTreeIter iter; | |
| 1311 GList *plist; | |
| 1312 gint id; | |
| 1313 | |
| 1314 selection = gtk_tree_view_get_selection(treeview); | |
| 1315 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
| 1316 return; | |
| 1317 | |
| 1318 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
| 1319 | |
| 1320 plist = get_vis_list(); | |
| 1321 plist = g_list_nth(plist, id); | |
| 1322 | |
| 1323 gtk_widget_set_sensitive(GTK_WIDGET(button), | |
| 1324 VIS_PLUGIN(plist->data)->configure != NULL); | |
| 1325 } | |
| 1326 | |
| 1327 static void | |
| 1328 vis_plugin_enable_info(GtkTreeView * treeview, | |
| 1329 GtkButton * button) | |
| 1330 { | |
| 1331 GtkTreeSelection *selection; | |
| 1332 GtkTreeModel *model; | |
| 1333 GtkTreeIter iter; | |
| 1334 GList *plist; | |
| 1335 gint id; | |
| 1336 | |
| 1337 selection = gtk_tree_view_get_selection(treeview); | |
| 1338 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
| 1339 return; | |
| 1340 | |
| 1341 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
| 1342 | |
| 1343 plist = get_vis_list(); | |
| 1344 plist = g_list_nth(plist, id); | |
| 1345 | |
| 1346 gtk_widget_set_sensitive(GTK_WIDGET(button), | |
| 1347 VIS_PLUGIN(plist->data)->about != NULL); | |
| 1348 } | |
| 1349 | |
| 1350 static void | |
| 1351 vis_plugin_open_prefs(GtkTreeView * treeview, | |
| 1352 gpointer data) | |
| 1353 { | |
| 1354 GtkTreeSelection *selection; | |
| 1355 GtkTreeModel *model; | |
| 1356 GtkTreeIter iter; | |
| 1357 gint id; | |
| 1358 | |
| 1359 selection = gtk_tree_view_get_selection(treeview); | |
| 1360 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
| 1361 return; | |
| 1362 | |
| 1363 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
| 1364 vis_configure(id); | |
| 1365 } | |
| 1366 | |
| 1367 | |
| 1368 static void | |
| 1369 vis_plugin_open_info(GtkTreeView * treeview, | |
| 1370 gpointer data) | |
| 1371 { | |
| 1372 GtkTreeSelection *selection; | |
| 1373 GtkTreeModel *model; | |
| 1374 GtkTreeIter iter; | |
| 1375 gint id; | |
| 1376 | |
| 1377 selection = gtk_tree_view_get_selection(treeview); | |
| 1378 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
| 1379 return; | |
| 1380 | |
| 1381 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
| 1382 vis_about(id); | |
| 1383 } | |
| 1384 | |
| 1385 | |
| 1386 | |
| 1387 | |
| 1388 | |
| 1389 | |
| 1390 static void | |
| 1391 effect_plugin_enable_prefs(GtkTreeView * treeview, | |
| 1392 GtkButton * button) | |
| 1393 { | |
| 1394 GtkTreeSelection *selection; | |
| 1395 GtkTreeModel *model; | |
| 1396 GtkTreeIter iter; | |
| 1397 GList *plist; | |
| 1398 gint id; | |
| 1399 | |
| 1400 selection = gtk_tree_view_get_selection(treeview); | |
| 1401 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
| 1402 return; | |
| 1403 | |
| 1404 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
| 1405 | |
| 1406 plist = get_effect_list(); | |
| 1407 plist = g_list_nth(plist, id); | |
| 1408 | |
| 1409 gtk_widget_set_sensitive(GTK_WIDGET(button), | |
| 1410 EFFECT_PLUGIN(plist->data)->configure != NULL); | |
| 1411 } | |
| 1412 | |
| 1413 static void | |
| 1414 effect_plugin_enable_info(GtkTreeView * treeview, | |
| 1415 GtkButton * button) | |
| 1416 { | |
| 1417 GtkTreeSelection *selection; | |
| 1418 GtkTreeModel *model; | |
| 1419 GtkTreeIter iter; | |
| 1420 GList *plist; | |
| 1421 gint id; | |
| 1422 | |
| 1423 selection = gtk_tree_view_get_selection(treeview); | |
| 1424 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
| 1425 return; | |
| 1426 | |
| 1427 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
| 1428 | |
| 1429 plist = get_effect_list(); | |
| 1430 plist = g_list_nth(plist, id); | |
| 1431 | |
| 1432 gtk_widget_set_sensitive(GTK_WIDGET(button), | |
| 1433 EFFECT_PLUGIN(plist->data)->about != NULL); | |
| 1434 } | |
| 1435 | |
| 1436 static void | |
| 1437 effect_plugin_open_prefs(GtkTreeView * treeview, | |
| 1438 gpointer data) | |
| 1439 { | |
| 1440 GtkTreeSelection *selection; | |
| 1441 GtkTreeModel *model; | |
| 1442 GtkTreeIter iter; | |
| 1443 gint id; | |
| 1444 | |
| 1445 selection = gtk_tree_view_get_selection(treeview); | |
| 1446 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
| 1447 return; | |
| 1448 | |
| 1449 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
| 1450 effect_configure(id); | |
| 1451 } | |
| 1452 | |
| 1453 | |
| 1454 static void | |
| 1455 effect_plugin_open_info(GtkTreeView * treeview, | |
| 1456 gpointer data) | |
| 1457 { | |
| 1458 GtkTreeSelection *selection; | |
| 1459 GtkTreeModel *model; | |
| 1460 GtkTreeIter iter; | |
| 1461 gint id; | |
| 1462 | |
| 1463 selection = gtk_tree_view_get_selection(treeview); | |
| 1464 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) | |
| 1465 return; | |
| 1466 | |
| 1467 gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); | |
| 1468 effect_about(id); | |
| 1469 } | |
| 1470 | |
| 1471 static void | |
| 1472 on_output_plugin_bufsize_realize(GtkSpinButton *button, | |
| 1473 gpointer data) | |
| 1474 { | |
| 1475 gtk_spin_button_set_value(button, cfg.output_buffer_size); | |
| 1476 } | |
| 1477 | |
| 1478 static void | |
| 1479 on_output_plugin_bufsize_value_changed(GtkSpinButton *button, | |
| 1480 gpointer data) | |
| 1481 { | |
| 1482 cfg.output_buffer_size = gtk_spin_button_get_value_as_int(button); | |
| 1483 } | |
| 1484 | |
| 1485 static void | |
| 1486 on_mouse_wheel_volume_realize(GtkSpinButton * button, | |
| 1487 gpointer data) | |
| 1488 { | |
| 1489 gtk_spin_button_set_value(button, cfg.mouse_change); | |
| 1490 } | |
| 1491 | |
| 1492 static void | |
| 1493 on_mouse_wheel_volume_changed(GtkSpinButton * button, | |
| 1494 gpointer data) | |
| 1495 { | |
| 1496 cfg.mouse_change = gtk_spin_button_get_value_as_int(button); | |
| 1497 } | |
| 1498 | |
| 1499 static void | |
| 1500 on_pause_between_songs_time_realize(GtkSpinButton * button, | |
| 1501 gpointer data) | |
| 1502 { | |
| 1503 gtk_spin_button_set_value(button, cfg.pause_between_songs_time); | |
| 1504 } | |
| 1505 | |
| 1506 static void | |
| 1507 on_pause_between_songs_time_changed(GtkSpinButton * button, | |
| 1508 gpointer data) | |
| 1509 { | |
| 1510 cfg.pause_between_songs_time = gtk_spin_button_get_value_as_int(button); | |
| 1511 } | |
| 1512 | |
| 1513 static void | |
|
2538
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1514 on_enable_src_realize(GtkToggleButton * button, |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1515 gpointer data) |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1516 { |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1517 #ifdef USE_SRC |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1518 ConfigDb *db; |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1519 gboolean ret; |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1520 |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1521 db = bmp_cfg_db_open(); |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1522 |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1523 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
|
1524 gtk_toggle_button_set_active(button, ret); |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1525 |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1526 bmp_cfg_db_close(db); |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1527 #else |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1528 gtk_toggle_button_set_active(button, FALSE); |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1529 gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE); |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1530 #endif |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1531 } |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1532 |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1533 static void |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1534 on_enable_src_toggled(GtkToggleButton * button, |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1535 gpointer data) |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1536 { |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1537 ConfigDb *db; |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1538 gboolean ret = gtk_toggle_button_get_active(button); |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1539 |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1540 db = bmp_cfg_db_open(); |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1541 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
|
1542 bmp_cfg_db_close(db); |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1543 } |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1544 |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1545 static void |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1546 on_src_rate_realize(GtkSpinButton * button, |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1547 gpointer data) |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1548 { |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1549 #ifdef USE_SRC |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1550 ConfigDb *db; |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1551 gint value; |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1552 |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1553 db = bmp_cfg_db_open(); |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1554 |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1555 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
|
1556 gtk_spin_button_set_value(button, (gdouble)value); |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1557 |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1558 bmp_cfg_db_close(db); |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1559 #else |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1560 gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE); |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1561 #endif |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1562 } |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1563 |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1564 static void |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1565 on_src_rate_value_changed(GtkSpinButton * button, |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1566 gpointer data) |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1567 { |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1568 ConfigDb *db; |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1569 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
|
1570 |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1571 db = bmp_cfg_db_open(); |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1572 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
|
1573 bmp_cfg_db_close(db); |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1574 } |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1575 |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1576 static void |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1577 on_src_converter_type_realize(GtkComboBox * box, |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1578 gpointer data) |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1579 { |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1580 #ifdef USE_SRC |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1581 ConfigDb *db; |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1582 gint value; |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1583 |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1584 db = bmp_cfg_db_open(); |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1585 |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1586 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
|
1587 gtk_combo_box_set_active(box, value); |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1588 else |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1589 gtk_combo_box_set_active(box, 0); |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1590 |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1591 bmp_cfg_db_close(db); |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1592 #else |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1593 gtk_widget_set_sensitive(GTK_WIDGET(box), FALSE); |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1594 #endif |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1595 } |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1596 |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1597 static void |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1598 on_src_converter_type_changed(GtkComboBox * box, |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1599 gpointer data) |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1600 { |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1601 ConfigDb *db; |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1602 gint value = gtk_combo_box_get_active(box); |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1603 |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1604 db = bmp_cfg_db_open(); |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1605 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
|
1606 bmp_cfg_db_close(db); |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1607 } |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1608 |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
1609 static void |
| 2313 | 1610 on_mouse_wheel_scroll_pl_realize(GtkSpinButton * button, |
| 1611 gpointer data) | |
| 1612 { | |
| 1613 gtk_spin_button_set_value(button, cfg.scroll_pl_by); | |
| 1614 } | |
| 1615 | |
| 1616 static void | |
| 1617 on_mouse_wheel_scroll_pl_changed(GtkSpinButton * button, | |
| 1618 gpointer data) | |
| 1619 { | |
| 1620 cfg.scroll_pl_by = gtk_spin_button_get_value_as_int(button); | |
| 1621 } | |
| 1622 | |
| 1623 static void | |
| 1624 on_playlist_convert_underscore_realize(GtkToggleButton * button, | |
| 1625 gpointer data) | |
| 1626 { | |
| 1627 gtk_toggle_button_set_active(button, cfg.convert_underscore); | |
| 1628 } | |
| 1629 | |
| 1630 static void | |
| 1631 on_playlist_convert_underscore_toggled(GtkToggleButton * button, | |
| 1632 gpointer data) | |
| 1633 { | |
| 1634 cfg.convert_underscore = gtk_toggle_button_get_active(button); | |
| 1635 } | |
| 1636 | |
| 1637 static void | |
| 1638 on_playlist_no_advance_realize(GtkToggleButton * button, gpointer data) | |
| 1639 { | |
| 1640 gtk_toggle_button_set_active(button, cfg.no_playlist_advance); | |
| 1641 } | |
| 1642 | |
| 1643 static void | |
| 1644 on_playlist_no_advance_toggled(GtkToggleButton * button, gpointer data) | |
| 1645 { | |
| 1646 cfg.no_playlist_advance = gtk_toggle_button_get_active(button); | |
| 1647 } | |
| 1648 | |
| 1649 static void | |
| 1650 on_continue_playback_on_startup_realize(GtkToggleButton * button, gpointer data) | |
| 1651 { | |
| 1652 gtk_toggle_button_set_active(button, cfg.resume_playback_on_startup); | |
| 1653 } | |
| 1654 | |
| 1655 static void | |
| 1656 on_continue_playback_on_startup_toggled(GtkToggleButton * button, gpointer data) | |
| 1657 { | |
| 1658 cfg.resume_playback_on_startup = gtk_toggle_button_get_active(button); | |
| 1659 } | |
| 1660 | |
| 1661 static void | |
| 1662 on_refresh_file_list_realize(GtkToggleButton * button, gpointer data) | |
| 1663 { | |
| 1664 gtk_toggle_button_set_active(button, cfg.refresh_file_list); | |
| 1665 } | |
| 1666 | |
| 1667 static void | |
| 1668 on_refresh_file_list_toggled(GtkToggleButton * button, gpointer data) | |
| 1669 { | |
| 1670 cfg.refresh_file_list = gtk_toggle_button_get_active(button); | |
| 1671 } | |
| 1672 | |
| 1673 static void | |
| 1674 on_playlist_convert_twenty_realize(GtkToggleButton * button, gpointer data) | |
| 1675 { | |
| 1676 gtk_toggle_button_set_active(button, cfg.convert_twenty); | |
| 1677 } | |
| 1678 | |
| 1679 static void | |
| 1680 on_playlist_convert_twenty_toggled(GtkToggleButton * button, gpointer data) | |
| 1681 { | |
| 1682 cfg.convert_twenty = gtk_toggle_button_get_active(button); | |
| 1683 } | |
| 1684 | |
| 1685 static void | |
| 1686 on_playlist_convert_slash_realize(GtkToggleButton * button, gpointer data) | |
| 1687 { | |
| 1688 gtk_toggle_button_set_active(button, cfg.convert_slash); | |
| 1689 } | |
| 1690 | |
| 1691 static void | |
| 1692 on_playlist_convert_slash_toggled(GtkToggleButton * button, gpointer data) | |
| 1693 { | |
| 1694 cfg.convert_slash = gtk_toggle_button_get_active(button); | |
| 1695 } | |
| 1696 | |
| 1697 static void | |
| 1698 on_use_pl_metadata_realize(GtkToggleButton * button, | |
| 1699 gpointer data) | |
| 1700 { | |
| 1701 gboolean state = cfg.use_pl_metadata; | |
| 1702 gtk_toggle_button_set_active(button, state); | |
| 1703 gtk_widget_set_sensitive(GTK_WIDGET(data), state); | |
| 1704 } | |
| 1705 | |
| 1706 static void | |
| 1707 on_use_pl_metadata_toggled(GtkToggleButton * button, | |
| 1708 gpointer data) | |
| 1709 { | |
| 1710 gboolean state = gtk_toggle_button_get_active(button); | |
| 1711 cfg.use_pl_metadata = state; | |
| 1712 gtk_widget_set_sensitive(GTK_WIDGET(data), state); | |
| 1713 } | |
| 1714 | |
| 1715 static void | |
| 1716 on_pause_between_songs_realize(GtkToggleButton * button, | |
| 1717 gpointer data) | |
| 1718 { | |
| 1719 gboolean state = cfg.pause_between_songs; | |
| 1720 gtk_toggle_button_set_active(button, state); | |
| 1721 gtk_widget_set_sensitive(GTK_WIDGET(data), state); | |
| 1722 } | |
| 1723 | |
| 1724 static void | |
| 1725 on_pause_between_songs_toggled(GtkToggleButton * button, | |
| 1726 gpointer data) | |
| 1727 { | |
| 1728 gboolean state = gtk_toggle_button_get_active(button); | |
| 1729 cfg.pause_between_songs = state; | |
| 1730 gtk_widget_set_sensitive(GTK_WIDGET(data), state); | |
| 1731 } | |
| 1732 | |
| 1733 static void | |
| 1734 on_pl_metadata_on_load_realize(GtkRadioButton * button, | |
| 1735 gpointer data) | |
| 1736 { | |
| 1737 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), | |
| 1738 cfg.get_info_on_load); | |
| 1739 } | |
| 1740 | |
| 1741 static void | |
| 1742 on_pl_metadata_on_display_realize(GtkRadioButton * button, | |
| 1743 gpointer data) | |
| 1744 { | |
| 1745 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), | |
| 1746 cfg.get_info_on_demand); | |
| 1747 } | |
| 1748 | |
| 1749 static void | |
| 1750 on_pl_metadata_on_load_toggled(GtkRadioButton * button, | |
| 1751 gpointer data) | |
| 1752 { | |
| 1753 cfg.get_info_on_load = | |
| 1754 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)); | |
| 1755 } | |
| 1756 | |
| 1757 static void | |
| 1758 on_pl_metadata_on_display_toggled(GtkRadioButton * button, | |
| 1759 gpointer data) | |
| 1760 { | |
| 1761 cfg.get_info_on_demand = | |
| 1762 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)); | |
| 1763 } | |
| 1764 | |
| 1765 static void | |
| 1766 on_custom_cursors_realize(GtkToggleButton * button, | |
| 1767 gpointer data) | |
| 1768 { | |
| 1769 gtk_toggle_button_set_active(button, cfg.custom_cursors); | |
| 1770 } | |
| 1771 | |
| 1772 static void | |
| 1773 on_custom_cursors_toggled(GtkToggleButton *togglebutton, | |
| 1774 gpointer data) | |
| 1775 { | |
| 1776 cfg.custom_cursors = gtk_toggle_button_get_active(togglebutton); | |
| 1777 skin_reload_forced(); | |
| 1778 } | |
| 1779 | |
| 1780 static void | |
| 1781 on_eq_dir_preset_entry_realize(GtkEntry * entry, | |
| 1782 gpointer data) | |
| 1783 { | |
| 1784 gtk_entry_set_text(entry, cfg.eqpreset_default_file); | |
| 1785 } | |
| 1786 | |
| 1787 static void | |
| 1788 on_eq_dir_preset_entry_changed(GtkEntry * entry, | |
| 1789 gpointer data) | |
| 1790 { | |
| 1791 g_free(cfg.eqpreset_default_file); | |
| 1792 cfg.eqpreset_default_file = g_strdup(gtk_entry_get_text(entry)); | |
| 1793 } | |
| 1794 | |
| 1795 static void | |
| 1796 on_eq_file_preset_entry_realize(GtkEntry * entry, | |
| 1797 gpointer data) | |
| 1798 { | |
| 1799 gtk_entry_set_text(entry, cfg.eqpreset_extension); | |
| 1800 } | |
| 1801 | |
| 1802 static void | |
| 1803 on_eq_file_preset_entry_changed(GtkEntry * entry, gpointer data) | |
| 1804 { | |
| 1805 const gchar *text = gtk_entry_get_text(entry); | |
| 1806 | |
| 1807 while (*text == '.') | |
| 1808 text++; | |
| 1809 | |
| 1810 g_free(cfg.eqpreset_extension); | |
| 1811 cfg.eqpreset_extension = g_strdup(text); | |
| 1812 } | |
| 1813 | |
| 1814 | |
| 1815 /* FIXME: implement these */ | |
| 1816 | |
| 1817 static void | |
| 1818 on_eq_preset_view_realize(GtkTreeView * treeview, | |
| 1819 gpointer data) | |
| 1820 {} | |
| 1821 | |
| 1822 static void | |
| 1823 on_eq_preset_add_clicked(GtkButton * button, | |
| 1824 gpointer data) | |
| 1825 {} | |
| 1826 | |
| 1827 static void | |
| 1828 on_eq_preset_remove_clicked(GtkButton * button, | |
| 1829 gpointer data) | |
| 1830 {} | |
| 1831 | |
| 1832 static void | |
| 1833 on_skin_refresh_button_clicked(GtkButton * button, | |
| 1834 gpointer data) | |
| 1835 { | |
| 1836 GladeXML *xml; | |
| 1837 GtkWidget *widget, *widget2; | |
| 1838 | |
| 1839 const mode_t mode755 = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; | |
| 1840 | |
| 1841 del_directory(bmp_paths[BMP_PATH_SKIN_THUMB_DIR]); | |
| 1842 make_directory(bmp_paths[BMP_PATH_SKIN_THUMB_DIR], mode755); | |
| 1843 | |
| 1844 xml = prefswin_get_xml(); | |
| 1845 | |
| 1846 widget = glade_xml_get_widget(xml, "skin_view"); | |
| 1847 widget2 = glade_xml_get_widget(xml, "skin_refresh_button"); | |
| 1848 skin_view_update(GTK_TREE_VIEW(widget), GTK_WIDGET(widget2)); | |
| 1849 } | |
| 1850 | |
| 1851 static gboolean | |
| 1852 on_skin_view_realize(GtkTreeView * treeview, | |
| 1853 gpointer data) | |
| 1854 { | |
| 1855 GladeXML *xml; | |
| 1856 GtkWidget *widget; | |
| 1857 | |
| 1858 xml = prefswin_get_xml(); | |
| 1859 widget = glade_xml_get_widget(xml, "skin_refresh_button"); | |
| 1860 skin_view_realize(treeview); | |
| 1861 | |
| 1862 return TRUE; | |
| 1863 } | |
| 1864 | |
| 1865 static void | |
| 1866 on_category_view_realize(GtkTreeView * treeview, | |
| 1867 GtkNotebook * notebook) | |
| 1868 { | |
| 1869 GtkListStore *store; | |
| 1870 GtkCellRenderer *renderer; | |
| 1871 GtkTreeViewColumn *column; | |
| 1872 GtkTreeSelection *selection; | |
| 1873 GtkTreeIter iter; | |
| 1874 GdkPixbuf *img; | |
| 1875 CategoryQueueEntry *qlist; | |
| 1876 gint i; | |
| 1877 | |
| 1878 column = gtk_tree_view_column_new(); | |
| 1879 gtk_tree_view_column_set_title(column, _("Category")); | |
| 1880 gtk_tree_view_append_column(treeview, column); | |
| 1881 gtk_tree_view_column_set_spacing(column, 2); | |
| 1882 | |
| 1883 renderer = gtk_cell_renderer_pixbuf_new(); | |
| 1884 gtk_tree_view_column_pack_start(column, renderer, FALSE); | |
| 1885 gtk_tree_view_column_set_attributes(column, renderer, "pixbuf", 0, NULL); | |
| 1886 | |
| 1887 renderer = gtk_cell_renderer_text_new(); | |
| 1888 gtk_tree_view_column_pack_start(column, renderer, FALSE); | |
| 1889 gtk_tree_view_column_set_attributes(column, renderer, "text", 1, NULL); | |
| 1890 | |
| 1891 store = gtk_list_store_new(CATEGORY_VIEW_N_COLS, | |
| 1892 GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_INT); | |
| 1893 gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(store)); | |
| 1894 | |
| 1895 for (i = 0; i < n_categories; i++) { | |
| 1896 img = gdk_pixbuf_new_from_file(categories[i].icon_path, NULL); | |
| 1897 gtk_list_store_append(store, &iter); | |
| 1898 gtk_list_store_set(store, &iter, | |
| 1899 CATEGORY_VIEW_COL_ICON, img, | |
| 1900 CATEGORY_VIEW_COL_NAME, | |
| 1901 gettext(categories[i].name), CATEGORY_VIEW_COL_ID, | |
| 1902 categories[i].id, -1); | |
| 1903 g_object_unref(img); | |
| 1904 } | |
| 1905 | |
| 1906 selection = gtk_tree_view_get_selection(treeview); | |
| 1907 | |
| 1908 g_signal_connect_swapped(selection, "changed", | |
| 1909 G_CALLBACK(change_category), notebook); | |
| 1910 | |
| 1911 /* mark the treeview widget as available to third party plugins */ | |
| 1912 category_treeview = GTK_WIDGET(treeview); | |
| 1913 | |
| 1914 /* prefswin_page_queue_destroy already pops the queue forward for us. */ | |
| 1915 for (qlist = category_queue; qlist != NULL; qlist = category_queue) | |
| 1916 { | |
| 1917 CategoryQueueEntry *ent = (CategoryQueueEntry *) qlist; | |
| 1918 | |
| 1919 prefswin_page_new(ent->container, ent->pg_name, ent->img_url); | |
| 1920 prefswin_page_queue_destroy(ent); | |
| 1921 } | |
| 1922 } | |
| 1923 | |
| 1924 static void | |
| 1925 mainwin_drag_data_received1(GtkWidget * widget, | |
| 1926 GdkDragContext * context, | |
| 1927 gint x, gint y, | |
| 1928 GtkSelectionData * selection_data, | |
| 1929 guint info, guint time, | |
| 1930 gpointer user_data) | |
| 1931 { | |
| 1932 gchar *path, *decoded; | |
| 1933 | |
| 1934 if (!selection_data->data) { | |
| 1935 g_warning("DND data string is NULL"); | |
| 1936 return; | |
| 1937 } | |
| 1938 | |
| 1939 path = (gchar *) selection_data->data; | |
| 1940 | |
| 1941 /* FIXME: use a real URL validator/parser */ | |
| 1942 | |
| 1943 if (!str_has_prefix_nocase(path, "fonts:///")) | |
| 1944 return; | |
| 1945 | |
| 1946 path[strlen(path) - 2] = 0; /* Why the hell a CR&LF? */ | |
| 1947 path += 8; | |
| 1948 | |
| 1949 /* plain, since we already stripped the first URI part */ | |
| 1950 decoded = xmms_urldecode_plain(path); | |
| 1951 | |
| 1952 /* Get the old font's size, and add it to the dropped | |
| 1953 * font's name */ | |
| 1954 cfg.playlist_font = g_strconcat(decoded+1, | |
| 1955 strrchr(cfg.playlist_font, ' '), | |
| 1956 NULL); | |
| 1957 playlist_list_set_font(cfg.playlist_font); | |
| 1958 playlistwin_update_list(playlist_get_active()); | |
| 1959 gtk_font_button_set_font_name(user_data, cfg.playlist_font); | |
| 1960 | |
| 1961 g_free(decoded); | |
| 1962 } | |
| 1963 | |
| 1964 static void | |
| 1965 on_skin_view_drag_data_received(GtkWidget * widget, | |
| 1966 GdkDragContext * context, | |
| 1967 gint x, gint y, | |
| 1968 GtkSelectionData * selection_data, | |
| 1969 guint info, guint time, | |
| 1970 gpointer user_data) | |
| 1971 { | |
| 1972 ConfigDb *db; | |
| 1973 gchar *path; | |
| 1974 | |
| 1975 GladeXML *xml; | |
| 1976 GtkWidget *widget2; | |
| 1977 | |
| 1978 if (!selection_data->data) { | |
| 1979 g_warning("DND data string is NULL"); | |
| 1980 return; | |
| 1981 } | |
| 1982 | |
| 1983 path = (gchar *) selection_data->data; | |
| 1984 | |
| 1985 /* FIXME: use a real URL validator/parser */ | |
| 1986 | |
| 1987 if (str_has_prefix_nocase(path, "file:///")) { | |
| 1988 path[strlen(path) - 2] = 0; /* Why the hell a CR&LF? */ | |
| 1989 path += 7; | |
| 1990 } | |
| 1991 else if (str_has_prefix_nocase(path, "file:")) { | |
| 1992 path += 5; | |
| 1993 } | |
| 1994 | |
| 1995 if (file_is_archive(path)) { | |
| 1996 bmp_active_skin_load(path); | |
| 1997 skin_install_skin(path); | |
| 1998 xml = prefswin_get_xml(); | |
| 1999 widget2 = glade_xml_get_widget(xml, "skin_refresh_button"); | |
| 2000 skin_view_update(GTK_TREE_VIEW(widget), GTK_WIDGET(widget2)); | |
| 2001 /* Change skin name in the config file */ | |
| 2002 db = bmp_cfg_db_open(); | |
| 2003 bmp_cfg_db_set_string(db, NULL, "skin", path); | |
| 2004 bmp_cfg_db_close(db); | |
| 2005 } | |
| 2006 | |
| 2007 } | |
| 2008 | |
| 2009 static void | |
| 2010 on_chardet_detector_cbox_changed(GtkComboBox * combobox, gpointer data) | |
| 2011 { | |
| 2012 ConfigDb *db; | |
| 2013 gint position = 0; | |
| 2014 | |
| 2015 position = gtk_combo_box_get_active(GTK_COMBO_BOX(combobox)); | |
| 2016 cfg.chardet_detector = (char *)chardet_detector_presets[position]; | |
| 2017 | |
| 2018 db = bmp_cfg_db_open(); | |
| 2019 bmp_cfg_db_set_string(db, NULL, "chardet_detector", cfg.chardet_detector); | |
| 2020 bmp_cfg_db_close(db); | |
| 2021 if (data != NULL) | |
| 2022 gtk_widget_set_sensitive(GTK_WIDGET(data), 1); | |
| 2023 } | |
| 2024 | |
| 2025 static void | |
| 2026 on_chardet_detector_cbox_realize(GtkComboBox *combobox, gpointer data) | |
| 2027 { | |
| 2028 ConfigDb *db; | |
| 2029 gchar *ret=NULL; | |
| 2030 guint i=0,index=0; | |
| 2031 | |
| 2032 for(i=0; i<n_chardet_detector_presets; i++) { | |
| 2033 gtk_combo_box_append_text(combobox, chardet_detector_presets[i]); | |
| 2034 } | |
| 2035 | |
| 2036 db = bmp_cfg_db_open(); | |
| 2037 if(bmp_cfg_db_get_string(db, NULL, "chardet_detector", &ret) != FALSE) { | |
| 2038 for(i=0; i<n_chardet_detector_presets; i++) { | |
| 2039 if(!strcmp(chardet_detector_presets[i], ret)) { | |
| 2040 cfg.chardet_detector = (char *)chardet_detector_presets[i]; | |
| 2041 index = i; | |
| 2042 } | |
| 2043 } | |
| 2044 } | |
| 2045 bmp_cfg_db_close(db); | |
| 2046 | |
| 2047 #ifdef USE_CHARDET | |
| 2048 gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), index); | |
| 2049 | |
| 2050 if (data != NULL) | |
| 2051 gtk_widget_set_sensitive(GTK_WIDGET(data), TRUE); | |
| 2052 | |
| 2053 g_signal_connect(combobox, "changed", | |
| 2054 G_CALLBACK(on_chardet_detector_cbox_changed), NULL); | |
| 2055 #else | |
| 2056 gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), -1); | |
| 2057 gtk_widget_set_sensitive(GTK_WIDGET(combobox), 0); | |
| 2058 #endif | |
| 2059 if(ret) | |
| 2060 g_free(ret); | |
| 2061 } | |
| 2062 | |
| 2063 static void | |
| 2064 on_chardet_fallback_realize(GtkEntry *entry, gpointer data) | |
| 2065 { | |
| 2066 ConfigDb *db; | |
| 2067 gchar *ret = NULL; | |
| 2068 | |
| 2069 db = bmp_cfg_db_open(); | |
| 2070 | |
| 2071 if (bmp_cfg_db_get_string(db, NULL, "chardet_fallback", &ret) != FALSE) { | |
| 2072 if(cfg.chardet_fallback) | |
| 2073 g_free(cfg.chardet_fallback); | |
| 2074 | |
| 2075 if(ret && strncasecmp(ret, "None", sizeof("None"))) { | |
| 2076 cfg.chardet_fallback = ret; | |
| 2077 } else { | |
| 2078 cfg.chardet_fallback = g_strdup(""); | |
| 2079 } | |
| 2080 gtk_entry_set_text(entry, cfg.chardet_fallback); | |
| 2081 } | |
| 2082 | |
| 2083 bmp_cfg_db_close(db); | |
| 2084 } | |
| 2085 | |
| 2086 static void | |
| 2087 on_chardet_fallback_changed(GtkEntry *entry, gpointer data) | |
| 2088 { | |
| 2089 ConfigDb *db; | |
| 2090 gchar *ret = NULL; | |
| 2091 | |
| 2092 if(cfg.chardet_fallback) | |
| 2093 g_free(cfg.chardet_fallback); | |
| 2094 | |
| 2095 ret = g_strdup(gtk_entry_get_text(entry)); | |
| 2096 | |
| 2097 if(ret == NULL) | |
| 2098 cfg.chardet_fallback = g_strdup(""); | |
| 2099 else | |
| 2100 cfg.chardet_fallback = ret; | |
| 2101 | |
| 2102 db = bmp_cfg_db_open(); | |
| 2103 | |
| 2104 if(cfg.chardet_fallback == NULL || !strcmp(cfg.chardet_fallback, "")) | |
| 2105 bmp_cfg_db_set_string(db, NULL, "chardet_fallback", "None"); | |
| 2106 else | |
| 2107 bmp_cfg_db_set_string(db, NULL, "chardet_fallback", cfg.chardet_fallback); | |
| 2108 | |
| 2109 bmp_cfg_db_close(db); | |
| 2110 } | |
| 2111 | |
| 2112 static void | |
| 2113 on_show_filepopup_for_tuple_realize(GtkToggleButton * button, gpointer data) | |
| 2114 { | |
| 2115 GladeXML *xml = prefswin_get_xml(); | |
| 2116 GtkWidget *settings_button = glade_xml_get_widget(xml, "filepopup_for_tuple_settings_button"); | |
| 2117 | |
| 2118 gtk_toggle_button_set_active(button, cfg.show_filepopup_for_tuple); | |
| 2119 filepopupbutton = (GtkWidget *)button; | |
| 2120 | |
| 2121 gtk_widget_set_sensitive(settings_button, cfg.show_filepopup_for_tuple); | |
| 2122 } | |
| 2123 | |
| 2124 static void | |
| 2125 on_show_filepopup_for_tuple_toggled(GtkToggleButton * button, gpointer data) | |
| 2126 { | |
| 2127 GladeXML *xml = prefswin_get_xml(); | |
| 2128 GtkWidget *settings_button = glade_xml_get_widget(xml, "filepopup_for_tuple_settings_button"); | |
| 2129 | |
| 2130 cfg.show_filepopup_for_tuple = gtk_toggle_button_get_active(button); | |
| 2131 | |
| 2132 gtk_widget_set_sensitive(settings_button, cfg.show_filepopup_for_tuple); | |
| 2133 } | |
| 2134 | |
| 2135 static void | |
| 2136 on_recurse_for_cover_toggled(GtkToggleButton *button, gpointer data) | |
| 2137 { | |
| 2138 gtk_widget_set_sensitive(GTK_WIDGET(data), | |
| 2139 gtk_toggle_button_get_active(button)); | |
| 2140 } | |
| 2141 | |
| 2142 static void | |
| 2143 on_colorize_button_clicked(GtkButton *button, gpointer data) | |
| 2144 { | |
| 2145 GladeXML *xml = prefswin_get_xml(); | |
| 2146 GtkWidget *widget; | |
| 2147 | |
| 2148 widget = glade_xml_get_widget(xml, "red_scale"); | |
| 2149 gtk_range_set_value(GTK_RANGE(widget), cfg.colorize_r); | |
| 2150 | |
| 2151 widget = glade_xml_get_widget(xml, "green_scale"); | |
| 2152 gtk_range_set_value(GTK_RANGE(widget), cfg.colorize_g); | |
| 2153 | |
| 2154 widget = glade_xml_get_widget(xml, "blue_scale"); | |
| 2155 gtk_range_set_value(GTK_RANGE(widget), cfg.colorize_b); | |
| 2156 | |
| 2157 gtk_widget_show(colorize_settings); | |
| 2158 } | |
| 2159 | |
| 2160 static void | |
| 2161 on_red_scale_value_changed(GtkHScale *scale, gpointer data) | |
| 2162 { | |
| 2328 | 2163 //GladeXML *xml = prefswin_get_xml(); |
| 2164 //GtkWidget *widget; | |
| 2313 | 2165 gint value; |
| 2166 | |
| 2167 value = gtk_range_get_value(GTK_RANGE(scale)); | |
| 2168 | |
| 2169 if (value != cfg.colorize_r) | |
| 2170 { | |
| 2171 cfg.colorize_r = value; | |
| 2172 | |
| 2173 /* reload the skin to apply the change */ | |
| 2174 skin_reload_forced(); | |
| 2175 draw_main_window(TRUE); | |
| 2176 draw_equalizer_window(TRUE); | |
| 2177 draw_playlist_window(TRUE); | |
| 2178 } | |
| 2179 } | |
| 2180 | |
| 2181 static void | |
| 2182 on_green_scale_value_changed(GtkHScale *scale, gpointer data) | |
| 2183 { | |
| 2328 | 2184 //GladeXML *xml = prefswin_get_xml(); |
| 2185 //GtkWidget *widget; | |
| 2313 | 2186 gint value; |
| 2187 | |
| 2188 value = gtk_range_get_value(GTK_RANGE(scale)); | |
| 2189 | |
| 2190 if (value != cfg.colorize_r) | |
| 2191 { | |
| 2192 cfg.colorize_g = value; | |
| 2193 | |
| 2194 /* reload the skin to apply the change */ | |
| 2195 skin_reload_forced(); | |
| 2196 draw_main_window(TRUE); | |
| 2197 draw_equalizer_window(TRUE); | |
| 2198 draw_playlist_window(TRUE); | |
| 2199 } | |
| 2200 } | |
| 2201 | |
| 2202 static void | |
| 2203 on_blue_scale_value_changed(GtkHScale *scale, gpointer data) | |
| 2204 { | |
| 2328 | 2205 //GladeXML *xml = prefswin_get_xml(); |
| 2206 //GtkWidget *widget; | |
| 2313 | 2207 gint value; |
| 2208 | |
| 2209 value = gtk_range_get_value(GTK_RANGE(scale)); | |
| 2210 | |
| 2211 if (value != cfg.colorize_r) | |
| 2212 { | |
| 2213 cfg.colorize_b = value; | |
| 2214 | |
| 2215 /* reload the skin to apply the change */ | |
| 2216 skin_reload_forced(); | |
| 2217 draw_main_window(TRUE); | |
| 2218 draw_equalizer_window(TRUE); | |
| 2219 draw_playlist_window(TRUE); | |
| 2220 } | |
| 2221 } | |
| 2222 | |
| 2223 static void | |
| 2224 on_colorize_close_clicked(GtkButton *button, gpointer data) | |
| 2225 { | |
| 2226 gtk_widget_hide(colorize_settings); | |
| 2227 } | |
| 2228 | |
| 2229 static void | |
| 2230 on_filepopup_for_tuple_settings_clicked(GtkButton *button, gpointer data) | |
| 2231 { | |
| 2232 GladeXML *xml = prefswin_get_xml(); | |
| 2233 GtkWidget *widget, *widget2; | |
| 2234 | |
| 2235 widget = glade_xml_get_widget(xml, "filepopup_settings_cover_name_include"); | |
| 2236 gtk_entry_set_text(GTK_ENTRY(widget), cfg.cover_name_include); | |
| 2237 | |
| 2238 widget = glade_xml_get_widget(xml, "filepopup_settings_cover_name_exclude"); | |
| 2239 gtk_entry_set_text(GTK_ENTRY(widget), cfg.cover_name_exclude); | |
| 2240 | |
| 2241 widget2 = glade_xml_get_widget(xml, "filepopup_settings_recurse_for_cover"); | |
| 2242 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget2), cfg.recurse_for_cover); | |
| 2243 | |
| 2244 widget = glade_xml_get_widget(xml, "filepopup_settings_recurse_for_cover_depth"); | |
| 2245 gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), cfg.recurse_for_cover_depth); | |
| 2246 | |
| 2247 widget = glade_xml_get_widget(xml, "filepopup_settings_recurse_for_cover_depth_box"); | |
| 2248 on_recurse_for_cover_toggled(GTK_TOGGLE_BUTTON(widget2), widget); | |
| 2249 | |
| 2250 widget = glade_xml_get_widget(xml, "filepopup_settings_use_file_cover"); | |
| 2251 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), cfg.use_file_cover); | |
| 2252 | |
| 2405 | 2253 widget = glade_xml_get_widget(xml, "filepopup_settings_showprogressbar"); |
| 2254 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), cfg.filepopup_showprogressbar); | |
| 2255 | |
| 2256 widget = glade_xml_get_widget(xml, "filepopup_settings_delay"); | |
| 2257 gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), cfg.filepopup_delay); | |
| 2258 | |
| 2313 | 2259 gtk_widget_show(filepopup_settings); |
| 2260 } | |
| 2261 | |
| 2262 static void | |
| 2263 on_filepopup_settings_ok_clicked(GtkButton *button, gpointer data) | |
| 2264 { | |
| 2265 GladeXML *xml = prefswin_get_xml(); | |
| 2266 GtkWidget *widget; | |
| 2267 | |
| 2268 widget = glade_xml_get_widget(xml, "filepopup_settings_cover_name_include"); | |
| 2269 g_free(cfg.cover_name_include); | |
| 2270 cfg.cover_name_include = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget))); | |
| 2271 | |
| 2272 widget = glade_xml_get_widget(xml, "filepopup_settings_cover_name_exclude"); | |
| 2273 g_free(cfg.cover_name_exclude); | |
| 2274 cfg.cover_name_exclude = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget))); | |
| 2275 | |
| 2276 widget = glade_xml_get_widget(xml, "filepopup_settings_recurse_for_cover"); | |
| 2277 cfg.recurse_for_cover = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); | |
| 2278 | |
| 2279 widget = glade_xml_get_widget(xml, "filepopup_settings_recurse_for_cover_depth"); | |
| 2280 cfg.recurse_for_cover_depth = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget)); | |
| 2281 | |
| 2282 widget = glade_xml_get_widget(xml, "filepopup_settings_use_file_cover"); | |
| 2283 cfg.use_file_cover = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); | |
| 2284 | |
| 2405 | 2285 widget = glade_xml_get_widget(xml, "filepopup_settings_showprogressbar"); |
| 2286 cfg.filepopup_showprogressbar = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); | |
| 2287 | |
| 2288 widget = glade_xml_get_widget(xml, "filepopup_settings_delay"); | |
| 2289 cfg.filepopup_delay = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget)); | |
| 2290 | |
| 2313 | 2291 gtk_widget_hide(filepopup_settings); |
| 2292 } | |
| 2293 | |
| 2294 static void | |
| 2295 on_filepopup_settings_cancel_clicked(GtkButton *button, gpointer data) | |
| 2296 { | |
| 2297 gtk_widget_hide(filepopup_settings); | |
| 2298 } | |
| 2299 | |
| 2300 static void | |
| 2301 on_xmms_style_fileselector_realize(GtkToggleButton * button, | |
| 2302 gpointer data) | |
| 2303 { | |
| 2304 gtk_toggle_button_set_active(button, cfg.use_xmms_style_fileselector); | |
| 2305 } | |
| 2306 | |
| 2307 static void | |
| 2308 on_xmms_style_fileselector_toggled(GtkToggleButton * button, | |
| 2309 gpointer data) | |
| 2310 { | |
| 2311 cfg.use_xmms_style_fileselector = gtk_toggle_button_get_active(button); | |
| 2312 } | |
| 2313 | |
| 2314 static void | |
| 2315 on_show_wm_decorations_realize(GtkToggleButton * button, | |
| 2316 gpointer data) | |
| 2317 { | |
| 2318 gtk_toggle_button_set_active(button, cfg.show_wm_decorations); | |
| 2319 } | |
| 2320 | |
| 2321 static void | |
| 2322 on_show_wm_decorations_toggled(GtkToggleButton * button, | |
| 2323 gpointer data) | |
| 2324 { | |
| 2325 extern GtkWidget *equalizerwin; | |
| 2326 cfg.show_wm_decorations = gtk_toggle_button_get_active(button); | |
| 2327 gtk_window_set_decorated(GTK_WINDOW(mainwin), cfg.show_wm_decorations); | |
| 2328 gtk_window_set_decorated(GTK_WINDOW(playlistwin), cfg.show_wm_decorations); | |
| 2329 gtk_window_set_decorated(GTK_WINDOW(equalizerwin), cfg.show_wm_decorations); | |
| 2623 | 2330 } |
| 2331 | |
| 2332 static void | |
| 2333 on_reload_plugins_clicked(GtkButton * button, gpointer data) | |
| 2334 { | |
| 2335 /* TBD: should every playlist entry have to be reprobed? | |
| 2336 * Pointers could come back stale if new plugins are added or | |
| 2337 * symbol sizes change. - nenolod | |
| 2338 */ | |
| 2339 | |
|
2682
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2635
diff
changeset
|
2340 bmp_config_save(); |
| 2623 | 2341 plugin_system_cleanup(); |
|
2682
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2635
diff
changeset
|
2342 bmp_config_free(); |
|
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2635
diff
changeset
|
2343 bmp_config_load(); |
| 2623 | 2344 plugin_system_init(); |
| 2313 | 2345 } |
| 2346 | |
| 2347 /* FIXME: complete the map */ | |
| 2348 FUNC_MAP_BEGIN(prefswin_func_map) | |
| 2349 FUNC_MAP_ENTRY(on_input_plugin_view_realize) | |
| 2350 FUNC_MAP_ENTRY(on_output_plugin_cbox_realize) | |
| 2351 FUNC_MAP_ENTRY(on_general_plugin_view_realize) | |
| 2352 FUNC_MAP_ENTRY(on_vis_plugin_view_realize) | |
| 2353 FUNC_MAP_ENTRY(on_effect_plugin_view_realize) | |
| 2354 FUNC_MAP_ENTRY(on_custom_cursors_realize) | |
| 2355 FUNC_MAP_ENTRY(on_custom_cursors_toggled) | |
| 2356 FUNC_MAP_ENTRY(on_mainwin_font_button_realize) | |
| 2357 FUNC_MAP_ENTRY(on_mainwin_font_button_font_set) | |
| 2358 FUNC_MAP_ENTRY(on_use_bitmap_fonts_realize) | |
| 2359 FUNC_MAP_ENTRY(on_use_bitmap_fonts_toggled) | |
| 2360 FUNC_MAP_ENTRY(on_mouse_wheel_volume_realize) | |
| 2361 FUNC_MAP_ENTRY(on_mouse_wheel_volume_changed) | |
| 2362 FUNC_MAP_ENTRY(on_mouse_wheel_scroll_pl_realize) | |
| 2363 FUNC_MAP_ENTRY(on_mouse_wheel_scroll_pl_changed) | |
| 2364 FUNC_MAP_ENTRY(on_pause_between_songs_time_realize) | |
| 2365 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
|
2366 FUNC_MAP_ENTRY(on_enable_src_realize) |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
2367 FUNC_MAP_ENTRY(on_enable_src_toggled) |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
2368 FUNC_MAP_ENTRY(on_src_rate_realize) |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
2369 FUNC_MAP_ENTRY(on_src_rate_value_changed) |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
2370 FUNC_MAP_ENTRY(on_src_converter_type_realize) |
|
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2468
diff
changeset
|
2371 FUNC_MAP_ENTRY(on_src_converter_type_changed) |
| 2313 | 2372 FUNC_MAP_ENTRY(on_pl_metadata_on_load_realize) |
| 2373 FUNC_MAP_ENTRY(on_pl_metadata_on_load_toggled) | |
| 2374 FUNC_MAP_ENTRY(on_pl_metadata_on_display_realize) | |
| 2375 FUNC_MAP_ENTRY(on_pl_metadata_on_display_toggled) | |
| 2376 FUNC_MAP_ENTRY(on_playlist_show_pl_numbers_realize) | |
| 2377 FUNC_MAP_ENTRY(on_playlist_show_pl_numbers_toggled) | |
| 2378 FUNC_MAP_ENTRY(on_playlist_show_pl_separator_realize) | |
| 2379 FUNC_MAP_ENTRY(on_playlist_show_pl_separator_toggled) | |
| 2380 FUNC_MAP_ENTRY(on_playlist_convert_twenty_realize) | |
| 2381 FUNC_MAP_ENTRY(on_playlist_convert_twenty_toggled) | |
| 2382 FUNC_MAP_ENTRY(on_playlist_convert_underscore_realize) | |
| 2383 FUNC_MAP_ENTRY(on_playlist_convert_underscore_toggled) | |
| 2384 FUNC_MAP_ENTRY(on_playlist_convert_slash_realize) | |
| 2385 FUNC_MAP_ENTRY(on_playlist_convert_slash_toggled) | |
| 2386 FUNC_MAP_ENTRY(on_playlist_font_button_realize) | |
| 2387 FUNC_MAP_ENTRY(on_playlist_font_button_font_set) | |
| 2388 FUNC_MAP_ENTRY(on_playlist_no_advance_realize) | |
| 2389 FUNC_MAP_ENTRY(on_playlist_no_advance_toggled) | |
| 2390 FUNC_MAP_ENTRY(on_refresh_file_list_realize) | |
| 2391 FUNC_MAP_ENTRY(on_refresh_file_list_toggled) | |
| 2392 FUNC_MAP_ENTRY(on_skin_view_realize) | |
| 2393 FUNC_MAP_ENTRY(on_titlestring_entry_realize) | |
| 2394 FUNC_MAP_ENTRY(on_titlestring_entry_changed) | |
| 2395 FUNC_MAP_ENTRY(on_eq_dir_preset_entry_realize) | |
| 2396 FUNC_MAP_ENTRY(on_eq_dir_preset_entry_changed) | |
| 2397 FUNC_MAP_ENTRY(on_eq_file_preset_entry_realize) | |
| 2398 FUNC_MAP_ENTRY(on_eq_file_preset_entry_changed) | |
| 2399 FUNC_MAP_ENTRY(on_eq_preset_view_realize) | |
| 2400 FUNC_MAP_ENTRY(on_eq_preset_add_clicked) | |
| 2401 FUNC_MAP_ENTRY(on_eq_preset_remove_clicked) | |
| 2402 FUNC_MAP_ENTRY(on_skin_refresh_button_clicked) | |
| 2403 FUNC_MAP_ENTRY(on_proxy_use_toggled) | |
| 2404 FUNC_MAP_ENTRY(on_proxy_use_realize) | |
| 2405 FUNC_MAP_ENTRY(on_proxy_auth_toggled) | |
| 2406 FUNC_MAP_ENTRY(on_proxy_auth_realize) | |
| 2407 FUNC_MAP_ENTRY(on_proxy_host_realize) | |
| 2408 FUNC_MAP_ENTRY(on_proxy_host_changed) | |
| 2409 FUNC_MAP_ENTRY(on_proxy_port_realize) | |
| 2410 FUNC_MAP_ENTRY(on_proxy_port_changed) | |
| 2411 FUNC_MAP_ENTRY(on_proxy_user_realize) | |
| 2412 FUNC_MAP_ENTRY(on_proxy_user_changed) | |
| 2413 FUNC_MAP_ENTRY(on_proxy_pass_realize) | |
| 2414 FUNC_MAP_ENTRY(on_proxy_pass_changed) | |
| 2415 FUNC_MAP_ENTRY(on_chardet_detector_cbox_realize) | |
| 2416 FUNC_MAP_ENTRY(on_chardet_detector_cbox_changed) | |
| 2417 FUNC_MAP_ENTRY(on_chardet_fallback_realize) | |
| 2418 FUNC_MAP_ENTRY(on_chardet_fallback_changed) | |
| 2419 FUNC_MAP_ENTRY(on_output_plugin_bufsize_realize) | |
| 2420 FUNC_MAP_ENTRY(on_output_plugin_bufsize_value_changed) | |
| 2421 FUNC_MAP_ENTRY(on_audio_format_det_cb_toggled) | |
| 2422 FUNC_MAP_ENTRY(on_audio_format_det_cb_realize) | |
| 2423 FUNC_MAP_ENTRY(on_detect_by_extension_cb_toggled) | |
| 2424 FUNC_MAP_ENTRY(on_detect_by_extension_cb_realize) | |
| 2425 FUNC_MAP_ENTRY(on_show_filepopup_for_tuple_realize) | |
| 2426 FUNC_MAP_ENTRY(on_show_filepopup_for_tuple_toggled) | |
| 2427 FUNC_MAP_ENTRY(on_filepopup_for_tuple_settings_clicked) | |
| 2428 FUNC_MAP_ENTRY(on_continue_playback_on_startup_realize) | |
| 2429 FUNC_MAP_ENTRY(on_continue_playback_on_startup_toggled) | |
| 2430 | |
| 2431 /* Filepopup settings */ | |
| 2432 FUNC_MAP_ENTRY(on_filepopup_settings_ok_clicked) | |
| 2433 FUNC_MAP_ENTRY(on_filepopup_settings_cancel_clicked) | |
| 2434 | |
| 2435 /* XMMS fileselector option -nenolod */ | |
| 2436 FUNC_MAP_ENTRY(on_xmms_style_fileselector_toggled) | |
| 2437 FUNC_MAP_ENTRY(on_xmms_style_fileselector_realize) | |
| 2438 | |
| 2439 /* show window manager decorations */ | |
| 2440 FUNC_MAP_ENTRY(on_show_wm_decorations_toggled) | |
| 2441 FUNC_MAP_ENTRY(on_show_wm_decorations_realize) | |
| 2442 | |
| 2443 /* colorize */ | |
| 2444 FUNC_MAP_ENTRY(on_colorize_button_clicked) | |
| 2445 FUNC_MAP_ENTRY(on_red_scale_value_changed) | |
| 2446 FUNC_MAP_ENTRY(on_green_scale_value_changed) | |
| 2447 FUNC_MAP_ENTRY(on_blue_scale_value_changed) | |
| 2448 FUNC_MAP_ENTRY(on_colorize_close_clicked) | |
| 2623 | 2449 |
| 2450 FUNC_MAP_ENTRY(on_reload_plugins_clicked) | |
| 2313 | 2451 FUNC_MAP_END |
| 2452 | |
| 2453 void | |
| 2454 create_prefs_window(void) | |
| 2455 { | |
| 2456 const gchar *glade_file = DATA_DIR "/glade/prefswin.glade"; | |
| 2457 | |
| 2458 GladeXML *xml; | |
| 2459 GtkWidget *widget, *widget2; | |
| 2467 | 2460 gchar *aud_version_string; |
| 2313 | 2461 |
| 2462 GtkWidget *titlestring_tag_menu, *menu_item; | |
| 2463 guint i; | |
| 2464 | |
| 2465 /* load the interface */ | |
| 2466 xml = glade_xml_new_or_die(_("Preferences Window"), glade_file, NULL, | |
| 2467 NULL); | |
| 2468 | |
| 2469 | |
| 2470 /* connect the signals in the interface */ | |
| 2471 glade_xml_signal_autoconnect_map(xml, prefswin_func_map); | |
| 2472 | |
| 2473 prefswin = glade_xml_get_widget(xml, "prefswin"); | |
| 2474 g_object_set_data(G_OBJECT(prefswin), "glade-xml", xml); | |
| 2475 | |
| 2476 /* create category view */ | |
| 2477 widget = glade_xml_get_widget(xml, "category_view"); | |
| 2478 widget2 = glade_xml_get_widget(xml, "category_notebook"); | |
| 2479 g_signal_connect_after(G_OBJECT(widget), "realize", | |
| 2480 G_CALLBACK(on_category_view_realize), | |
| 2481 widget2); | |
| 2482 | |
| 2483 category_treeview = GTK_WIDGET(widget); | |
| 2484 category_notebook = GTK_WIDGET(widget2); | |
| 2485 | |
| 2486 /* plugin->input page */ | |
| 2487 | |
| 2488 widget = glade_xml_get_widget(xml, "input_plugin_view"); | |
| 2489 widget2 = glade_xml_get_widget(xml, "input_plugin_prefs"); | |
| 2490 g_signal_connect(G_OBJECT(widget), "cursor-changed", | |
| 2491 G_CALLBACK(input_plugin_enable_prefs), | |
| 2492 widget2); | |
| 2493 | |
| 2494 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
| 2495 G_CALLBACK(input_plugin_open_prefs), | |
| 2496 widget); | |
| 2497 widget2 = glade_xml_get_widget(xml, "input_plugin_info"); | |
| 2498 g_signal_connect(G_OBJECT(widget), "cursor-changed", | |
| 2499 G_CALLBACK(input_plugin_enable_info), | |
| 2500 widget2); | |
| 2501 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
| 2502 G_CALLBACK(input_plugin_open_info), | |
| 2503 widget); | |
| 2504 | |
| 2505 /* plugin->output page */ | |
| 2506 | |
| 2507 widget = glade_xml_get_widget(xml, "output_plugin_cbox"); | |
| 2508 | |
| 2509 widget2 = glade_xml_get_widget(xml, "output_plugin_prefs"); | |
| 2510 g_signal_connect(G_OBJECT(widget), "changed", | |
| 2511 G_CALLBACK(output_plugin_enable_prefs), | |
| 2512 widget2); | |
| 2513 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
| 2514 G_CALLBACK(output_plugin_open_prefs), | |
| 2515 widget); | |
| 2516 | |
| 2517 widget2 = glade_xml_get_widget(xml, "output_plugin_info"); | |
| 2518 g_signal_connect(G_OBJECT(widget), "changed", | |
| 2519 G_CALLBACK(output_plugin_enable_info), | |
| 2520 widget2); | |
| 2521 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
| 2522 G_CALLBACK(output_plugin_open_info), | |
| 2523 widget); | |
| 2524 | |
| 2525 /* plugin->general page */ | |
| 2526 | |
| 2527 widget = glade_xml_get_widget(xml, "general_plugin_view"); | |
| 2528 | |
| 2529 widget2 = glade_xml_get_widget(xml, "general_plugin_prefs"); | |
| 2530 g_signal_connect(G_OBJECT(widget), "cursor-changed", | |
| 2531 G_CALLBACK(general_plugin_enable_prefs), | |
| 2532 widget2); | |
| 2533 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
| 2534 G_CALLBACK(general_plugin_open_prefs), | |
| 2535 widget); | |
| 2536 | |
| 2537 widget2 = glade_xml_get_widget(xml, "general_plugin_info"); | |
| 2538 g_signal_connect(G_OBJECT(widget), "cursor-changed", | |
| 2539 G_CALLBACK(general_plugin_enable_info), | |
| 2540 widget2); | |
| 2541 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
| 2542 G_CALLBACK(general_plugin_open_info), | |
| 2543 widget); | |
| 2544 | |
| 2545 | |
| 2546 /* plugin->vis page */ | |
| 2547 | |
| 2548 widget = glade_xml_get_widget(xml, "vis_plugin_view"); | |
| 2549 widget2 = glade_xml_get_widget(xml, "vis_plugin_prefs"); | |
| 2550 | |
| 2551 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
| 2552 G_CALLBACK(vis_plugin_open_prefs), | |
| 2553 widget); | |
| 2554 g_signal_connect(G_OBJECT(widget), "cursor-changed", | |
| 2555 G_CALLBACK(vis_plugin_enable_prefs), widget2); | |
| 2556 | |
| 2557 | |
| 2558 widget2 = glade_xml_get_widget(xml, "vis_plugin_info"); | |
| 2559 g_signal_connect(G_OBJECT(widget), "cursor-changed", | |
| 2560 G_CALLBACK(vis_plugin_enable_info), widget2); | |
| 2561 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
| 2562 G_CALLBACK(vis_plugin_open_info), | |
| 2563 widget); | |
| 2564 | |
| 2565 | |
| 2566 /* plugin->effects page */ | |
| 2567 | |
| 2568 widget = glade_xml_get_widget(xml, "effect_plugin_view"); | |
| 2569 widget2 = glade_xml_get_widget(xml, "effect_plugin_prefs"); | |
| 2570 | |
| 2571 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
| 2572 G_CALLBACK(effect_plugin_open_prefs), | |
| 2573 widget); | |
| 2574 g_signal_connect(G_OBJECT(widget), "cursor-changed", | |
| 2575 G_CALLBACK(effect_plugin_enable_prefs), widget2); | |
| 2576 | |
| 2577 | |
| 2578 widget2 = glade_xml_get_widget(xml, "effect_plugin_info"); | |
| 2579 g_signal_connect(G_OBJECT(widget), "cursor-changed", | |
| 2580 G_CALLBACK(effect_plugin_enable_info), widget2); | |
| 2581 g_signal_connect_swapped(G_OBJECT(widget2), "clicked", | |
| 2582 G_CALLBACK(effect_plugin_open_info), | |
| 2583 widget); | |
| 2584 | |
| 2585 /* playlist page */ | |
| 2586 | |
| 2587 widget = glade_xml_get_widget(xml, "pause_between_songs_box"); | |
| 2588 widget2 = glade_xml_get_widget(xml, "pause_between_songs"); | |
| 2589 g_signal_connect_after(G_OBJECT(widget2), "realize", | |
| 2590 G_CALLBACK(on_pause_between_songs_realize), | |
| 2591 widget); | |
| 2592 g_signal_connect(G_OBJECT(widget2), "toggled", | |
| 2593 G_CALLBACK(on_pause_between_songs_toggled), | |
| 2594 widget); | |
| 2595 | |
| 2596 widget = glade_xml_get_widget(xml, "playlist_use_metadata_box"); | |
| 2597 widget2 = glade_xml_get_widget(xml, "playlist_use_metadata"); | |
| 2598 g_signal_connect_after(G_OBJECT(widget2), "realize", | |
| 2599 G_CALLBACK(on_use_pl_metadata_realize), | |
| 2600 widget); | |
| 2601 g_signal_connect(G_OBJECT(widget2), "toggled", | |
| 2602 G_CALLBACK(on_use_pl_metadata_toggled), | |
| 2603 widget); | |
| 2604 | |
| 2605 widget = glade_xml_get_widget(xml, "skin_view"); | |
| 2606 g_signal_connect(widget, "drag-data-received", | |
| 2607 G_CALLBACK(on_skin_view_drag_data_received), | |
| 2608 NULL); | |
| 2609 bmp_drag_dest_set(widget); | |
| 2610 | |
| 2611 g_signal_connect(mainwin, "drag-data-received", | |
| 2612 G_CALLBACK(mainwin_drag_data_received), | |
| 2613 widget); | |
| 2614 | |
| 2615 widget = glade_xml_get_widget(xml, "skin_refresh_button"); | |
| 2616 g_signal_connect(widget, "clicked", | |
| 2617 G_CALLBACK(on_skin_refresh_button_clicked), | |
| 2618 NULL); | |
| 2619 | |
| 2620 widget = glade_xml_get_widget(xml, "playlist_font_button"); | |
| 2621 g_signal_connect(mainwin, "drag-data-received", | |
| 2622 G_CALLBACK(mainwin_drag_data_received1), | |
| 2623 widget); | |
| 2624 | |
| 2625 widget = glade_xml_get_widget(xml, "titlestring_cbox"); | |
| 2626 widget2 = glade_xml_get_widget(xml, "titlestring_entry"); | |
| 2627 g_signal_connect(widget, "realize", | |
| 2628 G_CALLBACK(on_titlestring_cbox_realize), | |
| 2629 widget2); | |
| 2630 g_signal_connect(widget, "changed", | |
| 2631 G_CALLBACK(on_titlestring_cbox_changed), | |
| 2632 widget2); | |
| 2633 | |
| 2634 /* FIXME: move this into a function */ | |
| 2635 /* create tag menu */ | |
| 2636 titlestring_tag_menu = gtk_menu_new(); | |
| 2637 for(i = 0; i < n_title_field_tags; i++) { | |
| 2638 menu_item = gtk_menu_item_new_with_label(_(title_field_tags[i].name)); | |
| 2639 gtk_menu_shell_append(GTK_MENU_SHELL(titlestring_tag_menu), menu_item); | |
| 2640 g_signal_connect(menu_item, "activate", | |
| 2641 G_CALLBACK(titlestring_tag_menu_callback), | |
| 2642 GINT_TO_POINTER(i)); | |
| 2643 }; | |
| 2644 gtk_widget_show_all(titlestring_tag_menu); | |
| 2645 | |
| 2646 widget = glade_xml_get_widget(xml, "titlestring_help_button"); | |
| 2647 widget2 = glade_xml_get_widget(xml, "titlestring_cbox"); | |
| 2648 | |
| 2649 g_signal_connect(widget2, "changed", | |
| 2650 G_CALLBACK(on_titlestring_cbox_changed), | |
| 2651 widget); | |
| 2652 g_signal_connect(widget, "clicked", | |
| 2653 G_CALLBACK(on_titlestring_help_button_clicked), | |
| 2654 titlestring_tag_menu); | |
| 2655 | |
| 2656 /* audacious version label */ | |
| 2657 widget = glade_xml_get_widget(xml, "audversionlabel"); | |
| 2467 | 2658 |
|
2468
5206f4ef02f7
[svn] - the svn_stamp is no longer an svn revision, but a serial number
nenolod
parents:
2467
diff
changeset
|
2659 aud_version_string = g_strdup_printf("<span size='small'>%s (%s) (%s@%s)</span>", |
| 2467 | 2660 "Audacious " PACKAGE_VERSION , |
| 2466 | 2661 svn_stamp , g_get_user_name() , g_get_host_name() ); |
| 2313 | 2662 |
| 2467 | 2663 gtk_label_set_markup( GTK_LABEL(widget) , aud_version_string ); |
| 2664 g_free(aud_version_string); | |
| 2313 | 2665 |
| 2666 /* Create window for filepopup settings */ | |
| 2667 filepopup_settings = glade_xml_get_widget(xml, "filepopup_for_tuple_settings"); | |
| 2668 gtk_window_set_transient_for(GTK_WINDOW(filepopup_settings), GTK_WINDOW(prefswin)); | |
| 2669 | |
| 2670 widget = glade_xml_get_widget(xml, "filepopup_settings_recurse_for_cover_depth_box"); | |
| 2671 widget2 = glade_xml_get_widget(xml, "filepopup_settings_recurse_for_cover"); | |
| 2672 g_signal_connect(G_OBJECT(widget2), "toggled", | |
| 2673 G_CALLBACK(on_recurse_for_cover_toggled), | |
| 2674 widget); | |
| 2675 | |
| 2635 | 2676 /* Create window for color adjustment settings */ |
| 2313 | 2677 colorize_settings = glade_xml_get_widget(xml, "colorize_popup"); |
| 2678 gtk_window_set_transient_for(GTK_WINDOW(colorize_settings), GTK_WINDOW(prefswin)); | |
| 2679 gtk_widget_hide(colorize_settings); | |
| 2680 } | |
| 2681 | |
| 2682 void | |
| 2683 show_prefs_window(void) | |
| 2684 { | |
|
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
|
2685 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
|
2686 |
| 2635 | 2687 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
|
2688 |
|
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
|
2689 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
|
2690 { |
|
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
|
2691 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
|
2692 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
|
2693 |
|
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
|
2694 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
|
2695 |
|
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
|
2696 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
|
2697 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
|
2698 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
|
2699 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
|
2700 } |
| 2313 | 2701 } |
| 2702 | |
| 2703 static void | |
| 2704 prefswin_page_queue_new(GtkWidget *container, gchar *name, gchar *imgurl) | |
| 2705 { | |
| 2706 CategoryQueueEntry *ent = g_malloc0(sizeof(CategoryQueueEntry)); | |
| 2707 | |
| 2708 ent->container = container; | |
| 2709 ent->pg_name = name; | |
| 2710 ent->img_url = imgurl; | |
| 2711 | |
| 2712 if (category_queue) | |
| 2713 ent->next = category_queue; | |
| 2714 | |
| 2715 category_queue = ent; | |
| 2716 } | |
| 2717 | |
| 2718 static void | |
| 2719 prefswin_page_queue_destroy(CategoryQueueEntry *ent) | |
| 2720 { | |
| 2721 category_queue = ent->next; | |
| 2722 g_free(ent); | |
| 2723 } | |
| 2724 | |
| 2725 /* | |
| 2726 * Public APIs for adding new pages to the prefs window. | |
| 2727 * | |
| 2728 * Basically, the concept here is that third party components can register themselves in the root | |
| 2729 * preferences window. | |
| 2730 * | |
| 2731 * From a usability standpoint this makes the application look more "united", instead of cluttered | |
| 2732 * and malorganised. Hopefully this option will be used further in the future. | |
| 2733 * | |
| 2734 * - nenolod | |
| 2735 */ | |
| 2736 gint | |
| 2737 prefswin_page_new(GtkWidget *container, gchar *name, gchar *imgurl) | |
| 2738 { | |
| 2739 GtkTreeModel *model; | |
| 2740 GtkTreeIter iter; | |
| 2741 GdkPixbuf *img = NULL; | |
| 2742 GtkTreeView *treeview = GTK_TREE_VIEW(category_treeview); | |
| 2743 gint id; | |
| 2744 | |
| 2745 if (treeview == NULL || category_notebook == NULL) | |
| 2746 { | |
| 2747 prefswin_page_queue_new(container, name, imgurl); | |
| 2748 return -1; | |
| 2749 } | |
| 2750 | |
| 2751 model = gtk_tree_view_get_model(treeview); | |
| 2752 | |
| 2753 if (model == NULL) | |
| 2754 { | |
| 2755 prefswin_page_queue_new(container, name, imgurl); | |
| 2756 return -1; | |
| 2757 } | |
| 2758 | |
| 2759 /* Make sure the widgets are visible. */ | |
| 2760 gtk_widget_show(container); | |
| 2761 id = gtk_notebook_append_page(GTK_NOTEBOOK(category_notebook), container, NULL); | |
| 2762 | |
| 2763 if (id == -1) | |
| 2764 return -1; | |
| 2765 | |
| 2766 if (imgurl != NULL) | |
| 2767 img = gdk_pixbuf_new_from_file(imgurl, NULL); | |
| 2768 | |
| 2769 gtk_list_store_append(GTK_LIST_STORE(model), &iter); | |
| 2770 gtk_list_store_set(GTK_LIST_STORE(model), &iter, | |
| 2771 CATEGORY_VIEW_COL_ICON, img, | |
| 2772 CATEGORY_VIEW_COL_NAME, | |
| 2773 name, CATEGORY_VIEW_COL_ID, id, -1); | |
| 2774 | |
| 2775 if (img != NULL) | |
| 2776 g_object_unref(img); | |
| 2777 | |
| 2778 return id; | |
| 2779 } | |
| 2780 | |
| 2781 void | |
| 2782 prefswin_page_destroy(GtkWidget *container) | |
| 2783 { | |
| 2784 GtkTreeModel *model; | |
| 2785 GtkTreeIter iter; | |
| 2786 GtkTreeView *treeview = GTK_TREE_VIEW(category_treeview); | |
| 2787 gboolean ret; | |
| 2788 gint id; | |
| 2789 gint index = -1; | |
| 2790 | |
| 2791 if (category_notebook == NULL || treeview == NULL || container == NULL) | |
| 2792 return; | |
| 2793 | |
| 2794 id = gtk_notebook_page_num(GTK_NOTEBOOK(category_notebook), container); | |
| 2795 | |
| 2796 if (id == -1) | |
| 2797 return; | |
| 2798 | |
| 2799 gtk_notebook_remove_page(GTK_NOTEBOOK(category_notebook), id); | |
| 2800 | |
| 2801 model = gtk_tree_view_get_model(treeview); | |
| 2802 | |
| 2803 if (model == NULL) | |
| 2804 return; | |
| 2805 | |
| 2806 ret = gtk_tree_model_get_iter_first(model, &iter); | |
| 2807 | |
| 2808 while (ret == TRUE) | |
| 2809 { | |
| 2810 gtk_tree_model_get(model, &iter, CATEGORY_VIEW_COL_ID, &index, -1); | |
| 2811 | |
| 2812 if (index == id) | |
| 2813 { | |
| 2814 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); | |
| 2815 ret = gtk_tree_model_get_iter_first(model, &iter); | |
| 2816 } | |
| 2817 | |
| 2818 if (index > id) | |
| 2819 { | |
| 2820 index--; | |
| 2821 gtk_list_store_set(GTK_LIST_STORE(model), &iter, CATEGORY_VIEW_COL_ID, index, -1); | |
| 2822 } | |
| 2823 | |
| 2824 ret = gtk_tree_model_iter_next(model, &iter); | |
| 2825 } | |
| 2826 } |
