XMMS2
src/includepriv/xmmspriv/xmms_collection.h
Go to the documentation of this file.
00001 /*  XMMS2 - X Music Multiplexer System
00002  *  Copyright (C) 2003-2011 XMMS2 Team
00003  *
00004  *  PLUGINS ARE NOT CONSIDERED TO BE DERIVED WORK !!!
00005  *
00006  *  This library is free software; you can redistribute it and/or
00007  *  modify it under the terms of the GNU Lesser General Public
00008  *  License as published by the Free Software Foundation; either
00009  *  version 2.1 of the License, or (at your option) any later version.
00010  *
00011  *  This library is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  *  Lesser General Public License for more details.
00015  */
00016 
00017 #ifndef __XMMS_COLLECTION_H__
00018 #define __XMMS_COLLECTION_H__
00019 
00020 #include <glib.h>
00021 
00022 
00023 /*
00024  * Public definitions
00025  */
00026 
00027 #define XMMS_COLLECTION_NUM_NAMESPACES  2
00028 
00029 typedef enum {
00030     XMMS_COLLECTION_NSID_COLLECTIONS,
00031     XMMS_COLLECTION_NSID_PLAYLISTS,
00032     XMMS_COLLECTION_NSID_ALL,
00033     XMMS_COLLECTION_NSID_INVALID,
00034 } xmms_collection_namespace_id_t;
00035 
00036 
00037 /*
00038  * Private defintions
00039  */
00040 
00041 struct xmms_coll_dag_St;
00042 typedef struct xmms_coll_dag_St xmms_coll_dag_t;
00043 
00044 #include "xmms/xmms_error.h"
00045 #include "xmmsc/xmmsv_coll.h"
00046 #include "xmmspriv/xmms_playlist.h"
00047 #include "xmmspriv/xmms_medialib.h"
00048 
00049 typedef void (*FuncApplyToColl)(xmms_coll_dag_t *dag, xmmsv_coll_t *coll, xmmsv_coll_t *parent, void *udata);
00050 
00051 
00052 /*
00053  * Public functions
00054  */
00055 
00056 xmms_coll_dag_t * xmms_collection_init (xmms_playlist_t *playlist);
00057 
00058 void xmms_collection_sync (xmms_coll_dag_t *dag);
00059 GList * xmms_collection_query_ids (xmms_coll_dag_t *dag, xmmsv_coll_t *coll, gint32 lim_start, gint32 lim_len, xmmsv_t *order, xmms_error_t *err);
00060 
00061 
00062 void xmms_collection_foreach_in_namespace (xmms_coll_dag_t *dag, guint nsid, GHFunc f, void *udata);
00063 void xmms_collection_apply_to_all_collections (xmms_coll_dag_t *dag, FuncApplyToColl f, void *udata);
00064 void xmms_collection_apply_to_collection (xmms_coll_dag_t *dag, xmmsv_coll_t *coll, FuncApplyToColl f, void *udata);
00065 
00066 xmmsv_coll_t * xmms_collection_get_pointer (xmms_coll_dag_t *dag, const gchar *collname, guint namespace);
00067 void xmms_collection_update_pointer (xmms_coll_dag_t *dag, const gchar *name, guint nsid, xmmsv_coll_t *newtarget);
00068 const gchar * xmms_collection_find_alias (xmms_coll_dag_t *dag, guint nsid, xmmsv_coll_t *value, const gchar *key);
00069 xmms_medialib_entry_t xmms_collection_get_random_media (xmms_coll_dag_t *dag, xmmsv_coll_t *source);
00070 void xmms_collection_dag_replace (xmms_coll_dag_t *dag, xmms_collection_namespace_id_t nsid, gchar *key, xmmsv_coll_t *newcoll);
00071 
00072 xmms_collection_namespace_id_t xmms_collection_get_namespace_id (const gchar *namespace);
00073 const gchar *xmms_collection_get_namespace_string (xmms_collection_namespace_id_t nsid);
00074 
00075 gboolean xmms_collection_get_int_attr (xmmsv_coll_t *coll, const gchar *attrname, gint *val);
00076 gboolean xmms_collection_set_int_attr (xmmsv_coll_t *coll, const gchar *attrname, gint newval);
00077 
00078 GTree *xmms_collection_changed_msg_new (xmms_collection_changed_actions_t type, const gchar *plname, const gchar *namespace);
00079 void xmms_collection_changed_msg_send (xmms_coll_dag_t *colldag, GTree *dict);
00080 
00081 void bind_all_references (xmms_coll_dag_t *dag, xmmsv_coll_t *coll, xmmsv_coll_t *parent, void *udata);
00082 
00083 #define XMMS_COLLECTION_PLAYLIST_CHANGED_MSG(dag, name) xmms_collection_changed_msg_send (dag, xmms_collection_changed_msg_new (XMMS_COLLECTION_CHANGED_UPDATE, name, XMMS_COLLECTION_NS_PLAYLISTS))
00084 
00085 
00086 #endif