summaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorMichal Ratajsky <[email protected]>2014-05-24 21:01:21 +0200
committerMichal Ratajsky <[email protected]>2014-05-24 21:01:21 +0200
commit4db8dc0cbb3959d6278a9e7650d5103a475ab897 (patch)
tree4bc508298ce65013a5819cf0cdde7444c23abdb2 /backends
parentcaf4d9b8b8b0d26856d2d64f00ab23756867a923 (diff)
downloadlibmatemixer-4db8dc0cbb3959d6278a9e7650d5103a475ab897.tar.bz2
libmatemixer-4db8dc0cbb3959d6278a9e7650d5103a475ab897.tar.xz
General additions and improvements
Diffstat (limited to 'backends')
-rw-r--r--backends/null/null.c13
-rw-r--r--backends/null/null.h2
-rw-r--r--backends/pulse/pulse-device.c53
-rw-r--r--backends/pulse/pulse-device.h18
-rw-r--r--backends/pulse/pulse.c12
5 files changed, 55 insertions, 43 deletions
diff --git a/backends/null/null.c b/backends/null/null.c
index c049dcb..b96c9b0 100644
--- a/backends/null/null.c
+++ b/backends/null/null.c
@@ -28,7 +28,6 @@
/* Support function for dynamic loading of the backend module */
void backend_module_init (GTypeModule *module);
-void backend_module_free (void);
const MateMixerBackendModuleInfo *backend_module_get_info (void);
@@ -52,11 +51,6 @@ backend_module_init (GTypeModule *module)
info.backend_type = MATE_MIXER_BACKEND_TYPE_NULL;
}
-void
-backend_module_free (void)
-{
-}
-
const MateMixerBackendModuleInfo *
backend_module_get_info (void)
{
@@ -66,6 +60,7 @@ backend_module_get_info (void)
static void
mate_mixer_backend_interface_init (MateMixerBackendInterface *iface)
{
+ iface->open = mate_mixer_null_open;
}
static void
@@ -93,3 +88,9 @@ static void
mate_mixer_null_class_finalize (MateMixerNullClass *klass)
{
}
+
+gboolean
+mate_mixer_null_open (MateMixerBackend *backend)
+{
+ return TRUE;
+}
diff --git a/backends/null/null.h b/backends/null/null.h
index ef5b779..d73794e 100644
--- a/backends/null/null.h
+++ b/backends/null/null.h
@@ -51,4 +51,6 @@ struct _MateMixerNullClass
GType mate_mixer_null_get_type (void) G_GNUC_CONST;
+gboolean mate_mixer_null_open (MateMixerBackend *backend);
+
#endif /* MATEMIXER_NULL_H */
diff --git a/backends/pulse/pulse-device.c b/backends/pulse/pulse-device.c
index 75c5a32..4421e97 100644
--- a/backends/pulse/pulse-device.c
+++ b/backends/pulse/pulse-device.c
@@ -57,7 +57,11 @@ G_DEFINE_TYPE_WITH_CODE (MateMixerPulseDevice, mate_mixer_pulse_device, G_TYPE_O
static void
mate_mixer_device_interface_init (MateMixerDeviceInterface *iface)
{
-
+ iface->list_tracks = mate_mixer_pulse_device_list_tracks;
+ iface->get_ports = mate_mixer_pulse_device_get_ports;
+ iface->get_profiles = mate_mixer_pulse_device_get_profiles;
+ iface->get_active_profile = mate_mixer_pulse_device_get_active_profile;
+ iface->set_active_profile = mate_mixer_pulse_device_set_active_profile;
}
static void
@@ -119,7 +123,9 @@ mate_mixer_pulse_device_set_property (GObject *object,
device->priv->icon = g_strdup (g_value_get_string (value));
break;
case PROP_ACTIVE_PROFILE:
- // TODO
+ mate_mixer_pulse_device_set_active_profile (
+ MATE_MIXER_DEVICE (device),
+ g_value_get_object (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
@@ -261,33 +267,50 @@ mate_mixer_pulse_device_new (const pa_card_info *info)
return device;
}
+gboolean
+mate_mixer_pulse_device_update (MateMixerPulseDevice *device, const pa_card_info *info)
+{
+ g_return_val_if_fail (MATE_MIXER_IS_PULSE_DEVICE (device), FALSE);
+ g_return_val_if_fail (info != NULL, FALSE);
+
+ // TODO: update status, active_profile, maybe others?
+ return TRUE;
+}
+
+const GList *
+mate_mixer_pulse_device_list_tracks (MateMixerDevice *device)
+{
+ // TODO
+ return NULL;
+}
+
const GList *
-mate_mixer_pulse_device_get_ports (MateMixerPulseDevice *device)
+mate_mixer_pulse_device_get_ports (MateMixerDevice *device)
{
g_return_val_if_fail (MATE_MIXER_IS_PULSE_DEVICE (device), NULL);
- return device->priv->ports;
+ return MATE_MIXER_PULSE_DEVICE (device)->priv->ports;
}
const GList *
-mate_mixer_pulse_device_get_profiles (MateMixerPulseDevice *device)
+mate_mixer_pulse_device_get_profiles (MateMixerDevice *device)
{
g_return_val_if_fail (MATE_MIXER_IS_PULSE_DEVICE (device), NULL);
- return device->priv->profiles;
+ return MATE_MIXER_PULSE_DEVICE (device)->priv->profiles;
}
MateMixerDeviceProfile *
-mate_mixer_pulse_device_get_active_profile (MateMixerPulseDevice *device)
+mate_mixer_pulse_device_get_active_profile (MateMixerDevice *device)
{
g_return_val_if_fail (MATE_MIXER_IS_PULSE_DEVICE (device), NULL);
- return device->priv->active_profile;
+ return MATE_MIXER_PULSE_DEVICE (device)->priv->active_profile;
}
gboolean
-mate_mixer_pulse_device_set_active_profile (MateMixerPulseDevice *device,
- MateMixerDeviceProfile *profile)
+mate_mixer_pulse_device_set_active_profile (MateMixerDevice *device,
+ MateMixerDeviceProfile *profile)
{
g_return_val_if_fail (MATE_MIXER_IS_PULSE_DEVICE (device), FALSE);
g_return_val_if_fail (MATE_MIXER_IS_DEVICE_PROFILE (profile), FALSE);
@@ -296,13 +319,3 @@ mate_mixer_pulse_device_set_active_profile (MateMixerPulseDevice *device,
// pa_context_set_card_profile_by_index ()
return TRUE;
}
-
-gboolean
-mate_mixer_pulse_device_update (MateMixerPulseDevice *device, const pa_card_info *info)
-{
- g_return_val_if_fail (MATE_MIXER_IS_PULSE_DEVICE (device), FALSE);
- g_return_val_if_fail (info != NULL, FALSE);
-
- // TODO: update status, active_profile, maybe others?
- return TRUE;
-}
diff --git a/backends/pulse/pulse-device.h b/backends/pulse/pulse-device.h
index f8b5a07..ab997fe 100644
--- a/backends/pulse/pulse-device.h
+++ b/backends/pulse/pulse-device.h
@@ -60,18 +60,20 @@ struct _MateMixerPulseDeviceClass
GType mate_mixer_pulse_device_get_type (void) G_GNUC_CONST;
MateMixerPulseDevice *mate_mixer_pulse_device_new (const pa_card_info *info);
-GList *mate_mixer_pulse_device_list_tracks (MateMixerPulseDevice *device);
-const GList *mate_mixer_pulse_device_get_ports (MateMixerPulseDevice *device);
-const GList *mate_mixer_pulse_device_get_profiles (MateMixerPulseDevice *device);
+gboolean mate_mixer_pulse_device_update (MateMixerPulseDevice *device,
+ const pa_card_info *info);
-MateMixerDeviceProfile *mate_mixer_pulse_device_get_active_profile (MateMixerPulseDevice *device);
+/* Interface implementation */
+const GList *mate_mixer_pulse_device_list_tracks (MateMixerDevice *device);
-gboolean mate_mixer_pulse_device_set_active_profile (MateMixerPulseDevice *device,
- MateMixerDeviceProfile *profile);
+const GList *mate_mixer_pulse_device_get_ports (MateMixerDevice *device);
+const GList *mate_mixer_pulse_device_get_profiles (MateMixerDevice *device);
-gboolean mate_mixer_pulse_device_update (MateMixerPulseDevice *device,
- const pa_card_info *info);
+MateMixerDeviceProfile *mate_mixer_pulse_device_get_active_profile (MateMixerDevice *device);
+
+gboolean mate_mixer_pulse_device_set_active_profile (MateMixerDevice *device,
+ MateMixerDeviceProfile *profile);
G_END_DECLS
diff --git a/backends/pulse/pulse.c b/backends/pulse/pulse.c
index e969dcf..d306577 100644
--- a/backends/pulse/pulse.c
+++ b/backends/pulse/pulse.c
@@ -41,7 +41,6 @@ struct _MateMixerPulsePrivate
/* Support function for dynamic loading of the backend module */
void backend_module_init (GTypeModule *module);
-void backend_module_free (void);
const MateMixerBackendModuleInfo *backend_module_get_info (void);
@@ -81,11 +80,6 @@ backend_module_init (GTypeModule *module)
info.backend_type = MATE_MIXER_BACKEND_TYPE_PULSE;
}
-void
-backend_module_free (void)
-{
-}
-
const MateMixerBackendModuleInfo *
backend_module_get_info (void)
{
@@ -95,9 +89,9 @@ backend_module_get_info (void)
static void
mate_mixer_backend_interface_init (MateMixerBackendInterface *iface)
{
- iface->open = mate_mixer_pulse_open;
- iface->close = mate_mixer_pulse_close;
- iface->list_devices = mate_mixer_pulse_list_devices;
+ iface->open = mate_mixer_pulse_open;
+ iface->close = mate_mixer_pulse_close;
+ iface->list_devices = mate_mixer_pulse_list_devices;
}
static void