static int timeout_func (Camera *camera, GPContext *context) { CR (knc_get_status (camera->pl->c, NULL, NULL), context); return (GP_OK); }
static GNOME_C_IDList * impl_get_files (PortableServer_Servant servant, CORBA_Environment *ev) { KncCDir *d = KNC_C_DIR (bonobo_object (servant)); KncStatus s; KncCamRes cam_res; KncCntrlRes cntrl_res; unsigned int i; KncImageInfo info; GNOME_C_IDList *l; cntrl_res = knc_get_status (d->priv->c, &cam_res, &s); CNIL (cntrl_res, cam_res, ev); l = GNOME_C_IDList__alloc (); l->_length = 0; l->_buffer = CORBA_sequence_CORBA_unsigned_long_allocbuf (s.pictures); for (i = 0; i < s.pictures; i++) { cntrl_res = knc_get_image_info (d->priv->c, &cam_res, i, &info); if (cntrl_res || cam_res) continue; l->_buffer[l->_length] = info.id; l->_length++; } CORBA_sequence_set_release (l, CORBA_TRUE); return l; }
static int file_list_func (CameraFilesystem *fs, const char *folder, CameraList *list, void *data, GPContext *context) { CameraFile *file; CameraFileInfo info; KncStatus status; unsigned int i, id; Camera *camera = data; int result; KncCamRes cr; /* * We can't get the filename from the camera. * But we decide to call the images %6i.jpeg', with the image id as * parameter. Therefore, let's get the image ids. */ CR (knc_get_status (camera->pl->c, &cr, &status), context); CCR (cr, context); id = gp_context_progress_start (context, status.pictures, _("Getting file list...")); for (i = 0; i < status.pictures; i++) { /* Get information */ gp_file_new (&file); result = get_info (camera, i + 1, &info, file, context); if (result < 0) { gp_file_unref (file); return (result); } /* * Append directly to the filesystem instead of to the list, * because we have additional information. */ gp_filesystem_append (camera->fs, folder, info.file.name, context); gp_filesystem_set_info_noop (camera->fs, folder, info, context); gp_filesystem_set_file_noop (camera->fs, folder, file, context); gp_file_unref (file); gp_context_idle (context); gp_context_progress_update (context, id, i + 1); if (gp_context_cancel (context) == GP_CONTEXT_FEEDBACK_CANCEL) return (GP_ERROR_CANCEL); } gp_context_progress_stop (context, id); return (GP_OK); }