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

bool ladish_app_supervisor_create ( ladish_app_supervisor_handle supervisor_handle_ptr,
const char *  opath,
const char *  name,
void *  context,
ladish_app_supervisor_on_app_renamed_callback  on_app_renamed 
)

Create app supervisor object

Parameters:
[out]supervisor_handle_ptrPointer to variable that will receive supervisor handle
[in]opathUnique D-Bus object path for supervisor being created
[in]nameName of the supervisor
[in]contextUser defined context to be supplied when the callback suppiled through the on_app_renamed parameter is called
[in]on_app_renamedCallback to call when app is renamed
Returns:
success status

Definition at line 73 of file app_supervisor.c.

{
  struct ladish_app_supervisor * supervisor_ptr;

  supervisor_ptr = malloc(sizeof(struct ladish_app_supervisor));
  if (supervisor_ptr == NULL)
  {
    log_error("malloc() failed to allocate struct ladish_app_supervisor");
    return false;
  }

  supervisor_ptr->opath = strdup(opath);
  if (supervisor_ptr->opath == NULL)
  {
    log_error("strdup() failed for app supervisor opath");
    free(supervisor_ptr);
    return false;
  }

  supervisor_ptr->name = strdup(name);
  if (supervisor_ptr->name == NULL)
  {
    log_error("strdup() failed for app supervisor name");
    free(supervisor_ptr->opath);
    free(supervisor_ptr);
    return false;
  }

  supervisor_ptr->dir = NULL;
  supervisor_ptr->project_name = NULL;

  supervisor_ptr->version = 0;
  supervisor_ptr->next_id = 1;

  INIT_LIST_HEAD(&supervisor_ptr->applist);

  supervisor_ptr->on_app_renamed_context = context;
  supervisor_ptr->on_app_renamed = on_app_renamed;

  *supervisor_handle_ptr = (ladish_app_supervisor_handle)supervisor_ptr;

  return true;
}

Generated by  Doxygen 1.6.0   Back to index