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.
This commit is contained in:
parent
5ec241aae2
commit
6872c767bb
1 changed files with 13 additions and 1 deletions
|
@ -41,6 +41,7 @@ device_added_cb (CcDeviceComboBox *self,
|
||||||
GvcMixerUIDevice *device = NULL;
|
GvcMixerUIDevice *device = NULL;
|
||||||
g_autofree gchar *label = NULL;
|
g_autofree gchar *label = NULL;
|
||||||
g_autofree gchar *icon_name = NULL;
|
g_autofree gchar *icon_name = NULL;
|
||||||
|
const gchar *origin;
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
|
|
||||||
if (self->is_output)
|
if (self->is_output)
|
||||||
|
@ -50,7 +51,18 @@ device_added_cb (CcDeviceComboBox *self,
|
||||||
if (device == NULL)
|
if (device == NULL)
|
||||||
return;
|
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 && origin[0] != '\0')
|
||||||
|
{
|
||||||
|
label = g_strdup_printf ("%s - %s",
|
||||||
|
gvc_mixer_ui_device_get_description (device),
|
||||||
|
origin);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
label = g_strdup (gvc_mixer_ui_device_get_description (device));
|
||||||
|
}
|
||||||
|
|
||||||
if (gvc_mixer_ui_device_get_icon_name (device) != NULL)
|
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));
|
icon_name = g_strdup_printf ("%s-symbolic", gvc_mixer_ui_device_get_icon_name (device));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue