diff options
Diffstat (limited to 'backends/null')
-rw-r--r-- | backends/null/null-backend.c | 79 | ||||
-rw-r--r-- | backends/null/null-backend.h | 8 |
2 files changed, 15 insertions, 72 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; -} diff --git a/backends/null/null-backend.h b/backends/null/null-backend.h index 505dd80..8499fe9 100644 --- a/backends/null/null-backend.h +++ b/backends/null/null-backend.h @@ -20,8 +20,8 @@ #include <glib.h> #include <glib-object.h> - -#include <libmatemixer/matemixer-backend-module.h> +#include <libmatemixer/matemixer.h> +#include <libmatemixer/matemixer-private.h> #define NULL_TYPE_BACKEND \ (null_backend_get_type ()) @@ -41,12 +41,12 @@ typedef struct _NullBackendClass NullBackendClass; struct _NullBackend { - GObject parent; + MateMixerBackend parent; }; struct _NullBackendClass { - GObjectClass parent_class; + MateMixerBackendClass parent_class; }; GType null_backend_get_type (void) G_GNUC_CONST; |