gphoto2-context.h
Go to the documentation of this file.
#ifndef __GPHOTO2_CONTEXT_H__
#define __GPHOTO2_CONTEXT_H__
#include <stdarg.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
typedef struct _GPContext GPContext;
GPContext *gp_context_new (void);
void gp_context_ref (GPContext *context);
void gp_context_unref (GPContext *context);
typedef enum _GPContextFeedback {
GP_CONTEXT_FEEDBACK_OK,
GP_CONTEXT_FEEDBACK_CANCEL
} GPContextFeedback;
/* Functions */
typedef void (* GPContextIdleFunc) (GPContext *context, void *data);
typedef void (* GPContextErrorFunc) (GPContext *context, const char *format,
va_list args, void *data)
#if (__GNUC__ >= 3)
__attribute__((__format__(printf,2,0)))
#endif
;
typedef void (* GPContextStatusFunc) (GPContext *context, const char *format,
va_list args, void *data)
#if (__GNUC__ >= 3)
__attribute__((__format__(printf,2,0)))
#endif
;
typedef void (* GPContextMessageFunc) (GPContext *context, const char *format,
va_list args, void *data)
#if (__GNUC__ >= 3)
__attribute__((__format__(printf,2,0)))
#endif
;
typedef GPContextFeedback (* GPContextQuestionFunc) (GPContext *context,
const char *format,
va_list args, void *data)
#if (__GNUC__ >= 3)
__attribute__((__format__(printf,2,0)))
#endif
;
typedef GPContextFeedback (* GPContextCancelFunc) (GPContext *context,
void *data);
typedef unsigned int (* GPContextProgressStartFunc) (GPContext *context,
float target,
const char *format,
va_list args, void *data)
#if (__GNUC__ >= 3)
__attribute__((__format__(printf,3,0)))
#endif
;
typedef void (* GPContextProgressUpdateFunc) (GPContext *context,
unsigned int id,
float current,
void *data);
typedef void (* GPContextProgressStopFunc) (GPContext *context,
unsigned int id,
void *data);
/* Setting those functions (frontends) */
void gp_context_set_idle_func (GPContext *context,
GPContextIdleFunc func, void *data);
void gp_context_set_progress_funcs (GPContext *context,
GPContextProgressStartFunc start_func,
GPContextProgressUpdateFunc update_func,
GPContextProgressStopFunc stop_func,
void *data);
void gp_context_set_error_func (GPContext *context,
GPContextErrorFunc func, void *data);
void gp_context_set_status_func (GPContext *context,
GPContextStatusFunc func, void *data);
void gp_context_set_question_func (GPContext *context,
GPContextQuestionFunc func, void *data);
void gp_context_set_cancel_func (GPContext *context,
GPContextCancelFunc func, void *data);
void gp_context_set_message_func (GPContext *context,
GPContextMessageFunc func, void *data);
/* Calling those functions (backends) */
void gp_context_idle (GPContext *context);
void gp_context_error (GPContext *context, const char *format, ...)
#ifdef __GNUC__
__attribute__((__format__(printf,2,3)))
#endif
;
void gp_context_status (GPContext *context, const char *format, ...)
#ifdef __GNUC__
__attribute__((__format__(printf,2,3)))
#endif
;
void gp_context_message (GPContext *context, const char *format, ...)
#ifdef __GNUC__
__attribute__((__format__(printf,2,3)))
#endif
;
GPContextFeedback gp_context_question (GPContext *context, const char *format,
...)
#ifdef __GNUC__
__attribute__((__format__(printf,2,3)))
#endif
;
GPContextFeedback gp_context_cancel (GPContext *context);
unsigned int gp_context_progress_start (GPContext *context, float target,
const char *format, ...)
#ifdef __GNUC__
__attribute__((__format__(printf,3,4)))
#endif
;
void gp_context_progress_update (GPContext *context, unsigned int id,
float current);
void gp_context_progress_stop (GPContext *context, unsigned int id);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __GPHOTO2_CONTEXT_H__ */
gp_context_ref
void gp_context_ref(GPContext *context)
Definition: gphoto2-context.c:91
gp_context_unref
void gp_context_unref(GPContext *context)
Decrements reference count of a context.
Definition: gphoto2-context.c:116
gp_context_message
void gp_context_message(GPContext *context, const char *format,...)
Print a message to the context.
Definition: gphoto2-context.c:253
gp_context_progress_start
unsigned int gp_context_progress_start(GPContext *context, float target, const char *format,...)
Start progress tracking.
Definition: gphoto2-context.c:156
gp_context_idle
void gp_context_idle(GPContext *context)
Notify frontend of a brief idle time.
Definition: gphoto2-context.c:136
GPContextFeedback
enum _GPContextFeedback GPContextFeedback
Return codes that can be returned by progress handling.
GP_CONTEXT_FEEDBACK_OK
Definition: gphoto2-context.h:56
GP_CONTEXT_FEEDBACK_CANCEL
Definition: gphoto2-context.h:57
gp_context_new
GPContext * gp_context_new(void)
Creates a new context.
Definition: gphoto2-context.c:71
gp_context_question
GPContextFeedback gp_context_question(GPContext *context, const char *format,...)
Ask frontend user a question.
Definition: gphoto2-context.c:287
_GPContextFeedback
_GPContextFeedback
Return codes that can be returned by progress handling.
Definition: gphoto2-context.h:55
gp_context_cancel
GPContextFeedback gp_context_cancel(GPContext *context)
Definition: gphoto2-context.c:315
_GPContext
Definition: gphoto2-context.c:35