~ubuntu-branches/ubuntu/intrepid/curl/intrepid-security

« back to all changes in this revision

Viewing changes to docs/examples/curlgtk.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2008-06-18 15:21:57 UTC
  • mfrom: (1.1.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20080618152157-qq94aiequcq35w6b
Tags: 7.18.2-1ubuntu1
* Merge from debian unstable, remaining changes:
  - Drop the stunnel build dependency.
  - Drop the build-dependency on libdb4.5-dev
  - Add build-dependency on openssh-server
  - Drop libssh2-1-dev from libcurl4-openssl-dev's Depends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 *                            | (__| |_| |  _ <| |___
6
6
 *                             \___|\___/|_| \_\_____|
7
7
 *
8
 
 * $Id: curlgtk.c,v 1.5 2004/11/22 13:43:52 bagder Exp $
 
8
 * $Id: curlgtk.c,v 1.7 2008-05-22 21:20:08 danf Exp $
9
9
 */
10
10
/* Copyright (c) 2000 David Odin (aka DindinX) for MandrakeSoft */
11
11
/* an attempt to use the curl library in concert with a gtk-threaded application */
29
29
  return fread(ptr, size, nmemb, stream);
30
30
}
31
31
 
32
 
int my_progress_func(GtkWidget *Bar,
 
32
int my_progress_func(GtkWidget *bar,
33
33
                     double t, /* dltotal */
34
34
                     double d, /* dlnow */
35
35
                     double ultotal,
37
37
{
38
38
/*  printf("%d / %d (%g %%)\n", d, t, d*100.0/t);*/
39
39
  gdk_threads_enter();
40
 
  gtk_progress_set_value(GTK_PROGRESS(Bar), d*100.0/t);
 
40
  gtk_progress_set_value(GTK_PROGRESS(bar), d*100.0/t);
41
41
  gdk_threads_leave();
42
42
  return 0;
43
43
}
58
58
    curl_easy_setopt(curl, CURLOPT_WRITEDATA, outfile);
59
59
    curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, my_write_func);
60
60
    curl_easy_setopt(curl, CURLOPT_READFUNCTION, my_read_func);
61
 
    curl_easy_setopt(curl, CURLOPT_NOPROGRESS, FALSE);
 
61
    curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L);
62
62
    curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, my_progress_func);
63
63
    curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, Bar);
64
64
 
77
77
  GtkWidget *Window, *Frame, *Frame2;
78
78
  GtkAdjustment *adj;
79
79
 
 
80
  /* Must initialize libcurl before any threads are started */
 
81
  curl_global_init(CURL_GLOBAL_ALL);
 
82
 
80
83
  /* Init thread */
81
84
  g_thread_init(NULL);
82
85