public
Description: Library to access lastfm via it's 2.0 api
Homepage: https://launchpad.net/liblastfm
Clone URL: git://github.com/LCID-Fire/liblastfm.git
Click here to lend your support to: liblastfm and make a donation at www.pledgie.com !
liblastfm / callback.h
100644 48 lines (40 sloc) 1.679 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef CALLBACK_H_
#define CALLBACK_H_
 
#define _XOPEN_SOURCE
#include <time.h>
#include <glib.h>
//#define _XOPEN_SOURCE //glibc2 needs this
 
enum error_codes
{
INVALID_SERVICE = 2,
    INVALID_METHOD = 3,
    AUTHENTICATION_FAILED = 4,
    INVALID_FORMAT = 5,
    INVALID_PARAMETERS = 6,
    INVALID_RESSOURCE = 7,
    INVALID_SESSION = 9,
    INVALID_API = 10,
    SERVICE_OFFLINE = 11,
    SUBSCRIBERS_ONLY = 12
};
 
//should GError be not NULL you have to take care of it
//and finally call g_error_free it
 
//in the case of an error it is guaranteed that the
//data passed to the callback does not have to be freed
 
//one element callbacks - called only once
typedef void (*void_callback)(gpointer user_data, GError* error);
typedef void (*utf8_callback)(const gchar* utf8, gpointer user_data, GError* error);
typedef void (*url_callback)(const gchar* url, gpointer user_data, GError* error);
typedef void (*uint_callback)(guint digit, gpointer user_data, GError* error);
typedef void (*boolean_callback)(gboolean istrue, gpointer user_data, GError* error);
typedef void (*date_time_callback)(struct tm, gpointer user_data, GError* error);
 
//mutliple element callbacks
//terminated by call with is_end == TRUE
typedef void (*multi_utf8_callback)(const gchar* artist_name, gpointer user_data, GError* error, gboolean is_end);
typedef multi_utf8_callback artists_callback;
typedef multi_utf8_callback tags_callback;
typedef multi_utf8_callback tracks_callback;
typedef multi_utf8_callback albums_callback;
typedef multi_utf8_callback events_callback;
typedef multi_utf8_callback users_callback;
 
#endif /*CALLBACK_H_*/