Updated Finnish translation
[rhythmbox.git] / daapsharing / rb-daap-connection.h
blob8a67df46e0b0147062381bd7df7992eea9b4e763
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
3 * Header for DAAP (iTunes Music Sharing) hashing, connection
5 * Copyright (C) 2004-2005 Charles Schmidt <cschmidt2@emich.edu>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
23 #ifndef __RB_DAAP_CONNECTION_H
24 #define __RB_DAAP_CONNECTION_H
26 #include <glib.h>
27 #include <glib-object.h>
28 #include "rhythmdb.h"
30 G_BEGIN_DECLS
32 typedef struct {
33 char *name;
34 int id;
35 GList *uris;
36 } RBDAAPPlaylist;
38 #define RB_TYPE_DAAP_CONNECTION (rb_daap_connection_get_type ())
39 #define RB_DAAP_CONNECTION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), RB_TYPE_DAAP_CONNECTION, RBDAAPConnection))
40 #define RB_DAAP_CONNECTION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), RB_TYPE_DAAP_CONNECTION, RBDAAPConnectionClass))
41 #define RB_IS_DAAP_CONNECTION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), RB_TYPE_DAAP_CONNECTION))
42 #define RB_IS_DAAP_CONNECTION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), RB_TYPE_DAAP_CONNECTION))
43 #define RB_DAAP_CONNECTION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), RB_TYPE_DAAP_CONNECTION, RBDAAPConnectionClass))
45 typedef struct RBDAAPConnectionPrivate RBDAAPConnectionPrivate;
47 typedef enum {
48 DAAP_GET_INFO = 0,
49 DAAP_GET_PASSWORD,
50 DAAP_LOGIN,
51 DAAP_GET_REVISION_NUMBER,
52 DAAP_GET_DB_INFO,
53 DAAP_GET_SONGS,
54 DAAP_GET_PLAYLISTS,
55 DAAP_GET_PLAYLIST_ENTRIES,
56 DAAP_LOGOUT,
57 DAAP_DONE
58 } RBDAAPConnectionState;
60 typedef struct {
61 GObject parent;
62 RBDAAPConnectionPrivate *priv;
63 } RBDAAPConnection;
65 typedef struct {
66 GObjectClass parent;
68 void (* connected) (RBDAAPConnection *connection);
69 void (* disconnected) (RBDAAPConnection *connection);
71 char * (* authenticate) (RBDAAPConnection *connection,
72 const char *name);
73 void (* connecting) (RBDAAPConnection *connection,
74 RBDAAPConnectionState state,
75 float progress);
77 void (* operation_done) (RBDAAPConnection *connection);
79 } RBDAAPConnectionClass;
81 /* hmm, maybe should give more error information? */
82 typedef gboolean (* RBDAAPConnectionCallback) (RBDAAPConnection *connection,
83 gboolean result,
84 const char *reason,
85 gpointer user_data);
87 GType rb_daap_connection_get_type (void);
89 RBDAAPConnection * rb_daap_connection_new (const char *name,
90 const char *host,
91 int port,
92 gboolean password_protected,
93 RhythmDB *db,
94 RhythmDBEntryType type);
96 gboolean rb_daap_connection_is_connected (RBDAAPConnection *connection);
97 void rb_daap_connection_connect (RBDAAPConnection *connection,
98 RBDAAPConnectionCallback callback,
99 gpointer user_data);
100 void rb_daap_connection_disconnect (RBDAAPConnection *connection,
101 RBDAAPConnectionCallback callback,
102 gpointer user_data);
104 char * rb_daap_connection_get_headers (RBDAAPConnection *connection,
105 const char *uri,
106 gint64 bytes);
108 GSList * rb_daap_connection_get_playlists (RBDAAPConnection *connection);
110 G_END_DECLS
112 #endif /* __RB_DAAP_CONNECTION_H */