From 7cf09a2b40a507caf2bea0c54af00da84a8f88af Mon Sep 17 00:00:00 2001 From: Michal Ratajsky Date: Sat, 7 Jun 2014 02:04:55 +0200 Subject: Fix properties --- libmatemixer/matemixer-device.c | 8 ++-- libmatemixer/matemixer-device.h | 4 +- libmatemixer/matemixer-stream.c | 93 +++++++++++++++++++++++++++++++---------- libmatemixer/matemixer-stream.h | 8 ++-- 4 files changed, 81 insertions(+), 32 deletions(-) diff --git a/libmatemixer/matemixer-device.c b/libmatemixer/matemixer-device.c index d4a7c39..cd5a47c 100644 --- a/libmatemixer/matemixer-device.c +++ b/libmatemixer/matemixer-device.c @@ -57,7 +57,7 @@ mate_mixer_device_default_init (MateMixerDeviceInterface *iface) g_object_interface_install_property (iface, g_param_spec_object ("active-profile", "Active profile", - "Name of the active profile", + "The currently active profile of the sound device", MATE_MIXER_TYPE_PROFILE, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); @@ -169,17 +169,17 @@ mate_mixer_device_get_active_profile (MateMixerDevice *device) } gboolean -mate_mixer_device_set_active_profile (MateMixerDevice *device, const gchar *name) +mate_mixer_device_set_active_profile (MateMixerDevice *device, const gchar *profile_name) { MateMixerDeviceInterface *iface; g_return_val_if_fail (MATE_MIXER_IS_DEVICE (device), FALSE); - g_return_val_if_fail (name != NULL, FALSE); + g_return_val_if_fail (profile_name != NULL, FALSE); iface = MATE_MIXER_DEVICE_GET_INTERFACE (device); if (iface->set_active_profile) - return iface->set_active_profile (device, name); + return iface->set_active_profile (device, profile_name); return FALSE; } diff --git a/libmatemixer/matemixer-device.h b/libmatemixer/matemixer-device.h index 89c0187..3b25313 100644 --- a/libmatemixer/matemixer-device.h +++ b/libmatemixer/matemixer-device.h @@ -49,7 +49,7 @@ struct _MateMixerDeviceInterface const GList *(*list_profiles) (MateMixerDevice *device); MateMixerProfile *(*get_active_profile) (MateMixerDevice *device); gboolean (*set_active_profile) (MateMixerDevice *device, - const gchar *name); + const gchar *profile_name); }; GType mate_mixer_device_get_type (void) G_GNUC_CONST; @@ -62,7 +62,7 @@ const GList * mate_mixer_device_list_ports (MateMixerDevice *device) const GList * mate_mixer_device_list_profiles (MateMixerDevice *device); MateMixerProfile *mate_mixer_device_get_active_profile (MateMixerDevice *device); gboolean mate_mixer_device_set_active_profile (MateMixerDevice *device, - const gchar *name); + const gchar *profile_name); G_END_DECLS diff --git a/libmatemixer/matemixer-stream.c b/libmatemixer/matemixer-stream.c index 62e0d2e..8fd309d 100644 --- a/libmatemixer/matemixer-stream.c +++ b/libmatemixer/matemixer-stream.c @@ -76,21 +76,59 @@ mate_mixer_stream_default_init (MateMixerStreamInterface *iface) G_PARAM_STATIC_STRINGS)); g_object_interface_install_property (iface, - g_param_spec_double ("volume", - "Volume", - "Volume of the stream", - -1, 0, 1, - G_PARAM_CONSTRUCT_ONLY | - G_PARAM_READWRITE | + g_param_spec_boolean ("mute", + "Mute", + "Mute state of the stream", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS)); + + g_object_interface_install_property (iface, + g_param_spec_uint ("volume", + "Volume", + "Volume of the stream", + 0, + G_MAXUINT, + 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS)); + + g_object_interface_install_property (iface, + g_param_spec_double ("volume-db", + "Volume dB", + "Volume of the stream in decibels", + -G_MAXDOUBLE, + G_MAXDOUBLE, + 0.0, + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); g_object_interface_install_property (iface, - g_param_spec_string ("mute", - "Mute", - "Mute state of the stream", - FALSE, - G_PARAM_CONSTRUCT_ONLY | - G_PARAM_READWRITE | + g_param_spec_double ("balance", + "Balance", + "Balance value of the stream", + -1.0, + 1.0, + 0.0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS)); + + g_object_interface_install_property (iface, + g_param_spec_double ("fade", + "Fade", + "Fade value of the stream", + -1.0, + 1.0, + 0.0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS)); + + g_object_interface_install_property (iface, + g_param_spec_object ("active-port", + "Active port", + "The currently active port of the stream", + MATE_MIXER_TYPE_PORT, + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); } @@ -305,7 +343,9 @@ mate_mixer_stream_get_channel_volume (MateMixerStream *stream, guint8 channel) } gboolean -mate_mixer_stream_set_channel_volume (MateMixerStream *stream, guint8 channel, guint32 volume) +mate_mixer_stream_set_channel_volume (MateMixerStream *stream, + guint8 channel, + guint32 volume) { MateMixerStreamInterface *iface; @@ -335,7 +375,9 @@ mate_mixer_stream_get_channel_volume_db (MateMixerStream *stream, guint8 channel } gboolean -mate_mixer_stream_set_channel_volume_db (MateMixerStream *stream, guint8 channel, gdouble volume_db) +mate_mixer_stream_set_channel_volume_db (MateMixerStream *stream, + guint8 channel, + gdouble volume_db) { MateMixerStreamInterface *iface; @@ -350,7 +392,8 @@ mate_mixer_stream_set_channel_volume_db (MateMixerStream *stream, guint8 channel } gboolean -mate_mixer_stream_has_position (MateMixerStream *stream, MateMixerChannelPosition position) +mate_mixer_stream_has_position (MateMixerStream *stream, + MateMixerChannelPosition position) { MateMixerStreamInterface *iface; @@ -365,7 +408,8 @@ mate_mixer_stream_has_position (MateMixerStream *stream, MateMixerChannelPositio } guint32 -mate_mixer_stream_get_position_volume (MateMixerStream *stream, MateMixerChannelPosition position) +mate_mixer_stream_get_position_volume (MateMixerStream *stream, + MateMixerChannelPosition position) { MateMixerStreamInterface *iface; @@ -380,7 +424,9 @@ mate_mixer_stream_get_position_volume (MateMixerStream *stream, MateMixerChannel } gboolean -mate_mixer_stream_set_position_volume (MateMixerStream *stream, MateMixerChannelPosition position, guint32 volume) +mate_mixer_stream_set_position_volume (MateMixerStream *stream, + MateMixerChannelPosition position, + guint32 volume) { MateMixerStreamInterface *iface; @@ -395,7 +441,8 @@ mate_mixer_stream_set_position_volume (MateMixerStream *stream, MateMixerChannel } gdouble -mate_mixer_stream_get_position_volume_db (MateMixerStream *stream, MateMixerChannelPosition position) +mate_mixer_stream_get_position_volume_db (MateMixerStream *stream, + MateMixerChannelPosition position) { MateMixerStreamInterface *iface; @@ -410,7 +457,9 @@ mate_mixer_stream_get_position_volume_db (MateMixerStream *stream, MateMixerChan } gboolean -mate_mixer_stream_set_position_volume_db (MateMixerStream *stream, MateMixerChannelPosition position, gdouble volume_db) +mate_mixer_stream_set_position_volume_db (MateMixerStream *stream, + MateMixerChannelPosition position, + gdouble volume_db) { MateMixerStreamInterface *iface; @@ -515,17 +564,17 @@ mate_mixer_stream_get_active_port (MateMixerStream *stream) } gboolean -mate_mixer_stream_set_active_port (MateMixerStream *stream, MateMixerPort *port) +mate_mixer_stream_set_active_port (MateMixerStream *stream, const gchar *port_name) { MateMixerStreamInterface *iface; g_return_val_if_fail (MATE_MIXER_IS_STREAM (stream), FALSE); - g_return_val_if_fail (MATE_MIXER_IS_PORT (port), FALSE); + g_return_val_if_fail (port_name != NULL, FALSE); iface = MATE_MIXER_STREAM_GET_INTERFACE (stream); if (iface->set_active_port) - return iface->set_active_port (stream, port); + return iface->set_active_port (stream, port_name); return FALSE; } diff --git a/libmatemixer/matemixer-stream.h b/libmatemixer/matemixer-stream.h index f95f13f..a6e8dde 100644 --- a/libmatemixer/matemixer-stream.h +++ b/libmatemixer/matemixer-stream.h @@ -82,15 +82,15 @@ struct _MateMixerStreamInterface gboolean (*set_position_volume_db) (MateMixerStream *stream, MateMixerChannelPosition position, gdouble volume); - gboolean (*get_balance) (MateMixerStream *stream); + gdouble (*get_balance) (MateMixerStream *stream); gboolean (*set_balance) (MateMixerStream *stream, gdouble balance); - gboolean (*get_fade) (MateMixerStream *stream); + gdouble (*get_fade) (MateMixerStream *stream); gboolean (*set_fade) (MateMixerStream *stream, gdouble fade); MateMixerPort * (*get_active_port) (MateMixerStream *stream); gboolean (*set_active_port) (MateMixerStream *stream, - MateMixerPort *port); + const gchar *port_name); const GList * (*list_ports) (MateMixerStream *stream); }; @@ -158,7 +158,7 @@ const GList * mate_mixer_stream_list_ports (MateMixerStre MateMixerPort * mate_mixer_stream_get_active_port (MateMixerStream *stream); gboolean mate_mixer_stream_set_active_port (MateMixerStream *stream, - MateMixerPort *port); + const gchar *port); G_END_DECLS -- cgit v1.2.1