diff options
Diffstat (limited to 'backends/null')
-rw-r--r-- | backends/null/Makefile.am | 5 | ||||
-rw-r--r-- | backends/null/null-backend.c (renamed from backends/null/null.c) | 40 | ||||
-rw-r--r-- | backends/null/null-backend.h (renamed from backends/null/null.h) | 48 |
3 files changed, 53 insertions, 40 deletions
diff --git a/backends/null/Makefile.am b/backends/null/Makefile.am index f28bc06..8ce28d1 100644 --- a/backends/null/Makefile.am +++ b/backends/null/Makefile.am @@ -9,13 +9,14 @@ AM_CPPFLAGS = \ libmatemixer_null_la_CFLAGS = $(GLIB_CFLAGS) libmatemixer_null_la_SOURCES = \ - null.c \ - null.h + null-backend.c \ + null-backend.h libmatemixer_null_la_LIBADD = $(GLIB_LIBS) libmatemixer_null_la_LDFLAGS = \ -avoid-version \ + -no-undefined \ -export-dynamic \ -module diff --git a/backends/null/null.c b/backends/null/null-backend.c index 1e8085d..f8c22c8 100644 --- a/backends/null/null.c +++ b/backends/null/null-backend.c @@ -21,31 +21,35 @@ #include <libmatemixer/matemixer-backend.h> #include <libmatemixer/matemixer-backend-module.h> -#include "null.h" +#include "null-backend.h" #define BACKEND_NAME "Null" -#define BACKEND_PRIORITY 999 +#define BACKEND_PRIORITY 0 static void mate_mixer_backend_interface_init (MateMixerBackendInterface *iface); -static void mate_mixer_null_class_init (MateMixerNullClass *klass); -static void mate_mixer_null_class_finalize (MateMixerNullClass *klass); -static void mate_mixer_null_init (MateMixerNull *null); -G_DEFINE_DYNAMIC_TYPE_EXTENDED (MateMixerNull, mate_mixer_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)) +static void null_backend_class_init (NullBackendClass *klass); +static void null_backend_class_finalize (NullBackendClass *klass); +static void null_backend_init (NullBackend *null); + +static gboolean backend_open (MateMixerBackend *backend); +static MateMixerState backend_get_state (MateMixerBackend *backend); + static MateMixerBackendInfo info; void backend_module_init (GTypeModule *module) { - mate_mixer_null_register_type (module); + null_backend_register_type (module); info.name = BACKEND_NAME; info.priority = BACKEND_PRIORITY; - info.g_type = MATE_MIXER_TYPE_NULL; + info.g_type = NULL_TYPE_BACKEND; info.backend_type = MATE_MIXER_BACKEND_NULL; } @@ -58,27 +62,35 @@ backend_module_get_info (void) static void mate_mixer_backend_interface_init (MateMixerBackendInterface *iface) { - iface->open = mate_mixer_null_open; + iface->open = backend_open; + iface->get_state = backend_get_state; } static void -mate_mixer_null_class_init (MateMixerNullClass *klass) +null_backend_class_init (NullBackendClass *klass) { + // XXX is it needed to have this function? shouldn't it call parent method if empty? } /* Called in the code generated by G_DEFINE_DYNAMIC_TYPE_EXTENDED() */ static void -mate_mixer_null_class_finalize (MateMixerNullClass *klass) +null_backend_class_finalize (NullBackendClass *klass) { } static void -mate_mixer_null_init (MateMixerNull *null) +null_backend_init (NullBackend *null) { } -gboolean -mate_mixer_null_open (MateMixerBackend *backend) +static gboolean +backend_open (MateMixerBackend *backend) { return TRUE; } + +static MateMixerState +backend_get_state (MateMixerBackend *backend) +{ + return MATE_MIXER_STATE_READY; +} diff --git a/backends/null/null.h b/backends/null/null-backend.h index c9dd501..2d718e3 100644 --- a/backends/null/null.h +++ b/backends/null/null-backend.h @@ -15,46 +15,46 @@ * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ -#ifndef MATEMIXER_NULL_H -#define MATEMIXER_NULL_H +#ifndef MATEMIXER_NULL_BACKEND_H +#define MATEMIXER_NULL_BACKEND_H #include <glib.h> #include <glib-object.h> #include <libmatemixer/matemixer-backend.h> -#define MATE_MIXER_TYPE_NULL \ - (mate_mixer_null_get_type ()) -#define MATE_MIXER_NULL(o) \ - (G_TYPE_CHECK_INSTANCE_CAST ((o), MATE_MIXER_TYPE_NULL, MateMixerNull)) -#define MATE_MIXER_IS_NULL(o) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((o), MATE_MIXER_TYPE_NULL)) -#define MATE_MIXER_NULL_CLASS(k) \ - (G_TYPE_CHECK_CLASS_CAST ((k), MATE_MIXER_TYPE_NULL, MateMixerNullClass)) -#define MATE_MIXER_IS_NULL_CLASS(k) \ - (G_TYPE_CLASS_CHECK_CLASS_TYPE ((k), MATE_MIXER_TYPE_NULL)) -#define MATE_MIXER_NULL_GET_CLASS(o) \ - (G_TYPE_INSTANCE_GET_CLASS ((o), MATE_MIXER_TYPE_NULL, MateMixerNullClass)) - -typedef struct _MateMixerNull MateMixerNull; -typedef struct _MateMixerNullClass MateMixerNullClass; - -struct _MateMixerNull +#define NULL_TYPE_BACKEND \ + (null_backend_get_type ()) +#define NULL_BACKEND(o) \ + (G_TYPE_CHECK_INSTANCE_CAST ((o), NULL_TYPE_BACKEND, NullBackend)) +#define NULL_IS_BACKEND(o) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((o), NULL_TYPE_BACKEND)) +#define NULL_BACKEND_CLASS(k) \ + (G_TYPE_CHECK_CLASS_CAST ((k), NULL_TYPE_BACKEND, NullBackendClass)) +#define NULL_IS_BACKEND_CLASS(k) \ + (G_TYPE_CLASS_CHECK_CLASS_TYPE ((k), NULL_TYPE_BACKEND)) +#define NULL_BACKEND_GET_CLASS(o) \ + (G_TYPE_INSTANCE_GET_CLASS ((o), NULL_TYPE_BACKEND, NullBackendClass)) + +typedef struct _NullBackend NullBackend; +typedef struct _NullBackendClass NullBackendClass; + +struct _NullBackend { + /*< private >*/ GObject parent; }; -struct _MateMixerNullClass +struct _NullBackendClass { + /*< private >*/ GObjectClass parent; }; -GType mate_mixer_null_get_type (void) G_GNUC_CONST; +GType null_backend_get_type (void) G_GNUC_CONST; /* Support function for dynamic loading of the backend module */ -void backend_module_init (GTypeModule *module); +void backend_module_init (GTypeModule *module); const MateMixerBackendInfo *backend_module_get_info (void); -gboolean mate_mixer_null_open (MateMixerBackend *backend); - #endif /* MATEMIXER_NULL_H */ |