Contents of /trunk/src/gcvote.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 165 - (show annotations)
Sun Nov 8 20:32:55 2009 UTC (14 years, 5 months ago) by harbaum
File MIME type: text/plain
File size: 1892 byte(s)
Lots of Fremantle'ization
1 /*
2 * Copyright (C) 2009 Till Harbaum <till@harbaum.org>.
3 *
4 * This file is part of GPXView.
5 *
6 * GPXView is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * GPXView is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with GPXView. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #ifndef GCVOTE_H
21 #define GCVOTE_H
22
23 #define GCVOTE_NONE -1
24
25 #include "gconf.h"
26
27 #include <curl/curl.h>
28 #include <curl/types.h>
29
30 /* the full vote structure used during parsing */
31 typedef struct gcvote_s {
32 int quality;
33 int votes;
34 char *id;
35 struct gcvote_s *next;
36 } gcvote_t;
37
38 /* a simple single vote */
39 typedef struct {
40 int quality;
41 int votes;
42 } vote_t;
43
44 typedef struct {
45 char *ptr;
46 int len;
47 } curl_mem_t;
48
49 typedef void (*gcvote_cb)(vote_t *, gpointer data);
50
51 /* structure shared between worker and master thread */
52 typedef struct {
53 gint refcount; /* reference counter for master and worker thread */
54
55 char *url, *id;
56
57 /* curl/http related stuff: */
58 CURLcode res;
59
60 curl_mem_t mem; /* used for NET_IO_DL_MEM */
61
62 gcvote_cb cb;
63 gpointer userdata;
64
65 /* system proxy settings if present */
66 proxy_t *proxy;
67
68 } gcvote_request_t;
69
70 vote_t *gcvote_restore(appdata_t *appdata, cache_t *cache);
71 gcvote_request_t *gcvote_request(appdata_t *appdata, gcvote_cb,
72 char *url, gpointer);
73 void gcvote_request_free(gcvote_request_t *request);
74 void gcvote_save(appdata_t *appdata, cache_t *cache, curl_mem_t *mem);
75
76 #endif // GCVOTE_H