Merge lp:~binli/unity-control-center/1291862 into lp:unity-control-center

Proposed by Bin Li
Status: Merged
Approved by: Iain Lane
Approved revision: 12757
Merged at revision: 12760
Proposed branch: lp:~binli/unity-control-center/1291862
Merge into: lp:unity-control-center
Diff against target: 83 lines (+28/-2)
2 files modified
debian/changelog (+6/-0)
panels/sound/gvc-mixer-dialog.c (+22/-2)
To merge this branch: bzr merge lp:~binli/unity-control-center/1291862
Reviewer Review Type Date Requested Status
Iain Lane Approve
Bin Li (community) Needs Resubmitting
Sebastien Bacher Needs Fixing
David Henningsson Pending
PS Jenkins bot Pending
Review via email: mp+211258@code.launchpad.net

Description of the change

Disable the input bar when there are no input devices.

To post a comment you must log in.
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thank you for the work, the change seems fine to me and it looks like it should apply to upstream GNOME (the code seems similar in https://git.gnome.org/browse/gnome-control-center/plain/panels/sound/gvc-mixer-dialog.c)

Could you forward the change to them (https://bugzilla.gnome.org/enter_bug.cgi?product=gnome-control-center)

It also looks like you could apply the same fix for the output as well (not sure how frequent it is to get a machine without audio ouput but it looks like it would lead to the same issue)

review: Needs Fixing
Revision history for this message
Iain Lane (laney) wrote :

With this patch, I noticed that if you have multiple inputs (> 1) then the slider is made insensitive when you remove one of them, meaning that you can't update the remaining input's volume.

There's a similar piece of code for adding inputs and outputs that only fires if it's the first one - it makes sense to do that check here too, and fixes that bug. You only need to consider making the slider insensitive if we are handling the removal of the last input.

I did this in lp:~laney/unity-control-center/make-insensitive-on-last-removal-only - please have a look and consider merging into this branch.

review: Needs Fixing
12753. By Bin Li

Merge Iain Lane patch to check if it's the last device

12754. By Bin Li

merge from upstream

Revision history for this message
Bin Li (binli) wrote :

> With this patch, I noticed that if you have multiple inputs (> 1) then the
> slider is made insensitive when you remove one of them, meaning that you can't
> update the remaining input's volume.
>
> There's a similar piece of code for adding inputs and outputs that only fires
> if it's the first one - it makes sense to do that check here too, and fixes
> that bug. You only need to consider making the slider insensitive if we are
> handling the removal of the last input.
>
> I did this in lp:~laney/unity-control-center/make-insensitive-on-last-removal-
> only - please have a look and consider merging into this branch.

Iain,

 Thanks, merged it and tested it. :)

review: Needs Resubmitting
Revision history for this message
Bin Li (binli) wrote :

> Thank you for the work, the change seems fine to me and it looks like it
> should apply to upstream GNOME (the code seems similar in
> https://git.gnome.org/browse/gnome-control-center/plain/panels/sound/gvc-
> mixer-dialog.c)
>
> Could you forward the change to them
> (https://bugzilla.gnome.org/enter_bug.cgi?product=gnome-control-center)
>
> It also looks like you could apply the same fix for the output as well (not
> sure how frequent it is to get a machine without audio ouput but it looks like
> it would lead to the same issue)
Sebastien,

 For output there should be same issue, I'll try to fix it. And the upstream have a lot of version for it, I'll compare the source code and push it into latest version.

 Thanks a lot!

12755. By Bin Li

Disable output bar when there are no output devices

12756. By Bin Li

update changelog

Revision history for this message
Bin Li (binli) wrote :

> Thank you for the work, the change seems fine to me and it looks like it
> should apply to upstream GNOME (the code seems similar in
> https://git.gnome.org/browse/gnome-control-center/plain/panels/sound/gvc-
> mixer-dialog.c)
>
> Could you forward the change to them
> (https://bugzilla.gnome.org/enter_bug.cgi?product=gnome-control-center)
>
> It also looks like you could apply the same fix for the output as well (not
> sure how frequent it is to get a machine without audio ouput but it looks like
> it would lead to the same issue)
Sebastien,

I've finished the code for output bar.

review: Needs Resubmitting
Revision history for this message
David Henningsson (diwic) wrote :

Looked at the code. It seems a bit weird perhaps to call active_input_update with a device that is being removed, but hey, if it solves the problem...

But at least we should probably change the g_warning ("The tree is empty => we have no devices... into a g_debug if this is in fact a supported and expected scenario.

(Same for output)

12757. By Bin Li

change g_warning to g_debug cause we have a supported and expected scenario.

Revision history for this message
Bin Li (binli) wrote :

> Looked at the code. It seems a bit weird perhaps to call active_input_update
> with a device that is being removed, but hey, if it solves the problem...
>
> But at least we should probably change the g_warning ("The tree is empty => we
> have no devices... into a g_debug if this is in fact a supported and expected
> scenario.
>
> (Same for output)
David,

 Thanks for your review. I've resubmitted again. :)

Revision history for this message
Iain Lane (laney) wrote :

Thanks, it looks good now and works for me.

Please forward the change to GNOME, as Seb suggested earlier.

review: Approve
Revision history for this message
Bin Li (binli) wrote :

> Thanks, it looks good now and works for me.
>
> Please forward the change to GNOME, as Seb suggested earlier.
Done for it.
https://bugzilla.gnome.org/show_bug.cgi?id=726686

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2014-03-17 13:46:59 +0000
+++ debian/changelog 2014-03-18 08:35:41 +0000
@@ -1,3 +1,9 @@
1unity-control-center (14.04.3+14.04.20140317-0ubuntu2) trusty; urgency=low
2
3 * Disable the input/output bar when no input/output devices (LP: #1291862)
4
5 -- Bin Li <bin.li@canonical.com> Mon, 18 Mar 2014 12:11:03 +0800
6
1unity-control-center (14.04.3+14.04.20140317-0ubuntu1) trusty; urgency=low7unity-control-center (14.04.3+14.04.20140317-0ubuntu1) trusty; urgency=low
28
3 [ Robert Ancell ]9 [ Robert Ancell ]
410
=== modified file 'panels/sound/gvc-mixer-dialog.c'
--- panels/sound/gvc-mixer-dialog.c 2014-03-14 14:46:32 +0000
+++ panels/sound/gvc-mixer-dialog.c 2014-03-18 08:35:41 +0000
@@ -727,7 +727,11 @@
727 model = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->priv->input_treeview));727 model = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->priv->input_treeview));
728728
729 if (gtk_tree_model_get_iter_first (model, &iter) == FALSE){729 if (gtk_tree_model_get_iter_first (model, &iter) == FALSE){
730 g_warning ("The tree is empty => we have no devices so cannot set the active input");730 /* When there are no device we need disable the input bar and set the original name */
731 gtk_label_set_label (GTK_LABEL(dialog->priv->selected_input_label),
732 _("Settings for the selected device"));
733 gtk_widget_set_sensitive (dialog->priv->input_bar, FALSE);
734 g_debug ("The tree is empty => we have no devices so cannot set the active input");
731 return; 735 return;
732 }736 }
733 737
@@ -850,7 +854,11 @@
850 model = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->priv->output_treeview));854 model = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->priv->output_treeview));
851855
852 if (gtk_tree_model_get_iter_first (model, &iter) == FALSE){856 if (gtk_tree_model_get_iter_first (model, &iter) == FALSE){
853 g_warning ("The tree is empty => we have no devices in the tree => cannot set the active output");857 /* When there are no device we need disable the output bar and set the original name */
858 gtk_label_set_label (GTK_LABEL(dialog->priv->selected_output_label),
859 _("Settings for the selected device"));
860 gtk_widget_set_sensitive (dialog->priv->output_bar, FALSE);
861 g_debug ("The tree is empty => we have no devices in the tree => cannot set the active output");
854 return; 862 return;
855 }863 }
856 864
@@ -1398,6 +1406,7 @@
1398 GvcMixerDialog *dialog)1406 GvcMixerDialog *dialog)
1399{1407{
1400 GtkWidget *bar;1408 GtkWidget *bar;
1409 gboolean is_last_device;
1401 gboolean found;1410 gboolean found;
1402 GtkTreeIter iter;1411 GtkTreeIter iter;
1403 GtkTreeModel *model;1412 GtkTreeModel *model;
@@ -1421,6 +1430,11 @@
1421 if (found) {1430 if (found) {
1422 gtk_list_store_remove (GTK_LIST_STORE (model), &iter);1431 gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
1423 }1432 }
1433
1434 /* Disable output bar when all output devices removed */
1435 is_last_device = !gtk_tree_model_get_iter_first (model, &iter);
1436 if (is_last_device)
1437 active_output_update (dialog, out);
1424} 1438}
14251439
14261440
@@ -1432,6 +1446,7 @@
1432{1446{
1433 GtkWidget *bar;1447 GtkWidget *bar;
1434 gboolean found;1448 gboolean found;
1449 gboolean is_last_device;
1435 GtkTreeIter iter;1450 GtkTreeIter iter;
1436 GtkTreeModel *model;1451 GtkTreeModel *model;
14371452
@@ -1454,6 +1469,11 @@
1454 if (found) {1469 if (found) {
1455 gtk_list_store_remove (GTK_LIST_STORE (model), &iter);1470 gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
1456 } 1471 }
1472
1473 /* Disable input bar when all input devices removed */
1474 is_last_device = !gtk_tree_model_get_iter_first (model, &iter);
1475 if (is_last_device)
1476 active_input_update (dialog, in);
1457}1477}
14581478
1459static void1479static void

Subscribers

People subscribed via source and target branches