~ubuntu-branches/ubuntu/wily/xmms2/wily

« back to all changes in this revision

Viewing changes to src/xmms/bindata.c

  • Committer: Bazaar Package Importer
  • Author(s): Benjamin Drung
  • Date: 2008-07-04 16:23:34 UTC
  • mfrom: (1.1.5 upstream) (6.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080704162334-b3esbkcapt8wbrk4
Tags: 0.5DrLecter-2ubuntu1
* Merge from debian unstable (LP: #241098), remaining changes:
  + debian/control:
    + Update Maintainer field
    + add lpia to xmms2-plugin-alsa supported architectures
    + Added liba52-0.7.4-dev to build depends
  + debian/rules: Added patch, patch-stamp and unpatch
  + changed 01_gcc4.3.patch:
    + src/include/xmmsclient/xmmsclient++/helpers.h: Added #include <climits>
* New upstream relase fixes LP: #212566, #222341

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*  XMMS2 - X Music Multiplexer System
2
 
 *  Copyright (C) 2003-2007 XMMS2 Team
 
2
 *  Copyright (C) 2003-2008 XMMS2 Team
3
3
 *
4
4
 *  PLUGINS ARE NOT CONSIDERED TO BE DERIVED WORK !!!
5
5
 *
62
62
static gchar *xmms_bindata_add (xmms_bindata_t *bindata, GString *data, xmms_error_t *err);
63
63
static GString *xmms_bindata_retrieve (xmms_bindata_t *bindata, gchar *hash, xmms_error_t *err);
64
64
static void xmms_bindata_remove (xmms_bindata_t *bindata, gchar *hash, xmms_error_t *);
 
65
static GList *xmms_bindata_list (xmms_bindata_t *bindata, xmms_error_t *err);
65
66
static gboolean _xmms_bindata_add (xmms_bindata_t *bindata, const guchar *data, gsize len, gchar hash[33], xmms_error_t *err);
66
67
 
67
68
XMMS_CMD_DEFINE (get_data, xmms_bindata_retrieve, xmms_bindata_t *, BIN, STRING, NONE);
68
69
XMMS_CMD_DEFINE (add_data, xmms_bindata_add, xmms_bindata_t *, STRING, BIN, NONE);
69
70
XMMS_CMD_DEFINE (remove_data, xmms_bindata_remove, xmms_bindata_t *, NONE, STRING, NONE);
 
71
XMMS_CMD_DEFINE (list_data, xmms_bindata_list, xmms_bindata_t *, LIST, NONE, NONE);
70
72
 
71
73
xmms_bindata_t *
72
74
xmms_bindata_init ()
89
91
                             XMMS_IPC_CMD_GET_DATA,
90
92
                             XMMS_CMD_FUNC (get_data));
91
93
 
 
94
        xmms_object_cmd_add (XMMS_OBJECT (obj),
 
95
                             XMMS_IPC_CMD_LIST_DATA,
 
96
                             XMMS_CMD_FUNC (list_data));
 
97
 
92
98
        xmms_ipc_object_register (XMMS_IPC_OBJECT_BINDATA, XMMS_OBJECT (obj));
93
99
 
94
100
        tmp = XMMS_BUILD_PATH ("bindata");
261
267
        return;
262
268
}
263
269
 
 
270
static GList *
 
271
xmms_bindata_list (xmms_bindata_t *bindata, xmms_error_t *err)
 
272
{
 
273
        GList *entries = NULL;
 
274
        gchar *path;
 
275
        const gchar *file;
 
276
        GDir *dir;
 
277
 
 
278
        path = XMMS_BUILD_PATH ("bindata");
 
279
        dir = g_dir_open (path, 0, NULL);
 
280
        g_free (path);
 
281
 
 
282
        if (!dir) {
 
283
                xmms_error_set (err, XMMS_ERROR_GENERIC,
 
284
                                "Couldn't open bindata directory");
 
285
                return NULL;
 
286
        }
 
287
 
 
288
        while ((file = g_dir_read_name (dir))) {
 
289
                entries = g_list_prepend (entries,
 
290
                                          xmms_object_cmd_value_str_new (file));
 
291
        }
 
292
 
 
293
        g_dir_close (dir);
 
294
 
 
295
        return entries;
 
296
}
 
297
 
264
298
/*
265
299
  Copyright (C) 1999, 2000, 2002 Aladdin Enterprises.  All rights reserved.
266
300