From 38a6d46a1058cd98466589427d5da704db7bfe09 Mon Sep 17 00:00:00 2001 From: Michal Ratajsky Date: Mon, 10 Nov 2014 11:40:06 +0100 Subject: Change MateMixerSwitchFlags into MateMixerStreamSwitchFlags --- backends/alsa/alsa-toggle.c | 2 +- docs/reference/libmatemixer-sections.txt | 4 ++-- libmatemixer/matemixer-enum-types.c | 24 ++++++++++---------- libmatemixer/matemixer-enum-types.h | 6 ++--- libmatemixer/matemixer-enums.h | 24 ++++++++++---------- libmatemixer/matemixer-stream-switch.c | 39 ++++++++++++++++++++++++++++++-- libmatemixer/matemixer-stream-switch.h | 7 +++--- libmatemixer/matemixer-switch.c | 35 ---------------------------- libmatemixer/matemixer-switch.h | 1 - 9 files changed, 71 insertions(+), 71 deletions(-) diff --git a/backends/alsa/alsa-toggle.c b/backends/alsa/alsa-toggle.c index c41e29a..1fee1c1 100644 --- a/backends/alsa/alsa-toggle.c +++ b/backends/alsa/alsa-toggle.c @@ -92,7 +92,7 @@ alsa_toggle_new (AlsaStream *stream, toggle = g_object_new (ALSA_TYPE_TOGGLE, "name", name, "label", label, - "flags", MATE_MIXER_SWITCH_TOGGLE, + "flags", MATE_MIXER_STREAM_SWITCH_TOGGLE, "role", role, "stream", stream, "on-state-option", on, diff --git a/docs/reference/libmatemixer-sections.txt b/docs/reference/libmatemixer-sections.txt index ddc5f19..983cd51 100644 --- a/docs/reference/libmatemixer-sections.txt +++ b/docs/reference/libmatemixer-sections.txt @@ -209,9 +209,11 @@ mate_mixer_stream_control_get_type
matemixer-stream-switch MateMixerStreamSwitch +MateMixerStreamSwitchFlags MateMixerStreamSwitchRole MateMixerStreamSwitch MateMixerStreamSwitchClass +mate_mixer_stream_switch_get_flags mate_mixer_stream_switch_get_role mate_mixer_stream_switch_get_stream @@ -249,12 +251,10 @@ mate_mixer_stream_toggle_get_type
matemixer-switch MateMixerSwitch -MateMixerSwitchFlags MateMixerSwitch MateMixerSwitchClass mate_mixer_switch_get_name mate_mixer_switch_get_label -mate_mixer_switch_get_flags mate_mixer_switch_get_option mate_mixer_switch_list_options mate_mixer_switch_get_active_option diff --git a/libmatemixer/matemixer-enum-types.c b/libmatemixer/matemixer-enum-types.c index 3d4d039..645fae5 100644 --- a/libmatemixer/matemixer-enum-types.c +++ b/libmatemixer/matemixer-enum-types.c @@ -190,36 +190,36 @@ mate_mixer_stream_control_media_role_get_type (void) } GType -mate_mixer_switch_flags_get_type (void) +mate_mixer_device_switch_role_get_type (void) { static GType etype = 0; if (etype == 0) { - static const GFlagsValue values[] = { - { MATE_MIXER_SWITCH_NO_FLAGS, "MATE_MIXER_SWITCH_NO_FLAGS", "no-flags" }, - { MATE_MIXER_SWITCH_TOGGLE, "MATE_MIXER_SWITCH_TOGGLE", "toggle" }, + static const GEnumValue values[] = { + { MATE_MIXER_DEVICE_SWITCH_ROLE_UNKNOWN, "MATE_MIXER_DEVICE_SWITCH_ROLE_UNKNOWN", "unknown" }, + { MATE_MIXER_DEVICE_SWITCH_ROLE_PROFILE, "MATE_MIXER_DEVICE_SWITCH_ROLE_PROFILE", "profile" }, { 0, NULL, NULL } }; - etype = g_flags_register_static ( - g_intern_static_string ("MateMixerSwitchFlags"), + etype = g_enum_register_static ( + g_intern_static_string ("MateMixerDeviceSwitchRole"), values); } return etype; } GType -mate_mixer_device_switch_role_get_type (void) +mate_mixer_stream_switch_flags_get_type (void) { static GType etype = 0; if (etype == 0) { - static const GEnumValue values[] = { - { MATE_MIXER_DEVICE_SWITCH_ROLE_UNKNOWN, "MATE_MIXER_DEVICE_SWITCH_ROLE_UNKNOWN", "unknown" }, - { MATE_MIXER_DEVICE_SWITCH_ROLE_PROFILE, "MATE_MIXER_DEVICE_SWITCH_ROLE_PROFILE", "profile" }, + static const GFlagsValue values[] = { + { MATE_MIXER_STREAM_SWITCH_NO_FLAGS, "MATE_MIXER_STREAM_SWITCH_NO_FLAGS", "no-flags" }, + { MATE_MIXER_STREAM_SWITCH_TOGGLE, "MATE_MIXER_STREAM_SWITCH_TOGGLE", "toggle" }, { 0, NULL, NULL } }; - etype = g_enum_register_static ( - g_intern_static_string ("MateMixerDeviceSwitchRole"), + etype = g_flags_register_static ( + g_intern_static_string ("MateMixerStreamSwitchFlags"), values); } return etype; diff --git a/libmatemixer/matemixer-enum-types.h b/libmatemixer/matemixer-enum-types.h index 42b996b..f86474c 100644 --- a/libmatemixer/matemixer-enum-types.h +++ b/libmatemixer/matemixer-enum-types.h @@ -49,12 +49,12 @@ GType mate_mixer_stream_control_role_get_type (void) G_GNUC_CONST; #define MATE_MIXER_TYPE_STREAM_CONTROL_MEDIA_ROLE (mate_mixer_stream_control_media_role_get_type ()) GType mate_mixer_stream_control_media_role_get_type (void) G_GNUC_CONST; -#define MATE_MIXER_TYPE_SWITCH_FLAGS (mate_mixer_switch_flags_get_type ()) -GType mate_mixer_switch_flags_get_type (void) G_GNUC_CONST; - #define MATE_MIXER_TYPE_DEVICE_SWITCH_ROLE (mate_mixer_device_switch_role_get_type ()) GType mate_mixer_device_switch_role_get_type (void) G_GNUC_CONST; +#define MATE_MIXER_TYPE_STREAM_SWITCH_FLAGS (mate_mixer_stream_switch_flags_get_type ()) +GType mate_mixer_stream_switch_flags_get_type (void) G_GNUC_CONST; + #define MATE_MIXER_TYPE_STREAM_SWITCH_ROLE (mate_mixer_stream_switch_role_get_type ()) GType mate_mixer_stream_switch_role_get_type (void) G_GNUC_CONST; diff --git a/libmatemixer/matemixer-enums.h b/libmatemixer/matemixer-enums.h index 6cbd78d..e1c475d 100644 --- a/libmatemixer/matemixer-enums.h +++ b/libmatemixer/matemixer-enums.h @@ -258,18 +258,6 @@ typedef enum { MATE_MIXER_STREAM_CONTROL_MEDIA_ROLE_FILTER } MateMixerStreamControlMediaRole; -/** - * MateMixerSwitchFlags: - * @MATE_MIXER_SWITCH_NO_FLAGS: - * No flags. - * @MATE_MIXER_SWITCH_TOGGLE: - * The switch is a #MateMixerToggle. - */ -typedef enum { /*< flags >*/ - MATE_MIXER_SWITCH_NO_FLAGS = 0, - MATE_MIXER_SWITCH_TOGGLE = 1 << 0, -} MateMixerSwitchFlags; - /** * MateMixerDeviceSwitchRole: * @MATE_MIXER_DEVICE_SWITCH_ROLE_UNKNOWN: @@ -297,6 +285,18 @@ typedef enum { MATE_MIXER_STREAM_SWITCH_ROLE_BOOST } MateMixerStreamSwitchRole; +/** + * MateMixerStreamSwitchFlags: + * @MATE_MIXER_STREAM_SWITCH_NO_FLAGS: + * No flags. + * @MATE_MIXER_STREAM_SWITCH_TOGGLE: + * The switch is a #MateMixerStreamToggle. + */ +typedef enum { /*< flags >*/ + MATE_MIXER_STREAM_SWITCH_NO_FLAGS = 0, + MATE_MIXER_STREAM_SWITCH_TOGGLE = 1 << 0, +} MateMixerStreamSwitchFlags; + /** * MateMixerChannelPosition: * @MATE_MIXER_CHANNEL_UNKNOWN: diff --git a/libmatemixer/matemixer-stream-switch.c b/libmatemixer/matemixer-stream-switch.c index 20af819..2a6d3b2 100644 --- a/libmatemixer/matemixer-stream-switch.c +++ b/libmatemixer/matemixer-stream-switch.c @@ -31,12 +31,14 @@ struct _MateMixerStreamSwitchPrivate { - MateMixerStream *stream; - MateMixerStreamSwitchRole role; + MateMixerStream *stream; + MateMixerStreamSwitchFlags flags; + MateMixerStreamSwitchRole role; }; enum { PROP_0, + PROP_FLAGS, PROP_ROLE, PROP_STREAM, N_PROPERTIES @@ -68,6 +70,16 @@ mate_mixer_stream_switch_class_init (MateMixerStreamSwitchClass *klass) object_class->get_property = mate_mixer_stream_switch_get_property; object_class->set_property = mate_mixer_stream_switch_set_property; + properties[PROP_FLAGS] = + g_param_spec_flags ("flags", + "Flags", + "Flags of the switch", + MATE_MIXER_TYPE_STREAM_SWITCH_FLAGS, + MATE_MIXER_STREAM_SWITCH_NO_FLAGS, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS); + properties[PROP_ROLE] = g_param_spec_enum ("role", "Role", @@ -103,6 +115,9 @@ mate_mixer_stream_switch_get_property (GObject *object, swtch = MATE_MIXER_STREAM_SWITCH (object); switch (param_id) { + case PROP_FLAGS: + g_value_set_flags (value, swtch->priv->flags); + break; case PROP_ROLE: g_value_set_enum (value, swtch->priv->role); break; @@ -126,6 +141,9 @@ mate_mixer_stream_switch_set_property (GObject *object, swtch = MATE_MIXER_STREAM_SWITCH (object); switch (param_id) { + case PROP_FLAGS: + swtch->priv->flags = g_value_get_flags (value); + break; case PROP_ROLE: swtch->priv->role = g_value_get_enum (value); break; @@ -151,6 +169,23 @@ mate_mixer_stream_switch_init (MateMixerStreamSwitch *swtch) MateMixerStreamSwitchPrivate); } +/** + * mate_mixer_stream_switch_get_flags: + * @swtch: a #MateMixerStreamSwitch + * + * Gets the flags of the switch. See #MateMixerStreamSwitchFlags for information + * about the meaning of the individual flags. + * + * Returns: the flags of the switch. + */ +MateMixerStreamSwitchFlags +mate_mixer_stream_switch_get_flags (MateMixerStreamSwitch *swtch) +{ + g_return_val_if_fail (MATE_MIXER_IS_STREAM_SWITCH (swtch), MATE_MIXER_STREAM_SWITCH_NO_FLAGS); + + return swtch->priv->flags; +} + /** * mate_mixer_stream_switch_get_role: * @swtch: a #MateMixerStreamSwitch diff --git a/libmatemixer/matemixer-stream-switch.h b/libmatemixer/matemixer-stream-switch.h index b6978fa..00e85d0 100644 --- a/libmatemixer/matemixer-stream-switch.h +++ b/libmatemixer/matemixer-stream-switch.h @@ -67,10 +67,11 @@ struct _MateMixerStreamSwitchClass MateMixerSwitchClass parent_class; }; -GType mate_mixer_stream_switch_get_type (void) G_GNUC_CONST; +GType mate_mixer_stream_switch_get_type (void) G_GNUC_CONST; -MateMixerStreamSwitchRole mate_mixer_stream_switch_get_role (MateMixerStreamSwitch *swtch); -MateMixerStream * mate_mixer_stream_switch_get_stream (MateMixerStreamSwitch *swtch); +MateMixerStreamSwitchFlags mate_mixer_stream_switch_get_flags (MateMixerStreamSwitch *swtch); +MateMixerStreamSwitchRole mate_mixer_stream_switch_get_role (MateMixerStreamSwitch *swtch); +MateMixerStream * mate_mixer_stream_switch_get_stream (MateMixerStreamSwitch *swtch); G_END_DECLS diff --git a/libmatemixer/matemixer-switch.c b/libmatemixer/matemixer-switch.c index d0f2691..b61f13a 100644 --- a/libmatemixer/matemixer-switch.c +++ b/libmatemixer/matemixer-switch.c @@ -34,7 +34,6 @@ struct _MateMixerSwitchPrivate { gchar *name; gchar *label; - MateMixerSwitchFlags flags; MateMixerSwitchOption *active; }; @@ -42,7 +41,6 @@ enum { PROP_0, PROP_NAME, PROP_LABEL, - PROP_FLAGS, PROP_ACTIVE_OPTION, N_PROPERTIES }; @@ -100,16 +98,6 @@ mate_mixer_switch_class_init (MateMixerSwitchClass *klass) G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); - properties[PROP_FLAGS] = - g_param_spec_flags ("flags", - "Flags", - "Flags of the switch", - MATE_MIXER_TYPE_SWITCH_FLAGS, - MATE_MIXER_SWITCH_NO_FLAGS, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS); - properties[PROP_ACTIVE_OPTION] = g_param_spec_object ("active-option", "Active option", @@ -141,9 +129,6 @@ mate_mixer_switch_get_property (GObject *object, case PROP_LABEL: g_value_set_string (value, swtch->priv->label); break; - case PROP_FLAGS: - g_value_set_flags (value, swtch->priv->flags); - break; case PROP_ACTIVE_OPTION: g_value_set_object (value, swtch->priv->active); break; @@ -173,9 +158,6 @@ mate_mixer_switch_set_property (GObject *object, /* Construct-only string */ swtch->priv->label = g_value_dup_string (value); break; - case PROP_FLAGS: - swtch->priv->flags = g_value_get_flags (value); - break; case PROP_ACTIVE_OPTION: /* Construct-only object */ swtch->priv->active = g_value_dup_object (value); @@ -258,23 +240,6 @@ mate_mixer_switch_get_label (MateMixerSwitch *swtch) return swtch->priv->label; } -/** - * mate_mixer_switch_get_flags: - * @swtch: a #MateMixerSwitch - * - * Gets the flags of the switch. See #MateMixerSwitchFlags for information about - * the meaning of the individual flags. - * - * Returns: the flags of the switch. - */ -MateMixerSwitchFlags -mate_mixer_switch_get_flags (MateMixerSwitch *swtch) -{ - g_return_val_if_fail (MATE_MIXER_IS_SWITCH (swtch), MATE_MIXER_SWITCH_NO_FLAGS); - - return swtch->priv->flags; -} - /** * mate_mixer_switch_get_option: * @swtch: a #MateMixerSwitch diff --git a/libmatemixer/matemixer-switch.h b/libmatemixer/matemixer-switch.h index a6b6d49..49bdeb1 100644 --- a/libmatemixer/matemixer-switch.h +++ b/libmatemixer/matemixer-switch.h @@ -80,7 +80,6 @@ GType mate_mixer_switch_get_type (void) G_GNUC_CONST; const gchar * mate_mixer_switch_get_name (MateMixerSwitch *swtch); const gchar * mate_mixer_switch_get_label (MateMixerSwitch *swtch); -MateMixerSwitchFlags mate_mixer_switch_get_flags (MateMixerSwitch *swtch); MateMixerSwitchOption *mate_mixer_switch_get_option (MateMixerSwitch *swtch, const gchar *name); -- cgit v1.2.1