// NewCreateDirectoryJob creates a new create job to create a new directory.
func NewCreateDirectoryJob(destDirURL string, dirname string, uiDelegate IUIDelegate) *CreateJob {
	job := &CreateJob{
		dbusInfo: genDBusInfo("CreateDirJob", &_CreateDirJobCount),
		op:       operations.NewCreateDirectoryJob(destDirURL, dirname, uiDelegate),
	}
	return job
}
// RequestCreatingAppGroup creates app group according to the files, and emits AppGroupCreated signal when it's done.
func (app *Application) RequestCreatingAppGroup(files []string) error {
	C.g_reload_user_special_dirs_cache()
	desktopDir := GetDesktopDir()

	availableFiles := filterDesktop(files)

	// get group name
	groupName := getGroupName(availableFiles)

	dirName := AppGroupPrefix + groupName

	// create app group.
	createJob := operations.NewCreateDirectoryJob(desktopDir, dirName, nil)
	createJob.Execute()

	if err := createJob.GetError(); err != nil {
		Log.Error("create appgroup failed:", err)
		return err
	}

	appGroupURI := createJob.Result().(string)

	// move files into app group.
	moveJob := operations.NewMoveJob(availableFiles, appGroupURI, "", 0, nil)
	moveJob.Execute()
	if err := moveJob.GetError(); err != nil {
		Log.Error("move apps to appgroup failed:", err)
		return err
	}

	return app.emitAppGroupCreated(appGroupURI, availableFiles)
}