~ubuntu-branches/ubuntu/precise/rhythmbox/precise-201203091205

« back to all changes in this revision

Viewing changes to daapsharing/rb-daap-connection.h

Tags: upstream-0.9.5
ImportĀ upstreamĀ versionĀ 0.9.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
 
1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
 
2
 *
2
3
 *  Header for DAAP (iTunes Music Sharing) hashing, connection
3
4
 *
4
 
 *  Copyright (C) 2004,2005 Charles Schmidt <cschmidt2@emich.edu>
 
5
 *  Copyright (C) 2004-2005 Charles Schmidt <cschmidt2@emich.edu>
5
6
 *
6
7
 *  This program is free software; you can redistribute it and/or modify
7
8
 *  it under the terms of the GNU General Public License as published by
15
16
 *
16
17
 *  You should have received a copy of the GNU General Public License
17
18
 *  along with this program; if not, write to the Free Software
18
 
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
19
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA.
19
20
 *
20
21
 */
21
22
 
22
23
#ifndef __RB_DAAP_CONNECTION_H
23
 
#define __RB_DAAP_CONNECTIONH
 
24
#define __RB_DAAP_CONNECTION_H
24
25
 
25
26
#include <glib.h>
26
27
#include <glib-object.h>
28
29
 
29
30
G_BEGIN_DECLS
30
31
 
31
 
 
32
32
typedef struct {
33
 
        gchar *name;
34
 
        gint id;
 
33
        char  *name;
 
34
        int    id;
35
35
        GList *uris;
36
36
} RBDAAPPlaylist;
37
37
 
43
43
#define RB_IS_DAAP_CONNECTION_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), RB_TYPE_DAAP_CONNECTION))
44
44
#define RB_DAAP_CONNECTION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), RB_TYPE_DAAP_CONNECTION, RBDAAPConnectionClass))
45
45
 
 
46
typedef struct RBDAAPConnectionPrivate RBDAAPConnectionPrivate;
 
47
 
 
48
typedef enum {
 
49
        DAAP_GET_INFO = 0,
 
50
        DAAP_GET_PASSWORD,
 
51
        DAAP_LOGIN,
 
52
        DAAP_GET_REVISION_NUMBER,
 
53
        DAAP_GET_DB_INFO,
 
54
        DAAP_GET_SONGS,
 
55
        DAAP_GET_PLAYLISTS,
 
56
        DAAP_GET_PLAYLIST_ENTRIES,
 
57
        DAAP_LOGOUT,
 
58
        DAAP_DONE
 
59
} RBDAAPConnectionState;
46
60
 
47
61
typedef struct {
48
62
        GObject parent;
 
63
        RBDAAPConnectionPrivate *priv;
49
64
} RBDAAPConnection;
50
65
 
51
66
typedef struct {
52
67
        GObjectClass parent;
 
68
 
 
69
        void   (* connected)      (RBDAAPConnection     *connection);
 
70
        void   (* disconnected)   (RBDAAPConnection     *connection); 
 
71
 
 
72
        char * (* authenticate)   (RBDAAPConnection     *connection,
 
73
                                   const char           *name);
 
74
        void   (* connecting)     (RBDAAPConnection     *connection,
 
75
                                   RBDAAPConnectionState state,
 
76
                                   float                 progress);
 
77
 
 
78
        void   (* operation_done) (RBDAAPConnection     *connection);
 
79
 
53
80
} RBDAAPConnectionClass;
54
81
 
55
82
 
56
83
/* hmm, maybe should give more error information? */
57
 
typedef gboolean (*RBDAAPConnectionCallback) (RBDAAPConnection *connection,
58
 
                                              gboolean result,
59
 
                                              gpointer user_data);
60
 
 
61
 
RBDAAPConnection * 
62
 
rb_daap_connection_new (const gchar *name,
63
 
                        const gchar *host,
64
 
                        gint port,
65
 
                        gboolean password_protected,
66
 
                        RhythmDB *db,
67
 
                        RhythmDBEntryType type,
68
 
                        RBDAAPConnectionCallback callback,
69
 
                        gpointer user_data);
70
 
 
71
 
/* will cause an assertion failure if the login has not completed yet (probably should FIXME) */
72
 
void
73
 
rb_daap_connection_logout (RBDAAPConnection *connection,
74
 
                           RBDAAPConnectionCallback callback,
75
 
                           gpointer user_data);
76
 
 
77
 
gchar * 
78
 
rb_daap_connection_get_headers (RBDAAPConnection *connection,
79
 
                                const gchar *uri,
80
 
                                gint64 bytes);
81
 
 
82
 
GSList * 
83
 
rb_daap_connection_get_playlists (RBDAAPConnection *connection);
84
 
 
85
 
GType 
86
 
rb_daap_connection_get_type (void);
 
84
typedef gboolean (* RBDAAPConnectionCallback)  (RBDAAPConnection *connection,
 
85
                                                gboolean          result,
 
86
                                                const char       *reason,
 
87
                                                gpointer          user_data);
 
88
 
 
89
GType              rb_daap_connection_get_type        (void);
 
90
 
 
91
RBDAAPConnection * rb_daap_connection_new             (const char              *name,
 
92
                                                       const char              *host,
 
93
                                                       int                      port,
 
94
                                                       gboolean                 password_protected,
 
95
                                                       RhythmDB                *db,
 
96
                                                       RhythmDBEntryType        type);
 
97
 
 
98
gboolean           rb_daap_connection_is_connected    (RBDAAPConnection        *connection);
 
99
void               rb_daap_connection_connect         (RBDAAPConnection        *connection,
 
100
                                                       RBDAAPConnectionCallback callback,
 
101
                                                       gpointer                 user_data);
 
102
void               rb_daap_connection_disconnect      (RBDAAPConnection        *connection,
 
103
                                                       RBDAAPConnectionCallback callback,
 
104
                                                       gpointer                 user_data);
 
105
 
 
106
char *             rb_daap_connection_get_headers     (RBDAAPConnection         *connection,
 
107
                                                       const char               *uri,
 
108
                                                       gint64                    bytes);
 
109
 
 
110
GSList *           rb_daap_connection_get_playlists   (RBDAAPConnection         *connection);
87
111
 
88
112
G_END_DECLS
89
113