Merge lp:~cjcurran/gnome-control-center/fix-profiles into lp:~ken-vandine/gnome-control-center/make-new-panel

Proposed by Conor Curran
Status: Merged
Merge reported by: Conor Curran
Merged at revision: not available
Proposed branch: lp:~cjcurran/gnome-control-center/fix-profiles
Merge into: lp:~ken-vandine/gnome-control-center/make-new-panel
Diff against target: 145 lines (+40/-23)
4 files modified
panels/sound-nua/gvc-mixer-control.c (+2/-2)
panels/sound-nua/gvc-mixer-dialog.c (+17/-3)
panels/sound-nua/gvc-mixer-ui-device.c (+13/-11)
panels/sound-nua/gvc-mixer-ui-device.h (+8/-7)
To merge this branch: bzr merge lp:~cjcurran/gnome-control-center/fix-profiles
Reviewer Review Type Date Requested Status
Conor Curran (community) Approve
Review via email: mp+91662@code.launchpad.net

Description of the change

ensure device swapping honours supported profiles

To post a comment you must log in.
Revision history for this message
Conor Curran (cjcurran) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'panels/sound-nua/gvc-mixer-control.c'
2--- panels/sound-nua/gvc-mixer-control.c 2012-02-03 17:15:47 +0000
3+++ panels/sound-nua/gvc-mixer-control.c 2012-02-06 14:48:21 +0000
4@@ -519,7 +519,7 @@
5 return;
6 }
7 const GList *profiles;
8- profiles = gvc_mixer_ui_device_get_profiles (output);
9+ profiles = gvc_mixer_ui_device_get_supported_profiles (output);
10 GList *last;
11 last = g_list_last (profiles);
12 GvcMixerCardProfile *profile;
13@@ -605,7 +605,7 @@
14 }
15
16 const GList *profiles;
17- profiles = gvc_mixer_ui_device_get_profiles (input);
18+ profiles = gvc_mixer_ui_device_get_supported_profiles (input);
19 GList *last;
20 last = g_list_last (profiles);
21 GvcMixerCardProfile *profile;
22
23=== modified file 'panels/sound-nua/gvc-mixer-dialog.c'
24--- panels/sound-nua/gvc-mixer-dialog.c 2012-02-03 17:15:47 +0000
25+++ panels/sound-nua/gvc-mixer-dialog.c 2012-02-06 14:48:21 +0000
26@@ -877,9 +877,23 @@
27 gvc_combo_box_set_profiles (GVC_COMBO_BOX (dialog->priv->output_port_combo),
28 profiles);
29
30- gvc_combo_box_set_active (GVC_COMBO_BOX (dialog->priv->output_port_combo),
31- gvc_mixer_control_get_active_profile_from_ui_device (dialog->priv->mixer_control,
32+ gboolean disabled;
33+ disabled = gvc_mixer_ui_device_determine_profile_sensitivity (active_output);
34+
35+ if (disabled){
36+ GList *profs;
37+ GvcMixerCardProfile *p;
38+ profs = gvc_mixer_ui_device_get_profiles (active_output);
39+ // We can be sure that its just one profile in the list when it's disabled
40+ p = g_list_last (profs)->data;
41+ gvc_combo_box_set_active (GVC_COMBO_BOX (dialog->priv->output_port_combo),
42+ p->profile);
43+ }
44+ else{
45+ gvc_combo_box_set_active (GVC_COMBO_BOX (dialog->priv->output_port_combo),
46+ gvc_mixer_control_get_active_profile_from_ui_device (dialog->priv->mixer_control,
47 active_output));
48+ }
49 g_object_set_data (G_OBJECT (dialog->priv->output_port_combo),
50 "uidevice",
51 active_output);
52@@ -896,7 +910,7 @@
53 }
54 gtk_widget_show (dialog->priv->output_port_combo);
55 gtk_widget_set_sensitive (dialog->priv->output_port_combo,
56- !gvc_mixer_ui_device_determine_profile_sensitivity (active_output));
57+ !disabled);
58 }
59
60 }
61
62=== modified file 'panels/sound-nua/gvc-mixer-ui-device.c'
63--- panels/sound-nua/gvc-mixer-ui-device.c 2012-02-03 17:15:47 +0000
64+++ panels/sound-nua/gvc-mixer-ui-device.c 2012-02-06 14:48:21 +0000
65@@ -34,7 +34,7 @@
66 gint stream_id;
67 guint id;
68 gboolean port_available;
69- //GList* profiles;
70+ GList* supported_profiles;
71 UiDeviceDirection type;
72 GHashTable* profiles;
73 gboolean disable_profile_swapping;
74@@ -309,12 +309,6 @@
75 g_type_class_add_private (klass, sizeof (GvcMixerUIDevicePrivate));
76 }
77
78-static void
79-tidy_profiles (GvcMixerUIDevice *device)
80-{
81-
82-}
83-
84 // TODO
85 // Optimise so as on the first pass you can 'choose' which profiles to hold on to which are essentially duplicates
86 void
87@@ -323,12 +317,14 @@
88 gint profile_count;
89 GList* t;
90 GHashTable *profile_descriptions;
91-
92+
93+ device->priv->supported_profiles = in_profiles;
94+
95 profile_count = g_list_length (in_profiles);
96 profile_descriptions = g_hash_table_new_full (g_str_hash,
97- g_str_equal,
98- g_free,
99- g_free);
100+ g_str_equal,
101+ g_free,
102+ g_free);
103
104 //debug
105 gboolean is_input = device->priv->type != UiDeviceOutput;
106@@ -518,6 +514,12 @@
107 return g_hash_table_get_values (device->priv->profiles);
108 }
109
110+GList*
111+gvc_mixer_ui_device_get_supported_profiles (GvcMixerUIDevice *device)
112+{
113+ return device->priv->supported_profiles;
114+}
115+
116 guint
117 gvc_mixer_ui_device_get_id (GvcMixerUIDevice *op)
118 {
119
120=== modified file 'panels/sound-nua/gvc-mixer-ui-device.h'
121--- panels/sound-nua/gvc-mixer-ui-device.h 2012-02-03 18:56:29 +0000
122+++ panels/sound-nua/gvc-mixer-ui-device.h 2012-02-06 14:48:21 +0000
123@@ -53,14 +53,15 @@
124
125 GType gvc_mixer_ui_device_get_type (void) G_GNUC_CONST;
126
127-guint gvc_mixer_ui_device_get_id (GvcMixerUIDevice *op);
128-gint gvc_mixer_ui_device_get_stream_id (GvcMixerUIDevice *op);
129-const gchar* gvc_mixer_ui_device_get_description (GvcMixerUIDevice *op);
130-const gchar* gvc_mixer_ui_device_get_origin (GvcMixerUIDevice *op);
131-const gchar* gvc_mixer_ui_device_get_port (GvcMixerUIDevice *op);
132-GList* gvc_mixer_ui_device_get_profiles (GvcMixerUIDevice *op);
133+guint gvc_mixer_ui_device_get_id (GvcMixerUIDevice *dev);
134+gint gvc_mixer_ui_device_get_stream_id (GvcMixerUIDevice *dev);
135+const gchar* gvc_mixer_ui_device_get_description (GvcMixerUIDevice *dev);
136+const gchar* gvc_mixer_ui_device_get_origin (GvcMixerUIDevice *dev);
137+const gchar* gvc_mixer_ui_device_get_port (GvcMixerUIDevice *dev);
138+GList* gvc_mixer_ui_device_get_profiles (GvcMixerUIDevice *dev);
139+GList* gvc_mixer_ui_device_get_supported_profiles (GvcMixerUIDevice *device);
140 gboolean gvc_mixer_ui_device_determine_profile_sensitivity (GvcMixerUIDevice *device);
141-void gvc_mixer_ui_device_set_profiles (GvcMixerUIDevice *op, GList *profiles);
142+void gvc_mixer_ui_device_set_profiles (GvcMixerUIDevice *device, GList *profiles);
143 void gvc_mixer_ui_device_invalidate_stream (GvcMixerUIDevice *dev);
144 gboolean gvc_mixer_ui_device_is_software_stream (GvcMixerUIDevice *dev);
145 gboolean gvc_mixer_ui_device_change_profile (GvcMixerUIDevice *device, const gchar* profile);

Subscribers

People subscribed via source and target branches

to all changes: