diff --git a/camlibs/kodak/dc3200/library.c b/camlibs/kodak/dc3200/library.c index 92dfe57a9..80a75bba2 100644 --- a/camlibs/kodak/dc3200/library.c +++ b/camlibs/kodak/dc3200/library.c @@ -361,7 +361,7 @@ int dc3200_get_data(Camera *camera, u_char **data, u_long *data_len, int command ptr_data += resp_len - data_start_pos; /* update gphoto2 frontend */ - gp_camera_progress(camera, (((float)total-(float)num_left)/(float)total)); +// gp_camera_progress(camera, (((float)total-(float)num_left)/(float)total)); break; case 0x01: @@ -382,7 +382,7 @@ int dc3200_get_data(Camera *camera, u_char **data, u_long *data_len, int command ptr_data += resp_len - data_start_pos; /* update gphoto2 frontend */ - gp_camera_progress(camera, (((float)total-(float)num_left)/(float)total)); +// gp_camera_progress(camera, (((float)total-(float)num_left)/(float)total)); break; case 0x81: @@ -404,7 +404,7 @@ int dc3200_get_data(Camera *camera, u_char **data, u_long *data_len, int command /* update gphoto2 frontend */ /*gp_frontend_progress(NULL, NULL, 100.0*(((float)total-(float)num_left)/(float)total));*/ - gp_camera_progress(camera, 1.); +// gp_camera_progress(camera, 1.); break; default: diff --git a/frontends/command-line/Makefile.am b/frontends/command-line/Makefile.am index 8a2b7a1e1..011bb5219 100644 --- a/frontends/command-line/Makefile.am +++ b/frontends/command-line/Makefile.am @@ -32,7 +32,6 @@ gphoto2_SOURCES = \ actions.c actions.h \ foreach.c foreach.h \ globals.h \ - interface.c interface.h \ main.c main.h \ options.c options.h \ range.c range.h \ diff --git a/frontends/command-line/gphoto2-cmd-capture.c b/frontends/command-line/gphoto2-cmd-capture.c index 6cae669a6..e307661f9 100644 --- a/frontends/command-line/gphoto2-cmd-capture.c +++ b/frontends/command-line/gphoto2-cmd-capture.c @@ -64,9 +64,6 @@ gp_cmd_capture_preview (Camera *camera, CameraFile *file, GPContext *context) aa_context *c; aa_renderparams *params; - /* We don't want status messages on our screen */ - gp_camera_set_status_func (camera, NULL, NULL); - c = aa_autoinit (&aa_defparams); if (!c) return (GP_ERROR); diff --git a/frontends/command-line/gphoto2-cmd-config.c b/frontends/command-line/gphoto2-cmd-config.c index 2e022fdc5..27dd447f7 100644 --- a/frontends/command-line/gphoto2-cmd-config.c +++ b/frontends/command-line/gphoto2-cmd-config.c @@ -527,15 +527,6 @@ show_widget (CmdConfig *cmd_config, CameraWidget *widget) return (GP_OK); } -static void -status_func (Camera *camera, const char *status, void *data) -{ - CmdConfig *cmd_config = data; - - /* We need to do something in here */ - cmd_config = NULL; -} - int gp_cmd_config (Camera *camera, GPContext *context) { @@ -564,7 +555,6 @@ gp_cmd_config (Camera *camera, GPContext *context) cmd_config.screen = screen; cmd_config.window = config; cmd_config.context = context; - gp_camera_set_status_func (camera, status_func, &cmd_config); result = show_widget (&cmd_config, config); /* Clean up */ diff --git a/frontends/command-line/interface.c b/frontends/command-line/interface.c deleted file mode 100644 index 2a36aa4d1..000000000 --- a/frontends/command-line/interface.c +++ /dev/null @@ -1,56 +0,0 @@ -#include -#include - -#include - -#include "interface.h" - -extern int glob_stdout; -extern int glob_quiet; - -void -status_func (Camera *camera, const char *status, void *data) -{ - if (glob_quiet) - return; - - if (status && *status) { - fprintf (stderr, "Status: %s\n", status); - fflush (stderr); - } else { - - /* - * gphoto2 tells us to clear the status. But it seems - * people really want '\n' above (not '\r'), therefore - * we can't clear the status. Hence, we don't do anything - * here. - * - * If we would use '\r' above, we could overwrite an existing - * status message by writing an empty line. But we don't, as - * when you're using the command line, stdout and stderr usually - * get mixed up on the same terminal. And overwriting the last - * program message with status message isn't really clever. - */ - } -} - -void -message_func (Camera *camera, const char *message, void *data) -{ - if (glob_quiet) - return; - - printf ("Message: %s\n", message); -} - -void -progress_func (Camera *camera, float percentage, void *data) -{ - if (glob_quiet) - return; - - if (percentage > 0.) { - printf ("Percent completed: %02.01f\r", percentage * 100.); - fflush(stdout); - } -} diff --git a/frontends/command-line/interface.h b/frontends/command-line/interface.h deleted file mode 100644 index 4baa96d59..000000000 --- a/frontends/command-line/interface.h +++ /dev/null @@ -1,3 +0,0 @@ -void status_func (Camera *camera, const char *status, void *data); -void progress_func (Camera *camera, float percentage, void *data); -void message_func (Camera *camera, const char *message, void *data); diff --git a/frontends/command-line/main.c b/frontends/command-line/main.c index bf1010d20..6f1ca3981 100644 --- a/frontends/command-line/main.c +++ b/frontends/command-line/main.c @@ -17,7 +17,6 @@ #include "actions.h" #include "foreach.h" -#include "interface.h" #include "options.h" #include "range.h" #include "shell.h" @@ -1179,8 +1178,6 @@ set_globals (void) if (!strncmp (glob_port, "serial:", 7)) CHECK_RESULT (gp_camera_set_port_speed (glob_camera, glob_speed)); - gp_camera_set_status_func (glob_camera, status_func, NULL); - return (GP_OK); } diff --git a/libgphoto2/gphoto2-camera.c b/libgphoto2/gphoto2-camera.c index cbb734eec..754d774ab 100644 --- a/libgphoto2/gphoto2-camera.c +++ b/libgphoto2/gphoto2-camera.c @@ -133,7 +133,6 @@ if ((c)->functions->pre_func) { \ r = (c)->functions->pre_func (c,ctx); \ if (r < 0) { \ - gp_camera_status ((c), ""); \ CAMERA_UNUSED (c,ctx); \ return (r); \ } \ @@ -221,9 +220,6 @@ struct _CameraPrivateCore { /* Some information about the port */ unsigned int speed; - CameraStatusFunc status_func; - void *status_data; - /* The abilities of this camera */ CameraAbilities a; @@ -500,71 +496,6 @@ gp_camera_get_port_speed (Camera *camera) return (camera->pc->speed); } -/** - * gp_camera_set_status_func: - * @camera: a #Camera - * @func: a #CameraStatusFunc - * @data: - * - * Sets the function that will be used to display status messages. Status - * messages are displayed before operations that can take some time. - * Typically, a frontend would - * call this function after #gp_camera_new in order to redirect status - * messages to the status bar. - * - * Return value: a gphoto2 error code - **/ -int -gp_camera_set_status_func (Camera *camera, CameraStatusFunc func, - void *data) -{ - CHECK_NULL (camera); - - camera->pc->status_func = func; - camera->pc->status_data = data; - - return (GP_OK); -} - -/** - * gp_camera_status: - * @camera: a #Camera - * @format: - * @...: - * - * Sets the status message. Typically, this function gets called by gphoto2 - * or a camera driver before operations that will take some time. For - * example, gphoto2 automatically sets a status message before - * each file download. - * - * Return value: a gphoto2 error code - **/ -int -gp_camera_status (Camera *camera, const char *format, ...) -{ - char buffer[2048]; - va_list arg; - - CHECK_NULL (camera && format); - - va_start (arg, format); -#if HAVE_VSNPRINTF - vsnprintf (buffer, sizeof (buffer), format, arg); -#else - vsprintf (buffer, format, arg); -#endif - va_end (arg); - - if (strlen (buffer)) - gp_log (GP_LOG_DEBUG, "gphoto2-camera", "Status: %s", buffer); - - if (camera->pc->status_func) - camera->pc->status_func (camera, buffer, - camera->pc->status_data); - - return (GP_OK); -} - /** * gp_camera_ref: * @camera: a #Camera @@ -1373,20 +1304,3 @@ gp_camera_folder_remove_dir (Camera *camera, const char *folder, CAMERA_UNUSED (camera, context); return (GP_OK); } - -int gp_camera_progress (Camera *camera, float percentage); -int -gp_camera_progress (Camera *camera, float percentage) -{ - gp_log (GP_LOG_DEBUG, "camera", "gp_camera_progress is deprecated. " - "Please use gp_context_progress_update. Thank you!"); - return (GP_OK); -} -int gp_camera_message (Camera *camera, const char *format, ...); -int -gp_camera_message (Camera *camera, const char *format, ...) -{ - gp_log (GP_LOG_DEBUG, "camera", "gp_camera_message is deprecated. " - "Please use gp_context_message. Thank you!"); - return (GP_OK); -} diff --git a/libgphoto2/gphoto2-camera.h b/libgphoto2/gphoto2-camera.h index 12352e76d..51283b324 100644 --- a/libgphoto2/gphoto2-camera.h +++ b/libgphoto2/gphoto2-camera.h @@ -191,10 +191,4 @@ int gp_camera_file_get (Camera *camera, const char *folder, int gp_camera_file_delete (Camera *camera, const char *folder, const char *file, GPContext *context); -/* Informing frontends - DON'T USE! THOSE ARE DEPRECATED!!! */ -typedef void (* CameraStatusFunc) (Camera *, const char *status, void *data); -int gp_camera_set_status_func (Camera *camera, CameraStatusFunc func, - void *data); -int gp_camera_status (Camera *camera, const char *format, ...); - #endif /* __GPHOTO2_CAMERA_H__ */ diff --git a/libgphoto2/gphoto2-context.c b/libgphoto2/gphoto2-context.c index 4939c3be9..bc18e7f0c 100644 --- a/libgphoto2/gphoto2-context.c +++ b/libgphoto2/gphoto2-context.c @@ -23,6 +23,8 @@ #include +#include + struct _GPContext { GPContextIdleFunc idle_func; @@ -180,6 +182,11 @@ gp_context_error (GPContext *context, const char *format, ...) { va_list args; + /* Log the error message */ + va_start (args, format); + gp_logv (GP_LOG_ERROR, "context", format, args); + va_end (args); + if (!context) return; @@ -196,6 +203,11 @@ gp_context_status (GPContext *context, const char *format, ...) { va_list args; + /* Log the status message */ + va_start (args, format); + gp_logv (GP_LOG_DEBUG, "context", format, args); + va_end (args); + if (!context) return; @@ -212,6 +224,11 @@ gp_context_message (GPContext *context, const char *format, ...) { va_list args; + /* Log the message */ + va_start (args, format); + gp_logv (GP_LOG_DEBUG, "context", format, args); + va_end (args); + if (!context) return;