5 #include "gmpc_easy_download.h"
7 gpointer config
= NULL
;
9 void show_error_message(void)
14 void playlist3_show_error_message(const char *message
, int el
)
21 int cfg_get_single_value_as_int_with_default(gpointer
*config
, const gchar
*a
, const gchar
*b
, int def
)
25 gchar
* cfg_get_single_value_as_string_with_default(gpointer
*config
, const gchar
*a
, const gchar
*b
, gchar
* def
)
29 gchar
*cfg_get_single_value_as_string(gpointer
*config
, const gchar
*a
, const gchar
*b
)
33 void cfg_set_single_value_as_string(gpointer
*config
, const gchar
*a
, const gchar
*b
, gchar
*def
)
37 void cfg_set_single_value_as_int(gpointer
*config
, const gchar
*a
, const gchar
*b
, int def
)
41 void downloaded2(const GEADAsyncHandler
*handle
, GEADStatus status
, gpointer user_data
)
43 GMainLoop
*loop
= user_data
;
44 if(status
== GEAD_PROGRESS
) return;
45 else if(status
== GEAD_DONE
){
47 const guchar
*data
= gmpc_easy_handler_get_data(handle
, &length
);
48 printf("Download: %li bytes\n", length
);
51 g_error("Download failed\n");
53 g_main_loop_quit(loop
);
56 void downloaded(const GEADAsyncHandler
*handle
, GEADStatus status
, gpointer user_data
)
58 GMainLoop
*loop
= user_data
;
59 if(status
== GEAD_PROGRESS
) return;
60 else if(status
== GEAD_DONE
){
61 GEADAsyncHandler
*handle2
;
63 const guchar
*data
= gmpc_easy_handler_get_data(handle
, &length
);
64 printf("Download: %li bytes\n", length
);
65 handle2
= gmpc_easy_async_downloader("http://maps.google.com", downloaded2
, loop
);
67 g_error("Download failed\n");
68 g_main_loop_quit(loop
);
71 int main(int argc
, char **argv
)
73 GEADAsyncHandler
*handle
;
76 loop
= g_main_loop_new(NULL
, FALSE
);
77 if(!g_thread_supported())
79 handle
= gmpc_easy_async_downloader("http://www.google.com", downloaded
, loop
);
80 g_main_loop_run(loop
);
81 gmpc_easy_async_quit();
82 g_main_loop_unref(loop
);