[webkit-gtk] download with webkit

Giovanni giovyemmanuel at hotmail.it
Wed Jun 2 01:53:38 PDT 2010


> Assuming that download_func is call back for
> g_signal_connect (web_view, "download-requested", G_CALLBACK
> (download_func), NULL);
> the function should look some what like below..
> 
> gboolean download_func(WebKitWebView* page,WebKitDownload*
> download,gpointer data)
> {
> 
> gchar *destination = NULL;
> destination     = g_filename_to_uri ("/home/john/Scaricat/test.ext",
> NULL, NULL);
> if(destination)
> {
> webkit_download_set_destination_uri(download,destination);
> g_free (destination);
> return TRUE;
> }
> else
> return FALSE;
> 
> }

it doesn't work...

but i don't understood why i must put the name of the file to download 
"test.ext", why not only the destination foder?

//-------------funzione MIME--------------------//
gboolean permessi (WebKitWebView *web_view, WebKitWebFrame *frame, 
WebKitNetworkRequest *request, gchar *mimetype, WebKitWebPolicyDecision 
*policy_decision)
{
if (webkit_web_view_can_show_mime_type (WEBKIT_WEB_VIEW (web_view),mimetype))
        return FALSE;

webkit_web_policy_decision_download (policy_decision);
//webkit_web_view_stop_loading (WEBKIT_WEB_VIEW (web_view));

return TRUE;
}

this is the code...

//-------------funzione MIME--------------------//
gboolean permessi (WebKitWebView *web_view, WebKitWebFrame *frame, 
WebKitNetworkRequest *request, gchar *mimetype, WebKitWebPolicyDecision 
*policy_decision)
{
if (webkit_web_view_can_show_mime_type (WEBKIT_WEB_VIEW (web_view),mimetype))
        return FALSE;

webkit_web_policy_decision_download (policy_decision);
//webkit_web_view_stop_loading (WEBKIT_WEB_VIEW (web_view));

return TRUE;
}

//-------------funzione download---------------//
gboolean download_func (WebKitWebView *web_view, WebKitDownload 
*download,gpointer data)
{
 gchar *destination = NULL;
destination = g_filename_to_uri ("/home/john/Scaricati/test.ext",NULL, NULL);
if(destination)
{
webkit_download_set_destination_uri(download,destination);
//webkit_download_start(download);
g_free (destination);
return TRUE;
}
else
return FALSE; 
}

now the error is...

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed

(prova:21701): GLib-GIO-CRITICAL **: g_output_stream_write_all: assertion 
`G_IS_OUTPUT_STREAM (stream)' failed








More information about the webkit-gtk mailing list