44
44
#include "totem-subtitle-encoding.h"
45
45
#include "totem-plugins-engine.h"
47
#define PWID(x) (GtkWidget *) gtk_builder_get_object (totem->prefs_xml, x)
48
#define POBJ(x) gtk_builder_get_object (totem->prefs_xml, x)
47
50
/* Callback functions for GtkBuilder */
48
51
G_MODULE_EXPORT void checkbutton2_toggled_cb (GtkToggleButton *togglebutton, Totem *totem);
49
52
G_MODULE_EXPORT void audio_screensaver_button_toggled_cb (GtkToggleButton *togglebutton, Totem *totem);
60
63
g_settings_set_boolean (totem->settings, "show-visualizations", value);
62
item = GTK_WIDGET (gtk_builder_get_object (totem->xml, "tpw_visuals_type_label"));
63
gtk_widget_set_sensitive (item, value);
64
item = GTK_WIDGET (gtk_builder_get_object (totem->xml,
65
"tpw_visuals_type_combobox"));
66
gtk_widget_set_sensitive (item, value);
67
item = GTK_WIDGET (gtk_builder_get_object (totem->xml, "tpw_visuals_size_label"));
68
gtk_widget_set_sensitive (item, value);
69
item = GTK_WIDGET (gtk_builder_get_object (totem->xml,
70
"tpw_visuals_size_combobox"));
65
item = PWID ("tpw_visuals_type_label");
66
gtk_widget_set_sensitive (item, value);
67
item = PWID ("tpw_visuals_type_combobox");
68
gtk_widget_set_sensitive (item, value);
69
item = PWID ("tpw_visuals_size_label");
70
gtk_widget_set_sensitive (item, value);
71
item = PWID ("tpw_visuals_size_combobox");
71
72
gtk_widget_set_sensitive (item, value);
73
74
bacon_video_widget_set_show_visualizations
119
120
GObject *item, *radio;
122
item = gtk_builder_get_object (totem->xml, "tpw_audio_toggle_button");
123
item = POBJ ("tpw_audio_toggle_button");
123
124
g_signal_handlers_disconnect_by_func (item,
124
125
audio_screensaver_button_toggled_cb, totem);
126
127
value = g_settings_get_boolean (totem->settings, "lock-screensaver-on-audio");
127
128
if (value != FALSE) {
128
radio = gtk_builder_get_object (totem->xml, "tpw_audio_toggle_button");
129
radio = POBJ ("tpw_audio_toggle_button");
130
radio = gtk_builder_get_object (totem->xml, "tpw_video_toggle_button");
131
radio = POBJ ("tpw_video_toggle_button");
132
133
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), TRUE);
301
303
gtk_container_set_border_width (GTK_CONTAINER (totem->prefs), 5);
302
304
content_area = gtk_dialog_get_content_area (GTK_DIALOG (totem->prefs));
303
305
gtk_box_set_spacing (GTK_BOX (content_area), 2);
304
gtk_widget_reparent (GTK_WIDGET (item), content_area);
306
gtk_widget_reparent (widget, content_area);
305
307
gtk_widget_show_all (content_area);
306
item = gtk_builder_get_object (totem->xml, "totem_preferences_window");
307
gtk_widget_destroy (GTK_WIDGET (item));
308
widget = PWID ("totem_preferences_window");
309
gtk_widget_destroy (widget);
309
311
g_signal_connect (G_OBJECT (totem->prefs), "response",
310
312
G_CALLBACK (gtk_widget_hide), NULL);
314
316
G_CALLBACK (gtk_widget_destroyed), &totem->prefs);
316
318
/* Remember position */
317
item = gtk_builder_get_object (totem->xml, "tpw_remember_position_checkbutton");
319
item = POBJ ("tpw_remember_position_checkbutton");
318
320
g_settings_bind (totem->settings, "remember-position", item, "active", G_SETTINGS_BIND_DEFAULT);
319
321
g_settings_bind (totem->settings, "remember-position", totem, "remember-position", G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_NO_SENSITIVITY);
321
323
/* Auto-resize */
322
item = gtk_builder_get_object (totem->xml, "tpw_display_checkbutton");
324
item = POBJ ("tpw_display_checkbutton");
323
325
g_settings_bind (totem->settings, "auto-resize", item, "active", G_SETTINGS_BIND_DEFAULT);
324
326
g_settings_bind (totem->settings, "auto-resize", bvw, "auto-resize", G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_NO_SENSITIVITY);
326
328
/* Screensaver audio locking */
327
329
lock_screensaver_on_audio = g_settings_get_boolean (totem->settings, "lock-screensaver-on-audio");
328
330
if (lock_screensaver_on_audio != FALSE)
329
item = gtk_builder_get_object (totem->xml, "tpw_audio_toggle_button");
331
item = POBJ ("tpw_audio_toggle_button");
331
item = gtk_builder_get_object (totem->xml, "tpw_video_toggle_button");
333
item = POBJ ("tpw_video_toggle_button");
332
334
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item), TRUE);
333
335
g_signal_connect (totem->settings, "changed::lock-screensaver-on-audio", (GCallback) lock_screensaver_on_audio_changed_cb, totem);
335
337
/* Disable deinterlacing */
336
item = gtk_builder_get_object (totem->xml, "tpw_no_deinterlace_checkbutton");
338
item = POBJ ("tpw_no_deinterlace_checkbutton");
337
339
g_settings_bind (totem->settings, "disable-deinterlacing", item, "active", G_SETTINGS_BIND_DEFAULT);
338
340
g_settings_bind (totem->settings, "disable-deinterlacing", bvw, "deinterlacing",
339
341
G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_NO_SENSITIVITY | G_SETTINGS_BIND_INVERT_BOOLEAN);
341
/* Connection Speed */
342
item = gtk_builder_get_object (totem->xml, "tpw_speed_combobox");
343
g_settings_bind (totem->settings, "connection-speed", bvw, "connection-speed", G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_NO_SENSITIVITY);
344
g_settings_bind_with_mapping (totem->settings, "connection-speed", item, "active", G_SETTINGS_BIND_DEFAULT,
345
(GSettingsBindGetMapping) int_enum_get_mapping, (GSettingsBindSetMapping) int_enum_set_mapping,
346
g_type_class_ref (BVW_TYPE_CONNECTION_SPEED), (GDestroyNotify) g_type_class_unref);
348
343
/* Enable visuals */
349
item = gtk_builder_get_object (totem->xml, "tpw_visuals_checkbutton");
344
item = POBJ ("tpw_visuals_checkbutton");
350
345
show_visuals = g_settings_get_boolean (totem->settings, "show-visualizations");
352
347
g_signal_handlers_disconnect_by_func (item, checkbutton2_toggled_cb, totem);
358
353
g_signal_connect (totem->settings, "changed::show-visualizations", (GCallback) show_vfx_changed_cb, totem);
360
355
/* Auto-load subtitles */
361
item = gtk_builder_get_object (totem->xml, "tpw_auto_subtitles_checkbutton");
356
item = POBJ ("tpw_auto_subtitles_checkbutton");
362
357
g_settings_bind (totem->settings, "autoload-subtitles", item, "active", G_SETTINGS_BIND_DEFAULT);
363
g_settings_bind (totem->settings, "autoload-subtitles", totem, "autoload-subtitles", G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_NO_SENSITIVITY);
365
359
/* Auto-load external chapters */
366
item = gtk_builder_get_object (totem->xml, "tpw_auto_chapters_checkbutton");
360
item = POBJ ("tpw_auto_chapters_checkbutton");
367
361
g_settings_bind (totem->settings, "autoload-chapters", item, "active", G_SETTINGS_BIND_DEFAULT);
369
363
/* Visuals list */
402
396
/* Visualisation quality. We have to bind the writability separately, as the sensitivity of the size combobox is also affected by whether
403
397
* visualizations are enabled. */
404
item = gtk_builder_get_object (totem->xml, "tpw_visuals_size_combobox");
398
item = POBJ ("tpw_visuals_size_combobox");
405
399
g_settings_bind (totem->settings, "visualization-quality", bvw, "visualization-quality",
406
400
G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_NO_SENSITIVITY);
407
401
g_settings_bind_with_mapping (totem->settings, "visualization-quality", item, "active",
415
409
for (i = 0; i < G_N_ELEMENTS (props); i++) {
418
item = gtk_builder_get_object (totem->xml, props[i].adjustment);
412
item = POBJ (props[i].adjustment);
419
413
g_settings_bind (totem->settings, props[i].key, item, "value", G_SETTINGS_BIND_DEFAULT);
420
414
g_settings_bind (totem->settings, props[i].key, bvw, props[i].key, G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_NO_SENSITIVITY);
422
416
prop_value = bacon_video_widget_get_video_property (totem->bvw, props[i].prop);
423
417
if (prop_value < 0) {
424
418
/* The property's unsupported, so hide the widget and its label */
425
item = gtk_builder_get_object (totem->xml, props[i].name);
419
item = POBJ (props[i].name);
426
420
gtk_range_set_value (GTK_RANGE (item), (gdouble) 65535/2);
427
421
gtk_widget_hide (GTK_WIDGET (item));
428
item = gtk_builder_get_object (totem->xml, props[i].label);
422
item = POBJ (props[i].label);
429
423
gtk_widget_hide (GTK_WIDGET (item));
434
428
/* If all the properties have been hidden, hide their section box */
435
429
if (hidden == G_N_ELEMENTS (props)) {
436
item = gtk_builder_get_object (totem->xml, "tpw_bright_contr_vbox");
430
item = POBJ ("tpw_bright_contr_vbox");
437
431
gtk_widget_hide (GTK_WIDGET (item));
440
434
/* Sound output type */
441
item = gtk_builder_get_object (totem->xml, "tpw_sound_output_combobox");
435
item = POBJ ("tpw_sound_output_combobox");
442
436
g_settings_bind (totem->settings, "audio-output-type", bvw, "audio-output-type",
443
437
G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_NO_SENSITIVITY);
444
438
g_settings_bind_with_mapping (totem->settings, "audio-output-type", item, "active", G_SETTINGS_BIND_DEFAULT,
446
440
g_type_class_ref (BVW_TYPE_AUDIO_OUTPUT_TYPE), (GDestroyNotify) g_type_class_unref);
448
442
/* Subtitle font selection */
449
item = gtk_builder_get_object (totem->xml, "font_sel_button");
443
item = POBJ ("font_sel_button");
450
444
gtk_font_button_set_title (GTK_FONT_BUTTON (item),
451
445
_("Select Subtitle Font"));
452
446
font = g_settings_get_string (totem->settings, "subtitle-font");
458
452
g_signal_connect (totem->settings, "changed::subtitle-font", (GCallback) font_changed_cb, totem);
460
454
/* Subtitle encoding selection */
461
item = gtk_builder_get_object (totem->xml, "subtitle_encoding_combo");
455
item = POBJ ("subtitle_encoding_combo");
462
456
totem_subtitle_encoding_init (GTK_COMBO_BOX (item));
463
457
encoding = g_settings_get_string (totem->settings, "subtitle-encoding");
464
458
/* Make sure the default is UTF-8 */