Logo Search packages:      
Sourcecode: libgphoto2 version File versions  Download package

int gp_widget_new ( CameraWidgetType  type,
const char *  label,
CameraWidget **  widget 
)

Create a new widget.

The function creates a new CameraWidget of specified type and with given label.

Parameters:
typethe type
labelthe label
widget
Returns:
a gphoto2 error code.

Definition at line 95 of file gphoto2-widget.c.

References GP_OK.

Referenced by camera_config_get().

{
      static int i = 0;

      CHECK_NULL (label && widget);

      *widget = (CameraWidget*) malloc (sizeof (CameraWidget));
      memset (*widget, 0, sizeof (CameraWidget));

      (*widget)->type = type;
      strcpy ((*widget)->label, label);
      
      /* set the value to nothing */
      (*widget)->value_int          = 0;
        (*widget)->value_float      = 0.0;
        (*widget)->value_string     = NULL;

        (*widget)->ref_count        = 1;
      (*widget)->choice_count       = 0;
      (*widget)->choice             = NULL;
      (*widget)->readonly           = 0;
      (*widget)->id                 = i++;

        /* Clear all children pointers */
      free ((*widget)->children);
      (*widget)->children = NULL;
      (*widget)->children_count = 0;

      return (GP_OK);
}

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index