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