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

int gp_widget_append ( CameraWidget widget,
CameraWidget child 

Appends a CameraWidget to a CameraWidget.

widget a CameraWidget
child the CameraWidget you would like to append to above
a gphoto2 error code.

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

References _CameraWidget::changed, CHECK_NULL, _CameraWidget::children, _CameraWidget::children_count, GP_ERROR_BAD_PARAMETERS, GP_ERROR_NO_MEMORY, GP_OK, GP_WIDGET_SECTION, GP_WIDGET_WINDOW, _CameraWidget::parent, and _CameraWidget::type.

      CameraWidget **newlist;
      CHECK_NULL (widget && child);

      /* Return if they can't have any children */
        if ((widget->type != GP_WIDGET_WINDOW) && 
          (widget->type != GP_WIDGET_SECTION))
            return (GP_ERROR_BAD_PARAMETERS);

      if (widget->children_count)
            newlist = realloc(widget->children,sizeof(CameraWidget*)*(widget->children_count+1));
            newlist = malloc(sizeof(CameraWidget*));
      if (!newlist) return (GP_ERROR_NO_MEMORY);
      widget->children = newlist;
      widget->children[widget->children_count] = child;
      widget->children_count += 1;
      child->parent = widget;
      child->changed = 0;

      return (GP_OK);

Generated by  Doxygen 1.6.0   Back to index