Mercurial > audlegacy
changeset 2712:aeb4d8da1543 trunk
[svn] - move configdb public API to audacious proper
- drop libaudacious entirely
author | nenolod |
---|---|
date | Wed, 09 May 2007 14:38:41 -0700 |
parents | c35913222440 |
children | 8f7da5257692 |
files | ChangeLog src/audacious/Makefile src/audacious/build_stamp.c src/audacious/configdb.c src/audacious/configdb.h src/libaudacious/Makefile src/libaudacious/configdb.c src/libaudacious/configdb.h |
diffstat | 8 files changed, 415 insertions(+), 433 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Wed May 09 14:36:37 2007 -0700 +++ b/ChangeLog Wed May 09 14:38:41 2007 -0700 @@ -1,3 +1,24 @@ +2007-05-09 21:36:37 +0000 Ben Tucker <bnt@interchange.ubc.ca> + revision [4448] + Initial commit of dbus client library for plugins. Various changes were made to the plugin structure to support dbus. + + trunk/configure.ac | 4 + trunk/mk/rules.mk.in | 2 + trunk/src/Makefile | 2 + trunk/src/audacious/Makefile | 14 +- + trunk/src/audacious/dbus-service.h | 91 +++++++++++++++++ + trunk/src/audacious/dbus.c | 66 ++++++++++-- + trunk/src/audacious/dbus.h | 64 ------------ + trunk/src/audacious/main.c | 10 + + trunk/src/audacious/objects.xml | 65 ++++++++++-- + trunk/src/audacious/plugin.h | 13 ++ + trunk/src/audacious/pluginenum.c | 11 ++ + trunk/src/libaudaciousng/Makefile | 42 ++++++++ + trunk/src/libaudaciousng/audctrl.c | 193 +++++++++++++++++++++++++++++++++++++ + trunk/src/libaudaciousng/audctrl.h | 130 ++++++++++++++++++++++++ + 14 files changed, 620 insertions(+), 87 deletions(-) + + 2007-05-09 21:35:33 +0000 William Pitcock <nenolod@sacredspiral.co.uk> revision [4446] - drop client code
--- a/src/audacious/Makefile Wed May 09 14:36:37 2007 -0700 +++ b/src/audacious/Makefile Wed May 09 14:38:41 2007 -0700 @@ -35,6 +35,7 @@ -I../intl HEADERS = \ + configdb.h \ dbus.h \ formatter.h \ rcfile.h \ @@ -58,7 +59,7 @@ SOURCES = \ build_stamp.c \ - controlsocket.c \ + configdb.c \ $(DBUS_C) \ dnd.c \ dock.c \
--- a/src/audacious/build_stamp.c Wed May 09 14:36:37 2007 -0700 +++ b/src/audacious/build_stamp.c Wed May 09 14:38:41 2007 -0700 @@ -1,2 +1,2 @@ #include <glib.h> -const gchar *svn_stamp = "20070509-4446"; +const gchar *svn_stamp = "20070509-4448";
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audacious/configdb.c Wed May 09 14:38:41 2007 -0700 @@ -0,0 +1,193 @@ +/* This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "configdb.h" + +#include <stdlib.h> +#include <string.h> + +#include <libmcs/mcs.h> + + +#define RCFILE_DEFAULT_SECTION_NAME "audacious" + +static gboolean mcs_initted = FALSE; + +struct _ConfigDb +{ + mcs_handle_t *handle; +}; + + +ConfigDb * +bmp_cfg_db_open() +{ + ConfigDb *db; + + db = g_new(ConfigDb, 1); + + if (!mcs_initted) + { + mcs_init(); + mcs_initted = TRUE; + } + + db->handle = mcs_new(RCFILE_DEFAULT_SECTION_NAME); + + return db; +} + +void +bmp_cfg_db_close(ConfigDb * db) +{ + mcs_destroy(db->handle); + g_free(db); +} + +gboolean +bmp_cfg_db_get_string(ConfigDb * db, + const gchar * section, + const gchar * key, + gchar ** value) +{ + if (!section) + section = RCFILE_DEFAULT_SECTION_NAME; + + return mcs_get_string(db->handle, section, key, value); +} + +gboolean +bmp_cfg_db_get_int(ConfigDb * db, + const gchar * section, const gchar * key, gint * value) +{ + if (!section) + section = RCFILE_DEFAULT_SECTION_NAME; + + return mcs_get_int(db->handle, section, key, value); +} + +gboolean +bmp_cfg_db_get_bool(ConfigDb * db, + const gchar * section, + const gchar * key, + gboolean * value) +{ + if (!section) + section = RCFILE_DEFAULT_SECTION_NAME; + + return mcs_get_bool(db->handle, section, key, value); +} + +gboolean +bmp_cfg_db_get_float(ConfigDb * db, + const gchar * section, + const gchar * key, + gfloat * value) +{ + if (!section) + section = RCFILE_DEFAULT_SECTION_NAME; + + return mcs_get_float(db->handle, section, key, value); +} + +gboolean +bmp_cfg_db_get_double(ConfigDb * db, + const gchar * section, + const gchar * key, + gdouble * value) +{ + if (!section) + section = RCFILE_DEFAULT_SECTION_NAME; + + return mcs_get_double(db->handle, section, key, value); +} + +void +bmp_cfg_db_set_string(ConfigDb * db, + const gchar * section, + const gchar * key, + const gchar * value) +{ + if (!section) + section = RCFILE_DEFAULT_SECTION_NAME; + + mcs_set_string(db->handle, section, key, value); +} + +void +bmp_cfg_db_set_int(ConfigDb * db, + const gchar * section, + const gchar * key, + gint value) +{ + if (!section) + section = RCFILE_DEFAULT_SECTION_NAME; + + mcs_set_int(db->handle, section, key, value); +} + +void +bmp_cfg_db_set_bool(ConfigDb * db, + const gchar * section, + const gchar * key, + gboolean value) +{ + if (!section) + section = RCFILE_DEFAULT_SECTION_NAME; + + mcs_set_bool(db->handle, section, key, value); +} + +void +bmp_cfg_db_set_float(ConfigDb * db, + const gchar * section, + const gchar * key, + gfloat value) +{ + if (!section) + section = RCFILE_DEFAULT_SECTION_NAME; + + mcs_set_float(db->handle, section, key, value); +} + +void +bmp_cfg_db_set_double(ConfigDb * db, + const gchar * section, + const gchar * key, + gdouble value) +{ + if (!section) + section = RCFILE_DEFAULT_SECTION_NAME; + + mcs_set_double(db->handle, section, key, value); +} + +void +bmp_cfg_db_unset_key(ConfigDb * db, + const gchar * section, + const gchar * key) +{ + g_return_if_fail(db != NULL); + g_return_if_fail(key != NULL); + + if (!section) + section = RCFILE_DEFAULT_SECTION_NAME; + + mcs_unset_key(db->handle, section, key); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audacious/configdb.h Wed May 09 14:38:41 2007 -0700 @@ -0,0 +1,198 @@ +#ifndef CONFIGDB_H +#define CONFIGDB_H + +#include <glib.h> + +/** + * ConfigDb: + * + * A configuration database handle, opened with bmp_cfg_db_open(). + **/ +typedef struct _ConfigDb ConfigDb; + + +G_BEGIN_DECLS + + /** + * bmp_cfg_db_open: + * + * Opens the configuration database. + * + * Return value: A configuration database handle. + **/ + ConfigDb *bmp_cfg_db_open(); + + /** + * bmp_cfg_db_close: + * @db: A configuration database handle. + * + * Closes the configuration database. + **/ + void bmp_cfg_db_close(ConfigDb *db); + + /** + * bmp_cfg_db_get_string: + * @db: A configuration database handle. + * @section: The section of the configuration database to search. + * @key: The name of the field in the configuration database to look up. + * @value: Pointer to a buffer to put the data in. + * + * Searches the configuration database for a value. + * + * Return value: TRUE if successful, FALSE otherwise. + **/ + gboolean bmp_cfg_db_get_string(ConfigDb *db, + const gchar *section, + const gchar *key, + gchar **value); + + /** + * bmp_cfg_db_get_int: + * @db: A configuration database handle. + * @section: The section of the configuration database to search. + * @key: The name of the field in the configuration database to look up. + * @value: Pointer to an integer to put the data in. + * + * Searches the configuration database for a value. + * + * Return value: TRUE if successful, FALSE otherwise. + **/ + gboolean bmp_cfg_db_get_int(ConfigDb *db, + const gchar *section, + const gchar *key, + gint *value); + + /** + * bmp_cfg_db_get_bool: + * @db: A configuration database handle. + * @section: The section of the configuration database to search. + * @key: The name of the field in the configuration database to look up. + * @value: Pointer to a boolean to put the data in. + * + * Searches the configuration database for a value. + * + * Return value: TRUE if successful, FALSE otherwise. + **/ + gboolean bmp_cfg_db_get_bool(ConfigDb *db, + const gchar *section, + const gchar *key, + gboolean *value); + + /** + * bmp_cfg_db_get_float: + * @db: A configuration database handle. + * @section: The section of the configuration database to search. + * @key: The name of the field in the configuration database to look up. + * @value: Pointer to a floating point integer to put the data in. + * + * Searches the configuration database for a value. + * + * Return value: TRUE if successful, FALSE otherwise. + **/ + gboolean bmp_cfg_db_get_float(ConfigDb *db, + const gchar *section, + const gchar *key, + gfloat *value); + + /** + * bmp_cfg_db_get_double: + * @db: A configuration database handle. + * @section: The section of the configuration database to search. + * @key: The name of the field in the configuration database to look up. + * @value: Pointer to a double-precision floating point integer to put the data in. + * + * Searches the configuration database for a value. + * + * Return value: TRUE if successful, FALSE otherwise. + **/ + gboolean bmp_cfg_db_get_double(ConfigDb *db, + const gchar *section, + const gchar *key, + gdouble *value); + + /** + * bmp_cfg_db_set_string: + * @db: A configuration database handle. + * @section: The section of the configuration database to search. + * @key: The name of the field in the configuration database to set. + * @value: Pointer to a buffer containing the data. + * + * Sets a value in the configuration database. + **/ + void bmp_cfg_db_set_string(ConfigDb *db, + const gchar *section, + const gchar *key, + const gchar *value); + + /** + * bmp_cfg_db_set_int: + * @db: A configuration database handle. + * @section: The section of the configuration database to search. + * @key: The name of the field in the configuration database to set. + * @value: Pointer to an integer containing the data. + * + * Sets a value in the configuration database. + **/ + void bmp_cfg_db_set_int(ConfigDb *db, + const gchar *section, + const gchar *key, + gint value); + + /** + * bmp_cfg_db_set_bool: + * @db: A configuration database handle. + * @section: The section of the configuration database to search. + * @key: The name of the field in the configuration database to set. + * @value: Pointer to a boolean containing the data. + * + * Sets a value in the configuration database. + **/ + void bmp_cfg_db_set_bool(ConfigDb *db, + const gchar *section, + const gchar *key, + gboolean value); + + /** + * bmp_cfg_db_set_float: + * @db: A configuration database handle. + * @section: The section of the configuration database to search. + * @key: The name of the field in the configuration database to set. + * @value: Pointer to a floating point integer containing the data. + * + * Sets a value in the configuration database. + **/ + void bmp_cfg_db_set_float(ConfigDb *db, + const gchar *section, + const gchar *key, + gfloat value); + + /** + * bmp_cfg_db_set_double: + * @db: A configuration database handle. + * @section: The section of the configuration database to search. + * @key: The name of the field in the configuration database to set. + * @value: Pointer to a double precision floating point integer containing the data. + * + * Sets a value in the configuration database. + **/ + void bmp_cfg_db_set_double(ConfigDb *db, + const gchar *section, + const gchar *key, + gdouble value); + + /** + * bmp_cfg_db_unset_key: + * @db: A configuration database handle. + * @section: The section of the configuration database to search. + * @key: The name of the field in the configuration database to set. + * + * Removes a value from the configuration database. + **/ + void bmp_cfg_db_unset_key(ConfigDb *db, + const gchar *section, + const gchar *key); + +G_END_DECLS + +#endif /* CONFIGDB_H */ +
--- a/src/libaudacious/Makefile Wed May 09 14:36:37 2007 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -include ../../mk/rules.mk -include ../../mk/init.mk - -PICLDFLAGS = $(LIBLDFLAGS) - -OBJECTIVE_LIBS = libaudacious$(SHARED_SUFFIX) -OBJECTIVE_SONAME_SUFFIX = 5 -LIBAUDACIOUS_SUFFIX = 5.0.0 - -LIBADD = \ - $(GTK_LIBS) \ - $(MOWGLI_LIBS) \ - $(GCONF_LIBS) \ - $(LIBMCS_LIBS) - -CFLAGS += $(PICFLAGS) \ - $(MOWGLI_CFLAGS) \ - $(GTK_CFLAGS) \ - $(GCONF_CFLAGS) \ - $(LIBMCS_CFLAGS) \ - -D_AUDACIOUS_CORE \ - -I.. -I../.. \ - -I../intl - -SOURCES = \ - configdb.c - -OBJECTS = ${SOURCES:.c=.o} - -HEADERS = \ - configdb.h - -include ../../mk/objective.mk - -install-posthook: - @mv ${DESTDIR}/${LIBDIR}/libaudacious$(SHARED_SUFFIX) ${DESTDIR}/${LIBDIR}/libaudacious$(SHARED_SUFFIX).$(LIBAUDACIOUS_SUFFIX) - @ln -sf libaudacious$(SHARED_SUFFIX).$(LIBAUDACIOUS_SUFFIX) \ - ${DESTDIR}/${LIBDIR}/libaudacious$(SHARED_SUFFIX).5 - @ln -sf libaudacious$(SHARED_SUFFIX).5 \ - ${DESTDIR}/${LIBDIR}/libaudacious$(SHARED_SUFFIX)
--- a/src/libaudacious/configdb.c Wed May 09 14:36:37 2007 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,193 +0,0 @@ -/* This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include "configdb.h" - -#include <stdlib.h> -#include <string.h> - -#include <libmcs/mcs.h> - - -#define RCFILE_DEFAULT_SECTION_NAME "audacious" - -static gboolean mcs_initted = FALSE; - -struct _ConfigDb -{ - mcs_handle_t *handle; -}; - - -ConfigDb * -bmp_cfg_db_open() -{ - ConfigDb *db; - - db = g_new(ConfigDb, 1); - - if (!mcs_initted) - { - mcs_init(); - mcs_initted = TRUE; - } - - db->handle = mcs_new(RCFILE_DEFAULT_SECTION_NAME); - - return db; -} - -void -bmp_cfg_db_close(ConfigDb * db) -{ - mcs_destroy(db->handle); - g_free(db); -} - -gboolean -bmp_cfg_db_get_string(ConfigDb * db, - const gchar * section, - const gchar * key, - gchar ** value) -{ - if (!section) - section = RCFILE_DEFAULT_SECTION_NAME; - - return mcs_get_string(db->handle, section, key, value); -} - -gboolean -bmp_cfg_db_get_int(ConfigDb * db, - const gchar * section, const gchar * key, gint * value) -{ - if (!section) - section = RCFILE_DEFAULT_SECTION_NAME; - - return mcs_get_int(db->handle, section, key, value); -} - -gboolean -bmp_cfg_db_get_bool(ConfigDb * db, - const gchar * section, - const gchar * key, - gboolean * value) -{ - if (!section) - section = RCFILE_DEFAULT_SECTION_NAME; - - return mcs_get_bool(db->handle, section, key, value); -} - -gboolean -bmp_cfg_db_get_float(ConfigDb * db, - const gchar * section, - const gchar * key, - gfloat * value) -{ - if (!section) - section = RCFILE_DEFAULT_SECTION_NAME; - - return mcs_get_float(db->handle, section, key, value); -} - -gboolean -bmp_cfg_db_get_double(ConfigDb * db, - const gchar * section, - const gchar * key, - gdouble * value) -{ - if (!section) - section = RCFILE_DEFAULT_SECTION_NAME; - - return mcs_get_double(db->handle, section, key, value); -} - -void -bmp_cfg_db_set_string(ConfigDb * db, - const gchar * section, - const gchar * key, - const gchar * value) -{ - if (!section) - section = RCFILE_DEFAULT_SECTION_NAME; - - mcs_set_string(db->handle, section, key, value); -} - -void -bmp_cfg_db_set_int(ConfigDb * db, - const gchar * section, - const gchar * key, - gint value) -{ - if (!section) - section = RCFILE_DEFAULT_SECTION_NAME; - - mcs_set_int(db->handle, section, key, value); -} - -void -bmp_cfg_db_set_bool(ConfigDb * db, - const gchar * section, - const gchar * key, - gboolean value) -{ - if (!section) - section = RCFILE_DEFAULT_SECTION_NAME; - - mcs_set_bool(db->handle, section, key, value); -} - -void -bmp_cfg_db_set_float(ConfigDb * db, - const gchar * section, - const gchar * key, - gfloat value) -{ - if (!section) - section = RCFILE_DEFAULT_SECTION_NAME; - - mcs_set_float(db->handle, section, key, value); -} - -void -bmp_cfg_db_set_double(ConfigDb * db, - const gchar * section, - const gchar * key, - gdouble value) -{ - if (!section) - section = RCFILE_DEFAULT_SECTION_NAME; - - mcs_set_double(db->handle, section, key, value); -} - -void -bmp_cfg_db_unset_key(ConfigDb * db, - const gchar * section, - const gchar * key) -{ - g_return_if_fail(db != NULL); - g_return_if_fail(key != NULL); - - if (!section) - section = RCFILE_DEFAULT_SECTION_NAME; - - mcs_unset_key(db->handle, section, key); -}
--- a/src/libaudacious/configdb.h Wed May 09 14:36:37 2007 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,198 +0,0 @@ -#ifndef CONFIGDB_H -#define CONFIGDB_H - -#include <glib.h> - -/** - * ConfigDb: - * - * A configuration database handle, opened with bmp_cfg_db_open(). - **/ -typedef struct _ConfigDb ConfigDb; - - -G_BEGIN_DECLS - - /** - * bmp_cfg_db_open: - * - * Opens the configuration database. - * - * Return value: A configuration database handle. - **/ - ConfigDb *bmp_cfg_db_open(); - - /** - * bmp_cfg_db_close: - * @db: A configuration database handle. - * - * Closes the configuration database. - **/ - void bmp_cfg_db_close(ConfigDb *db); - - /** - * bmp_cfg_db_get_string: - * @db: A configuration database handle. - * @section: The section of the configuration database to search. - * @key: The name of the field in the configuration database to look up. - * @value: Pointer to a buffer to put the data in. - * - * Searches the configuration database for a value. - * - * Return value: TRUE if successful, FALSE otherwise. - **/ - gboolean bmp_cfg_db_get_string(ConfigDb *db, - const gchar *section, - const gchar *key, - gchar **value); - - /** - * bmp_cfg_db_get_int: - * @db: A configuration database handle. - * @section: The section of the configuration database to search. - * @key: The name of the field in the configuration database to look up. - * @value: Pointer to an integer to put the data in. - * - * Searches the configuration database for a value. - * - * Return value: TRUE if successful, FALSE otherwise. - **/ - gboolean bmp_cfg_db_get_int(ConfigDb *db, - const gchar *section, - const gchar *key, - gint *value); - - /** - * bmp_cfg_db_get_bool: - * @db: A configuration database handle. - * @section: The section of the configuration database to search. - * @key: The name of the field in the configuration database to look up. - * @value: Pointer to a boolean to put the data in. - * - * Searches the configuration database for a value. - * - * Return value: TRUE if successful, FALSE otherwise. - **/ - gboolean bmp_cfg_db_get_bool(ConfigDb *db, - const gchar *section, - const gchar *key, - gboolean *value); - - /** - * bmp_cfg_db_get_float: - * @db: A configuration database handle. - * @section: The section of the configuration database to search. - * @key: The name of the field in the configuration database to look up. - * @value: Pointer to a floating point integer to put the data in. - * - * Searches the configuration database for a value. - * - * Return value: TRUE if successful, FALSE otherwise. - **/ - gboolean bmp_cfg_db_get_float(ConfigDb *db, - const gchar *section, - const gchar *key, - gfloat *value); - - /** - * bmp_cfg_db_get_double: - * @db: A configuration database handle. - * @section: The section of the configuration database to search. - * @key: The name of the field in the configuration database to look up. - * @value: Pointer to a double-precision floating point integer to put the data in. - * - * Searches the configuration database for a value. - * - * Return value: TRUE if successful, FALSE otherwise. - **/ - gboolean bmp_cfg_db_get_double(ConfigDb *db, - const gchar *section, - const gchar *key, - gdouble *value); - - /** - * bmp_cfg_db_set_string: - * @db: A configuration database handle. - * @section: The section of the configuration database to search. - * @key: The name of the field in the configuration database to set. - * @value: Pointer to a buffer containing the data. - * - * Sets a value in the configuration database. - **/ - void bmp_cfg_db_set_string(ConfigDb *db, - const gchar *section, - const gchar *key, - const gchar *value); - - /** - * bmp_cfg_db_set_int: - * @db: A configuration database handle. - * @section: The section of the configuration database to search. - * @key: The name of the field in the configuration database to set. - * @value: Pointer to an integer containing the data. - * - * Sets a value in the configuration database. - **/ - void bmp_cfg_db_set_int(ConfigDb *db, - const gchar *section, - const gchar *key, - gint value); - - /** - * bmp_cfg_db_set_bool: - * @db: A configuration database handle. - * @section: The section of the configuration database to search. - * @key: The name of the field in the configuration database to set. - * @value: Pointer to a boolean containing the data. - * - * Sets a value in the configuration database. - **/ - void bmp_cfg_db_set_bool(ConfigDb *db, - const gchar *section, - const gchar *key, - gboolean value); - - /** - * bmp_cfg_db_set_float: - * @db: A configuration database handle. - * @section: The section of the configuration database to search. - * @key: The name of the field in the configuration database to set. - * @value: Pointer to a floating point integer containing the data. - * - * Sets a value in the configuration database. - **/ - void bmp_cfg_db_set_float(ConfigDb *db, - const gchar *section, - const gchar *key, - gfloat value); - - /** - * bmp_cfg_db_set_double: - * @db: A configuration database handle. - * @section: The section of the configuration database to search. - * @key: The name of the field in the configuration database to set. - * @value: Pointer to a double precision floating point integer containing the data. - * - * Sets a value in the configuration database. - **/ - void bmp_cfg_db_set_double(ConfigDb *db, - const gchar *section, - const gchar *key, - gdouble value); - - /** - * bmp_cfg_db_unset_key: - * @db: A configuration database handle. - * @section: The section of the configuration database to search. - * @key: The name of the field in the configuration database to set. - * - * Removes a value from the configuration database. - **/ - void bmp_cfg_db_unset_key(ConfigDb *db, - const gchar *section, - const gchar *key); - -G_END_DECLS - -#endif /* CONFIGDB_H */ -