From a2290d5e13ccee88fd9ae66a3895eb4da646f81f Mon Sep 17 00:00:00 2001 From: Michal Ratajsky Date: Fri, 13 Jun 2014 17:36:14 +0200 Subject: Weekly update --- backends/null/Makefile.am | 5 ++- backends/null/null-backend.c | 96 ++++++++++++++++++++++++++++++++++++++++++++ backends/null/null-backend.h | 60 +++++++++++++++++++++++++++ backends/null/null.c | 84 -------------------------------------- backends/null/null.h | 60 --------------------------- 5 files changed, 159 insertions(+), 146 deletions(-) create mode 100644 backends/null/null-backend.c create mode 100644 backends/null/null-backend.h delete mode 100644 backends/null/null.c delete mode 100644 backends/null/null.h (limited to 'backends/null') 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-backend.c b/backends/null/null-backend.c new file mode 100644 index 0000000..f8c22c8 --- /dev/null +++ b/backends/null/null-backend.c @@ -0,0 +1,96 @@ +/* + * Copyright (C) 2014 Michal Ratajsky + * + * 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 . + */ + +#include +#include + +#include +#include + +#include "null-backend.h" + +#define BACKEND_NAME "Null" +#define BACKEND_PRIORITY 0 + +static void mate_mixer_backend_interface_init (MateMixerBackendInterface *iface); + +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) +{ + null_backend_register_type (module); + + info.name = BACKEND_NAME; + info.priority = BACKEND_PRIORITY; + info.g_type = NULL_TYPE_BACKEND; + info.backend_type = MATE_MIXER_BACKEND_NULL; +} + +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) +{ + // 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 +null_backend_class_finalize (NullBackendClass *klass) +{ +} + +static void +null_backend_init (NullBackend *null) +{ +} + +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-backend.h b/backends/null/null-backend.h new file mode 100644 index 0000000..2d718e3 --- /dev/null +++ b/backends/null/null-backend.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2014 Michal Ratajsky + * + * 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 . + */ + +#ifndef MATEMIXER_NULL_BACKEND_H +#define MATEMIXER_NULL_BACKEND_H + +#include +#include + +#include + +#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 _NullBackendClass +{ + /*< private >*/ + GObjectClass parent; +}; + +GType null_backend_get_type (void) G_GNUC_CONST; + +/* Support function for dynamic loading of the backend module */ +void backend_module_init (GTypeModule *module); +const MateMixerBackendInfo *backend_module_get_info (void); + +#endif /* MATEMIXER_NULL_H */ diff --git a/backends/null/null.c b/backends/null/null.c deleted file mode 100644 index 1e8085d..0000000 --- a/backends/null/null.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (C) 2014 Michal Ratajsky - * - * 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 . - */ - -#include -#include - -#include -#include - -#include "null.h" - -#define BACKEND_NAME "Null" -#define BACKEND_PRIORITY 999 - -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_TYPE_OBJECT, 0, - G_IMPLEMENT_INTERFACE_DYNAMIC (MATE_MIXER_TYPE_BACKEND, - mate_mixer_backend_interface_init)) - -static MateMixerBackendInfo info; - -void -backend_module_init (GTypeModule *module) -{ - mate_mixer_null_register_type (module); - - info.name = BACKEND_NAME; - info.priority = BACKEND_PRIORITY; - info.g_type = MATE_MIXER_TYPE_NULL; - info.backend_type = MATE_MIXER_BACKEND_NULL; -} - -const MateMixerBackendInfo * -backend_module_get_info (void) -{ - return &info; -} - -static void -mate_mixer_backend_interface_init (MateMixerBackendInterface *iface) -{ - iface->open = mate_mixer_null_open; -} - -static void -mate_mixer_null_class_init (MateMixerNullClass *klass) -{ -} - -/* Called in the code generated by G_DEFINE_DYNAMIC_TYPE_EXTENDED() */ -static void -mate_mixer_null_class_finalize (MateMixerNullClass *klass) -{ -} - -static void -mate_mixer_null_init (MateMixerNull *null) -{ -} - -gboolean -mate_mixer_null_open (MateMixerBackend *backend) -{ - return TRUE; -} diff --git a/backends/null/null.h b/backends/null/null.h deleted file mode 100644 index c9dd501..0000000 --- a/backends/null/null.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2014 Michal Ratajsky - * - * 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 . - */ - -#ifndef MATEMIXER_NULL_H -#define MATEMIXER_NULL_H - -#include -#include - -#include - -#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 -{ - GObject parent; -}; - -struct _MateMixerNullClass -{ - GObjectClass parent; -}; - -GType mate_mixer_null_get_type (void) G_GNUC_CONST; - -/* Support function for dynamic loading of the backend 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 */ -- cgit v1.2.1