diff options
author | Michal Ratajsky <[email protected]> | 2014-08-12 05:19:40 +0200 |
---|---|---|
committer | Michal Ratajsky <[email protected]> | 2014-08-12 05:19:40 +0200 |
commit | 006ea9dd9baa9e879fc9ab47626e3e38d1aac634 (patch) | |
tree | 19b6872f32e62f256a0d2c10c3f38c3050c59bd2 /backends/null/null-backend.c | |
parent | d0e77b52d34c89d013787028c576264222b190b3 (diff) | |
download | libmatemixer-006ea9dd9baa9e879fc9ab47626e3e38d1aac634.tar.bz2 libmatemixer-006ea9dd9baa9e879fc9ab47626e3e38d1aac634.tar.xz |
Adapt Null module to API changes
Diffstat (limited to 'backends/null/null-backend.c')
-rw-r--r-- | backends/null/null-backend.c | 79 |
1 files changed, 11 insertions, 68 deletions
diff --git a/backends/null/null-backend.c b/backends/null/null-backend.c index 05d06a8..49038b1 100644 --- a/backends/null/null-backend.c +++ b/backends/null/null-backend.c @@ -17,41 +17,21 @@ #include <glib.h> #include <glib-object.h> - -#include <libmatemixer/matemixer-backend.h> -#include <libmatemixer/matemixer-backend-module.h> -#include <libmatemixer/matemixer-enums.h> +#include <libmatemixer/matemixer.h> +#include <libmatemixer/matemixer-private.h> #include "null-backend.h" #define BACKEND_NAME "Null" #define BACKEND_PRIORITY 0 -enum { - PROP_0, - PROP_STATE, - PROP_DEFAULT_INPUT, - PROP_DEFAULT_OUTPUT, - N_PROPERTIES -}; - -static void mate_mixer_backend_interface_init (MateMixerBackendInterface *iface); - static void null_backend_class_init (NullBackendClass *klass); static void null_backend_class_finalize (NullBackendClass *klass); -static void null_backend_get_property (GObject *object, - guint param_id, - GValue *value, - GParamSpec *pspec); static void null_backend_init (NullBackend *null); -G_DEFINE_DYNAMIC_TYPE_EXTENDED (NullBackend, null_backend, - G_TYPE_OBJECT, 0, - G_IMPLEMENT_INTERFACE_DYNAMIC (MATE_MIXER_TYPE_BACKEND, - mate_mixer_backend_interface_init)) +G_DEFINE_DYNAMIC_TYPE (NullBackend, null_backend, MATE_MIXER_TYPE_BACKEND) -static gboolean backend_open (MateMixerBackend *backend); -static MateMixerState backend_get_state (MateMixerBackend *backend); +static gboolean null_backend_open (MateMixerBackend *backend); static MateMixerBackendInfo info; @@ -66,71 +46,34 @@ backend_module_init (GTypeModule *module) info.backend_type = MATE_MIXER_BACKEND_NULL; } -const MateMixerBackendInfo * -backend_module_get_info (void) +const MateMixerBackendInfo *backend_module_get_info (void) { return &info; } static void -mate_mixer_backend_interface_init (MateMixerBackendInterface *iface) -{ - iface->open = backend_open; - iface->get_state = backend_get_state; -} - -static void null_backend_class_init (NullBackendClass *klass) { - GObjectClass *object_class; - - object_class = G_OBJECT_CLASS (klass); - object_class->get_property = null_backend_get_property; + MateMixerBackendClass *backend_class; - g_object_class_override_property (object_class, PROP_STATE, "state"); - g_object_class_override_property (object_class, PROP_DEFAULT_INPUT, "default-input"); - g_object_class_override_property (object_class, PROP_DEFAULT_OUTPUT, "default-output"); + backend_class = MATE_MIXER_BACKEND_CLASS (klass); + backend_class->open = null_backend_open; } -/* Called in the code generated by G_DEFINE_DYNAMIC_TYPE_EXTENDED() */ +/* Called in the code generated by G_DEFINE_DYNAMIC_TYPE() */ static void null_backend_class_finalize (NullBackendClass *klass) { } static void -null_backend_get_property (GObject *object, - guint param_id, - GValue *value, - GParamSpec *pspec) -{ - switch (param_id) { - case PROP_STATE: - g_value_set_enum (value, MATE_MIXER_STATE_READY); - break; - case PROP_DEFAULT_INPUT: - case PROP_DEFAULT_OUTPUT: - g_value_set_object (value, NULL); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); - break; - } -} - -static void null_backend_init (NullBackend *null) { } static gboolean -backend_open (MateMixerBackend *backend) +null_backend_open (MateMixerBackend *backend) { + _mate_mixer_backend_set_state (backend, MATE_MIXER_STATE_READY); return TRUE; } - -static MateMixerState -backend_get_state (MateMixerBackend *backend) -{ - return MATE_MIXER_STATE_READY; -} |