Remove generated files
[framework/connectivity/libgphoto2.git] / examples / context.c
1 #include <stdio.h>
2 #include "samples.h"
3
4 static void
5 ctx_error_func (GPContext *context, const char *format, va_list args, void *data)
6 {
7         fprintf  (stderr, "\n");
8         fprintf  (stderr, "*** Contexterror ***              \n");
9         vfprintf (stderr, format, args);
10         fprintf  (stderr, "\n");
11         fflush   (stderr);
12 }
13
14 static void
15 ctx_status_func (GPContext *context, const char *format, va_list args, void *data)
16 {
17         vfprintf (stderr, format, args);
18         fprintf  (stderr, "\n");
19         fflush   (stderr);
20 }
21
22 GPContext* sample_create_context() {
23         GPContext *context;
24
25         /* This is the mandatory part */
26         context = gp_context_new();
27
28         /* All the parts below are optional! */
29         gp_context_set_error_func (context, ctx_error_func, NULL);
30         gp_context_set_status_func (context, ctx_status_func, NULL);
31
32         /* also:
33         gp_context_set_cancel_func    (p->context, ctx_cancel_func,  p);
34         gp_context_set_message_func   (p->context, ctx_message_func, p);
35         if (isatty (STDOUT_FILENO))
36                 gp_context_set_progress_funcs (p->context,
37                         ctx_progress_start_func, ctx_progress_update_func,
38                         ctx_progress_stop_func, p);
39          */
40         return context;
41 }