album art support and other work on play window
[devious] / devious.h
1 /*
2  * Devious: UPNP Control Point for Maemo 5
3  *
4  * Copyright (C) 2009 Kyle Cronan
5  *
6  * Author: Kyle Cronan <kyle@pbx.org>
7  *
8  * This program is free software; you can redistribute it and/or modify it
9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; version 3 of the License, or (at your option)
11  * any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
16  * Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this library; if not, write to the Free Software Foundation, Inc.,
20  * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21  *
22  */
23
24 #ifndef INCLUDED_DEVIOUS_H
25 #define INCLUDED_DEVIOUS_H 1
26
27 #define APPLICATION_NAME "Devious"
28 #define PLAY_WINDOW_TITLE "Now playing"
29 #define CHOOSE_TARGET "Choose target"
30 #define ROW_HEIGHT 75
31 #define MP_ICON_PATH "/usr/share/themes/default/mediaplayer/"
32 #define ICON_WIDTH 90
33 #define ICON_XALIGN 0.6
34 #define PLAY_WINDOW_IMAGE_SIZE 295
35 #define MEDIA_RENDERER "urn:schemas-upnp-org:device:MediaRenderer:*"
36 #define MEDIA_SERVER "urn:schemas-upnp-org:device:MediaServer:*"
37 #define CONTENT_DIR "urn:schemas-upnp-org:service:ContentDirectory"
38 #define CONNECTION_MANAGER "urn:schemas-upnp-org:service:ConnectionManager"
39 #define AV_TRANSPORT "urn:schemas-upnp-org:service:AVTransport"
40 #define ALBUM_ART "albumArtURI"
41 #define MAX_BROWSE 64
42
43 struct proxy_set {
44     GHashTable *renderers;
45     GHashTable *servers;
46     GtkListStore *renderer_list;
47     GtkListStore *server_list;
48     struct application *app;
49 };
50
51 struct application {
52     struct proxy_set set;
53     SoupSession *soup;
54     HildonPickerButton *renderer_picker;
55     GUPnPDIDLLiteParser *didl_parser;
56 };
57
58 struct proxy {
59     GtkTreeRowReference *row;
60     GUPnPDeviceProxy *proxy;
61     char *name;
62     char **protocols;
63     struct proxy_set *set;
64 };
65
66 struct browse_data {
67     GUPnPServiceProxy *content_dir;
68     gchar *id;
69     guint32 starting_index;
70     GtkListStore *list;
71     struct proxy_set *set;
72 };
73
74 struct selection_data {
75     GtkTreeRowReference *row;
76     char *duration;
77     char *art_uri;
78     GtkWidget *art_image;
79     struct proxy_set *set;
80 };
81
82 struct toggle_data {
83     GdkPixbuf *pixbufs[2];
84     GtkImage *image;
85     gboolean toggle;
86     gboolean state;
87     void (*callback)(GtkWidget *, gpointer);
88     gpointer user_data;
89 };
90
91 enum {
92     COL_ICON = 0,
93     COL_LABEL,
94     COL_ID,
95     COL_CONTENT,
96     COL_CONTAINER,
97     NUM_COLS
98 };
99
100
101 void browse(GUPnPServiceProxy *content_dir, const char *container_id,
102             guint32 starting_index, guint32 requested_count,
103             GtkListStore *list, struct proxy_set *proxy_set);
104
105 void set_panarea_padding(GtkWidget *child, gpointer data);
106
107 GtkWidget *new_selector(GtkListStore *list);
108
109 void content_select(HildonTouchSelector *selector, gint column, gpointer data);
110
111 GtkWidget *content_window(struct proxy *server, char *title,
112                           GtkListStore **list);
113
114 void server_select(HildonTouchSelector *selector, gint column, gpointer data);
115
116 GtkWidget *main_window(HildonProgram *program, struct proxy_set *proxy_set);
117
118 void add_renderer(GUPnPDeviceProxy *proxy, struct proxy_set *proxy_set);
119
120 void add_server(GUPnPDeviceProxy *proxy, struct proxy_set *proxy_set);
121
122 void remove_server(GUPnPDeviceProxy *proxy, struct proxy_set *proxy_set);
123
124 void device_proxy_available(GUPnPControlPoint *cp,
125                             GUPnPDeviceProxy *proxy, gpointer user_data);
126
127 void init_upnp(struct proxy_set *proxy_set);
128
129 #endif /* INCLUDED_DEVIOUS_H */