~walkerlee/totem/pre-interview

« back to all changes in this revision

Viewing changes to src/totem-preferences.c

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-05-26 00:07:51 UTC
  • mfrom: (1.6.1) (24.1.4 experimental)
  • Revision ID: package-import@ubuntu.com-20130526000751-kv8ap3x1di4qq8j2
Tags: 3.8.2-0ubuntu1
* Sync with Debian. Remaining changes: 
* debian/control.in:
  - Drop build-depends on libepc-ui-dev and libgrilo-0.2-dev (in universe)
  - Drop libxtst-dev build-depends so that the (redundant) fake key presses
    for inhibiting the screensaver are disabled (LP: #1007438)
  - Build-depend on libzeitgeist-dev
  - Suggest rather than recommend gstreamer components in universe
  - Add totem-plugins-extra
  - Add XB-Npp-Description and XB-Npp-Filename header to the 
    totem-mozilla package to improve ubufox/ubuntu plugin db integration 
  - Refer to Firefox in totem-mozilla description instead of Iceweasel
  - Don't have totem-mozilla recommend any particular browser
  - Drop obsolete python library dependencies since iplayer is no longer
    included
* debian/totem-common.install, debian/source_totem.py:
  - Install Ubuntu apport debugging hook
* debian/totem-plugins-extra.install:
  - Universe plugins split out of totem-plugins (currently only gromit)
* debian/totem-plugins.install:    
  - Skip the plugins split to -extra and add the zeitgeist plugin
* debian/rules:
  - Build with --fail-missing, to ensure we install everything. 
    + Ignore libtotem.{,l}a since we delibrately don't install these.
  - Re-enable hardening, make sure both PIE and BINDNOW are used
    by setting hardening=+all. (LP: #1039604)
* debian/patches/91_quicklist_entries.patch:
  - Add static quicklist
* debian/patches/92_gst-plugins-good.patch:
  - Build without unnecessary gstreamer1.0-bad dependency
* debian/patches/93_grilo_optional.patch:
  - Allow building without grilo while grilo MIR is still pending
* debian/patches/correct_desktop_mimetypes.patch:
  - Don't list the mimetypes after the unity lists
* debian/patches/revert_shell_menu.patch: 
  - revert the use of a shell menu until indicator-appmenu can handle
    the mixed shell/traditional menus itself
* New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
#include "totem-subtitle-encoding.h"
45
45
#include "totem-plugins-engine.h"
46
46
 
 
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)
 
49
 
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);
59
62
 
60
63
        g_settings_set_boolean (totem->settings, "show-visualizations", value);
61
64
 
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);
72
73
 
73
74
        bacon_video_widget_set_show_visualizations
97
98
{
98
99
        GObject *item;
99
100
 
100
 
        item = gtk_builder_get_object (totem->xml, "tpw_visuals_checkbutton");
 
101
        item = POBJ ("tpw_visuals_checkbutton");
101
102
        g_signal_handlers_disconnect_by_func (item,
102
103
                        checkbutton2_toggled_cb, totem);
103
104
 
119
120
        GObject *item, *radio;
120
121
        gboolean value;
121
122
 
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);
125
126
 
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");
129
130
        } else {
130
 
                radio = gtk_builder_get_object (totem->xml, "tpw_video_toggle_button");
 
131
                radio = POBJ ("tpw_video_toggle_button");
131
132
        }
132
133
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), TRUE);
133
134
 
163
164
 
164
165
        for (i = 0; i < G_N_ELEMENTS (scales); i++) {
165
166
                GtkRange *item;
166
 
                item = GTK_RANGE (gtk_builder_get_object (totem->xml, scales[i]));
 
167
                item = GTK_RANGE (POBJ (scales[i]));
167
168
                gtk_range_set_value (item, 65535/2);
168
169
        }
169
170
}
193
194
        gchar *font;
194
195
        GtkFontButton *item;
195
196
 
196
 
        item = GTK_FONT_BUTTON (gtk_builder_get_object (totem->xml, "font_sel_button"));
 
197
        item = GTK_FONT_BUTTON (POBJ ("font_sel_button"));
197
198
        font = g_settings_get_string (settings, "subtitle-font");
198
199
        gtk_font_button_set_font_name (item, font);
199
200
        bacon_video_widget_set_subtitle_font (totem->bvw, font);
206
207
        gchar *encoding;
207
208
        GtkComboBox *item;
208
209
 
209
 
        item = GTK_COMBO_BOX (gtk_builder_get_object (totem->xml, "subtitle_encoding_combo"));
 
210
        item = GTK_COMBO_BOX (POBJ ("subtitle_encoding_combo"));
210
211
        encoding = g_settings_get_string (settings, "subtitle-encoding");
211
212
        totem_subtitle_encoding_set (item, encoding);
212
213
        bacon_video_widget_set_subtitle_encoding (totem->bvw, encoding);
259
260
        show_visualizations = g_settings_get_boolean (settings, "show-visualizations");
260
261
 
261
262
        /* Only enable the size combobox if the visualization-quality setting is writable, and visualizations are enabled */
262
 
        gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (totem->xml, "tpw_visuals_size_combobox")), writable && show_visualizations);
 
263
        gtk_widget_set_sensitive (PWID ("tpw_visuals_size_combobox"), writable && show_visualizations);
263
264
}
264
265
 
265
266
void
270
271
        guint i, hidden;
271
272
        char *visual, *font, *encoding;
272
273
        GList *list, *l;
 
274
        GtkWidget *widget;
273
275
        GObject *item;
274
276
 
275
277
        static struct {
291
293
 
292
294
        /* Work-around builder dialogue not parenting properly for
293
295
         * On top windows */
294
 
        item = gtk_builder_get_object (totem->xml, "tpw_notebook");
 
296
        widget = PWID ("tpw_notebook");
295
297
        totem->prefs = gtk_dialog_new_with_buttons (_("Preferences"),
296
298
                        GTK_WINDOW (totem->win),
297
299
                        GTK_DIALOG_DESTROY_WITH_PARENT,
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);
308
310
 
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);
315
317
 
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);
320
322
 
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);
325
327
 
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");
330
332
        else
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);
334
336
 
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);
340
342
 
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);
347
 
 
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");
351
346
 
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);
359
354
 
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);
364
358
 
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);
368
362
 
369
363
        /* Visuals list */
377
371
                visual = g_strdup ("goom");
378
372
        }
379
373
 
380
 
        item = gtk_builder_get_object (totem->xml, "tpw_visuals_type_liststore");
 
374
        item = POBJ ("tpw_visuals_type_liststore");
381
375
 
382
376
        i = 0;
383
377
        for (l = list; l != NULL; l = l->next) {
391
385
                if (strcmp (name, visual) == 0) {
392
386
                        GObject *combobox;
393
387
 
394
 
                        combobox = gtk_builder_get_object (totem->xml, "tpw_visuals_type_combobox");
 
388
                        combobox = POBJ ("tpw_visuals_type_combobox");
395
389
                        gtk_combo_box_set_active (GTK_COMBO_BOX (combobox), i);
396
390
                }
397
391
 
401
395
 
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++) {
416
410
                int prop_value;
417
411
 
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);
421
415
 
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));
430
424
                        hidden++;
431
425
                }
433
427
 
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));
438
432
        }
439
433
 
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);
447
441
 
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);
459
453
 
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 */