diff options
author | Michal Ratajsky <[email protected]> | 2014-11-10 11:28:44 +0100 |
---|---|---|
committer | Michal Ratajsky <[email protected]> | 2014-11-10 11:28:44 +0100 |
commit | 6c1be9a4ad08f84235d4a1fcd4597bff910f59c4 (patch) | |
tree | 779944fba11c918cbbf960cc23f0479b3baf890c /libmatemixer | |
parent | 44f3cd7ba3b672e67a91358fb0f6e3370c62301a (diff) | |
download | libmatemixer-6c1be9a4ad08f84235d4a1fcd4597bff910f59c4.tar.bz2 libmatemixer-6c1be9a4ad08f84235d4a1fcd4597bff910f59c4.tar.xz |
Change MateMixerToggle into MateMixerStreamToggle and adapt ALSA
Diffstat (limited to 'libmatemixer')
-rw-r--r-- | libmatemixer/Makefile.am | 6 | ||||
-rw-r--r-- | libmatemixer/matemixer-stream-toggle.c (renamed from libmatemixer/matemixer-toggle.c) | 138 | ||||
-rw-r--r-- | libmatemixer/matemixer-stream-toggle.h | 81 | ||||
-rw-r--r-- | libmatemixer/matemixer-toggle.h | 80 | ||||
-rw-r--r-- | libmatemixer/matemixer-types.h | 2 | ||||
-rw-r--r-- | libmatemixer/matemixer.h | 2 |
6 files changed, 155 insertions, 154 deletions
diff --git a/libmatemixer/Makefile.am b/libmatemixer/Makefile.am index f89f784..59f0e63 100644 --- a/libmatemixer/Makefile.am +++ b/libmatemixer/Makefile.am @@ -20,9 +20,9 @@ libmatemixer_include_HEADERS = \ matemixer-stream.h \ matemixer-stream-control.h \ matemixer-stream-switch.h \ + matemixer-stream-toggle.h \ matemixer-switch.h \ matemixer-switch-option.h \ - matemixer-toggle.h \ matemixer-types.h \ matemixer-version.h @@ -47,11 +47,11 @@ libmatemixer_la_SOURCES = \ matemixer-stream-control.c \ matemixer-stream-control-private.h \ matemixer-stream-switch.c \ + matemixer-stream-toggle.c \ matemixer-switch.c \ matemixer-switch-private.h \ matemixer-switch-option.c \ - matemixer-switch-option-private.h \ - matemixer-toggle.c + matemixer-switch-option-private.h libmatemixer_la_LIBADD = $(GLIB_LIBS) diff --git a/libmatemixer/matemixer-toggle.c b/libmatemixer/matemixer-stream-toggle.c index 78f7f5b..70c829e 100644 --- a/libmatemixer/matemixer-toggle.c +++ b/libmatemixer/matemixer-stream-toggle.c @@ -20,15 +20,15 @@ #include "matemixer-switch.h" #include "matemixer-switch-option.h" -#include "matemixer-toggle.h" +#include "matemixer-stream-toggle.h" /** - * SECTION:matemixer-toggle + * SECTION:matemixer-stream-toggle * @short_description: On/Off switch * @include: libmatemixer/matemixer.h */ -struct _MateMixerTogglePrivate +struct _MateMixerStreamTogglePrivate { GList *options; MateMixerSwitchOption *on; @@ -45,44 +45,44 @@ enum { static GParamSpec *properties[N_PROPERTIES] = { NULL, }; -static void mate_mixer_toggle_class_init (MateMixerToggleClass *klass); +static void mate_mixer_stream_toggle_class_init (MateMixerStreamToggleClass *klass); -static void mate_mixer_toggle_get_property (GObject *object, - guint param_id, - GValue *value, - GParamSpec *pspec); -static void mate_mixer_toggle_set_property (GObject *object, - guint param_id, - const GValue *value, - GParamSpec *pspec); +static void mate_mixer_stream_toggle_get_property (GObject *object, + guint param_id, + GValue *value, + GParamSpec *pspec); +static void mate_mixer_stream_toggle_set_property (GObject *object, + guint param_id, + const GValue *value, + GParamSpec *pspec); -static void mate_mixer_toggle_init (MateMixerToggle *toggle); -static void mate_mixer_toggle_dispose (GObject *object); +static void mate_mixer_stream_toggle_init (MateMixerStreamToggle *toggle); +static void mate_mixer_stream_toggle_dispose (GObject *object); -G_DEFINE_ABSTRACT_TYPE (MateMixerToggle, mate_mixer_toggle, MATE_MIXER_TYPE_SWITCH) +G_DEFINE_ABSTRACT_TYPE (MateMixerStreamToggle, mate_mixer_stream_toggle, MATE_MIXER_TYPE_STREAM_SWITCH) -static MateMixerSwitchOption *mate_mixer_toggle_get_option (MateMixerSwitch *swtch, - const gchar *name); +static MateMixerSwitchOption *mate_mixer_stream_toggle_get_option (MateMixerSwitch *swtch, + const gchar *name); -static const GList * mate_mixer_toggle_list_options (MateMixerSwitch *swtch); +static const GList * mate_mixer_stream_toggle_list_options (MateMixerSwitch *swtch); static void -mate_mixer_toggle_class_init (MateMixerToggleClass *klass) +mate_mixer_stream_toggle_class_init (MateMixerStreamToggleClass *klass) { GObjectClass *object_class; MateMixerSwitchClass *switch_class; object_class = G_OBJECT_CLASS (klass); - object_class->dispose = mate_mixer_toggle_dispose; - object_class->get_property = mate_mixer_toggle_get_property; - object_class->set_property = mate_mixer_toggle_set_property; + object_class->dispose = mate_mixer_stream_toggle_dispose; + object_class->get_property = mate_mixer_stream_toggle_get_property; + object_class->set_property = mate_mixer_stream_toggle_set_property; switch_class = MATE_MIXER_SWITCH_CLASS (klass); - switch_class->get_option = mate_mixer_toggle_get_option; - switch_class->list_options = mate_mixer_toggle_list_options; + switch_class->get_option = mate_mixer_stream_toggle_get_option; + switch_class->list_options = mate_mixer_stream_toggle_list_options; /** - * MateMixerToggle:state: + * MateMixerStreamToggle:state: * * The current state of the toggle. %TRUE corresponds to the 'on' state and * %FALSE to the 'off' state. @@ -96,7 +96,7 @@ mate_mixer_toggle_class_init (MateMixerToggleClass *klass) G_PARAM_STATIC_STRINGS); /** - * MateMixerToggle:on-state-option: + * MateMixerStreamToggle:on-state-option: * * The #MateMixerSwitchOption representing the 'on' value of the toggle. */ @@ -110,7 +110,7 @@ mate_mixer_toggle_class_init (MateMixerToggleClass *klass) G_PARAM_STATIC_STRINGS); /** - * MateMixerToggle:off-state-option: + * MateMixerStreamToggle:off-state-option: * * The #MateMixerSwitchOption representing the 'off' value of the toggle. */ @@ -125,22 +125,22 @@ mate_mixer_toggle_class_init (MateMixerToggleClass *klass) g_object_class_install_properties (object_class, N_PROPERTIES, properties); - g_type_class_add_private (object_class, sizeof (MateMixerTogglePrivate)); + g_type_class_add_private (object_class, sizeof (MateMixerStreamTogglePrivate)); } static void -mate_mixer_toggle_get_property (GObject *object, - guint param_id, - GValue *value, - GParamSpec *pspec) +mate_mixer_stream_toggle_get_property (GObject *object, + guint param_id, + GValue *value, + GParamSpec *pspec) { - MateMixerToggle *toggle; + MateMixerStreamToggle *toggle; - toggle = MATE_MIXER_TOGGLE (object); + toggle = MATE_MIXER_STREAM_TOGGLE (object); switch (param_id) { case PROP_STATE: - g_value_set_boolean (value, mate_mixer_toggle_get_state (toggle)); + g_value_set_boolean (value, mate_mixer_stream_toggle_get_state (toggle)); break; case PROP_ON_STATE_OPTION: g_value_set_object (value, toggle->priv->on); @@ -156,18 +156,18 @@ mate_mixer_toggle_get_property (GObject *object, } static void -mate_mixer_toggle_set_property (GObject *object, - guint param_id, - const GValue *value, - GParamSpec *pspec) +mate_mixer_stream_toggle_set_property (GObject *object, + guint param_id, + const GValue *value, + GParamSpec *pspec) { - MateMixerToggle *toggle; + MateMixerStreamToggle *toggle; - toggle = MATE_MIXER_TOGGLE (object); + toggle = MATE_MIXER_STREAM_TOGGLE (object); switch (param_id) { case PROP_STATE: - mate_mixer_toggle_set_state (toggle, g_value_get_boolean (value)); + mate_mixer_stream_toggle_set_state (toggle, g_value_get_boolean (value)); break; case PROP_ON_STATE_OPTION: /* Construct-only object */ @@ -185,19 +185,19 @@ mate_mixer_toggle_set_property (GObject *object, } static void -mate_mixer_toggle_init (MateMixerToggle *toggle) +mate_mixer_stream_toggle_init (MateMixerStreamToggle *toggle) { toggle->priv = G_TYPE_INSTANCE_GET_PRIVATE (toggle, - MATE_MIXER_TYPE_TOGGLE, - MateMixerTogglePrivate); + MATE_MIXER_TYPE_STREAM_TOGGLE, + MateMixerStreamTogglePrivate); } static void -mate_mixer_toggle_dispose (GObject *object) +mate_mixer_stream_toggle_dispose (GObject *object) { - MateMixerToggle *toggle; + MateMixerStreamToggle *toggle; - toggle = MATE_MIXER_TOGGLE (object); + toggle = MATE_MIXER_STREAM_TOGGLE (object); if (toggle->priv->options != NULL) { g_list_free (toggle->priv->options); @@ -207,12 +207,12 @@ mate_mixer_toggle_dispose (GObject *object) g_clear_object (&toggle->priv->on); g_clear_object (&toggle->priv->off); - G_OBJECT_CLASS (mate_mixer_toggle_parent_class)->dispose (object); + G_OBJECT_CLASS (mate_mixer_stream_toggle_parent_class)->dispose (object); } /** - * mate_mixer_toggle_get_state: - * @toggle: a #MateMixerToggle + * mate_mixer_stream_toggle_get_state: + * @toggle: a #MateMixerStreamToggle * * Gets the current state of the toggle. %TRUE corresponds to the 'on' state and * %FALSE to the 'off' state. @@ -220,11 +220,11 @@ mate_mixer_toggle_dispose (GObject *object) * Returns: %TRUE or %FALSE. */ gboolean -mate_mixer_toggle_get_state (MateMixerToggle *toggle) +mate_mixer_stream_toggle_get_state (MateMixerStreamToggle *toggle) { MateMixerSwitchOption *active; - g_return_val_if_fail (MATE_MIXER_IS_TOGGLE (toggle), FALSE); + g_return_val_if_fail (MATE_MIXER_IS_STREAM_TOGGLE (toggle), FALSE); active = mate_mixer_switch_get_active_option (MATE_MIXER_SWITCH (toggle)); if G_UNLIKELY (active == NULL) @@ -237,8 +237,8 @@ mate_mixer_toggle_get_state (MateMixerToggle *toggle) } /** - * mate_mixer_toggle_get_state_option: - * @toggle: a #MateMixerToggle + * mate_mixer_stream_toggle_get_state_option: + * @toggle: a #MateMixerStreamToggle * @state: the state to get the #MateMixerSwitchOption for * * Gets the #MateMixerSwitchOption representing the selected state. @@ -246,9 +246,9 @@ mate_mixer_toggle_get_state (MateMixerToggle *toggle) * Returns: a #MateMixerSwitchOption. */ MateMixerSwitchOption * -mate_mixer_toggle_get_state_option (MateMixerToggle *toggle, gboolean state) +mate_mixer_stream_toggle_get_state_option (MateMixerStreamToggle *toggle, gboolean state) { - g_return_val_if_fail (MATE_MIXER_IS_TOGGLE (toggle), NULL); + g_return_val_if_fail (MATE_MIXER_IS_STREAM_TOGGLE (toggle), NULL); if (state == TRUE) return toggle->priv->on; @@ -257,8 +257,8 @@ mate_mixer_toggle_get_state_option (MateMixerToggle *toggle, gboolean state) } /** - * mate_mixer_toggle_set_state: - * @toggle: a #MateMixerToggle + * mate_mixer_stream_toggle_set_state: + * @toggle: a #MateMixerStreamToggle * @state: the state to set * * Sets the @toggle to the selected state. @@ -269,11 +269,11 @@ mate_mixer_toggle_get_state_option (MateMixerToggle *toggle, gboolean state) * Returns: %TRUE on success or %FALSE on failure. */ gboolean -mate_mixer_toggle_set_state (MateMixerToggle *toggle, gboolean state) +mate_mixer_stream_toggle_set_state (MateMixerStreamToggle *toggle, gboolean state) { MateMixerSwitchOption *active; - g_return_val_if_fail (MATE_MIXER_IS_TOGGLE (toggle), FALSE); + g_return_val_if_fail (MATE_MIXER_IS_STREAM_TOGGLE (toggle), FALSE); if (state == TRUE) active = toggle->priv->on; @@ -287,14 +287,14 @@ mate_mixer_toggle_set_state (MateMixerToggle *toggle, gboolean state) } static MateMixerSwitchOption * -mate_mixer_toggle_get_option (MateMixerSwitch *swtch, const gchar *name) +mate_mixer_stream_toggle_get_option (MateMixerSwitch *swtch, const gchar *name) { - MateMixerToggle *toggle; + MateMixerStreamToggle *toggle; - g_return_val_if_fail (MATE_MIXER_IS_TOGGLE (swtch), NULL); + g_return_val_if_fail (MATE_MIXER_IS_STREAM_TOGGLE (swtch), NULL); g_return_val_if_fail (name != NULL, NULL); - toggle = MATE_MIXER_TOGGLE (swtch); + toggle = MATE_MIXER_STREAM_TOGGLE (swtch); if (g_strcmp0 (name, mate_mixer_switch_option_get_name (toggle->priv->on)) == 0) return toggle->priv->on; @@ -305,13 +305,13 @@ mate_mixer_toggle_get_option (MateMixerSwitch *swtch, const gchar *name) } static const GList * -mate_mixer_toggle_list_options (MateMixerSwitch *swtch) +mate_mixer_stream_toggle_list_options (MateMixerSwitch *swtch) { - MateMixerToggle *toggle; + MateMixerStreamToggle *toggle; - g_return_val_if_fail (MATE_MIXER_IS_TOGGLE (swtch), NULL); + g_return_val_if_fail (MATE_MIXER_IS_STREAM_TOGGLE (swtch), NULL); - toggle = MATE_MIXER_TOGGLE (swtch); + toggle = MATE_MIXER_STREAM_TOGGLE (swtch); if (toggle->priv->options == NULL) { if G_LIKELY (toggle->priv->off != NULL) diff --git a/libmatemixer/matemixer-stream-toggle.h b/libmatemixer/matemixer-stream-toggle.h new file mode 100644 index 0000000..7417568 --- /dev/null +++ b/libmatemixer/matemixer-stream-toggle.h @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2014 Michal Ratajsky <[email protected]> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the licence, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef MATEMIXER_STREAM_TOGGLE_H +#define MATEMIXER_STREAM_TOGGLE_H + +#include <glib.h> +#include <glib-object.h> + +#include <libmatemixer/matemixer-stream-switch.h> +#include <libmatemixer/matemixer-types.h> + +G_BEGIN_DECLS + +#define MATE_MIXER_TYPE_STREAM_TOGGLE \ + (mate_mixer_stream_toggle_get_type ()) +#define MATE_MIXER_STREAM_TOGGLE(o) \ + (G_TYPE_CHECK_INSTANCE_CAST ((o), MATE_MIXER_TYPE_STREAM_TOGGLE, MateMixerStreamToggle)) +#define MATE_MIXER_IS_STREAM_TOGGLE(o) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((o), MATE_MIXER_TYPE_STREAM_TOGGLE)) +#define MATE_MIXER_STREAM_TOGGLE_CLASS(k) \ + (G_TYPE_CHECK_CLASS_CAST ((k), MATE_MIXER_TYPE_STREAM_TOGGLE, MateMixerStreamToggleClass)) +#define MATE_MIXER_IS_STREAM_TOGGLE_CLASS(k) \ + (G_TYPE_CHECK_CLASS_TYPE ((k), MATE_MIXER_TYPE_STREAM_TOGGLE)) +#define MATE_MIXER_STREAM_TOGGLE_GET_CLASS(o) \ + (G_TYPE_INSTANCE_GET_CLASS ((o), MATE_MIXER_TYPE_STREAM_TOGGLE, MateMixerStreamToggleClass)) + +typedef struct _MateMixerStreamToggleClass MateMixerStreamToggleClass; +typedef struct _MateMixerStreamTogglePrivate MateMixerStreamTogglePrivate; + +/** + * MateMixerStreamToggle: + * + * The #MateMixerStreamToggle structure contains only private data and should only + * be accessed using the provided API. + */ +struct _MateMixerStreamToggle +{ + MateMixerStreamSwitch object; + + /*< private >*/ + MateMixerStreamTogglePrivate *priv; +}; + +/** + * MateMixerStreamToggleClass: + * @parent_class: The parent class. + * + * The class structure for #MateMixerStreamToggle. + */ +struct _MateMixerStreamToggleClass +{ + MateMixerStreamSwitchClass parent_class; +}; + +GType mate_mixer_stream_toggle_get_type (void) G_GNUC_CONST; + +gboolean mate_mixer_stream_toggle_get_state (MateMixerStreamToggle *toggle); +gboolean mate_mixer_stream_toggle_set_state (MateMixerStreamToggle *toggle, + gboolean state); + +MateMixerSwitchOption *mate_mixer_stream_toggle_get_state_option (MateMixerStreamToggle *toggle, + gboolean state); + +G_END_DECLS + +#endif /* MATEMIXER_STREAM_TOGGLE_H */ diff --git a/libmatemixer/matemixer-toggle.h b/libmatemixer/matemixer-toggle.h deleted file mode 100644 index 09e8943..0000000 --- a/libmatemixer/matemixer-toggle.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (C) 2014 Michal Ratajsky <[email protected]> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the licence, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef MATEMIXER_TOGGLE_H -#define MATEMIXER_TOGGLE_H - -#include <glib.h> -#include <glib-object.h> - -#include <libmatemixer/matemixer-types.h> - -G_BEGIN_DECLS - -#define MATE_MIXER_TYPE_TOGGLE \ - (mate_mixer_toggle_get_type ()) -#define MATE_MIXER_TOGGLE(o) \ - (G_TYPE_CHECK_INSTANCE_CAST ((o), MATE_MIXER_TYPE_TOGGLE, MateMixerToggle)) -#define MATE_MIXER_IS_TOGGLE(o) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((o), MATE_MIXER_TYPE_TOGGLE)) -#define MATE_MIXER_TOGGLE_CLASS(k) \ - (G_TYPE_CHECK_CLASS_CAST ((k), MATE_MIXER_TYPE_TOGGLE, MateMixerToggleClass)) -#define MATE_MIXER_IS_TOGGLE_CLASS(k) \ - (G_TYPE_CHECK_CLASS_TYPE ((k), MATE_MIXER_TYPE_TOGGLE)) -#define MATE_MIXER_TOGGLE_GET_CLASS(o) \ - (G_TYPE_INSTANCE_GET_CLASS ((o), MATE_MIXER_TYPE_TOGGLE, MateMixerToggleClass)) - -typedef struct _MateMixerToggleClass MateMixerToggleClass; -typedef struct _MateMixerTogglePrivate MateMixerTogglePrivate; - -/** - * MateMixerToggle: - * - * The #MateMixerToggle structure contains only private data and should only - * be accessed using the provided API. - */ -struct _MateMixerToggle -{ - MateMixerSwitch object; - - /*< private >*/ - MateMixerTogglePrivate *priv; -}; - -/** - * MateMixerToggleClass: - * @parent_class: The parent class. - * - * The class structure for #MateMixerToggle. - */ -struct _MateMixerToggleClass -{ - MateMixerSwitchClass parent_class; -}; - -GType mate_mixer_toggle_get_type (void) G_GNUC_CONST; - -gboolean mate_mixer_toggle_get_state (MateMixerToggle *toggle); -gboolean mate_mixer_toggle_set_state (MateMixerToggle *toggle, - gboolean state); - -MateMixerSwitchOption *mate_mixer_toggle_get_state_option (MateMixerToggle *toggle, - gboolean state); - -G_END_DECLS - -#endif /* MATEMIXER_TOGGLE_H */ diff --git a/libmatemixer/matemixer-types.h b/libmatemixer/matemixer-types.h index 1d116d1..8ed2ab2 100644 --- a/libmatemixer/matemixer-types.h +++ b/libmatemixer/matemixer-types.h @@ -28,9 +28,9 @@ typedef struct _MateMixerStoredControl MateMixerStoredControl; typedef struct _MateMixerStream MateMixerStream; typedef struct _MateMixerStreamControl MateMixerStreamControl; typedef struct _MateMixerStreamSwitch MateMixerStreamSwitch; +typedef struct _MateMixerStreamToggle MateMixerStreamToggle; typedef struct _MateMixerSwitch MateMixerSwitch; typedef struct _MateMixerSwitchOption MateMixerSwitchOption; -typedef struct _MateMixerToggle MateMixerToggle; G_END_DECLS diff --git a/libmatemixer/matemixer.h b/libmatemixer/matemixer.h index 2df604d..309c30c 100644 --- a/libmatemixer/matemixer.h +++ b/libmatemixer/matemixer.h @@ -33,9 +33,9 @@ #include <libmatemixer/matemixer-stream.h> #include <libmatemixer/matemixer-stream-control.h> #include <libmatemixer/matemixer-stream-switch.h> +#include <libmatemixer/matemixer-stream-toggle.h> #include <libmatemixer/matemixer-switch.h> #include <libmatemixer/matemixer-switch-option.h> -#include <libmatemixer/matemixer-toggle.h> #include <libmatemixer/matemixer-version.h> G_BEGIN_DECLS |