~cjcurran/+junk/soundnua-gtk-warnings

« back to all changes in this revision

Viewing changes to soundnua/gvc-mixer-control.c

  • Committer: Conor Curran
  • Date: 2012-03-22 16:12:54 UTC
  • Revision ID: conor.curran@canonical.com-20120322161254-4j8hudgw9wo4iaty
make sure to disable ui elements for a device that has no sink source

Show diffs side-by-side

added added

removed removed

Lines of Context:
86
86
        guint            cached_desired_input_id;
87
87
        GvcMixerStream   *new_default_stream; /* new default stream, used in gvc_mixer_control_set_default_sink () */
88
88
        guint            profile_swapping_device_id;
 
89
        guint            problem_detection_timer;
89
90
        GvcMixerControlState state;
90
91
};
91
92
 
102
103
        ACTIVE_INPUT_UPDATE,        
103
104
        INPUT_ADDED,
104
105
        OUTPUT_REMOVED,
 
106
        OUTPUT_DISABLED,
105
107
        INPUT_REMOVED,
106
108
        LAST_SIGNAL
107
109
};
654
656
                }
655
657
                return;
656
658
        }
657
 
 
 
659
        
658
660
        const GvcMixerStreamPort* active_port = gvc_mixer_stream_get_port (stream);
659
661
        const gchar* input_port = gvc_mixer_ui_device_get_port (input);
660
662
        // First ensure the correct port is active on the sink
1218
1220
                        
1219
1221
                        g_object_set (G_OBJECT (device),
1220
1222
                                      "stream-id", (gint)stream_id,
1221
 
                                      NULL);                                                                                 
 
1223
                                      NULL);    
 
1224
                        gvc_mixer_ui_device_enable (device);
 
1225
                                                                                                             
1222
1226
                        in_possession = TRUE;                                               
1223
1227
                }
1224
1228
                                                                              
1268
1272
                                             "card-id", &card_id,
1269
1273
                                              NULL);
1270
1274
                                if (card_id == gvc_mixer_stream_get_card_index (stream)){
 
1275
                                        gvc_mixer_ui_device_enable (device);
1271
1276
                                        in_possession = TRUE;
1272
1277
                                        break;
1273
1278
                                }
1280
1285
                        GvcMixerCard* card = NULL;
1281
1286
                        card = gvc_mixer_control_lookup_card_id (control,
1282
1287
                                                                 gvc_mixer_stream_get_card_index (stream));
1283
 
                        g_object_set (G_OBJECT (device),
1284
 
                                      "stream-id", (gint)gvc_mixer_stream_get_id (stream),
1285
 
                                      "description", gvc_mixer_stream_get_description (stream),
1286
 
                                      "origin", "", /*Leave it empty for these special cases*/
 
1288
                        g_object_set ( G_OBJECT (device),
 
1289
                                       "stream-id", (gint)gvc_mixer_stream_get_id (stream),
 
1290
                                       "description", gvc_mixer_stream_get_description (stream),
 
1291
                                       "origin", "", /*Leave it empty for these special cases*/
1287
1292
                                       "port-name", NULL,
1288
1293
                                       "port-available", TRUE,
1289
1294
                                       NULL);
1300
1305
                                               "port-available", TRUE,
1301
1306
                                               NULL);
1302
1307
                        device = GVC_MIXER_UI_DEVICE (object);
 
1308
                        gvc_mixer_ui_device_enable (device);
1303
1309
 
1304
1310
                        g_hash_table_insert (is_output ? control->priv->ui_outputs : control->priv->ui_inputs,
1305
1311
                                             GUINT_TO_POINTER (gvc_mixer_ui_device_get_id (device)),
2683
2689
                g_print ("\n invalidate stream on device - remove-sinks - %s \n", gvc_mixer_ui_device_get_description (device));        
2684
2690
 
2685
2691
                gvc_mixer_ui_device_invalidate_stream (device);
 
2692
                gvc_mixer_ui_device_disable (device);
 
2693
 
 
2694
                /*g_signal_emit (G_OBJECT (control),
 
2695
                               signals[OUTPUT_DISABLED],
 
2696
                               0,
 
2697
                               gvc_mixer_ui_device_get_id (device));*/  
 
2698
 
2686
2699
                // If its a software device - get rid of it
2687
2700
                if (gvc_mixer_ui_device_is_software (device) || gvc_mixer_ui_device_is_bluetooth (device)) {
2688
2701
                        g_signal_emit (G_OBJECT (control),
2706
2719
                                if (stream_id == gvc_mixer_stream_get_id (stream)){
2707
2720
                                        g_print ("\n invalidate stream on another relevant device - %s \n", gvc_mixer_ui_device_get_description (device)); 
2708
2721
                                        gvc_mixer_ui_device_invalidate_stream (device);
 
2722
                                        gvc_mixer_ui_device_disable (device);
 
2723
 
 
2724
                                        /*g_signal_emit (G_OBJECT (control),
 
2725
                                                       signals[OUTPUT_DISABLED],
 
2726
                                                       0,
 
2727
                                                       gvc_mixer_ui_device_get_id (device));*/  
2709
2728
                                }
2710
2729
                        }
2711
2730
                }
3311
3330
                              NULL, NULL,
3312
3331
                              g_cclosure_marshal_VOID__UINT,
3313
3332
                              G_TYPE_NONE, 1, G_TYPE_UINT);
 
3333
        signals [OUTPUT_DISABLED] =
 
3334
                g_signal_new ("output-disabled",
 
3335
                              G_TYPE_FROM_CLASS (klass),
 
3336
                              G_SIGNAL_RUN_LAST,
 
3337
                              G_STRUCT_OFFSET (GvcMixerControlClass, output_disabled),
 
3338
                              NULL, NULL,
 
3339
                              g_cclosure_marshal_VOID__UINT,
 
3340
                              G_TYPE_NONE, 1, G_TYPE_UINT);
3314
3341
        signals [INPUT_ADDED] =
3315
3342
                g_signal_new ("input-added",
3316
3343
                              G_TYPE_FROM_CLASS (klass),
3358
3385
        control->priv->cards = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify)g_object_unref);
3359
3386
        control->priv->ui_outputs = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify)g_object_unref);
3360
3387
        control->priv->ui_inputs = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify)g_object_unref);
3361
 
 
3362
3388
        control->priv->clients = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify)g_free);
3363
 
 
 
3389
        control->priv->problem_detection_timer = 0;
3364
3390
        control->priv->state = GVC_STATE_CLOSED;
3365
3391
}
3366
3392