don't show modems and other unwanted devices (bug #523888)
2008-04-01 Jens Granseuer <jensgr@gmx.net> * sound-properties-capplet.c: (device_added_callback): don't show modems and other unwanted devices (bug #523888) svn path=/trunk/; revision=8622
This commit is contained in:
parent
24d98528ea
commit
de1e37ceae
2 changed files with 84 additions and 74 deletions
|
@ -1,3 +1,8 @@
|
|||
2008-04-01 Jens Granseuer <jensgr@gmx.net>
|
||||
|
||||
* sound-properties-capplet.c: (device_added_callback): don't show
|
||||
modems and other unwanted devices (bug #523888)
|
||||
|
||||
2008-03-27 Jens Granseuer <jensgr@gmx.net>
|
||||
|
||||
* sound-properties.glade: don't mention esd (bug #519722)
|
||||
|
|
|
@ -400,20 +400,28 @@ remove_device (int type, const gchar *pipeline)
|
|||
static void
|
||||
device_added_callback (LibHalContext *ctx, const char *udi)
|
||||
{
|
||||
DBusError error;
|
||||
gchar *type_string;
|
||||
gchar *class_string;
|
||||
int type;
|
||||
const gchar *element;
|
||||
gchar *pipeline, *description;
|
||||
gboolean ignore;
|
||||
|
||||
dbus_error_init (&error);
|
||||
|
||||
if (!libhal_device_query_capability (ctx, udi, "alsa", &error)) {
|
||||
dbus_error_free (&error);
|
||||
if (!libhal_device_query_capability (ctx, udi, "alsa", NULL)) {
|
||||
return;
|
||||
}
|
||||
|
||||
type_string = libhal_device_get_property_string (ctx, udi, "alsa.type", &error);
|
||||
/* filter out "digitizer", "modem", "none", "unknown" */
|
||||
class_string = libhal_device_get_property_string (ctx, udi, "alsa.pcm_class", NULL);
|
||||
ignore = class_string != NULL
|
||||
&& strcmp (class_string, "generic") != 0
|
||||
&& strcmp (class_string, "multi") != 0;
|
||||
libhal_free_string (class_string);
|
||||
if (ignore) {
|
||||
return;
|
||||
}
|
||||
|
||||
type_string = libhal_device_get_property_string (ctx, udi, "alsa.type", NULL);
|
||||
if (strcmp (type_string, "playback") == 0) {
|
||||
type = AUDIO_PLAYBACK;
|
||||
element = "halaudiosink";
|
||||
|
@ -426,19 +434,16 @@ device_added_callback (LibHalContext *ctx, const char *udi)
|
|||
}
|
||||
libhal_free_string (type_string);
|
||||
if (type == -1) {
|
||||
dbus_error_free (&error);
|
||||
return;
|
||||
}
|
||||
|
||||
pipeline = g_strdup_printf ("%s udi=%s", element, udi);
|
||||
description = libhal_device_get_property_string (ctx, udi, "alsa.device_id", &error);
|
||||
description = libhal_device_get_property_string (ctx, udi, "alsa.device_id", NULL);
|
||||
|
||||
add_device (type, pipeline, description, NULL);
|
||||
|
||||
g_free (pipeline);
|
||||
libhal_free_string (description);
|
||||
|
||||
dbus_error_free (&error);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Add table
Reference in a new issue