[gnome-control-center/benzea/fix-empty-origin] sound: Clean up labels of devices without origin
- From: Benjamin Berg <bberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/benzea/fix-empty-origin] sound: Clean up labels of devices without origin
- Date: Wed, 22 May 2019 12:34:52 +0000 (UTC)
commit c322e5026a49ceb291a449cbb4fb64008b6c8d9a
Author: Benjamin Berg <bberg redhat com>
Date: Wed May 22 14:32:23 2019 +0200
sound: Clean up labels of devices without origin
Sound devices may not have an origin, in that case we ended up with a
trailing " - " in the label which should not be there. Add a check that
the origin is non-null and not an empty string and only show the devices
description otherwise.
panels/sound/cc-device-combo-box.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/panels/sound/cc-device-combo-box.c b/panels/sound/cc-device-combo-box.c
index a4dc3b951..c90d5f0ce 100644
--- a/panels/sound/cc-device-combo-box.c
+++ b/panels/sound/cc-device-combo-box.c
@@ -41,6 +41,7 @@ device_added_cb (CcDeviceComboBox *self,
GvcMixerUIDevice *device = NULL;
g_autofree gchar *label = NULL;
g_autofree gchar *icon_name = NULL;
+ gchar *origin;
GtkTreeIter iter;
if (self->is_output)
@@ -50,7 +51,12 @@ device_added_cb (CcDeviceComboBox *self,
if (device == NULL)
return;
- label = g_strdup_printf ("%s - %s", gvc_mixer_ui_device_get_description (device),
gvc_mixer_ui_device_get_origin (device));
+ origin = gvc_mixer_ui_device_get_origin (device);
+ if (origin && g_strcmp0 (origin, "") != 0)
+ label = g_strdup_printf ("%s - %s", gvc_mixer_ui_device_get_description (device),
gvc_mixer_ui_device_get_origin (device));
+ else
+ label = g_strdup (gvc_mixer_ui_device_get_description (device));
+
if (gvc_mixer_ui_device_get_icon_name (device) != NULL)
icon_name = g_strdup_printf ("%s-symbolic", gvc_mixer_ui_device_get_icon_name (device));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]