diff options
author | Michal Ratajsky <[email protected]> | 2014-11-08 23:04:31 +0100 |
---|---|---|
committer | Michal Ratajsky <[email protected]> | 2014-11-08 23:04:31 +0100 |
commit | 44651c5d2334da5dd295eca9c2e530b99348bdd6 (patch) | |
tree | ff27dab4ba61563bf04442d7d2c5f0547e2dbaea /libmatemixer/matemixer-device-switch.c | |
parent | 068d95e1c28b0e20e692c5ecb24f044542e82ae9 (diff) | |
download | libmatemixer-44651c5d2334da5dd295eca9c2e530b99348bdd6.tar.bz2 libmatemixer-44651c5d2334da5dd295eca9c2e530b99348bdd6.tar.xz |
Split MateMixerSwitchRole into MateMixerDeviceSwitchRole and MateMixerStreamSwitchRole
Diffstat (limited to 'libmatemixer/matemixer-device-switch.c')
-rw-r--r-- | libmatemixer/matemixer-device-switch.c | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/libmatemixer/matemixer-device-switch.c b/libmatemixer/matemixer-device-switch.c index cc0bbec..bc0ea70 100644 --- a/libmatemixer/matemixer-device-switch.c +++ b/libmatemixer/matemixer-device-switch.c @@ -19,6 +19,8 @@ #include <glib-object.h> #include "matemixer-device.h" +#include "matemixer-enums.h" +#include "matemixer-enum-types.h" #include "matemixer-switch.h" #include "matemixer-device-switch.h" @@ -29,11 +31,13 @@ struct _MateMixerDeviceSwitchPrivate { - MateMixerDevice *device; + MateMixerDevice *device; + MateMixerDeviceSwitchRole role; }; enum { PROP_0, + PROP_ROLE, PROP_DEVICE, N_PROPERTIES }; @@ -64,6 +68,16 @@ mate_mixer_device_switch_class_init (MateMixerDeviceSwitchClass *klass) object_class->get_property = mate_mixer_device_switch_get_property; object_class->set_property = mate_mixer_device_switch_set_property; + properties[PROP_ROLE] = + g_param_spec_enum ("role", + "Role", + "Role of the switch", + MATE_MIXER_TYPE_DEVICE_SWITCH_ROLE, + MATE_MIXER_DEVICE_SWITCH_ROLE_UNKNOWN, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS); + properties[PROP_DEVICE] = g_param_spec_object ("device", "Device", @@ -89,6 +103,9 @@ mate_mixer_device_switch_get_property (GObject *object, swtch = MATE_MIXER_DEVICE_SWITCH (object); switch (param_id) { + case PROP_ROLE: + g_value_set_enum (value, swtch->priv->role); + break; case PROP_DEVICE: g_value_set_object (value, swtch->priv->device); break; @@ -109,6 +126,9 @@ mate_mixer_device_switch_set_property (GObject *object, swtch = MATE_MIXER_DEVICE_SWITCH (object); switch (param_id) { + case PROP_ROLE: + swtch->priv->role = g_value_get_enum (value); + break; case PROP_DEVICE: /* Construct-only object */ swtch->priv->device = g_value_get_object (value); @@ -132,6 +152,22 @@ mate_mixer_device_switch_init (MateMixerDeviceSwitch *swtch) } /** + * mate_mixer_device_switch_get_role: + * @swtch: a #MateMixerDeviceSwitch + * + * Gets the role of the switch. The role identifies the purpose of the switch. + * + * Returns: the switch role. + */ +MateMixerDeviceSwitchRole +mate_mixer_device_switch_get_role (MateMixerDeviceSwitch *swtch) +{ + g_return_val_if_fail (MATE_MIXER_IS_DEVICE_SWITCH (swtch), MATE_MIXER_DEVICE_SWITCH_ROLE_UNKNOWN); + + return swtch->priv->role; +} + +/** * mate_mixer_device_switch_get_device: * @swtch: a #MateMixerDeviceSwitch */ |