Logo Search packages:      
Sourcecode: libgphoto2 version File versions

int gp_widget_add_choice ( CameraWidget widget,
const char *  choice 

Adds a choice to the CameraWidget.

widget a CameraWidget of type GP_WIDGET_RADIO or GP_WIDGET_MENU
a gphoto2 error code.

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

References CHECK_NULL, _CameraWidget::choice, _CameraWidget::choice_count, GP_ERROR, GP_ERROR_BAD_PARAMETERS, GP_OK, GP_WIDGET_MENU, GP_WIDGET_RADIO, and _CameraWidget::type.

      CHECK_NULL (widget && choice);
      if ((widget->type != GP_WIDGET_RADIO) &&
          (widget->type != GP_WIDGET_MENU))
            return (GP_ERROR_BAD_PARAMETERS);

      /* static list of choices is full */
      if (widget->choice_count >= sizeof(widget->choice)/sizeof(widget->choice[0]))
            return (GP_ERROR);

      strncpy (widget->choice[widget->choice_count], choice, sizeof(widget->choice[0]));
      widget->choice_count += 1;

      return (GP_OK);

Generated by  Doxygen 1.6.0   Back to index