~ubuntu-branches/ubuntu/saucy/gnome-control-center/saucy-proposed

« back to all changes in this revision

Viewing changes to panels/sound/gvc-speaker-test.c

  • Committer: Package Import Robot
  • Author(s): Sebastien Bacher, Sebastien Bacher, Robert Ancell, Iain Lane, Edward Donovan, Rico Tzschichholz, Jeremy Bicha, David Henningsson
  • Date: 2012-11-21 19:32:45 UTC
  • mfrom: (1.1.63)
  • Revision ID: package-import@ubuntu.com-20121121193245-mj61nzz1z4fk3z25
Tags: 1:3.6.3-0ubuntu1
[ Sebastien Bacher ]
* New upstream version
* debian/control.in: recommends libcanberra-pulse (lp: #1004973)
* debian/patches/58_ubuntu_icon_views_redesign.patch:
  - drop most of the changes, keep the different grid size though
    to fit on screen with our extra icons
* debian/patches/91_dont_show_in_unity.patch:
  - dropped, show the upstream printer panel and the layout tab
* debian/patches/revert_git_keyboard_gsettings.patch,
  debian/patches/revert_git_stop_using_gconf.patch:
  - dropped the gconf->gsettings reverts

[ Robert Ancell ]
* New upstream release (LP: #1010317)
* debian/control:
  - Bump build-depends on libgnome-desktop-3-dev, libwacom-dev
  - Add build-depends on libclutter-1.0-dev, libclutter-gtk-1.0-dev,
    libpwquality-dev
  - Drop build-depends on libgnomekbd-dev
* debian/patches/60_ubuntu_nav_bar.patch:
  - Disabled for now, doesn't apply
* debian/patches/revert_ua_gsettings.patch:
  - We can use GSettings for universal access now
* debian/patches/00git_online_accounts_gtkgrid.patch:
* debian/patches/00git_online_accounts_layout.part:
* debian/patches/git_wacom_translations.patch:
  - Applied upstream

[ Iain Lane ]
* Add Build-Depends on libxkbfile-dev
* New upstream release.
* Refresh all patches to apply cleanly.

[ Edward Donovan ]
* debian/source_gnome-control-center.py: Fix for Python 3. (LP: #1013171)

[ Rico Tzschichholz ]
* debian/control.in:
  - Build-depend on gtk-doc-tools instead of docbook directly
  - Bump minimum glib-2.0, gnome-desktop3, gnome-settings-daemon
     and gsettings-desktop-schemas

[ Jeremy Bicha ]
* Dropped more patches applied in new version:
  - git_unmute_sound_event.patch
  - git_fix_big_editable_labels.patch
  - 96_sound_nua_panel.patch
* debian/patches/04_new_appearance_settings.patch:
  - Dropped, this is now packaged separately as gnome-control-center-unity
* debian/patches/10_keyboard_layout_on_unity.patch:
  - Don't change the keyboard panel name when not running Unity
* debian/patches/52_ubuntu_language_list_mods.patch:
  - Don't disable adding current language to the list. While this
    fix shows the current language twice, at least it avoids the
    "Ubuntu suddenly in Chinese" bug (LP: #1035219)
* debian/patches/53_use_ubuntu_help.patch:
  - Only show Ubuntu help when running Unity
* debian/patches/58_hide_gdm_notifications.patch:
  - Hide "Show notifications when locked" settings when running Unity
    since it's a GNOME Shell-specific feature
* debian/patches/63_normal_scrollbar_in_a11y.patch:
  - Drop, overlay-scrollbars should handle this instead
* debian/patches/91_dont_show_in_unity.patch:
  - Hide Printers & Region panels in Unity until we're ready to switch
    to them.
* debian/patches/fix-crash-on-user-panel.patch:
  - Dropped, GNOME says it's obsolete
* debian/rules:
  - Build with -z,defs again
  - Explicitly disable ibus support since ibus 1.4 isn't supported in
    this version
* debian/control.in:
  - Drop ubuntu-docs and gnome-user-guide from recommends to suggests
  - Don't recommend indicators; let's leave that to Unity

[ David Henningsson ]
* sound_nua_panel.patch: Rebase to gnome 3.6 

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
 
34
34
#include "gvc-speaker-test.h"
35
35
#include "gvc-mixer-stream.h"
36
 
#include "gvc-mixer-card.h"
37
36
 
38
37
#define GVC_SPEAKER_TEST_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GVC_TYPE_SPEAKER_TEST, GvcSpeakerTestPrivate))
39
38
 
41
40
{
42
41
        GtkWidget       *channel_controls[PA_CHANNEL_POSITION_MAX];
43
42
        ca_context      *canberra;
44
 
        GvcMixerCard    *card;
 
43
        GvcMixerStream  *stream;
45
44
        GvcMixerControl *control;
46
45
};
47
46
 
53
52
 
54
53
enum {
55
54
        PROP_0,
56
 
        PROP_CARD,
 
55
        PROP_STREAM,
57
56
        PROP_CONTROL
58
57
};
59
58
 
89
88
        GvcSpeakerTest *self = GVC_SPEAKER_TEST (object);
90
89
 
91
90
        switch (prop_id) {
92
 
        case PROP_CARD:
93
 
                self->priv->card = g_value_dup_object (value);
 
91
        case PROP_STREAM:
 
92
                self->priv->stream = g_value_dup_object (value);
94
93
                if (self->priv->control != NULL)
95
94
                        update_channel_map (self);
96
95
                break;
97
96
        case PROP_CONTROL:
98
97
                self->priv->control = g_value_dup_object (value);
99
 
                if (self->priv->card != NULL)
 
98
                if (self->priv->stream != NULL)
100
99
                        update_channel_map (self);
101
100
                break;
102
101
        default:
114
113
        GvcSpeakerTest *self = GVC_SPEAKER_TEST (object);
115
114
 
116
115
        switch (prop_id) {
117
 
        case PROP_CARD:
118
 
                g_value_set_object (value, self->priv->card);
 
116
        case PROP_STREAM:
 
117
                g_value_set_object (value, self->priv->stream);
119
118
                break;
120
119
        case PROP_CONTROL:
121
120
                g_value_set_object (value, self->priv->control);
136
135
        object_class->get_property = gvc_speaker_test_get_property;
137
136
 
138
137
        g_object_class_install_property (object_class,
139
 
                                         PROP_CARD,
140
 
                                         g_param_spec_object ("card",
141
 
                                                              "card",
142
 
                                                              "The card",
143
 
                                                              GVC_TYPE_MIXER_CARD,
 
138
                                         PROP_STREAM,
 
139
                                         g_param_spec_object ("stream",
 
140
                                                              "stream",
 
141
                                                              "The stream",
 
142
                                                              GVC_TYPE_MIXER_STREAM,
144
143
                                                              G_PARAM_READWRITE|G_PARAM_CONSTRUCT));
145
144
        g_object_class_install_property (object_class,
146
145
                                         PROP_CONTROL,
331
330
        gtk_box_pack_start (GTK_BOX (control), label, FALSE, FALSE, 0);
332
331
 
333
332
        test_button = gtk_button_new_with_label (_("Test"));
334
 
        
 
333
 
335
334
        g_signal_connect (G_OBJECT (test_button), "clicked",
336
335
                          G_CALLBACK (on_test_button_clicked), control);
337
336
        g_object_set_data (G_OBJECT (control), "button", test_button);
366
365
        }
367
366
}
368
367
 
369
 
static const GvcChannelMap *
370
 
get_channel_map_for_card (GvcMixerControl *control,
371
 
                          GvcMixerCard    *card,
372
 
                          char           **output_name)
373
 
{
374
 
        int card_index;
375
 
        GSList *sinks, *l;
376
 
        GvcMixerStream *stream;
377
 
        const GvcChannelMap *map;
378
 
 
379
 
        /* This gets the channel map for the only
380
 
         * output for the card */
381
 
 
382
 
        card_index = gvc_mixer_card_get_index (card);
383
 
        if (card_index == PA_INVALID_INDEX)
384
 
                return NULL;
385
 
        sinks = gvc_mixer_control_get_sinks (control);
386
 
        stream = NULL;
387
 
        for (l = sinks; l != NULL; l = l->next) {
388
 
                GvcMixerStream *s = l->data;
389
 
                if (gvc_mixer_stream_get_card_index (s) == card_index) {
390
 
                        stream = g_object_ref (s);
391
 
                        break;
392
 
                }
393
 
        }
394
 
        g_slist_free (sinks);
395
 
 
396
 
        if (stream == NULL)
397
 
                return NULL;
398
 
 
399
 
        g_debug ("Found stream '%s' for card '%s'",
400
 
                 gvc_mixer_stream_get_name (stream),
401
 
                 gvc_mixer_card_get_name (card));
402
 
 
403
 
        *output_name = g_strdup (gvc_mixer_stream_get_name (stream));
404
 
        map = gvc_mixer_stream_get_channel_map (stream);
405
 
 
406
 
        g_debug ("Got channel map '%s' for port '%s'",
407
 
                 gvc_channel_map_get_mapping (map), *output_name);
408
 
 
409
 
        return map;
410
 
}
411
 
 
412
368
static void
413
369
update_channel_map (GvcSpeakerTest *speaker_test)
414
370
{
415
371
        guint i;
416
372
        const GvcChannelMap *map;
417
 
        char *output_name;
418
373
 
419
374
        g_return_if_fail (speaker_test->priv->control != NULL);
420
 
        g_return_if_fail (speaker_test->priv->card != NULL);
 
375
        g_return_if_fail (speaker_test->priv->stream != NULL);
421
376
 
422
377
        g_debug ("XXX update_channel_map called XXX");
423
378
 
424
 
        map = get_channel_map_for_card (speaker_test->priv->control,
425
 
                                        speaker_test->priv->card,
426
 
                                        &output_name);
427
 
 
 
379
        map = gvc_mixer_stream_get_channel_map (speaker_test->priv->stream);
428
380
        g_return_if_fail (map != NULL);
429
381
 
430
 
        ca_context_change_device (speaker_test->priv->canberra, output_name);
431
 
        g_free (output_name);
 
382
        ca_context_change_device (speaker_test->priv->canberra,
 
383
                                  gvc_mixer_stream_get_name (speaker_test->priv->stream));
432
384
 
433
385
        for (i = 0; i < G_N_ELEMENTS (position_table); i += 3) {
434
386
                gtk_widget_set_visible (speaker_test->priv->channel_controls[position_table[i]],
495
447
 
496
448
        g_return_if_fail (speaker_test->priv != NULL);
497
449
 
498
 
        g_object_unref (speaker_test->priv->card);
499
 
        speaker_test->priv->card = NULL;
 
450
        g_object_unref (speaker_test->priv->stream);
 
451
        speaker_test->priv->stream = NULL;
500
452
 
501
453
        g_object_unref (speaker_test->priv->control);
502
454
        speaker_test->priv->control = NULL;
509
461
 
510
462
GtkWidget *
511
463
gvc_speaker_test_new (GvcMixerControl *control,
512
 
                      GvcMixerCard *card)
 
464
                      GvcMixerStream  *stream)
513
465
{
514
466
        GObject *speaker_test;
515
467
 
516
 
        g_return_val_if_fail (card != NULL, NULL);
 
468
        g_return_val_if_fail (stream != NULL, NULL);
517
469
        g_return_val_if_fail (control != NULL, NULL);
518
470
 
519
471
        speaker_test = g_object_new (GVC_TYPE_SPEAKER_TEST,
520
 
                                  "card", card,
 
472
                                  "stream", stream,
521
473
                                  "control", control,
522
474
                                  NULL);
523
475